Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.event.*;
- import org.dreambot.api.wrappers.interactive.GameObject;
- import java.awt.*;
- import java.awt.event.ActionEvent;
- import java.util.ArrayList;
- import javax.swing.*;
- /*
- * Created by JFormDesigner on Thu Nov 19 19:05:37 PST 2015
- */
- /**
- * @author Zack Townsend
- */
- public class stateminerGUI extends JFrame {
- private DefaultListModel<GameObject> mineListModel;
- private DefaultListModel<GameObject> rockListModel;
- private ArrayList<GameObject> ourRocks;
- private stateminer ctx;
- public stateminerGUI (stateminer main) {
- this.ctx = main;
- initComponents();
- mineList = new JList<GameObject>(mineListModel);
- rockList = new JList<GameObject>(rockListModel);
- rockListModel = new DefaultListModel<GameObject>();
- mineListModel = new DefaultListModel<GameObject>();
- }
- //---Starts script after GUI selection ---\\
- private void button1ActionPerformed (ActionEvent e){
- ctx.setStartScript(true);
- ctx.setOreName(oreBox.getSelectedItem().toString());
- ArrayList<GameObject> ourRocks = new ArrayList<GameObject>();
- for (int i = 0; i < mineListModel.getSize(); i++){
- ourRocks.add(mineListModel.get(i));
- }
- ctx.setOurRocks(ourRocks);
- }
- //---List of ores in area around the player---\\
- private void rockListValueChanged(ListSelectionEvent e) {
- ctx.setRockWireFrame((GameObject)rockList.getSelectedValue());
- }
- //---Creates the refreshed ore list---\\
- public void RefreshOreButtonActionPerformed(ActionEvent e) {
- for (GameObject nearbyrocks : ctx.getNearbyRocks()) {
- rockListModel.addElement(nearbyrocks);
- }
- }
- public void AddOreButtonActionPerformed(ActionEvent e) {
- rockListModel.addElement((GameObject)mineList.getSelectedValue());
- }
- private void RemoveOreButtonActionPerformed(ActionEvent e) {
- mineListModel.removeElement(mineList.getSelectedValue());
- }
- private void initComponents() {
- tabbedPane1 = new JTabbedPane();
- Panel1 = new JPanel();
- oreBox = new JComboBox<>();
- label1 = new JLabel();
- button1 = new JButton();
- checkBox1 = new JCheckBox();
- Rocks = new JPanel();
- scrollPane1 = new JScrollPane();
- rockList = new JList();
- scrollPane2 = new JScrollPane();
- mineList = new JList();
- AddOreButton = new JButton();
- RemoveOreButton = new JButton();
- RefreshOreButton = new JButton();
- //======== this ========
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- //======== tabbedPane1 ========
- {
- //======== Panel1 ========
- {
- Panel1.setBorder(new javax.swing.border.CompoundBorder(
- new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
- "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
- javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
- java.awt.Color.red), Panel1.getBorder()));
- Panel1.addPropertyChangeListener(e -> {
- if ("border".equals(e.getPropertyName())) throw new RuntimeException();
- });
- Panel1.setLayout(null);
- //---- oreBox ----
- oreBox.setModel(new DefaultComboBoxModel<>(new String[]{
- "Tin",
- "Copper",
- "Iron ore",
- "Coal",
- "Silver ore",
- "Gold ore",
- "Mithril ore",
- "Adamantite ore",
- "Runite ore"
- }));
- Panel1.add(oreBox);
- oreBox.setBounds(70, 45, 130, 50);
- //---- label1 ----
- label1.setText("Select your ore type");
- Panel1.add(label1);
- label1.setBounds(new Rectangle(new Point(210, 60), label1.getPreferredSize()));
- //---- button1 ----
- button1.setText("Start");
- button1.addActionListener(e -> button1ActionPerformed(e));
- Panel1.add(button1);
- button1.setBounds(30, 165, 310, 65);
- //---- checkBox1 ---- Add to drop functionality if not checked. Or bank if checked etc. --\\
- ctx.setDrop(!checkBox1.isSelected());
- checkBox1.setText("Bank?");
- Panel1.add(checkBox1);
- checkBox1.setBounds(145, 105, 75, 35);
- }
- tabbedPane1.addTab("Settings", Panel1);
- //======== Rocks ========
- {
- //======== scrollPane1 ========
- {
- //---- rockList ----
- rockList.addListSelectionListener(e -> rockListValueChanged(e));
- scrollPane1.setViewportView(rockList);
- }
- //======== scrollPane2 ========
- {
- scrollPane2.setViewportView(mineList);
- }
- //---- AddOreButton ----
- AddOreButton.setText("Add ore");
- AddOreButton.addActionListener(e -> AddOreButtonActionPerformed(e));
- //---- RemoveOreButton ----
- RemoveOreButton.setText("Remove ore");
- RemoveOreButton.addActionListener(e -> RemoveOreButtonActionPerformed(e));
- //---- RefreshOreButton ----
- RefreshOreButton.setText("Refresh ore list");
- RefreshOreButton.addActionListener(e -> RefreshOreButtonActionPerformed(e));
- GroupLayout RocksLayout = new GroupLayout(Rocks);
- Rocks.setLayout(RocksLayout);
- RocksLayout.setHorizontalGroup(
- RocksLayout.createParallelGroup()
- .addGroup(RocksLayout.createSequentialGroup()
- .addGap(14, 14, 14)
- .addComponent(scrollPane1, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(RocksLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(RemoveOreButton, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(RefreshOreButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(AddOreButton, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(scrollPane2, GroupLayout.PREFERRED_SIZE, 106, GroupLayout.PREFERRED_SIZE)
- .addGap(40, 40, 40))
- );
- RocksLayout.setVerticalGroup(
- RocksLayout.createParallelGroup()
- .addGroup(RocksLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(RocksLayout.createParallelGroup()
- .addComponent(scrollPane2, GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)
- .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 228, Short.MAX_VALUE)))
- .addGroup(RocksLayout.createSequentialGroup()
- .addGap(20, 20, 20)
- .addComponent(AddOreButton)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(RemoveOreButton)
- .addGap(42, 42, 42)
- .addComponent(RefreshOreButton)
- .addGap(0, 70, Short.MAX_VALUE))
- );
- }
- tabbedPane1.addTab("Rocks", Rocks);
- }
- contentPane.add(tabbedPane1);
- tabbedPane1.setBounds(0, 0, 385, 260);
- contentPane.setPreferredSize(new Dimension(370, 260));
- pack();
- setLocationRelativeTo(getOwner());
- }
- private JTabbedPane tabbedPane1;
- private JPanel Panel1;
- private JComboBox<String> oreBox;
- private JLabel label1;
- private JButton button1;
- private JCheckBox checkBox1;
- private JPanel Rocks;
- private JScrollPane scrollPane1;
- private JList rockList;
- private JScrollPane scrollPane2;
- private JList mineList;
- private JButton AddOreButton;
- private JButton RemoveOreButton;
- private JButton RefreshOreButton;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement