Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

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
 
A wop bop a lu bop a womp bam boom! Tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic