[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 387
  • Last Modified:

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
0
emeraldpiggy
Asked:
emeraldpiggy
  • 3
  • 2
1 Solution
 
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
 
emeraldpiggyAuthor 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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now