JFrame no display of submenus

Hi Experts,

I tried to create a framework with a set of menus in NORTH

A text box to the CENTER

A button in the SOUTH

When I click on the QUALITY or LIVE it shows all the Sub Menus.

When I click on HELP or DEVELOPMENT it does NOT show a submenu.

If I comment the line

contentPane.add (textArea, BorderLayout.CENTER);

everything works fine.

What I'am missing.

I'm working on java 1.5.0_05 version

Help, please

Thank you

KR
= launch java prog Menu =.

import java.awt.*. *;

Javax.swing import. *;


SerializableAttribute public class Menu extends JFrame
{

private JMenuBar menuBar = new JMenuBar();
private TextArea textArea;
Private JButton clear;


Menu (String title) public
{
Super (title);

textArea = new TextArea ("", 0, 0, TextArea.SCROLLBARS_VERTICAL_ONLY);
textArea.setEditable (false);

clear = new JButton ("clear log");
Container contentPane = this.getContentPane ();
this.setDefaultCloseOperation (WindowConstants.EXIT_ON_CLOSE);


contentPane.add (menu bar, BorderLayout.NORTH);

If I comment below the line IT WORKS OK
contentPane.add (textArea, BorderLayout.CENTER);

contentPane.add (clear, BorderLayout.SOUTH);




createMenu();
}


Public Sub createMenu()
{
create a menu bar and attach it to this JFrame
menuBar = new JMenuBar();
this.setJMenuBar (menuBar);

create 4 menus and add them to the menu bar
JMenu devmenu = new JMenu ("Development");
JMenu qamenu = new JMenu ("Quality");
JMenu pmenu = new JMenu ("Live");
JMenu WorldShip = new JMenu("Help");


menuBar.add (qamenu);
menuBar.add (devmenu);
menuBar.add (pmenu);
menuBar.add (helpMenu);

Add a menu item to the Dev menu
Intersted d9210 = new intersted ("D92 10");
Intersted d92710 = new intersted ("D92 710");
Intersted d7510 = new intersted ("D75 10");
Intersted d7511 = new intersted ("D75 11");
Intersted d7010 = new intersted ("D70 10");
Intersted d7011 = new intersted ("D70 11");
Intersted output = new intersted ("Exit");

devmenu. Add (d9210);
devmenu. Add (d92710);
devmenu. Add (d7510);
devmenu. Add (d7511);
devmenu. Add (d7010);
devmenu. Add (d7011);
devmenu. Add (Exit);

Add three menu items to the menu QA
Intersted q9210 = new intersted ("Q92 10");
Intersted q7510 = new intersted ("Q75 10");
Intersted q7010 = new intersted ("Q70 10");
Intersted q7020 = new intersted ("Q70 20");
Intersted q7030 = new intersted ("Q70 30");
Intersted q7040 = new intersted ("Q70 40");
Intersted q7050 = new intersted ("Q70 50');
Intersted q7060 = new intersted ("Q70 60");
Intersted q7070 = new intersted ("Q70 70");
Intersted q7080 = new intersted ("Q70 80");
Intersted q7090 = new intersted ("Q70 90");
Intersted q7095 = new intersted ("Q70 95");
qamenu. Add (q9210);
qamenu. Add (q7510);
qamenu. Add (q7010);
qamenu. Add (q7020);
qamenu. Add (q7030);
qamenu. Add (q7040);
qamenu. Add (q7050);
qamenu. Add (q7060);
qamenu. Add (q7070);
qamenu. Add (q7080);
qamenu. Add (q7090);
qamenu. Add (q7095);



Add three menu items to the menu prod
Intersted p9210 = new intersted ("P92 10");
Intersted p7510 = new intersted ("P75 10");
Intersted p7010 = new intersted ("P70 10");
Intersted p7020 = new intersted ("P70 20");
Intersted p7030 = new intersted ("P70 30");
Intersted p7040 = new intersted ("P70 40");
Intersted p7050 = new intersted ("P70 50');
Intersted p7060 = new intersted ("P70 60");
Intersted p7070 = new intersted ("P70 70");
Intersted p7080 = new intersted ("80 P70");
Intersted p7090 = new intersted ("P70 90");
Intersted p7095 = new intersted ("P70 95");
pMenu.Add (p9210);
pMenu.Add (P7510);
pMenu.Add (P7010);
pMenu.Add (p7020);
pMenu.Add (p7030);
pMenu.Add (p7040);
pMenu.Add (p7050);
pMenu.Add (p7060);
pMenu.Add (p7070);
pMenu.Add (p7080);
pMenu.Add (p7090);
pMenu.Add (p7095);


Add two menu item and a menu in the menu "Help".
Intersted pad = new intersted ("Logon Pad");
helpMenu.add (pad);

Intersted about = new intersted ("About");
helpMenu.add (about);


Add the button to clear logs also


}

Public Shared Sub main (String [] args)
{
Menu f = New Menu ("Test Menu");
f.setSize (400,300);
f.setVisible (true);
}
}
= end java prog Menu =.

You use an AWT TextArea : use a JTextArea Swing instead.
AWT and Swing widgets do not play well together (at least that was true in the JDK 1.5). In particular componentys AWT (components 'heavy weight') always paint over Swing ('light' components).
Your JMenus are probably paint, but disappear behind the text box.

Published by: jduprez on January 14, 2011 22:34

Tags: Java

Similar Questions

  • Aspire E1-570 Bluetooth connection woes...

    Acer Aspire E1-570, i3 intel 64-bit W8.1

    Had a problem with the Bluetooth since owning this phone a month ago.  Bluetooth can be lit but picks up no devices.

    I tried to uninstall and reinstall drivers without result.  Troubleshooting Microsoft trying to repair but fails.

    With Bluetooth enabled-

    Device Manager displays three submenus under the folder containing Bluetooth:

    Adapter Bluetooth usb (Qualcomm Atheros).

    Micorsoft Bluetooth enumerator,

    Microsoft Bluetooth enumerator THE.

    These all State that they are working properly and up to date.

    Further to the bottom of the line I in sound, video and game controllers under a submenu containing a folder:

    Bluetooth Audio (Qualcomm Atheros) device

    It has a yellow triangle and an exclamation point.

    In the Properties tab, under general, he States "this device cannot start. (Code 10) Object path component was not a directory object. "The driver is up-to-date.

    Can someone explain how to solve this problem.  Wireless Internet is fine as the rest.  Thank you very much.

    Please provide your number of SNIDS. The system is delivered with bIuetooth. You can try to uninstall all the drivers in Device Manager that have an exclamation mark next to them and the last 8.1 Bluetooth driver for your system of loading. I would test to see if the bluetooth works at this stage. If it doesn't, also download and install the latest version of the WLAN 8.1 driver for your system.

    If this does not resolve your problem, you can try to reload the system to install Windows 8 and test on Windows 8.

  • How can I check the log files

    I want to find my syslogs in windows 7. I faced a problem with ip address conflict. I need to know what is happening in my system/network. How can I check this problem?

    On the Start Menu, right-click on computer, and in the menu, click on manage.

    In the left pane, under System Tools, you will find event viewer, click on the arrow symbol.

    Which will display 4 submenus, some newspapers of Windows. Which displays a set of available log files than two sector those troubleshooting application logs and system. When you click in the left pane events will populate the middle pane with the most recent on top.

    The right pane has various tools that are active when a newspaper is opened.

  • [Need help] Menu item delete

    Hello!

    IAM on a small Menu for InDesign to make life easier for my co-workers.

    Somehow, I do not pay attention for a second and added a new menu item which does not seem to have a name.

    Bildschirmfoto 2016-09-05 um 08.39.34.png

    I use this code to remove the old entries menu / clear an iam working one before reloading:

    main2();
    
    function main2(){
            try{
                app.scriptMenuActions.item("Skripte").remove();
            }
        catch(myException){}
        
        try{
            app.menus.item("$ID/Main").submenus.item("Skripte").remove();
            }catch(e){}
        
        
    }
    

    The problem is that it doesn't seem to work if the Menu item does not have a name in itself... any idea on this?

    Maybe there is a way to do it by "ID"? Or I am too blind to see what is obvious?

    Thanks in advance!

    You can try to remove the sumenu index, for example

    App.menus.Item("$ID/main"). Submenus [3] .abolish)

    If your submenu nameless is the fourth menu. To make sure that you use the correct index, display all submenus of the main menu names. Your name of nameless menu should appear as two commas, as in

    File, edit, layout, Type, object, Table, view, window, help, Math

    This shows that there is a submenu without name between object and table or a submenu [5].

    If this does not work you can always restart InDesign and delete the preferences (Ctrl + Alt + Delete on Windows).

    Peter

  • The Interactions menu

    Is there a way to display the submenus ONLY vertically under the main menu.

    1. I have 4 menu - Menu 1 Menu 2 Menu 3 Menu 4

    2. I have submenus for Menu 2 only - 21, 22 submenu submenu

    3. I need to show these two sub-menus just below Menu 2 Menu 3 & Menu4 pushing

    Right now, when I try to do that, it shows submenus that to the right of the Menu 2 and not in Menu 2.

    Check out the example here: http://compmenu.aphotographer.in/index.html

    Discover the source of the sample: http://compmenu.aphotographer.in/assets/compmenu.muse

    Hope that helps.

    See you soon,.

    Vikas

  • Mouse events are going "through" my JPanel in a JLayeredPane

    Hello

    I use the JLayeredPane to a JFrame to display a JPanel "above" normal display from my window. In this "popup" Panel, I have a few buttons - it works very well, but with a caveat:

    When I click on a button on my 'popup' Panel, but the Panel itself, mouse click events are going through this Panel the normal JPanel of my JFrame, maybe keys behind her. So, my JPanel Popup, which is on top of my normal JFrame/JPanel, consumes no capture/mouse events.

    Do you have any idea how to stop the mouse events through my popup window/panel behind Panel?


    Thanks a lot for your help!

    Add a listener for mouse (movement/wheel) in the Panel that does nothing. One annoying feature that mouse events are not passed at the top of the hierarchy so normally not consumed but its exactly what you want :).

  • Color change undesirable in decorated JDialog

    Hello

    I would like a small JDialog to appear on mouse on a TextField. Popping any
    problem, but the Red title/frame color is only visible for the split of
    one second - and then he turns to blue. (If your graphics card is a super fast, use)
    the limits of the comment line).
    How can I make the permanent red color?

    I used the same code for pop - up on a JTable; so I wonder what makes the
    difference of JTextFields. I desperately even put the display.setVisible (true) one
    SwingUtilities.invokeLater, but nothing helped.

    Concerning
    Jörg
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    
    public class Y extends JFrame {
      JDialog display;
    
      public Y() {
        setSize(300,300);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        Container cp= getContentPane();
        cp.setLayout(null);
        JTextField tf= new JTextField(30);
        tf.addMouseListener(new MousListener());
        tf.setBounds(30,50, 100, 25);
    //    tf.setBounds(10,10, 100, 25);
        cp.add(tf, BorderLayout.NORTH);
        setVisible(true);
      }
    
    
      public static void main(String args[]) {
        EventQueue.invokeLater(new Runnable() {
          public void run() {
         new Y();
          }
        });
      }
    
    
      class MousListener extends MouseAdapter {
        public void mouseEntered(MouseEvent e) {
          JDialog.setDefaultLookAndFeelDecorated(true);
          UIManager.put("inactiveCaption",
              new javax.swing.plaf.ColorUIResource(Color.RED));
          display= new JDialog(Y.this, "Title");
          JDialog.setDefaultLookAndFeelDecorated(false);
          Point p= Y.this.getLocation();
          display.setBounds(p.x, p.y, 110, 60);
          display.setVisible(true);
        }
    
        public void mouseExited(MouseEvent e) {
          if (display!=null) display.dispose();
        }
      }
    
    }

    weird - I just added a textField.requestFocus after the setVisible (and was half amazed that it worked without invoking :-)

    CU
    Jeanette

    Here is the snippet of code, just in case I forgot something (the rest of the code is unchanged except for adding the textfield as a member):

          public void mouseEntered(MouseEvent e) {
              JDialog.setDefaultLookAndFeelDecorated(true);
              UIManager.put("inactiveCaption",
    //                  Color.RED);
                      new javax.swing.plaf.ColorUIResource(Color.RED));
              LOG.info("" + UIManager.get("inactiveCaption"));
            display= new JDialog(UndecoratedDialog.this, "Title");
    //        display.setUndecorated(true);
    //        display.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG);
            JDialog.setDefaultLookAndFeelDecorated(false);
            Point p= UndecoratedDialog.this.getLocation();
            display.setBounds(p.x, p.y, 110, 60);
            display.setVisible(true);
            tf.requestFocus();
    
          }
    

    Published by: Kleopatra November 4, 2010 16:31
    the tags damned... How are we supposed to remember...

    Published by: Kleopatra November 4, 2010 16:33

  • Interactions between get and JTextPane

    I have trouble getting the text in a JTextPane to wrap correctly when they are inside (a-deletion) a get. More specifically, I have:
              JFrame frame = new JFrame();
              JPanel mainPanel = new JPanel();
              mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
              JPanel innerPanel = new JPanel();
              innerPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory
                        .createTitledBorder("Border text"), BorderFactory
                        .createEmptyBorder(5, 5, 5, 5)));
              innerPanel.setAlignmentX(JComponent.LEFT_ALIGNMENT);
              innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
              JTextPane entryPane = new JTextPane();
              entryPane.setAlignmentX(JTextPane.LEFT_ALIGNMENT);
              entryPane.setEditable(false);
              entryPane.setContentType("text/html");
              entryPane
                        .setText("text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text");
              innerPanel.add(entryPane);
    
              mainPanel.add(innerPanel);
    
              innerPanel = new JPanel();
              innerPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory
                        .createTitledBorder("Border text"), BorderFactory
                        .createEmptyBorder(5, 5, 5, 5)));
              innerPanel.setAlignmentX(JComponent.LEFT_ALIGNMENT);
              innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
              entryPane = new JTextPane();
              entryPane.setAlignmentX(JTextPane.LEFT_ALIGNMENT);
              entryPane.setEditable(false);
              entryPane.setContentType("text/html");
              entryPane
                        .setText("text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text");
              innerPanel.add(entryPane);
    
              mainPanel.add(innerPanel);
    
              // This works
              frame.getContentPane().add(mainPanel);
    
              // This doesn't
              /*JScrollPane mainScroller = new JScrollPane(mainPanel);
              mainScroller
                        .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
              frame.getContentPane().add(mainScroller);
              */
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              // Display the window.
              frame.pack();
              frame.setVisible(true);
     
    With the get out of the game, everything works as I want, but I have many more entries to display and when I activate theJScrollPane, skin stops working. Curiously, if I put the JTextPane directly inside a get, work clothing, but it is not feasible for me, since scrolling must happen at a higher level.

    Published by: user10480804 on October 14, 2010 20:16

    The suggestion jduprez you should be able to use the [url http://tips4java.wordpress.com/2009/12/20/scrollable-panel/] scroll pane.

  • Title bar of JFrame is not the display of Arabic and Hebrew characters in Ubuntu 8.04

    Hi all
    While internationalizing my request in Arabic and Hebrew, I had a problem in these language characters display in the title bar of JFrame. These characters are not displayed in the title bar. I have the application around 30 + languages of internationalization, but the problem occurs only with these two languages very precisely on the Ubuntu OS only. I'm able to display these characters of the language on the buttons and labels throughout the application, but cannot be displayed on the title bar. I don't know where is the problem.

    Please suggest me in this regard.

    Here is the code example
    import javax.swing.JFrame;
    
    
    public class LanguageTitleBar {
    
         public static void main(String[] args) {
              JFrame jf = new JFrame();
              jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              //jf.setTitle("\u0633\u0627\u0639\u0629 \u0627\u0644\u062a\u0648\u0642\u0641");//Arabic Text
              jf.setTitle("\u05e9\u05e2\u05d5\u05df \u05e2\u05e6\u05e8");//Hebrew Text
              jf.setSize(200,200);
              jf.setVisible(true);
         }
    }
    Thank you
    Uday.

    Would it be something simple? I think that maybe the default font in Ubuntu 8.04 may have the Hebrew or Arabic characters.

    If this is it, the fix would be to install the Unicode font more complete a Ubuntu later and have your application to use. Another challenge would be to convince your three users of Ubuntu 8.04 to upgrade. ;)

    -Rich

    Published by: RichF on November 26, 2010 22:49
    do not take into account. I just re-read your first post, and only the title bar does not display the characters. The only special thing about labels and vs of title bar buttons, is that the title bar is owned by the external GUI, Java not directly. Java has an interface with the GUI to set, title bar text that apparently needs some kind of special treatment for Arabic and Hebrew characters.

  • Submenus Spry menu bar displaying under other tags Div

    I created a menu bar that works great except the submenus to display under all other elements on the page.  It can be consulted at http://bakerlake50k.com/drafts.  You will notice from the source code that I added "overflow: visible;" everywhere for the style css without result.  I don't know what else to do

    Help!

    Jeannette

    You're probably working on your site so that I can not solve the problem.

    I know that if you detach the CSSLayouts.css of your document, as in

    http://bakerlake50k.com/includes/CSSLayouts/CSSLayouts.CSS"rel ="stylesheet"type =" text/css"/ >

    bar bar menus work.

    GRAMPS

  • Submenus are moving to the top of the screen in IE8? All other browsers display correctly

    First of all, I am new to the design of websites and Dreamweaver, but a quick learner. So - please assume that I know very little.

    I use a mac and created a horizontal nav bar using the widget spry (DMCS3; Spry 1.6.1). Everything is ok, except for the submenus in my navigation bar. I confirmed it seems correct (for PC) in Chrome and Firefox and (for mac), Safari and Firefox. But in Internet Explorer 8, the submenus are moving all the way to the top of the screen. The only way I could solve this problem, is that if I type 132 px for the 'top', 'margin' in the category 'box' in my ul. MenuBarHorizontal of ul rule. However, by doing this it makes all other browsers display incorrectly (the submenu is down to the bottom of the page).

    I've seen where people have been to "conditional comments" in their CSS file, for IE... and if what I have to do, that what I write and where I need to put in order all IE8 users to conform to the margin of the top 132 px, while other users are in line with the original upper margin of 2 px.

    Finally, a few people have noted that the submenu buttons "stick" (loading/disappear slowly) as they scroll buttons, is there a way for me to fix this?

    Here is the link to the site, and my CSS file is attached - thank you in advance:

    http://www.newarkfop.com/test/home.html

    P.S. Attaches would be great, but Im also interested to know why IE same did it than its weight?

    TryI have a forms 10G application that shows main menu items but used submenu items are displayed. The application works correctly on Linux (OAS 10.1.2.0.1) and a Windows (OAS 10.1.2.3) testserver.

    After you have placed and compilation (without error) of the application on a server from clients, the main screen appears with the items of the main menu. However, by clicking on the menu items will not open submenus. The only menu item that works is the output option that is not of type 'menu' of the order, but the order type "PL/SQL".

    The menu use security property is set to no.

    Everyone knows this behavior? What's not?

    you have 2 monitors?
    I have this behavior when the form runs on one screen other than the main screen.

  • How to add events from time to display a jframe component after another sequetial?

    I want to create the Visual expression of merge sort of explain it.

    So what I want is first in the initial of the number textbox. And the later next State with a certain delay in the order.

    Can someone tell me how to do.
    I tried to create the Thread as:

    PrimeThread p = new PrimeThread();
    p.Start ();
    jTextField1.setVisible (false);
    jTextField2.setVisible (false);
    p.Sleep (1000);
    jTextField1.setVisible (true);
    p.Sleep (2000);
    jTextField2.setVisible (true);

    but it does not work. Each of them appearing at the same time! I want them displayed with some delay, one after the other...

    828752 wrote:
    I want to create the Visual expression of merge sort of explain it.

    So what I want is first in the initial of the number textbox. And the later next State with a certain delay in the order.

    Can someone tell me how to do.
    I tried to create the Thread as:

    PrimeThread p = new PrimeThread();
    p.Start ();
    jTextField1.setVisible (false);
    jTextField2.setVisible (false);
    p.Sleep (1000);
    jTextField1.setVisible (true);
    p.Sleep (2000);
    jTextField2.setVisible (true);

    but it does not work. Each of them appearing at the same time! I want them displayed with some delay, one after the other...

    Wrong forum. This seems to be Java - rather focus on the APEX.

  • One of the submenus is displayed

    Hello

    This menu has been designed using CSS.

    http://www.thebeautyroomashby.co.UK/CSS3.html

    If you see the tab treatment, facials is supposed to get another menu that comes out of this... like the body care (which is me)... anyone have any suggestions as to why this facial treatments do not work?

    The css...

    @charset "utf-8"; #nav, #nav ul {padding: 0; list-style-type: none; list-style-position: outside; position: relative; line-height: 1.5em; width: 750px; margin-top: 15; margin-right: 0; margin-bottom: 15; margin-left: 0;} Z - index: auto; } #nav a: link, #nav a: active, #nav a: visited {display: block;}     padding: 0px 5px;     border: 1px solid #333;     Color: #000000;     text-decoration: none;     background-color: #CCC; z index: inherit; } #nav a: hover {background-color: #999; color: #000000; z-index: inherit ;} #nav li {float: left; position: relative; width: 107px; background-color: #CCC; z-index: inherit ;} #nav ul {position: absolute;}}}     Width: 12em;     top: 1.5em;     display: none; z index: inherit; } ul li #nav {width: 12em;}     float: left; z index: inherit; } #nav ul ul {top: auto; z-index: inherit ;} #nav li ul ul {left: 12em;}}     margin: 0px 0 0 10px; z index: inherit;      } #nav li: hover ul ul, #nav li: hover ul, #nav li: hover ul ul ul ul ul ul {display: none;}     } #nav li: hover ul, #nav li li: hover ul, #nav li li li: hover ul, #nav li li li li: hover ul {display: block;}     }

    Thank you in advance for pointers.

    For the moment, you have a closing tag in the wrong position in your code. Instead of

  • Face care
  • It must be placed after the closing tag (see below)

  • Face care

  • In addition, you are missing the closing for the care of the body tag. It should be inserted after the closing tag (see below)

  • Body care

  • The display of the toolbars submenus?

    Hello! Very new to Illustrator and so please excuseamatuer question.

    For example, if I click on the pen tool, I don't have the box with "Add anchor point", "remove anchor", "convert anchor point."


    Thanks for any help in advance!

    Click and HOLD the tool.

    When it appears, you can then move your mouse over the tool you want or go to the small arrow to the right of the pop-up window and additional tools will come out to their own Panel.

Maybe you are looking for

  • BIOS locked on a Satellite C855-2GV - grayed out options

    Hello having trouble with my laptop.The partition of my drive is lost (not so bad, I can fix it I guess), but the main problem is that my Bios is really stuck. I can not change anything in it. Everything is grey, I can't make changes to it but the da

  • COMPUTER LAPTOP WON'T PLAY MY MUSIC

    Hi, whenever I try to play music through my laptop it wil not play, I get a few seconds then take the following message: Windows media player has stopped playing. am not very good looking for failure, so don't know if its something I did or if it's a

  • Problem when using SOAP requests with HTTP POST function

    Hello! Using the vi of HTTP POST to send SOAP requests to a device, I encountered a problem. Take care of the HTTP header for you HTTP POST vi and defines the type of 'content' as "Content-Type: application/x-www-formulaires-urlencoded. Who is consid

  • USB does not work with flash or usb HD drives

    Lenovo T60 with XP Pro. USB flash drive appears in my computer, but must be formatted. If I click on the message in the format software generats the reader would noy be formatted. In properties-> volume are not met. If I click on fill to field will f

  • update the video card driver

    try to play DVDs on windows media player and will not play.  Is MSG says error video card driver update, a download available for this?