daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest May 16th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.awt.*;
  2. import javax.swing.*;
  3. import java.awt.event.*;
  4.  
  5. public class Fenster{
  6.  
  7. public Fenster(){
  8.     startFrame();
  9. }
  10.  
  11. public void startFrame(){
  12.  
  13.     /*Generate Frame*/
  14.     JFrame frame = new JFrame("Tic Tac Toe");
  15.     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  16.     frame.setSize(500,500);
  17.     frame.setVisible(true);
  18.    
  19.     /*Generate Headline and add to frame*/
  20.     JLabel headline = new JLabel("Tic Tac Toe");
  21.     frame.add(BorderLayout.NORTH, headline);
  22.    
  23.     /*Generate Panel for Buttons*/
  24.     JPanel panel = new JPanel(new GridLayout(0,3));
  25.    
  26.     /*Generate Buttons*/
  27.     JButton b1 = new JButton("");
  28.     JButton b2 = new JButton("");
  29.     JButton b3 = new JButton("");
  30.     JButton b4 = new JButton("");
  31.     JButton b5 = new JButton("");
  32.     JButton b6 = new JButton("");
  33.     JButton b7 = new JButton("");
  34.     JButton b8 = new JButton("");
  35.     JButton b9 = new JButton("");
  36.    
  37.     /*Add Buttons to Panel*/
  38.     panel.add(b1);
  39.     panel.add(b2);
  40.     panel.add(b3);
  41.     panel.add(b4);
  42.     panel.add(b5);
  43.     panel.add(b6);
  44.     panel.add(b7);
  45.     panel.add(b8);
  46.     panel.add(b9);
  47.    
  48.     /*Add Panel to Frame*/
  49.     frame.add(BorderLayout.CENTER, panel);
  50.    
  51.  
  52. }
  53.  
  54.  
  55. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top