Advertisement
Guest User

YewsGUI

a guest
Mar 14th, 2016
621
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.62 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3.  
  4. import javax.swing.*;
  5.  
  6. @SuppressWarnings("serial")
  7. public class YewsGUI extends JFrame {
  8.     private Main ctx;
  9.  
  10.     public YewsGUI(Main main) {
  11.         getContentPane().setBackground(Color.LIGHT_GRAY);
  12.         setForeground(Color.LIGHT_GRAY);
  13.         getContentPane().setBackground(SystemColor.activeCaption);
  14.         getContentPane().setForeground(Color.LIGHT_GRAY);
  15.         this.ctx = main;
  16.         initComponents();
  17.     }
  18.  
  19.     private void button1ActionPerformed(ActionEvent e) {
  20.         // if button is clicked this will be activated
  21.         ctx.setStartScript(true);
  22.         this.setVisible(false);
  23.     }
  24.  
  25.     private void initComponents() {
  26.         comboBox1 = new JComboBox<>();
  27.         comboBox1.setBounds(10, 46, 136, 75);
  28.  
  29.         // ======== this ========
  30.         setTitle("GE Yews");
  31.  
  32.         // ---- comboBox1 ----
  33.         comboBox1.setModel(new DefaultComboBoxModel<>(new String[] {
  34.                 "Free2Play", "Member", }));
  35.  
  36.         JLabel lblNewLabel = new JLabel("Member or Free2Play?");
  37.         lblNewLabel.setBounds(11, 13, 136, 34);
  38.         getContentPane().setPreferredSize(new Dimension(300, 200));
  39.         pack();
  40.         setLocationRelativeTo(getOwner());
  41.         getContentPane().setLayout(null);
  42.         getContentPane().add(comboBox1);
  43.         getContentPane().add(lblNewLabel);
  44.         button1 = new JButton();
  45.         button1.setBounds(159, 15, 81, 106);
  46.  
  47.         // ---- button1 ----
  48.         button1.setText("Start");
  49.         button1.addActionListener(e -> button1ActionPerformed(e));
  50.         getContentPane().add(button1);
  51.     }
  52.  
  53.     // a getter to acces this piece of information
  54.     public String getway() {
  55.         return comboBox1.getSelectedItem().toString();
  56.     }
  57.  
  58.     private JButton button1;
  59.     private JComboBox<String> comboBox1;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement