how to make a java applet menu interact with jframe

hi mind me asking how to make a java applet menu that can call on different jframe window base on the parameter being passed ?
i ll really appreciate it if u can show me piece of code
thanks
emeraldpiggyAsked:
Who is Participating?
 
emeraldpiggyConnect With a Mentor Author Commented:
hi joseph i am trying to pass the parameter from javaapplet to jframe


can u enlighten me on this ?

first i am going to change button to menu
second passing the parameter thru actionListener  with constructor override
		button = new JButton("go");
		button.addActionListener(new ButtonListener());

class ButtonListener implements ActionListener {
	  ButtonListener() {}
	  public void actionPerformed(ActionEvent e) {
		    if (e.getActionCommand().equals("Play Chess")) {
		    	JFrame jf = new JavaChess1();
		    	jf.setVisible(true);
		    }
		  }
}

Open in new window

0
 
josephtsangCommented:
Sorry, can you tell me some more details? What do you want to see?
0
 
emeraldpiggyAuthor Commented:
hi joseph
i am trying to make a java applet menu and every button opens a same jframe panel with different content inside
thanks
0
 
josephtsangCommented:
Are you using Applet (AWT) or JApplet (Swing)?

For Swing, you can try to include a JInternalFrame to your JApplet. The link below is a good tutorial with code examples. You may make use of the example and modify it to fit your needs.

http://java.sun.com/docs/books/tutorial/uiswing/components/internalframe.html
0
 
emeraldpiggyAuthor Commented:
Both awt and swing
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.