Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.clues;
- import java.awt.Font;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.font.TextAttribute;
- import java.lang.reflect.InvocationTargetException;
- import java.util.HashMap;
- import java.util.Map;
- import javax.swing.DefaultComboBoxModel;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.JSlider;
- import javax.swing.JTextField;
- import javax.swing.SwingUtilities;
- import javax.swing.border.EmptyBorder;
- import org.tribot.api.General;
- import org.tribot.api.input.Mouse;
- import scripts.clues.HamDungeon.AcquiringMethod;
- @SuppressWarnings("serial")
- public class GUI extends JFrame {
- private Main main;
- private JPanel contentPane;
- private JComboBox<Teleporting.TeleportMethod> comboBox;
- private JComboBox<AcquiringMethod> comboBox_3;
- private JTextField foodName;
- private JTextField foodAmount;
- private Profile guiProfile = null;
- private AcquiringMethod setAcquiringMethod;
- private Teleporting.TeleportMethod setTeleportMethod;
- private String setFoodName;
- private int setFoodAmount;
- public GUI(Main main) {
- setMain(main);
- try {
- SwingUtilities.invokeAndWait(new Runnable() {
- @Override
- public void run() {
- if(getMain().getProfile() == null) {
- getMain().setProfile(ProfileHandler.loadProfile(getMain().getName()));
- }
- setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- setBounds(100, 100, 280, 350);
- contentPane = new JPanel();
- contentPane.setName("iClueSolver by iant06");
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- contentPane.setOpaque(true);
- setContentPane(contentPane);
- contentPane.setLayout(null);
- contentPane.setFont(new Font("Arial", Font.PLAIN, 12));
- JLabel title = new JLabel("iClueSolver by iant06");
- Font h = new Font("Helvetica", Font.ITALIC, 24);
- title.setFont(h);
- Font ffont = title.getFont();
- Map<TextAttribute, Object> fattributes = new HashMap<TextAttribute, Object>();
- fattributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);
- Font fnewFont = ffont.deriveFont(fattributes);
- title.setFont(fnewFont);
- title.setBounds(20, -30, 480, 100);
- contentPane.add(title);
- JLabel taskLabel = new JLabel("Acquiring Method:");
- taskLabel.setFont(new Font("Arial", Font.BOLD, 12));
- taskLabel.setBounds(15, 77-20, 135, 23);
- contentPane.add(taskLabel);
- setComboBox_3(new JComboBox<AcquiringMethod>(new DefaultComboBoxModel<AcquiringMethod>(AcquiringMethod.values())));
- contentPane.add(getComboBox_3());
- comboBox_3.setBounds(123, 77-20, 135, 23);
- getComboBox_3().setSelectedItem(getMain().getProfile().getAcquiringMethod());
- JLabel barLabel = new JLabel("Teleport Method:");
- barLabel.setFont(new Font("Arial", Font.BOLD, 12));
- barLabel.setBounds(15, 108-20, 135, 23);
- contentPane.add(barLabel);
- setComboBox(new JComboBox<Teleporting.TeleportMethod>(new DefaultComboBoxModel<Teleporting.TeleportMethod>(Teleporting.TeleportMethod.values())));
- contentPane.add(getComboBox());
- comboBox.setBounds(123, 108-20, 135, 23);
- getComboBox().setSelectedItem(getMain().getProfile().getTeleportMethod());
- JLabel foodNameLabel = new JLabel("Food Name:");
- contentPane.add(foodNameLabel);
- foodNameLabel.setBounds(20, 142-20, 120, 18);
- foodNameLabel.setFont(new Font("Arial", Font.BOLD, 12));
- foodName = new JTextField();
- contentPane.add(foodName);
- String pFoodName = getMain().getProfile().getFoodName();
- foodName.setText(!pFoodName.equals("") ? pFoodName : "Lobster");
- foodName.setColumns(10);
- foodName.setBounds(123, 139-20, 135, 23);
- JLabel locationLabel = new JLabel("Food Amount:");
- contentPane.add(locationLabel);
- locationLabel.setBounds(20, 174-20, 120, 18);
- locationLabel.setFont(new Font("Arial", Font.BOLD, 12));
- foodAmount = new JTextField();
- contentPane.add(foodAmount);
- int pFoodAmount = getMain().getProfile().getFoodAmount();
- foodAmount.setText("" + (pFoodAmount == -1 ? 10 : pFoodAmount));
- foodAmount.setColumns(10);
- foodAmount.setBounds(123, 170-20, 135, 23);
- JLabel mouseSpeedLabel = new JLabel("Mouse Speed:");
- contentPane.add(mouseSpeedLabel);
- mouseSpeedLabel.setBounds(105, 213-20, 120, 18);
- mouseSpeedLabel.setFont(new Font("Arial", Font.BOLD, 12));
- JSlider mouseSpeed = new JSlider(JSlider.HORIZONTAL,
- 90, 120, General.random(90, 105));
- mouseSpeed.setMajorTickSpacing(10);
- mouseSpeed.setMinorTickSpacing(5);
- mouseSpeed.setPaintTicks(true);
- mouseSpeed.setPaintLabels(true);
- mouseSpeed.setBounds(20, 235-20, 250, 50);
- contentPane.add(mouseSpeed);
- JButton btnStart = new JButton("Start");
- btnStart.setBounds(100, 313-30, 89, 23);
- btnStart.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent arg0)
- {
- AcquiringMethod a = (AcquiringMethod) getComboBox_3().getSelectedItem();
- Teleporting.TeleportMethod t = (Teleporting.TeleportMethod) getComboBox().getSelectedItem();
- getMain().setAcquiringMethod(a);
- getMain().setTeleportMethod(t);
- getMain().setFoodName(foodName.getText());
- getMain().setFoodAmount(Integer.parseInt(foodAmount.getText()));
- Mouse.setSpeed((int) mouseSpeed.getValue());
- getMain().println("Starting iClueSolver by iant06.");
- ProfileHandler.saveProfile(getMain().getProfile(), new Object[] {
- a, t, foodName.getText(), Integer.parseInt(foodAmount.getText())
- });
- setVisible(false);
- dispose();
- }
- });
- contentPane.add(btnStart);
- contentPane.repaint();
- setVisible(true);
- }
- });
- } catch (InvocationTargetException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- public Main getMain() {
- return main;
- }
- public void setMain(Main main) {
- this.main = main;
- }
- public JTextField getFoodName() {
- return foodName;
- }
- public void setFoodName(JTextField foodName) {
- this.foodName = foodName;
- }
- public JTextField getFoodAmount() {
- return foodAmount;
- }
- public void setFoodAmount(JTextField foodAmount) {
- this.foodAmount = foodAmount;
- }
- public JComboBox<Teleporting.TeleportMethod> getComboBox() {
- return comboBox;
- }
- public void setComboBox(JComboBox<Teleporting.TeleportMethod> comboBox) {
- this.comboBox = comboBox;
- }
- public JComboBox<AcquiringMethod> getComboBox_3() {
- return comboBox_3;
- }
- public void setComboBox_3(JComboBox<AcquiringMethod> comboBox_3) {
- this.comboBox_3 = comboBox_3;
- }
- public Profile getGuiProfile() {
- return guiProfile;
- }
- public void setGuiProfile(Profile guiProfile) {
- this.guiProfile = guiProfile;
- }
- public AcquiringMethod getSetAcquiringMethod() {
- return setAcquiringMethod;
- }
- public void setSetAcquiringMethod(AcquiringMethod setAcquiringMethod) {
- this.setAcquiringMethod = setAcquiringMethod;
- }
- public Teleporting.TeleportMethod getSetTeleportMethod() {
- return setTeleportMethod;
- }
- public void setSetTeleportMethod(Teleporting.TeleportMethod setTeleportMethod) {
- this.setTeleportMethod = setTeleportMethod;
- }
- public String getSetFoodName() {
- return setFoodName;
- }
- public void setSetFoodName(String setFoodName) {
- this.setFoodName = setFoodName;
- }
- public int getSetFoodAmount() {
- return setFoodAmount;
- }
- public void setSetFoodAmount(int setFoodAmount) {
- this.setFoodAmount = setFoodAmount;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement