• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

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

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 36
Mac Eclipse IDE Flex
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Destroy anything that stands in your way. Except this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic