Advertisement
Guest User

TicTacToe GUI

a guest
Dec 15th, 2011
33,465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.20 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import javax.swing.*;
  4. import javax.swing.GroupLayout;
  5. import javax.swing.LayoutStyle;
  6. /*
  7.  * Created by JFormDesigner on Thu Dec 08 14:16:42 EST 2011
  8.  */
  9.  
  10.  
  11.  
  12. /**
  13.  * @author Bradley Chelsey
  14.  */
  15. public class tictactoe extends JFrame {
  16.     public tictactoe() {
  17.         initComponents();
  18.     }
  19.  
  20.     private void button1ActionPerformed(ActionEvent e) {
  21.         // TODO add your code here
  22.     }
  23.  
  24.     private void button2ActionPerformed(ActionEvent e) {
  25.         // TODO add your code here
  26.     }
  27.  
  28.     private void button3ActionPerformed(ActionEvent e) {
  29.         // TODO add your code here
  30.     }
  31.  
  32.     private void button4ActionPerformed(ActionEvent e) {
  33.         // TODO add your code here
  34.     }
  35.  
  36.     private void button5ActionPerformed(ActionEvent e) {
  37.         // TODO add your code here
  38.     }
  39.  
  40.     private void button6ActionPerformed(ActionEvent e) {
  41.         // TODO add your code here
  42.     }
  43.  
  44.     private void button7ActionPerformed(ActionEvent e) {
  45.         // TODO add your code here
  46.     }
  47.  
  48.     private void button8ActionPerformed(ActionEvent e) {
  49.         // TODO add your code here
  50.     }
  51.  
  52.     private void button9ActionPerformed(ActionEvent e) {
  53.         // TODO add your code here
  54.     }
  55.  
  56.     private void initComponents() {
  57.         // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
  58.         // Generated using JFormDesigner Evaluation license - Bradley Chelsey
  59.         button1 = new JButton();
  60.         button2 = new JButton();
  61.         button3 = new JButton();
  62.         button4 = new JButton();
  63.         button5 = new JButton();
  64.         button6 = new JButton();
  65.         button7 = new JButton();
  66.         button8 = new JButton();
  67.         button9 = new JButton();
  68.  
  69.         //======== this ========
  70.         setTitle("Tic Tac Toe");
  71.         Container contentPane = getContentPane();
  72.  
  73.         //---- button1 ----
  74.         button1.setText("1");
  75.         button1.addActionListener(new ActionListener() {
  76.             @Override
  77.             public void actionPerformed(ActionEvent e) {
  78.                 button1ActionPerformed(e);
  79.             }
  80.         });
  81.  
  82.         //---- button2 ----
  83.         button2.setText("2");
  84.         button2.addActionListener(new ActionListener() {
  85.             @Override
  86.             public void actionPerformed(ActionEvent e) {
  87.                 button2ActionPerformed(e);
  88.             }
  89.         });
  90.  
  91.         //---- button3 ----
  92.         button3.setText("3");
  93.         button3.addActionListener(new ActionListener() {
  94.             @Override
  95.             public void actionPerformed(ActionEvent e) {
  96.                 button3ActionPerformed(e);
  97.             }
  98.         });
  99.  
  100.         //---- button4 ----
  101.         button4.setText("4");
  102.         button4.addActionListener(new ActionListener() {
  103.             @Override
  104.             public void actionPerformed(ActionEvent e) {
  105.                 button4ActionPerformed(e);
  106.             }
  107.         });
  108.  
  109.         //---- button5 ----
  110.         button5.setText("5");
  111.         button5.addActionListener(new ActionListener() {
  112.             @Override
  113.             public void actionPerformed(ActionEvent e) {
  114.                 button5ActionPerformed(e);
  115.             }
  116.         });
  117.  
  118.         //---- button6 ----
  119.         button6.setText("6");
  120.         button6.addActionListener(new ActionListener() {
  121.             @Override
  122.             public void actionPerformed(ActionEvent e) {
  123.                 button6ActionPerformed(e);
  124.             }
  125.         });
  126.  
  127.         //---- button7 ----
  128.         button7.setText("7");
  129.         button7.addActionListener(new ActionListener() {
  130.             @Override
  131.             public void actionPerformed(ActionEvent e) {
  132.                 button7ActionPerformed(e);
  133.             }
  134.         });
  135.  
  136.         //---- button8 ----
  137.         button8.setText("8");
  138.         button8.addActionListener(new ActionListener() {
  139.             @Override
  140.             public void actionPerformed(ActionEvent e) {
  141.                 button8ActionPerformed(e);
  142.             }
  143.         });
  144.  
  145.         //---- button9 ----
  146.         button9.addActionListener(new ActionListener() {
  147.             @Override
  148.             public void actionPerformed(ActionEvent e) {
  149.                 button9ActionPerformed(e);
  150.             }
  151.         });
  152.  
  153.         GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  154.         contentPane.setLayout(contentPaneLayout);
  155.         contentPaneLayout.setHorizontalGroup(
  156.             contentPaneLayout.createParallelGroup()
  157.                 .addGroup(contentPaneLayout.createSequentialGroup()
  158.                     .addContainerGap()
  159.                     .addGroup(contentPaneLayout.createParallelGroup()
  160.                         .addGroup(contentPaneLayout.createSequentialGroup()
  161.                             .addComponent(button1, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE)
  162.                             .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  163.                             .addComponent(button2, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE)
  164.                             .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  165.                             .addComponent(button3, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE))
  166.                         .addGroup(contentPaneLayout.createSequentialGroup()
  167.                             .addComponent(button4, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE)
  168.                             .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  169.                             .addComponent(button5, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE)
  170.                             .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  171.                             .addComponent(button6, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE))
  172.                         .addGroup(contentPaneLayout.createSequentialGroup()
  173.                             .addComponent(button7, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE)
  174.                             .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  175.                             .addComponent(button8, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE)
  176.                             .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  177.                             .addComponent(button9, GroupLayout.PREFERRED_SIZE, 68, GroupLayout.PREFERRED_SIZE)))
  178.                     .addContainerGap(11, Short.MAX_VALUE))
  179.         );
  180.         contentPaneLayout.setVerticalGroup(
  181.             contentPaneLayout.createParallelGroup()
  182.                 .addGroup(contentPaneLayout.createSequentialGroup()
  183.                     .addContainerGap()
  184.                     .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  185.                         .addComponent(button1, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
  186.                         .addComponent(button2, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
  187.                         .addComponent(button3, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE))
  188.                     .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  189.                     .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  190.                         .addComponent(button4, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
  191.                         .addComponent(button5, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
  192.                         .addComponent(button6, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE))
  193.                     .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  194.                     .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  195.                         .addComponent(button7, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
  196.                         .addComponent(button8, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
  197.                         .addComponent(button9, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE))
  198.                     .addContainerGap(15, Short.MAX_VALUE))
  199.         );
  200.         pack();
  201.         setLocationRelativeTo(getOwner());
  202.         // JFormDesigner - End of component initialization  //GEN-END:initComponents
  203.     }
  204.  
  205.     // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
  206.     // Generated using JFormDesigner Evaluation license - Bradley Chelsey
  207.     private JButton button1;
  208.     private JButton button2;
  209.     private JButton button3;
  210.     private JButton button4;
  211.     private JButton button5;
  212.     private JButton button6;
  213.     private JButton button7;
  214.     private JButton button8;
  215.     private JButton button9;
  216.     // JFormDesigner - End of variables declaration  //GEN-END:variables
  217. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement