Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2004

Tip: Looking for answers? Try searching our database.

JMenu disappears after dismissing JOptionPane

Thread view: 
VisionSet - 29 May 2004 00:12 GMT
I have a JMenu, the top JMenuItem of this JMenu fires a JOptionPane.
After dismissing the JOptionPane and returning to the JMenu:

I click on the JMenu to activate it.
The Menu pops up as normal.
But when I hover over the menu it disappears instantly.
Reactivating it by hovering back over the JMenu returns the operation to
normal.

Only firing the JOptionPane causes this behaviour.

Any clues?

Something to do with the disposal and modal state of the JOptionPane?

Signature

Mike W

VisionSet - 29 May 2004 14:12 GMT
> I have a JMenu, the top JMenuItem of this JMenu fires a JOptionPane.
> After dismissing the JOptionPane and returning to the JMenu:
[quoted text clipped - 10 lines]
>
> Something to do with the disposal and modal state of the JOptionPane?

This demonstrates the problem:

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

public class Test extends JFrame {

public Test() {
 setDefaultCloseOperation(EXIT_ON_CLOSE);
 JMenuBar menuBar = new JMenuBar();
 JMenu menu;
 JMenuItem item;
 menu = new JMenu("Menu");
 menuBar.add(menu);
 item = new JMenuItem("Fire JOptionPane");
 item.addActionListener(new ActionListener() {
  public void actionPerformed(ActionEvent e) {
   JOptionPane.showConfirmDialog(null, "Dispose of this and try menu
again",
   "Test", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
  }
 });
 menu.add(item);
 setJMenuBar(menuBar);
 setSize(100,100);
 setVisible(true);
}

public static void main(String[] args) {
 new Test();
}

}
Andrew Thompson - 29 May 2004 16:33 GMT
>> But when I hover over the menu it disappears instantly.

The code you provided does not display that
behaviour using 1.2.2 under XP, but does
using 1.4.2

[ ..and no, I do not have any deep (or
meaningful) thoughts on a solution, just
thought I would mention some results. ]

Signature

Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology

iamfractal@hotmail.com - 31 May 2004 23:11 GMT
> I have a JMenu, the top JMenuItem of this JMenu fires a JOptionPane.
> After dismissing the JOptionPane and returning to the JMenu:
[quoted text clipped - 10 lines]
>
> Something to do with the disposal and modal state of the JOptionPane?

I've just encountered the exact same problem myself (and CRAP, I
posted it to the wrong group - that'll get some howls).

I'm at a loss.

.ed

www.EdmundKirwan.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.