Re: JFrame
Thanks Andrew,
public class GUIMain extends javax.swing.JFrame {
public GUIMain() {
initComponents();
}
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
getContentPane().setLayout(null);
setTitle("Main Menu");
setName("Main Menu");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
jLabel1.setText("Main Menu:");
getContentPane().add(jLabel1);
jLabel1.setBounds(150, 10, 64, 20);
jButton1.setText("Customer");
jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton1MouseClicked(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(10, 40, 90, 26);
jButton2.setText("Vehicle");
jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton2MouseClicked(evt);
}
});
getContentPane().add(jButton2);
jButton2.setBounds(110, 40, 76, 26);
jButton3.setText("Rental");
jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton3MouseClicked(evt);
}
});
getContentPane().add(jButton3);
jButton3.setBounds(200, 40, 70, 26);
jButton4.setText("Close");
jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jButton4MouseClicked(evt);
}
});
getContentPane().add(jButton4);
jButton4.setBounds(280, 40, 66, 26);
pack();
java.awt.Dimension screenSize =
java.awt.Toolkit.getDefaultToolkit().getScreenSize();
setSize(new java.awt.Dimension(365, 120));
setLocation((screenSize.width-365)/2,(screenSize.height-120)/2);
}
private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {
// Add your handling code here:close
System.exit(0);
}
private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {
// Add your handling code here:rental
}
private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {
// Add your handling code here:vehicle
}
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
// Add your handling code here:customer
Process p = rt.exec("GUICustomer.class") ;
}
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new GUIMain().show();
}
private javax.swing.JLabel jLabel1;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
}
That's my code and I'm trying to make jButton1open a .java file but
cant figure out the code to do it, any idea?
Thanks again.