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 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JSeparator;
import javax.swing.JTextField;
import javax.swing.JPanel;
/**
* Created by IntelliJ IDEA.
* User: bebe
* Date: 12-Jun-2006
* Time: 07:47:57
* To change this template use File | Settings | File Templates.
*/
public class Carte2 extends JPanel {
private JLabel entreeLabelTitle = new JLabel();
private JSeparator entreeSeparator = new JSeparator();
private JLabel entree1Label = new JLabel();
private JTextField entree1TextField = new JTextField();
private JLabel entree2Label = new JLabel();
private JLabel entreeSuiteLabel = new JLabel();
private JLabel crepeSaleeLabelTitle = new JLabel();
private JSeparator crepeSalerSeparator = new JSeparator();
private JLabel crepeSaleeType1Label = new JLabel();
private JTextField crepeSalerType1TextField = new JTextField();
private JLabel suiteSaleesLabel = new JLabel();
private JTextField suiteSalerTextField = new JTextField();
private JLabel crepeSucreeLabelTitle = new JLabel();
private JSeparator crepSucrerSeparator = new JSeparator();
private JLabel crepeSucrerType1Label = new JLabel();
private JLabel suiteSucrerLabel = new JLabel();
private JTextField crepeSucrerType1TextField = new JTextField();
private JTextField suiteSucrerTextField = new JTextField();
private JLabel boissonLabelTitle = new JLabel();
private JLabel numeroTableLabel = new JLabel();
private JSeparator boissonSeparator = new JSeparator();
private JLabel cocaLabel = new JLabel();
private JTextField cocaTextField = new JTextField();
private JLabel fantaLabel = new JLabel();
private JTextField fantaTextField = new JTextField();
private JButton ticketButton = new JButton();
private JButton quitterButton = new JButton();
private JComboBox numeroTableCombobox = new JComboBox();
private JLabel nomServeurLabel = new JLabel();
private JTextField nomServeurTextField = new JTextField();
private JTextField totalTextField = new JTextField();
private JSeparator totalSeparator = new JSeparator();
private JLabel totalLabel = new JLabel();
public Carte2() {
initGui();
}
private void initGui(){
setLayout(new GridBagLayout());
entreeLabelTitle.setText("Entrees :");
entreeLabelTitle.setFont(new Font("Verdana", Font.BOLD | Font.ITALIC, 15));
entreeLabelTitle.setForeground(new Color(115, 24, 0));
entree1Label.setText("Une entree ");
entree1TextField.setPreferredSize(new Dimension(85, 20));
entree1TextField.setMinimumSize(new Dimension(85, 20));
entree2Label.setText("Second entree ");
entreeSuiteLabel.setText("suite...");
crepeSaleeLabelTitle.setText("Crepes salees :");
crepeSaleeLabelTitle.setFont(new Font("Verdana", 1, 15));
crepeSaleeLabelTitle.setForeground(new Color(115, 24, 0));
crepeSaleeType1Label.setText("Type de crepe salee");
crepeSalerType1TextField.setPreferredSize(new Dimension(85, 20));
crepeSalerType1TextField.setMinimumSize(new Dimension(85, 20));
suiteSaleesLabel.setText("suite...");
suiteSalerTextField.setMinimumSize(new Dimension(85, 20));
suiteSalerTextField.setPreferredSize(new Dimension(85, 20));
crepeSucreeLabelTitle.setText("Crepes sucres :");
crepeSucreeLabelTitle.setFont(new Font("Verdana", 1, 15));
crepeSucreeLabelTitle.setForeground(new Color(115, 24, 0));
crepeSucrerType1Label.setText("Type de crepe sucrer");
suiteSucrerLabel.setText("suite...");
crepeSucrerType1TextField.setPreferredSize(new Dimension(85, 20));
crepeSucrerType1TextField.setMinimumSize(new Dimension(85, 20));
suiteSucrerTextField.setMinimumSize(new Dimension(85, 20));
suiteSucrerTextField.setPreferredSize(new Dimension(85, 20));
boissonLabelTitle.setText("Boissons :");
boissonLabelTitle.setFont(new Font("Verdana", 1, 15));
boissonLabelTitle.setForeground(new Color(115, 24, 0));
numeroTableLabel.setText("Numero de table :");
cocaLabel.setText("Coca");
cocaTextField.setPreferredSize(new Dimension(85, 20));
cocaTextField.setMinimumSize(new Dimension(85, 20));
fantaLabel.setText("Fanta");
fantaTextField.setMinimumSize(new Dimension(85, 20));
fantaTextField.setPreferredSize(new Dimension(85, 20));
ticketButton.setText("Ticket");
quitterButton.setText("Quitter");
numeroTableCombobox.setPreferredSize(new Dimension(75, 20));
numeroTableCombobox.setMinimumSize(new Dimension(75, 20));
nomServeurLabel.setText("Nom du serveur :");
totalTextField.setMinimumSize(new Dimension(85, 20));
totalTextField.setPreferredSize(new Dimension(85, 20));
totalTextField.setEditable(false);
totalLabel.setText("Total");
this.add(entreeLabelTitle,
new GridBagConstraints(0, 2, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(10, 5, 0, 0), 0, 0));
this.add(entreeSeparator,
new GridBagConstraints(1, 3, GridBagConstraints.REMAINDER,
1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL,
new Insets(0, 25, 0, 5), 0, 0));
this.add(entree1Label,
new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(15, 25, 0, 0), 0, 0));
this.add(entree1TextField,
new GridBagConstraints(1, 4, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(12, 0, 0, 5), 0, 0));
this.add(entree2Label,
new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(5, 25, 0, 0), 0, 0));
this.add(entreeSuiteLabel,
new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(5, 25, 0, 0), 0, 0));
this.add(crepeSaleeLabelTitle,
new GridBagConstraints(0, 7, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(25, 5, 0, 0), 0, 0));
this.add(crepeSalerSeparator,
new GridBagConstraints(1, 8, GridBagConstraints.REMAINDER,
1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL,
new Insets(0, 25, 0, 5), 0, 0));
this.add(crepeSaleeType1Label,
new GridBagConstraints(0, 9, 1, 1, 0.0, 0.0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(15, 25, 0, 0), 0, 0));
this.add(crepeSalerType1TextField,
new GridBagConstraints(1, 9, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(12, 0, 0, 5), 0, 0));
this.add(suiteSaleesLabel,
new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(5, 25, 0, 0), 0, 0));
this.add(suiteSalerTextField,
new GridBagConstraints(1, 10, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(3, 0, 0, 5), 0, 0));
this.add(crepeSucreeLabelTitle,
new GridBagConstraints(0, 11, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(25, 5, 0, 0), 0, 0));
this.add(crepSucrerSeparator,
new GridBagConstraints(1, 12, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL,
new Insets(0, 25, 0, 5), 0, 0));
this.add(crepeSucrerType1Label,
new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(15, 25, 0, 0), 0, 0));
this.add(suiteSucrerLabel,
new GridBagConstraints(0, 14, 1, 1, 0.0, 0.0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(5, 25, 0, 0), 0, 0));
this.add(crepeSucrerType1TextField,
new GridBagConstraints(1, 13, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(12, 0, 0, 5), 0, 0));
this.add(suiteSucrerTextField,
new GridBagConstraints(1, 14, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(3, 0, 0, 5), 0, 0));
this.add(boissonLabelTitle,
new GridBagConstraints(0, 15, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(25, 5, 0, 0), 0, 0));
this.add(numeroTableLabel,
new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(8, 0, 0, 0), 0, 0));
this.add(boissonSeparator,
new GridBagConstraints(1, 16, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL,
new Insets(0, 25, 0, 5), 0, 0));
this.add(cocaLabel,
new GridBagConstraints(0, 17, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(15, 25, 0, 0), 0, 0));
this.add(cocaTextField,
new GridBagConstraints(1, 17, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(12, 0, 0, 5), 0, 0));
this.add(fantaLabel,
new GridBagConstraints(0, 18, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(5, 25, 0, 0), 0, 0));
this.add(fantaTextField,
new GridBagConstraints(1, 18, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(3, 0, 0, 5), 0, 0));
this.add(ticketButton,
new GridBagConstraints(2, 21, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
new Insets(10, 0, 5, 5), 0, 0));
this.add(quitterButton,
new GridBagConstraints(3, 21, 1, 1, 0.0, 1.0, GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE,
new Insets(10, 0, 5, 5), 0, 0));
this.add(numeroTableCombobox,
new GridBagConstraints(2, 1, 2, 1, 0.0, 0.0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(5, 5, 10, 5), 0, 0));
this.add(nomServeurLabel,
new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(8, 0, 0, 0), 0, 0));
this.add(nomServeurTextField,
new GridBagConstraints(2, 0, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
new Insets(5, 5, 0, 5), 0, 0));
this.add(totalTextField,
new GridBagConstraints(1, 20, GridBagConstraints.REMAINDER,
1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
new Insets(7, 0, 0, 5), 0, 0));
this.add(totalSeparator,
new GridBagConstraints(0, 19, GridBagConstraints.REMAINDER,
1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(15, 25, 0, 5), 0, 0));
this.add(totalLabel,
new GridBagConstraints(0, 20, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
new Insets(10, 25, 0, 0), 0, 0));
}
public static void main(String[] args) {
JFrame myFrame = new JFrame("Carte");
myFrame.add(new Carte2());
myFrame.pack();
myFrame.setLocationRelativeTo(null);
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
myFrame.setVisible(true);
}
} |
Partager