How to add JMenuBar to a JApplet?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sreelatha_Kuchipudi
Posted On:   Wednesday, August 6, 2008 06:24 AM

I have created a MenuApplet.java class which extends JApplet. I am tring to drag and drop JMenuBar on to the form but the menu bar is not visible. The menu bar is only visible when I try to check the preview. But the auto generated code shows that JMenuBar is added.

I have created a MenuBar.java class which extends JFrame. I am tring to drag and drop JMenuBar on to the form and the menu bar is visible.

What should I do to over that JApplet so that I can use it like a JFrame by adding menubar, labela, buttons, text panes and drop downs.

Re: How to add JMenuBar to a JApplet?

Posted By:   Sreelatha_Kuchipudi  
Posted On:   Tuesday, August 19, 2008 05:23 AM

For this problem I have found one solution where I will be creating one more java class which extends JFrame and I will be calling this class when the applet gets started. But at the same time the default applet viewer and the JFrame are visible. Can you help me out in hiding the default applet viewer so that only the JFrame is visible.
How I have done is like as follows:
{code}public class MenuApplet extends JApplet {

/** Initializes the applet MenuApplet */
@Override
public void init() {
MenuFrame mFrame = new MenuFrame();
mFrame.setVisible(true);
//this.stop();
//this.destroy();
}
}{code}

Here, MenuFrame is the java class which extends JFrame. Even stop() and destroy() methods are not helpful for me.
About | Sitemap | Contact