• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

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
 
Without subsidies, chem-ag food costs four times more than organic. Or this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic