1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.GridBagLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.FlowLayout;
import java.awt.CardLayout;
import java.awt.Insets;
import java.awt.SystemColor;
import javax.swing.JTabbedPane;
import java.awt.ComponentOrientation;
import javax.swing.JButton;
import javax.swing.JTextArea;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.SwingConstants;
import java.awt.Button;
import java.awt.Point;
import java.awt.Graphics;
import javax.swing.*;
import java.awt.Graphics;
import java.awt.Graphics2D;
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
MaClasse thisClass = new MaClasse();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
}
});
}
public MaClasse() {
super();
initialize();
Dessin panel = new Dessin();
add(panel);
}
private void initialize() {
this.setSize(1000, 750);
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.setForeground(new Color(51, 102, 120));
jContentPane.add(getJPanelConfiguration(), null);
jContentPane.add(getJPanelCarte(), null);
jContentPane.add(getJPanelSimulation(), null);
}
return jContentPane;
}
public class MaClasse extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JPanel jPanelSimulation = null;
private JPanel jPanelConfiguration = null;
private JPanel jPanelCarte = null;
private JButton jButtonRemiseAZero = null;
private JTextArea jTextAreaAB = null;
private JPanel getJPanelSimulation() {
if (jPanelSimulation == null) {
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.fill = GridBagConstraints.VERTICAL;
gridBagConstraints.gridy = 1;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.gridx = 0;
jPanelSimulation = new JPanel();
jPanelSimulation.setLayout(new GridBagLayout());
jPanelSimulation.setBackground(new Color(84, 57, 0));
jPanelSimulation.setBounds(new Rectangle(0, 600, 984, 115));
jPanelSimulation.add(getJComboBoxNbTour(), gridBagConstraints);
}
return jPanelSimulation;
}
private JPanel getJPanelConfiguration() {
if (jPanelConfiguration == null) {
jPanelConfiguration = new JPanel();
jPanelConfiguration.setBounds(new Rectangle(0, 0, 384, 600));
jPanelConfiguration.setLayout(null);
jPanelConfiguration.setBackground(SystemColor.activeCaption);
jPanelConfiguration.add(getJButtonRemiseAZero(), null);
jPanelConfiguration.add(getJTextAreaAB(), null);
}
return jPanelConfiguration;
}
private JPanel getJPanelCarte() {
if (jPanelCarte == null) {
jPanelCarte = new JPanel();
jPanelCarte.setLayout(new GridBagLayout());
jPanelCarte.setBounds(new Rectangle(384, 0, 600, 600));
jPanelCarte.setBackground(Color.green);
}
return jPanelCarte;
}
/**
* This method initializes jButtonRemiseAZero
*
* @return javax.swing.JButton
*/
private JButton getJButtonRemiseAZero() {
if (jButtonRemiseAZero == null) {
jButtonRemiseAZero = new JButton();
jButtonRemiseAZero.setText("Remise à Zéro");
jButtonRemiseAZero.setSize(new Dimension(150, 40));
jButtonRemiseAZero.setLocation(new Point(120, 24));
jButtonRemiseAZero.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
}
});
}
return jButtonRemiseAZero;
}
private JTextArea getJTextAreaAB() {
if (jTextAreaAB == null) {
jTextAreaAB = new JTextArea();
jTextAreaAB.setBounds(new Rectangle(38, 355, 310, 22));
jTextAreaAB.setFont(new Font("Trebuchet MS", Font.BOLD, 18));
jTextAreaAB.setText("Armée bleue...............................");
jTextAreaAB.setEditable(false);
jTextAreaAB.setTabSize(8);
jTextAreaAB.setBackground(SystemColor.activeCaption);
}
return jTextAreaAB;
}
} |
Partager