Wrathchild
Technical User
Ok 2-part quesion here:
I'm still VERY new to Java and am trying to make my first basic application. At work I build Access applications and I'm trying to build a menu bar in Java that would allow the users to select an application from a listing instead of having multiple shortcuts on their desktops as they do now.
Part 1 - I have code to build the skeleton of the menu, however I'm lost when it comes to the actual handling of the selection clicked (actionhandler)
Part 2 - when the user selects an item, I need to open the corresponding Access (.mde) application
any input would be appreciated; below is what I have so far
-----------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ApplicationList extends JFrame {
public ApplicationList() {
super("Application List");
setSize(300, 225);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuItem kr1 = new JMenuItem("App1");
JMenuItem kr2 = new JMenuItem("App2");
JMenuItem kr3 = new JMenuItem("App3");
JMenuItem kr4 = new JMenuItem("App4");
JMenuItem kr5 = new JMenuItem("App5");
JMenu m1 = new JMenu("Application");
m1.add(kr1);
m1.add(kr2);
m1.addSeparator();
m1.add(kr3);
m1.add(kr4);
m1.addSeparator();
m1.add(kr5);
JMenuBar jmb = new JMenuBar();
jmb.add(m1);
setJMenuBar(jmb);
setVisible(true);
}
public static void main(String[] arguments) {
ApplicationList md = new ApplicationList();
}
}
I'm still VERY new to Java and am trying to make my first basic application. At work I build Access applications and I'm trying to build a menu bar in Java that would allow the users to select an application from a listing instead of having multiple shortcuts on their desktops as they do now.
Part 1 - I have code to build the skeleton of the menu, however I'm lost when it comes to the actual handling of the selection clicked (actionhandler)
Part 2 - when the user selects an item, I need to open the corresponding Access (.mde) application
any input would be appreciated; below is what I have so far
-----------------------------------------------------------
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ApplicationList extends JFrame {
public ApplicationList() {
super("Application List");
setSize(300, 225);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JMenuItem kr1 = new JMenuItem("App1");
JMenuItem kr2 = new JMenuItem("App2");
JMenuItem kr3 = new JMenuItem("App3");
JMenuItem kr4 = new JMenuItem("App4");
JMenuItem kr5 = new JMenuItem("App5");
JMenu m1 = new JMenu("Application");
m1.add(kr1);
m1.add(kr2);
m1.addSeparator();
m1.add(kr3);
m1.add(kr4);
m1.addSeparator();
m1.add(kr5);
JMenuBar jmb = new JMenuBar();
jmb.add(m1);
setJMenuBar(jmb);
setVisible(true);
}
public static void main(String[] arguments) {
ApplicationList md = new ApplicationList();
}
}