Java Menu
Hey Eksperter.Jeg er i gang med at lave en applet hvor at man trykker på noget i menu'en også skulle det gerne komme from nedeunder. Men jeg ved bare ikke hvordan jeg skal lave det. Her er koden:
/*
* TestApplet1.java
*
* Created on 21. maj 2003, 23:09
*/
/**
*
* @author Bjarne Herhold
*/
public class TestApplet1 extends java.awt.Frame {
/** Creates new form TestApplet1 */
public TestApplet1() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
private void initComponents() {
menuBar1 = new java.awt.MenuBar();
menu1 = new java.awt.Menu();
menuItem1 = new java.awt.MenuItem();
menu2 = new java.awt.Menu();
setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
exitForm(evt);
}
});
menu1.setLabel("Menu");
menuItem1.setLabel("Quit");
menuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
menuItem1ActionPerformed(evt);
}
});
menu1.add(menuItem1);
menuBar1.add(menu1);
menu2.setLabel("Avis");
menuBar1.add(menu2);
setMenuBar(menuBar1);
pack();
}
private void menuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
// Add your handling code here:
}
/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit(0);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
new TestApplet1().show();
}
// Variables declaration - do not modify
private java.awt.MenuItem menuItem1;
private java.awt.MenuBar menuBar1;
private java.awt.Menu menu2;
private java.awt.Menu menu1;
// End of variables declaration
}
Håber i kan hjælpe mig.
//zubmit