Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.31 KB | None | 0 0
  1.     class gui extends JFrame {
  2.         public gui() {
  3.             initComponents();
  4.         }
  5.  
  6.         private void startButtonActionPerformed(ActionEvent e) {
  7.             if (whichMethod.getSelectedIndex() == 0) {
  8.                 power = true;
  9.             } else {
  10.                 power = false;
  11.             }
  12.             setVisible(false);
  13.         }
  14.  
  15.         private void initComponents() {
  16.             label1 = new JLabel();
  17.             label2 = new JLabel();
  18.             whichMethod = new JComboBox();
  19.             startButton = new JButton();
  20.  
  21.             //======== this ========
  22.             Container contentPane = getContentPane();
  23.             contentPane.setLayout(null);
  24.  
  25.             //---- label1 ----
  26.             label1.setText("SimplyMiner by Simply Pro");
  27.             label1.setFont(new Font("Tahoma", Font.BOLD, 22));
  28.             contentPane.add(label1);
  29.             label1.setBounds(40, 0, 330, 70);
  30.  
  31.             //---- label2 ----
  32.             label2.setText("Which Method?");
  33.             contentPane.add(label2);
  34.             label2.setBounds(20, 100, 85, 35);
  35.  
  36.             //---- whichMethod ----
  37.             whichMethod.setModel(new DefaultComboBoxModel(new String[] {
  38.                 "Powermine",
  39.                 "Banking"
  40.             }));
  41.             contentPane.add(whichMethod);
  42.             whichMethod.setBounds(110, 110, 110, 25);
  43.  
  44.             //---- startButton ----
  45.             startButton.setText("Start Script!");
  46.             startButton.addActionListener(new ActionListener() {
  47.                 @Override
  48.                 public void actionPerformed(ActionEvent e) {
  49.                     startButtonActionPerformed(e);
  50.                 }
  51.             });
  52.             contentPane.add(startButton);
  53.             startButton.setBounds(105, 185, 120, 53);
  54.  
  55.             { // compute preferred size
  56.                 Dimension preferredSize = new Dimension();
  57.                 for(int i = 0; i < contentPane.getComponentCount(); i++) {
  58.                     Rectangle bounds = contentPane.getComponent(i).getBounds();
  59.                     preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  60.                     preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  61.                 }
  62.                 Insets insets = contentPane.getInsets();
  63.                 preferredSize.width += insets.right;
  64.                 preferredSize.height += insets.bottom;
  65.                 contentPane.setMinimumSize(preferredSize);
  66.                 contentPane.setPreferredSize(preferredSize);
  67.             }
  68.             pack();
  69.             setLocationRelativeTo(getOwner());
  70.             // JFormDesigner - End of component initialization  //GEN-END:initComponents
  71.         }
  72.  
  73.  
  74.         private JLabel label1;
  75.         private JLabel label2;
  76.         private JComboBox whichMethod;
  77.         private JButton startButton;
  78.         // JFormDesigner - End of variables declaration  //GEN-END:variables
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement