Main() {
   f = new JFrame("Wiki Seach");
   JPanel p = new JPanel();
   JPanel p1 = new JPanel();
   b = new JButton("Search");
   b1 = new JButton("Exit");
   t = new JTextField(30);
   b.addActionListener(this);
   b1.addActionListener(this);
   p1.add(b);
   p1.add(b1);
   p.add(t);
   f.setLayout(new GridLayout(2, 1));
   f.add(p);
   f.add(p1);
   f.pack();
   f.setLocationRelativeTo(null);
   f.addWindowListener(
       new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
   f.setVisible(true);
 }
 public RemoveFrame() {
   frame = new JFrame("Select Files you wish to Remove from Drive");
   frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
   frame.getRootPane().setDefaultButton(confirm);
   try {
     files = DriveList.list();
   } catch (IOException e) {
     files = new ArrayList<File>();
   }
   confirm = new JButton("Remove");
   quit = new JButton("Cancel");
   confirm.addActionListener(this);
   quit.addActionListener(this);
   frame.setLayout(new BorderLayout());
   checkPanel = new JPanel();
   control = new JPanel();
   control.setLayout(new GridLayout(1, 2));
   control.add(confirm);
   control.add(quit);
   frame.add(control, BorderLayout.SOUTH);
   drawCheckPanel();
   frame.add(checkPanel, BorderLayout.CENTER);
   frame.pack();
   frame.setVisible(true);
 }
 public void editContactWindow() {
   editWindow = new JFrame("Edit Contacts");
   editWindow.setLayout(new FlowLayout());
   // Add List
   editWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
   editWindow.pack();
   editWindow.setVisible(true);
 }
 public void toSendWindow() {
   toWindow = new JFrame("Send Email To");
   toWindow.setLayout(new BorderLayout());
   contactList = new ContactListCheckBox(cList);
   toWindow.add(contactList, BorderLayout.CENTER);
   toWindow.add(addSendContacts, BorderLayout.SOUTH);
   toWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
   toWindow.pack();
   toWindow.setVisible(true);
 }
Beispiel #5
0
 /*
  * (non-Javadoc)
  *
  * @see javax.swing.JFrame#setLayout(java.awt.LayoutManager)
  */
 @Override
 public void setLayout(LayoutManager manager) {
   if (manager.getClass() != RibbonFrameLayout.class) {
     LayoutManager currManager = getLayout();
     if (currManager != null) {
       throw new IllegalArgumentException("Can't set a custom layout manager on JRibbonFrame");
     }
   }
   super.setLayout(manager);
 }
Beispiel #6
0
  public JFrame buildFrame() {

    f = new JFrame("AMSA World");
    f.setSize(800, 600);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLayout(new GridBagLayout());

    textArea.setFocusable(false);
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

    ActionListener listener =
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            checkInput();
          }
        };
    inputText.addActionListener(listener);

    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1.0;
    c.gridwidth = 3;
    c.weighty = 0.025;
    c.gridx = 0;
    c.gridy = 0;
    f.add(topPanel, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 2;
    c.gridx = 0;
    c.gridy = 1;
    f.add(scrollPane, c);

    c.fill = GridBagConstraints.BOTH;
    c.weighty = 1.0;
    c.gridwidth = 1;
    c.gridx = 2;
    c.gridy = 1;
    f.add(sidePanel, c);
    sidePanel.setVisible(false);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weighty = 0.025;
    c.gridwidth = 3;
    c.gridx = 0;
    c.gridy = 2;
    f.add(inputText, c);

    f.setVisible(true);

    return f;
  }
  public static void main(String[] args) {
    frame.setLayout(new FlowLayout());

    final JPanel sceneHolder = new JPanel();
    initialize(sceneHolder);
    frame.add(sceneHolder);

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(700, 700);
    frame.setVisible(true);
  }
 public void removeContactWindow() {
   removeWindow = new JFrame("Remove Contacts");
   removeWindow.setLayout(new BorderLayout());
   contactList = new ContactListCheckBox(cList);
   removeWindow.add(contactList, BorderLayout.CENTER);
   // Add List here
   removeWindow.add(deleteContact, BorderLayout.SOUTH);
   removeWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
   removeWindow.pack();
   removeWindow.setVisible(true);
 }
Beispiel #9
0
  public void CreateFrame() throws IOException {

    makeFrame();

    JFrame f;
    f = new JFrame();
    // f.setSize(1300, 800);
    f.setLayout(new BorderLayout());
    f.add(panel);
    f.pack();
    f.setVisible(true);
  }
Beispiel #10
0
 public GUI() {
   frame.setSize(500, 450);
   frame.setResizable(false);
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   teksti.setEditable(false);
   loki = new JScrollPane(teksti);
   frame.setLocationRelativeTo(null);
   asetaLayout();
   panelv.setLayout(layout);
   frame.setLayout(new BorderLayout());
   frame.add(panelv, BorderLayout.WEST);
   frame.add(panelo, BorderLayout.CENTER);
   frame.setVisible(true);
 }
Beispiel #11
0
  Jf() {

    j.setBounds(500, 40, 500, 500);
    j.setVisible(true);
    j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    j.setLayout(null);
    ImageIcon image = new ImageIcon("im1.jpg");
    JLabel l = new JLabel(image);
    int m = image.getIconWidth();
    int m1 = image.getIconHeight();
    j.setResizable(false); // frame resize nahi hoga	
    l.setBounds(0, 0, m, m1);
    j.add(l);
    l.add(linfo);
    l.add(lid);
    l.add(fid);
    l.add(lpass);
    l.add(fpass);
    fpass.setEchoChar('*');

    l.add(blogin);
    l.add(bnewaccount);
    l.add(bforget);

    ImageIcon image1 = new ImageIcon("logo1.png");
    JLabel limage = new JLabel(image1);
    l.add(limage);
    limage.setBounds(10, 50, 190, 130);

    Font f = new Font("ALGERIAN", Font.BOLD, 20);
    linfo.setFont(f);
    linfo.setBounds(40, 10, 420, 30);
    lid.setBounds(210, 50, 70, 30);
    fid.setBounds(290, 50, 150, 30);
    lpass.setBounds(210, 90, 70, 30);
    fpass.setBounds(290, 90, 150, 30);
    blogin.setBounds(210, 130, 100, 50);
    bnewaccount.setBounds(320, 130, 160, 20);
    bforget.setBounds(320, 160, 160, 20);
    blogin.setBackground(Color.green);
    bnewaccount.setBackground(Color.cyan);
    bforget.setBackground(Color.pink);

    blogin.addActionListener(new Login());
    bnewaccount.addActionListener(new Account());
    bforget.addActionListener(new Forget());
  }
  public void init() {
    frame = new JFrame();
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setTitle("PersistentFrameTest");
    frame.setSize(400, 200);

    JButton loadButton = new JButton("Load");
    frame.add(loadButton);
    loadButton.addActionListener(EventHandler.create(ActionListener.class, this, "load"));

    JButton saveButton = new JButton("Save");
    frame.add(saveButton);
    saveButton.addActionListener(EventHandler.create(ActionListener.class, this, "save"));

    frame.setVisible(true);
  }
Beispiel #13
0
  private void mostrarGUI() {
    janela = new JFrame("Java Swing Examples");
    janela.setSize(400, 400);
    janela.setLayout(new GridLayout(3, 1));

    janela.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent windowEvent) {
            System.exit(0);
          }
        });

    statusLabel = new JLabel("", JLabel.CENTER);
    statusLabel.setSize(350, 100);

    controlPanel = new JPanel();
    controlPanel.setLayout(new FlowLayout());

    ImageIcon icon = criarImageIcon("/resources/home153.png", "Home");

    JButton okButton = new JButton("OK");
    // JButton homeButton = new JButton("Home", icon);

    okButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            statusLabel.setText("Clicou no Botao Ok.");
          }
        });

    /*
       homeButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
             statusLabel.setText("Clicou no Botao Home.");
          }
       });
    */

    controlPanel.add(okButton);
    // controlPanel.add(homeButton);

    janela.add(statusLabel);
    janela.add(controlPanel);
    janela.setVisible(true);
  }
 private void setupBoard() {
   JFrame mainBoard = new JFrame("Tic-Tac-Toe");
   mainBoard.setSize(300, 300);
   mainBoard.setLayout(new GridLayout(3, 3));
   mainBoard.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   int place = 1;
   for (int row = 0; row < 3; row++) {
     for (int column = 0; column < 3; column++) {
       button[row][column] = new JButton("");
       button[row][column].setName(Integer.toString(place));
       button[row][column].addActionListener(new ButtonListener(row, column));
       button[row][column].setFont(new Font("", Font.PLAIN, 55));
       mainBoard.add(button[row][column]);
       place += 1;
     }
   }
   mainBoard.setVisible(true);
 }
 public static void main(String[] args) {
   JLabel labelLoto = new JLabel();
   // Creation d'un bouton mettant a jour
   // le label avec un nouveau tirage de
   // loto grace au listener de classe
   // com.eteks.test.NouveauTirage
   JButton boutonLoto = new JButton("Nouveau tirage");
   boutonLoto.addActionListener(new NouveauTirage(labelLoto));
   // Affichage du bouton et du label l'un
   // sous l'autre dans une fenetre
   JFrame fenetre = new JFrame("Loto");
   fenetre.setLayout(new GridLayout(2, 1));
   fenetre.add(boutonLoto);
   fenetre.add(labelLoto);
   fenetre.pack();
   fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   fenetre.setVisible(true);
 }
Beispiel #16
0
  private static void createAndShowGUI() {
    JFrame frame = new JFrame("Fractal");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    SpringLayout layout = new SpringLayout();
    frame.setLayout(layout);

    Orientation nw = new Orientation();
    nw.setOffset(0, 0);
    Orientation sw = new Orientation();
    sw.setOffset(0, regionSize);
    Orientation se = new Orientation();
    se.setOffset(regionSize, regionSize);

    Fractal fractal = new Fractal(regionSize);
    fractal.setOrientations(nw, sw, se);

    layout.putConstraint(SpringLayout.WEST, fractal, 5, SpringLayout.WEST, frame.getContentPane());
    layout.putConstraint(
        SpringLayout.NORTH, fractal, 5, SpringLayout.NORTH, frame.getContentPane());

    layout.putConstraint(SpringLayout.WEST, nw, 5, SpringLayout.EAST, fractal);
    layout.putConstraint(SpringLayout.NORTH, nw, 0, SpringLayout.NORTH, fractal);

    layout.putConstraint(SpringLayout.NORTH, sw, 5, SpringLayout.SOUTH, nw);
    layout.putConstraint(SpringLayout.WEST, sw, 0, SpringLayout.WEST, nw);

    layout.putConstraint(SpringLayout.NORTH, se, 5, SpringLayout.SOUTH, nw);
    layout.putConstraint(SpringLayout.WEST, se, 5, SpringLayout.EAST, sw);

    layout.putConstraint(
        SpringLayout.SOUTH, frame.getContentPane(), 5, SpringLayout.SOUTH, fractal);
    layout.putConstraint(SpringLayout.EAST, frame.getContentPane(), 5, SpringLayout.EAST, se);

    frame.add(nw);
    frame.add(sw);
    frame.add(se);

    frame.add(fractal);

    frame.setResizable(false);
    frame.pack();
    frame.setVisible(true);
  }
Beispiel #17
0
 // main test method
 public static void main(String[] args) {
   JFrame testFrame = new JFrame();
   testFrame.setLayout(new GridLayout(2, 2));
   MineButton button1 = new MineButton();
   MineButton button2 = new MineButton();
   MineButton button3 = new MineButton();
   MineButton button4 = new MineButton();
   button2.setType(MineButton.MINE);
   button3.setNumber(5);
   ;
   testFrame.add(button1);
   testFrame.add(button2);
   testFrame.add(button3);
   testFrame.add(button4);
   testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   testFrame.pack();
   testFrame.setLocationRelativeTo(null);
   testFrame.setVisible(true);
 }
Beispiel #18
0
  public GridDemo() {
    _frame.setSize(WIDTH, HEIGHT);
    // Close program when window is closed
    _frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    _frame.setLayout(new GridLayout(3, 3));

    for (int j = 0; j < 9; j++) {
      _buttons[j] = new JButton("_");
      ActionListener buttonListener = new ButtonListener();
      _buttons[j].addActionListener(buttonListener);
      _buttons[j].setFont(new Font("Courier", Font.PLAIN, 48));
      _frame.add(_buttons[j]);
    }

    // Refresh window - otherwise we will not be able to see it
    // THIS IS A COMMON SOURCE OF BUGS!
    _frame.setVisible(true);
  }
Beispiel #19
0
  Slideshow(String images[]) {
    // transfer array of images into local array
    imagePaths = images;

    // create the frame and set its size, layout, location, and close operation
    frame = new JFrame("Slideshow");
    frame.setSize(800, 600);
    frame.setLayout(new BorderLayout());
    frame.setLocationRelativeTo(frame);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // create center and play/stop buttons
    centerButton = new JButton("center");
    PlayStopButton = new JButton("Play");

    // set actionListener for timer
    timer = new Timer(seconds, this);
    timer.setActionCommand("timer");

    // set actionListener for the Play/Stop button
    PlayStopButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            if (PlayStopButton.getText() == "Play") {
              PlayStopButton.setText("Stop");
              timer.start();
            } else if (PlayStopButton.getText() == "Stop") {
              PlayStopButton.setText("Play");
              timer.stop();
            }
          }
        });

    // add the JLabel to the JScrollPane
    image = new JLabel("");
    scrollPane = new JScrollPane(image);

    // add everything to the frame and display it
    frame.add(scrollPane);
    frame.add(PlayStopButton, BorderLayout.SOUTH);
    frame.setVisible(true);
  }
 public void addContactWindow() {
   addWindow = new JFrame("Add a Contact");
   addWindow.setLayout(new GridLayout(2, 3));
   newContactFields = new JTextField[3];
   for (int i = 0; i < newContactFields.length; i++) {
     newContactFields[i] = new JTextField("", 15);
   }
   save = new JButton("Save Contact");
   addWindow.add(new JLabel("Email Address: "));
   addWindow.add(newContactFields[0]);
   addWindow.add(new JLabel("First Name: "));
   addWindow.add(newContactFields[1]);
   addWindow.add(new JLabel("Last Name: "));
   addWindow.add(newContactFields[2]);
   save.addActionListener(this);
   addWindow.add(save);
   addWindow.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
   addWindow.pack();
   addWindow.setVisible(true);
 }
Beispiel #21
0
  OSSelect() {
    f = new JFrame("Graphics");
    l = new TextArea();
    cbg = new CheckboxGroup();
    win = new Checkbox("win", cbg, true);
    mac = new Checkbox("mac", cbg, false);
    unix = new Checkbox("unix", cbg, false);

    f.add(win);
    f.add(mac);
    f.add(unix);
    f.add(l);
    win.addItemListener(this);
    mac.addItemListener(this);
    unix.addItemListener(this);

    f.setSize(400, 400);
    f.setVisible(true);
    f.setLayout(new FlowLayout());
  }
Beispiel #22
0
  public TextDemo() {
    _frame.setSize(WIDTH, HEIGHT);
    // Close program when window is closed
    _frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    _frame.setLayout(new FlowLayout());

    _frame.add(_text);

    PrintListener printListener = new PrintListener();
    _button.addActionListener(printListener);

    _frame.add(_button);

    _frame.pack();

    // Refresh window - otherwise we will not be able to see it
    // THIS IS A COMMON SOURCE OF BUGS!
    _frame.setVisible(true);
  }
  public SyntaxTest() {

    JFrame frame = new JFrame();
    frame.setSize(300, 300);

    JEditorPane editor = new JEditorPane();
    DefaultSyntaxKit.initKit();
    editor.setContentType("text/banking");

    frame.setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();
    c.weightx = 1.0;
    c.weighty = 1.0;
    c.fill = GridBagConstraints.BOTH;

    frame.add(editor, c);

    frame.pack();
    frame.setVisible(true);
  }
  public reminder(int m, int y, int m3, int y3) {
    m1 = m;
    y1 = y;
    m2 = m3;
    y2 = y3;

    try {
      f.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("skrm.jpg")));
      String cn = UIManager.getSystemLookAndFeelClassName();

      UIManager.setLookAndFeel(cn); // Use the native L&F
    } catch (Exception cnf) {
      System.out.println(cnf);
    }

    f = new JFrame("Print Reminders");
    f.setVisible(true);
    f.setLayout(null);
    f.setSize(300, 100);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            System.exit(0);
          }
        });
    b = new JButton("Print Reminders");
    b.addActionListener(this);
    back = new JButton("Back");
    back.addActionListener(this);
    f.add(b);
    b.setBounds(10, 10, 100, 20);
    b.setMnemonic('P');
    f.add(back);
    back.setMnemonic('B');
    back.setBounds(150, 10, 100, 20);
    // f.pack();

  }
Beispiel #25
0
  /**
   * Constructor del juego que inicializa los valores.
   *
   * @param juga
   * @param jugadorActual
   */
  public Juego(ArrayList<Jugador> juga, Jugador jugadorActual) {
    jugadores = new ArrayList<>();
    this.jugadores = juga;
    this.jugador = jugadorActual;
    loader = Juego.class.getClassLoader();
    utilidades = new Util();
    claseTime = new Time();
    ventana = new JFrame("Concéntrese - Juan S.");
    ventana.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    ventana.setSize(520, 475);
    ventana.setLayout(null);
    ventana.setResizable(false);
    contadorJugadas = 0;
    cartaPorDefecto = new ImageIcon(loader.getResource("recursos/carta8.gif"));
    panel = new JPanel();
    panel.setSize(300, 450);
    panel.setLayout(new GridLayout(4, 4));
    intentos = new JLabel("Intento : 0");
    etiquetaTiempoPartida = new JLabel("Tiempo: ");
    tiempoPartida = new JLabel("00.00.000");
    etiquetaTiempoPartida.setFont(etiquetaTiempoPartida.getFont().deriveFont(20.0f));
    tiempoPartida.setFont(tiempoPartida.getFont().deriveFont(20.0f));
    intentos.setFont(intentos.getFont().deriveFont(20.0f));
    intentos.setBounds(320, 50, 200, 30);
    tiempoPartida.setBounds(420, 5, 200, 30);
    etiquetaTiempoPartida.setBounds(320, 5, 200, 30);
    ventana.add(tiempoPartida);
    ventana.add(etiquetaTiempoPartida);
    ventana.add(intentos);
    ventana.add(panel);

    crearMenuSuperior();
    crearMatrizIconos();
    crearArrayBotones();
    crearTemporizador();

    ventana.setLocationRelativeTo(null);
    ventana.setVisible(true);
  }
Beispiel #26
0
  private void prepareGUI() {
    mainFrame = new JFrame("Java Swing Examples");
    mainFrame.setSize(400, 400);
    mainFrame.setLayout(new GridLayout(3, 1));
    mainFrame.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent windowEvent) {
            System.exit(0);
          }
        });
    headerLabel = new JLabel("", JLabel.CENTER);
    statusLabel = new JLabel("", JLabel.CENTER);

    statusLabel.setSize(350, 100);

    controlPanel = new JPanel();
    controlPanel.setLayout(new FlowLayout());

    mainFrame.add(headerLabel);
    mainFrame.add(controlPanel);
    mainFrame.add(statusLabel);
    mainFrame.setVisible(true);
  }
Beispiel #27
0
	Swing4(String s)
	{
		f=new JFrame(s);
		
		ta=new JTextArea();
		ta.setBounds(50,50,400,200);
		f.add(ta);
		
		tf=new JTextField();
		tf.setBounds(50,300,100,50);
		f.add(tf);
		
		b=new JButton("FIND");
		b.setBounds(200,300,100,50);
		b.addActionListener(this);
		f.add(b);
		
		b1=new JButton("NEXT");
		b1.setBounds(350,300,100,50);
		b1.addActionListener(this);
		b1.setVisible(false);
		f.add(b1);
		
		tf1=new JTextField();
		tf1.setBounds(50,400,100,50);
		f.add(tf1);
		
		b2=new JButton("REPLACE");
		b2.setBounds(200,400,100,50);
		b2.addActionListener(this);
		f.add(b2);
		
		f.setLayout(null);
		f.setSize(500,500);
		f.setVisible(true);
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
Beispiel #28
0
  public void hacerInterfaz() {
    ventana_chat = new JFrame("Cliente");
    btn_enviar = new JButton("Enviar");
    txt_mensaje = new JTextField(4);
    area_chat = new JTextArea(10, 17);
    scroll = new JScrollPane(area_chat);
    contenedor_areachat = new JPanel();
    contenedor_areachat.setLayout(new GridLayout(1, 1));
    contenedor_areachat.add(scroll);
    contenedor_btntxt = new JPanel();
    contenedor_btntxt.setLayout(new GridLayout(1, 2));
    contenedor_btntxt.add(txt_mensaje);
    contenedor_btntxt.add(btn_enviar);
    ventana_chat.setLayout(new BorderLayout());
    ventana_chat.add(contenedor_areachat, BorderLayout.NORTH);
    ventana_chat.add(contenedor_btntxt, BorderLayout.SOUTH);
    ventana_chat.setSize(300, 220);
    ventana_chat.setVisible(true);
    ventana_chat.setResizable(false);
    ventana_chat.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Thread principal =
        new Thread(
            new Runnable() {
              public void run() {
                try {
                  socket = new Socket("localhost", 8000);
                  leer();
                  escribir();
                } catch (Exception ex) {
                  ex.printStackTrace();
                }
              }
            });
    principal.start();
  }
  private void prepareGUI() {

    frame = new JFrame("Control Sample");
    frame.setSize(600, 480);
    frame.setLayout(new GridLayout(3, 1));

    headerLabel = new JLabel("", JLabel.CENTER);

    statusLabel = new JLabel("", JLabel.CENTER);

    frame.addWindowFocusListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent windowEvent) {
            System.exit(0);
          }
        });

    controlPanel = new JPanel();
    controlPanel.setLayout(new FlowLayout());

    frame.add(headerLabel);
    frame.add(statusLabel);
    frame.add(controlPanel);
  }
 private static void initGui() {
   try {
     UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
   } catch (Exception exception) {
     exception.printStackTrace();
   }
   JFrame frame = new JFrame("DarkBot");
   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   frame.setLayout(new GridBagLayout());
   Insets noInsets = new Insets(0, 0, 0, 0);
   final JToggleButton sessionsButton = new JToggleButton("Login (0)");
   frame.add(
       sessionsButton,
       new GridBagConstraints(
           0, 0, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0));
   sessionsButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           sessions.set(sessionsButton.isSelected());
           synchronized (sessions) {
             sessions.notifyAll();
           }
         }
       });
   final JToggleButton joinsButton = new JToggleButton("Join (0)");
   frame.add(
       joinsButton,
       new GridBagConstraints(
           0, 1, 2, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0));
   joinsButton.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           joins.set(joinsButton.isSelected());
           synchronized (joins) {
             joins.notifyAll();
           }
         }
       });
   final JTextField field = new JTextField();
   frame.add(
       field,
       new GridBagConstraints(
           0, 2, 1, 1, 1, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0));
   final JButton button = new JButton("Start");
   frame.add(
       button,
       new GridBagConstraints(
           1, 2, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, noInsets, 0, 0));
   button.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent e) {
           if (button.getText().startsWith("Start")) {
             field.setEnabled(false);
             spamMessage = field.getText();
             button.setText("Stop");
           } else {
             spamMessage = null;
             button.setText("Start");
             field.setEnabled(true);
           }
         }
       });
   Timer timer =
       new Timer(
           500,
           new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent e) {
               sessionsButton.setText(
                   sessionsButton.getText().split(" ")[0]
                       + " ("
                       + Integer.toString(sessionCount.get())
                       + ")");
               joinsButton.setText(
                   joinsButton.getText().split(" ")[0]
                       + " ("
                       + Integer.toString(amountJoined.get())
                       + ")");
             }
           });
   timer.setRepeats(true);
   timer.start();
   frame.pack();
   frame.setSize(500, frame.getHeight());
   frame.setLocationRelativeTo(null);
   frame.setVisible(true);
 }