• Post Reply Bookmark Topic Watch Topic
  • New Topic

I can't side set JMenuBar (top-down)

 
Aleksandar Mitrev
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to set the JMenuBar in JApplet from the top to down. Is this possible. I have maket work with application why I can't makit work with JApplet what I'm doing wrong Here is my Applet:

import javax.swing.*;
import java.awt.*;
//import java.awt.event.*;
import javax.swing.border.*;


public class Feni extends JApplet {


public JMenuBar menibar = new JMenuBar();
public JMenu[] menita = {
new JMenu("Resources and mining"),
new JMenu("Production"),
new JMenu("About the process"),
new JMenu("Investments"),
new JMenu("Logistic"),
new JMenu("Environment"),
new JMenu("Other activitys")
};

public void init() {
menibar.setLayout(new BoxLayout(menibar, BoxLayout.Y_AXIS));
for(int i=0; i<menita.length; i++) {
menita[i].setBorder(new EtchedBorder());
menibar.add(menita[i]);
}
//setPreferredSize(new Dimension(150, 1000));
setJMenuBar(menibar);

}
}

and I insert in to HTML:
<html>
<body>
<applet code=Feni.class width="160" height="1100">
</applet>
</body>
</html>

I dont have error but thе menubar is in the top of the window from left to right not like I want, from top to down
 
Chris Waguespack
Ranch Hand
Posts: 36
Eclipse IDE Flex Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what you are trying to do should be accomplished with JMenuItem. Try adding those to your JMenu, instead of adding JMenus.

-Chris
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!