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 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
|
package test;
import java.awt.*;
import java.awt.event.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JToolBar;
import javax.swing.JButton;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import com.borland.jbcl.layout.XYLayout;
import com.borland.jbcl.layout.*;
import javax.swing.Box;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2007</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class Frame1 extends JFrame {
JPanel contentPane;
JMenuBar jMenuBar1 = new JMenuBar();
JMenu jMenuFile = new JMenu();
JMenuItem jMenuFileExit = new JMenuItem();
JMenu jMenuHelp = new JMenu();
JMenuItem jMenuHelpAbout = new JMenuItem();
JToolBar jToolBar = new JToolBar();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JButton jButton3 = new JButton();
ImageIcon image1 = new ImageIcon(test.Frame1.class.getResource(
"openFile.png"));
ImageIcon image2 = new ImageIcon(test.Frame1.class.getResource(
"closeFile.png"));
ImageIcon image3 = new ImageIcon(test.Frame1.class.getResource("help.png"));
JLabel statusBar = new JLabel();
JButton jButton4 = new JButton();
JButton jButton5 = new JButton();
JButton jButton6 = new JButton();
Component glue1 = Box.createGlue();
JButton jButton7 = new JButton();
GridBagLayout gridBagLayout1 = new GridBagLayout();
public Frame1() {
try {
setDefaultCloseOperation(EXIT_ON_CLOSE);
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Component initialization.
*
* @throws java.lang.Exception
*
*
*/
private void jbInit() throws Exception {
contentPane = (JPanel) getContentPane();
contentPane.setLayout(gridBagLayout1);
setSize(new Dimension(400, 300));
setTitle("Frame Title");
statusBar.setText(" ");
jMenuFile.setText("File");
jMenuFileExit.setText("Exit");
jMenuFileExit.addActionListener(new Frame1_jMenuFileExit_ActionAdapter(this));
jMenuHelp.setText("Help");
jMenuHelpAbout.setText("About");
jMenuHelpAbout.addActionListener(new
Frame1_jMenuHelpAbout_ActionAdapter(this));
jButton4.setText("jButton4");
jButton4.addActionListener(new Frame1_jButton4_actionAdapter(this));
// jButton4.addActionListener(new Frame1_jButton4_actionAdapter(this));
jButton5.setText("jButton5");
jButton5.addActionListener(new Frame1_jButton5_actionAdapter(this));
jButton6.setText("jButton6");
jButton6.addActionListener(new Frame1_jButton6_actionAdapter(this));
jButton7.setText("try componont");
jButton7.addActionListener(new Frame1_jButton7_actionAdapter(this));
jMenuBar1.add(jMenuFile);
jMenuFile.add(jMenuFileExit);
jMenuBar1.add(jMenuHelp);
jMenuHelp.add(jMenuHelpAbout);
setJMenuBar(jMenuBar1);
jButton1.setIcon(image1);
jButton1.setToolTipText("Open File");
jButton2.setIcon(image2);
jButton2.setToolTipText("Close File");
jButton3.setIcon(image3);
jButton3.setToolTipText("Help");
jToolBar.add(jButton1);
jToolBar.add(jButton2);
jToolBar.add(jButton3);
contentPane.add(jButton7, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.NONE,
new Insets(12, 110, 0, 0), 14, 14));
contentPane.add(statusBar, new GridBagConstraints(0, 5, 2, 1, 0.0, 0.0
, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(0, 0, 0, 0), 397, 0));
contentPane.add(jButton6, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.NONE,
new Insets(14, 70, 0, 7), 23, 10));
contentPane.add(jButton5, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.NONE,
new Insets(16, 72, 44, 0), 28, 3));
contentPane.add(jButton4, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.NONE,
new Insets(52, 91, 0, 0), 6, 8));
contentPane.add(glue1, new GridBagConstraints(0, 1, 1, 2, 1.0, 1.0
, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
new Insets(35, 35, 0, 20), 172, 134));
contentPane.add(jToolBar, new GridBagConstraints(0, 0, 2, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
new Insets(0, 0, 0, 0), 318, 0));
}
/**
* File | Exit action performed.
*
* @param actionEvent ActionEvent
*/
void jMenuFileExit_actionPerformed(ActionEvent actionEvent) {
System.exit(0);
}
/**
* Help | About action performed.
*
* @param actionEvent ActionEvent
*/
void jMenuHelpAbout_actionPerformed(ActionEvent actionEvent) {
Frame1_AboutBox dlg = new Frame1_AboutBox(this);
Dimension dlgSize = dlg.getPreferredSize();
Dimension frmSize = getSize();
Point loc = getLocation();
dlg.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x,
(frmSize.height - dlgSize.height) / 2 + loc.y);
dlg.setModal(true);
dlg.pack();
dlg.setVisible(true);
}
public void jButton4_actionPerformed(ActionEvent actionEvent) {
//
}
public void jButton6_actionPerformed(ActionEvent e) {
//ajouter les fonctions pour ce boutton
}
public void jButton5_actionPerformed(ActionEvent e) {
Anis anis = new Anis(this,"croucrou",true);
//anis.setBounds(100,100,100,100);
anis.setLocation(200,200);
//anis.setSize(100,100);
anis.setModal(true);
anis.pack();
anis.setVisible(true);
}
public void jButton7_actionPerformed(ActionEvent e) {
glue1.setName("aaa");
}
}
class Frame1_jButton7_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jButton7_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton7_actionPerformed(e);
}
}
class Frame1_jButton4_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jButton4_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton4_actionPerformed(e);
}
}
class Frame1_jButton5_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jButton5_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton5_actionPerformed(e);
}
}
class Frame1_jButton6_actionAdapter implements ActionListener {
private Frame1 adaptee;
Frame1_jButton6_actionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton6_actionPerformed(e);
}
}
class Frame1_jMenuFileExit_ActionAdapter implements ActionListener {
Frame1 adaptee;
Frame1_jMenuFileExit_ActionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent actionEvent) {
adaptee.jMenuFileExit_actionPerformed(actionEvent);
}
}
class Frame1_jMenuHelpAbout_ActionAdapter implements ActionListener {
Frame1 adaptee;
Frame1_jMenuHelpAbout_ActionAdapter(Frame1 adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent actionEvent) {
adaptee.jMenuHelpAbout_actionPerformed(actionEvent);
}
} |