Advertisement
Guest User

Untitled

a guest
Aug 11th, 2014
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. package scripts.CrabKiller;
  2.  
  3. import java.awt.*;
  4. import java.awt.event.*;
  5.  
  6. import javax.swing.*;
  7.  
  8. public class GUI extends JFrame {
  9.  
  10.  
  11. public GUI() {
  12. initComponents();
  13. }
  14.  
  15. private void initComponents() {
  16. // JFormDesigner - Component initialization - DO NOT MODIFY
  17. // //GEN-BEGIN:initComponents
  18. // Generated using JFormDesigner Evaluation license - Will Baker
  19. checkBox1 = new JCheckBox();
  20. checkBox2 = new JCheckBox();
  21. label1 = new JLabel();
  22. textField1 = new JTextField();
  23. button1 = new JButton();
  24. textField2 = new JTextField();
  25. label2 = new JLabel();
  26.  
  27. // ======== this ========
  28. setTitle("wbCrabKiller Settings");
  29. setResizable(false);
  30. Container contentPane = getContentPane();
  31. contentPane.setLayout(null);
  32.  
  33. // ---- checkBox1 ----
  34. checkBox1.setText("Eating?");
  35. contentPane.add(checkBox1);
  36. checkBox1.setBounds(new Rectangle(new Point(135, 95), checkBox1
  37. .getPreferredSize()));
  38.  
  39. // ---- checkBox2 ----
  40. checkBox2.setText("Banking?");
  41. contentPane.add(checkBox2);
  42. checkBox2.setBounds(15, 95, 80, 23);
  43.  
  44. // ---- label1 ----
  45. label1.setText("Food ID:");
  46. contentPane.add(label1);
  47. label1.setBounds(15, 10, 42, 30);
  48. contentPane.add(textField1);
  49. textField1.setBounds(165, 15, 200, 20);
  50.  
  51. // ---- button1 ----
  52. button1.setText("Start");
  53. button1.addActionListener(new ActionListener() {
  54.  
  55. public void actionPerformed(ActionEvent e) {
  56. if( checkBox2.isSelected()) {
  57.  
  58. UserVariables.foodID = Integer.parseInt(textField1.getText());
  59. UserVariables.foodWithdrawAmmount = Integer.parseInt(textField2.getText());
  60. }
  61.  
  62. UserVariables.eating = checkBox1.isSelected();
  63.  
  64. UserVariables.running = true;
  65.  
  66.  
  67. setVisible(false);
  68. dispose();
  69. }
  70. });
  71. contentPane.add(button1);
  72. button1.setBounds(260, 85, 105, 35);
  73. contentPane.add(textField2);
  74. textField2.setBounds(165, 40, 200, 20);
  75.  
  76. // ---- label2 ----
  77. label2.setText("Food withdraw ammount:");
  78. contentPane.add(label2);
  79. label2.setBounds(15, 40, 130, 25);
  80.  
  81. { // compute preferred size
  82. Dimension preferredSize = new Dimension();
  83. for (int i = 0; i < contentPane.getComponentCount(); i++) {
  84. Rectangle bounds = contentPane.getComponent(i).getBounds();
  85. preferredSize.width = Math.max(bounds.x + bounds.width,
  86. preferredSize.width);
  87. preferredSize.height = Math.max(bounds.y + bounds.height,
  88. preferredSize.height);
  89. }
  90. Insets insets = contentPane.getInsets();
  91. preferredSize.width += insets.right;
  92. preferredSize.height += insets.bottom;
  93. contentPane.setMinimumSize(preferredSize);
  94. contentPane.setPreferredSize(preferredSize);
  95. }
  96. pack();
  97. setLocationRelativeTo(null);
  98. // JFormDesigner - End of component initialization
  99. // //GEN-END:initComponents
  100. }
  101.  
  102. // JFormDesigner - Variables declaration - DO NOT MODIFY
  103. // //GEN-BEGIN:variables
  104. // Generated using JFormDesigner Evaluation license - Will Baker
  105. private JCheckBox checkBox1;
  106. private JCheckBox checkBox2;
  107. private JLabel label1;
  108. private JTextField textField1;
  109. private JButton button1;
  110. private JTextField textField2;
  111. private JLabel label2;
  112. // JFormDesigner - End of variables declaration //GEN-END:variables
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement