Custimizing an AWT DIalog

I have a javax.swing/JFileChooser dialog which I have extended so that there is a checkbox at the bottom to allow you to say if you want to load subdirectorys once a directory has been selected.
On OSX it is recommended you use the native awt.Dialog instead of the Swing Dialogs i cant work out if I can cutomize the AWT Dialogs or not.

I don't know why it would say that. AWT Dialog and Swing Dialogs have no particular difference, except that JDialog is a root pane container and thus has the whole content pane thing in it. But JDialog is an AWT Dialog by extension.

Similar Messages

  • Java.awt.Dialog in Java 1.6 has a memory leak

    When a modal Dialog opens a modal sub-dialog, the Dialog stays in memory after both the sub-dialog and the Dialog itself is disposed.
    The field that contains the leaked object is Dialog.modalDialogs (static). The methods which causes the leak are Dialog.modalHide and Dialog.modalShow.
    Whenever a modal Dialog is opened, Dialog.modalShow is called, and adds itself to Dialog.modalDialogs.
    When it closes, Dialog.modalHide is called and removes one copy of itself from Dialog.modalDialogs. Then Dialog.modalShow is called on all previously blocked modal dialogs. When the sub-dialog is opened and closed, Dialog.modalDialogs contains two references to the main Dialog, and only one of them is removed when Dialog.modalHide for that Dialog is called.
    To detect the leak, just put a break point in Dialog.modalHide, after modalDialogs.remove(this);. When opening a Dialog and closing it without opening a sub-dialog, the Dialog.modalDialogs field should be empty. When a sub-dialog was opened and closed before the main Dialog is closed, the Dialog.modalDialogs field contains a reference to the disposed main Dialog.
    This leak does not exist in 1.5.0_10 (no Dialog.modalDialogs field). I have searched the bug database, but I have not found this bug there. Could anyone confirm this?
    A simple code to reproduce the leak:
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.WindowEvent;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    public class Test {
       public static void main(String[] args) {
          final JFrame frame = new JFrame() {
             protected void processWindowEvent(WindowEvent e) {
                super.processWindowEvent(e);
                if (e.getID() == WindowEvent.WINDOW_CLOSING) {
                   System.exit(0);
          JButton button = new JButton("Dialog");
          button.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent aE) {
                JButton subButton = new JButton("SubDialog");
                subButton.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent aE) {
                      JOptionPane.showMessageDialog(frame, "SubDialog");
                JOptionPane.showMessageDialog(frame, subButton);
          frame.getContentPane().add(button);
          frame.pack();
          // Center the window
          Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
          Dimension frameSize = frame.getSize();
          if (frameSize.height > screenSize.height) {
             frameSize.height = screenSize.height;
          if (frameSize.width > screenSize.width) {
             frameSize.width = screenSize.width;
          frame.setLocation((screenSize.width - frameSize.width) / 2,
                (screenSize.height - frameSize.height) / 2);
          frame.setVisible(true);
    }

    Sorry, I just found the bug in the bugdatabase (with google of course,):
    [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6497929]

  • Awt-dialog starts transparent

    hi,
    i am very confused due to the fact, that the dialogs in my small program have transparent backgrunds around a label.
    these area stays transparent till the mouse is scrolling over the dialog.
    maybe OS-problems ?
    regards
    djoxo

    wow !
    i tried to reproduce the problem in a small testformat, but the GUI opened correctly. hours later i noticed, that my java.awt GUI gots a transparent background, when i start it with javaw. a start with java displays all elements really proper, but javaw makes problems.
    i started with: c:\myJavaPath\javaw.exe "myPackage.myClass"
    any ideas ?

  • Strange nop(?) code in java.awt.Dialog

    Can anyone give some explanation for the following code?
    private void hideAndDisposeHandler() {
        if (keepBlocking) {
            synchronized (getTreeLock()) {
                keepBlocking = false;
                EventQueue.invokeLater(new Runnable(){ public void run() {} });
                //what was that for???
                getTreeLock().notifyAll();
    } It seems some strange hacks are going on out there.
    Thanks,
    Dimitris

    It's also possible that the Runnable is a fence that
    prevents AWTEvents from being coalesced into one
    another from opposite sides. Was this from src.zip, or
    did you decompile the class file? Is the comment
    theirs, or yours? I would have expected to see a
    comment about it in their code.I looked at the java src from the src.zip. You can also get the real java src with the C code to build your own JRE, but it's the same as the code they include with the JDK.
    This comment is mine as they don't provide it (though they should, what they are doing is not obvious). It's just a guess, but from the code I'd say that it' the goal. The invokeLater function causes a chain reaction that causes all currently pending events to be executed. Normally, you would call this from another thread, and it would be executed non-sync with your current thread. If you execute it from the event queue thread then it seems that all events are flushed and then your functionality is run.
    The event queue system has it's good and bad points, it's easy to start coding, but you really can't do a lot of custom processing of events. Modal dialogs are one thing that they had to do a strange hack to get to work correctly. Even then, they don't always work correctly. Multiple modal dialogs tend to mess up.

  • Dialogs and JDK1.6.0_10

    Hm. I have seen this like four times now; a user opens a dialog in any form (JDialog or glasspane) on top of a JFrame, the EDT is blocked and a new event pump is installed to continue painting, as things should be. However the dialog is not drawn and the frame freezes since you cannot close the dialog. Has anyone else had such an experience?
    Naturally this happens very rarely, like once or twice a week (with an average of 25 active users at any time). But if it happens and I pull the stack trace, I do not see anything wrong. AFAIK from the trace, the dialog should have been visible... A stack trace is below:
    Full thread dump Java HotSpot(TM) Client VM (11.0-b15 mixed mode):
    "Foxtrot Multi Worker Thread Runner #1" daemon prio=6 tid=0x4d410400 nid=0x6d8 in Object.wait() [0x4edbf000..0x4edbfb14]
       java.lang.Thread.State: WAITING (on object monitor)
            at java.lang.Object.wait(Native Method)
            at java.lang.Object.wait(Object.java:485)
            at foxtrot.workers.SingleWorkerThread.takeTask(SingleWorkerThread.java:132)
            - locked <0x07cbe9c8> (a foxtrot.workers.MultiWorkerThread)
            at foxtrot.workers.SingleWorkerThread.run(SingleWorkerThread.java:180)
            at java.lang.Thread.run(Unknown Source)
    "Thread-5 StateChecker" prio=6 tid=0x4d429400 nid=0x250 waiting on condition [0x4e35f000..0x4e35fd14]
       java.lang.Thread.State: TIMED_WAITING (sleeping)
            at java.lang.Thread.sleep(Native Method)
            at nl.reinders.Reinders.run(Reinders.java:2186)
            at java.lang.Thread.run(Unknown Source)
    "ESTOS Timeouter" prio=6 tid=0x4d432400 nid=0x7c waiting on condition [0x4e2bf000..0x4e2bfa94]
       java.lang.Thread.State: TIMED_WAITING (sleeping)
            at java.lang.Thread.sleep(Native Method)
            at org.tbee.util.ThreadUtil.sleepForced(ThreadUtil.java:244)
            at org.tbee.util.ThreadUtil.sleepForced(ThreadUtil.java:224)
            at nl.reinders.estos.EstosWrapper.timeouter(EstosWrapper.java:863)
            at nl.reinders.estos.EstosWrapper.access$100(EstosWrapper.java:47)
            at nl.reinders.estos.EstosWrapper$2.run(EstosWrapper.java:832)
            at java.lang.Thread.run(Unknown Source)
    "ESTOS Dispatcher" prio=6 tid=0x4d4a4800 nid=0x114 runnable [0x4e26f000..0x4e26fa14]
       java.lang.Thread.State: RUNNABLE
            at java.net.SocketInputStream.socketRead0(Native Method)
            at java.net.SocketInputStream.read(Unknown Source)
            at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)
            at sun.nio.cs.StreamDecoder.implRead(Unknown Source)
            at sun.nio.cs.StreamDecoder.read(Unknown Source)
            - locked <0x0742a760> (a java.io.InputStreamReader)
            at java.io.InputStreamReader.read(Unknown Source)
            at java.io.BufferedReader.fill(Unknown Source)
            at java.io.BufferedReader.readLine(Unknown Source)
            - locked <0x0742a760> (a java.io.InputStreamReader)
            at java.io.BufferedReader.readLine(Unknown Source)
            at nl.reinders.estos.EstosWrapper.dispatch(EstosWrapper.java:748)
            at nl.reinders.estos.EstosWrapper.access$000(EstosWrapper.java:47)
            at nl.reinders.estos.EstosWrapper$1.run(EstosWrapper.java:714)
            at java.lang.Thread.run(Unknown Source)
    "D3D Screen Updater" daemon prio=8 tid=0x4d32e000 nid=0xccc in Object.wait() [0x4dc4f000..0x4dc4fb14]
       java.lang.Thread.State: TIMED_WAITING (on object monitor)
            at java.lang.Object.wait(Native Method)
            at sun.java2d.d3d.D3DScreenUpdateManager.run(Unknown Source)
            - locked <0x068fbc18> (a java.lang.Object)
            at java.lang.Thread.run(Unknown Source)
    "TimerQueue" daemon prio=6 tid=0x4d31c400 nid=0xe00 in Object.wait() [0x4dbff000..0x4dbffb94]
       java.lang.Thread.State: WAITING (on object monitor)
            at java.lang.Object.wait(Native Method)
            at javax.swing.TimerQueue.run(Unknown Source)
            - locked <0x069f81d8> (a javax.swing.TimerQueue)
            at java.lang.Thread.run(Unknown Source)
    "AWT-EventQueue-1" prio=6 tid=0x4d23b800 nid=0xd64 in Object.wait() [0x4d69e000..0x4d69fd14]
       java.lang.Thread.State: WAITING (on object monitor)
            at java.lang.Object.wait(Native Method)
            at java.lang.Object.wait(Object.java:485)
            at java.awt.EventQueue.getNextEvent(Unknown Source)
            - locked <0x068b8a20> (a org.tbee.swing.EventQueue)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
            at java.awt.Dialog$1.run(Unknown Source)
            at java.awt.Dialog$3.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.awt.Dialog.show(Unknown Source)
            at java.awt.Component.show(Unknown Source)
            at java.awt.Component.setVisible(Unknown Source)
            at java.awt.Window.setVisible(Unknown Source)
            at java.awt.Dialog.setVisible(Unknown Source)
            at org.tbee.swing.jpa.JpaEntitySearchBuilder.searchDialog(JpaEntitySearchBuilder.java:1670)
            at org.tbee.swing.jpa.JpaEntitySearchBuilder.searchSingleDialog(JpaEntitySearchBuilder.java:1403)
            at org.tbee.swing.jpa.JpaObjectNavigatorBar$11.actionPerformed(JpaObjectNavigatorBar.java:239)
            at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
            at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
            at javax.swing.JToggleButton$ToggleButtonModel.setPressed(Unknown Source)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
            at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
            at java.awt.Component.processMouseEvent(Unknown Source)
            at javax.swing.JComponent.processMouseEvent(Unknown Source)
            at java.awt.Component.processEvent(Unknown Source)
            at java.awt.Container.processEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Window.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.EventQueue.dispatchEvent(Unknown Source)
            at org.tbee.swing.EventQueue.dispatchEvent(EventQueue.java:83)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)
    "DestroyJavaVM" prio=6 tid=0x002b6800 nid=0x718 waiting on condition [0x00000000..0x0090fd4c]
       java.lang.Thread.State: RUNNABLE
    "AWT-Windows" daemon prio=6 tid=0x38df4000 nid=0x814 runnable [0x390bf000..0x390bfa94]
       java.lang.Thread.State: RUNNABLE
            at sun.awt.windows.WToolkit.eventLoop(Native Method)
            at sun.awt.windows.WToolkit.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)
    "AWT-Shutdown" prio=6 tid=0x38df2800 nid=0x138 in Object.wait() [0x3906f000..0x3906fb94]
       java.lang.Thread.State: WAITING (on object monitor)
            at java.lang.Object.wait(Native Method)
            at java.lang.Object.wait(Object.java:485)
            at sun.awt.AWTAutoShutdown.run(Unknown Source)
            - locked <0x06893fa0> (a java.lang.Object)
            at java.lang.Thread.run(Unknown Source)
    "Java2D Disposer" daemon prio=10 tid=0x38df1800 nid=0xd6c in Object.wait() [0x3901f000..0x3901fb14]
       java.lang.Thread.State: WAITING (on object monitor)
            at java.lang.Object.wait(Native Method)
            at java.lang.ref.ReferenceQueue.remove(Unknown Source)
            - locked <0x068a4478> (a java.lang.ref.ReferenceQueue$Lock)
            at java.lang.ref.ReferenceQueue.remove(Unknown Source)
            at sun.java2d.Disposer.run(Unknown Source)
            at java.lang.Thread.run(Unknown Source)
    "Low Memory Detector" daemon prio=6 tid=0x38d81800 nid=0xac runnable [0x00000000..0x00000000]
       java.lang.Thread.State: RUNNABLE
    "CompilerThread0" daemon prio=10 tid=0x38d92000 nid=0xf34 waiting on condition [0x00000000..0x38eef9bc]
       java.lang.Thread.State: RUNNABLE
    "Attach Listener" daemon prio=10 tid=0x38a7d000 nid=0xd18 runnable [0x00000000..0x00000000]
       java.lang.Thread.State: RUNNABLE
    "Signal Dispatcher" daemon prio=10 tid=0x38a7bc00 nid=0xa60 waiting on condition [0x00000000..0x00000000]
       java.lang.Thread.State: RUNNABLE
    "Finalizer" daemon prio=8 tid=0x38a6c000 nid=0x98c in Object.wait() [0x38bdf000..0x38bdfa94]
       java.lang.Thread.State: WAITING (on object monitor)
            at java.lang.Object.wait(Native Method)
            at java.lang.ref.ReferenceQueue.remove(Unknown Source)
            - locked <0x065c2d40> (a java.lang.ref.ReferenceQueue$Lock)
            at java.lang.ref.ReferenceQueue.remove(Unknown Source)
            at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
    "Reference Handler" daemon prio=10 tid=0x38a67800 nid=0xac4 in Object.wait() [0x38b8f000..0x38b8fb14]
       java.lang.Thread.State: WAITING (on object monitor)
            at java.lang.Object.wait(Native Method)
            at java.lang.Object.wait(Object.java:485)
            at java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
            - locked <0x065c2dc8> (a java.lang.ref.Reference$Lock)
    "VM Thread" prio=10 tid=0x38a62800 nid=0x5fc runnable
    "VM Periodic Task Thread" prio=10 tid=0x38cd3800 nid=0x9dc waiting on condition
    JNI global references: 2883
    Heap
    def new generation   total 9600K, used 4976K [0x02aa0000, 0x03500000, 0x065b0000)
      eden space 8576K,  55% used [0x02aa0000, 0x02f3f720, 0x03300000)
      from space 1024K,  23% used [0x03400000, 0x0343c910, 0x03500000)
      to   space 1024K,   0% used [0x03300000, 0x03300000, 0x03400000)
    tenured generation   total 127084K, used 56180K [0x065b0000, 0x0e1cb000, 0x32aa0000)
       the space 127084K,  44% used [0x065b0000, 0x09c8d388, 0x09c8d400, 0x0e1cb000)
    compacting perm gen  total 36096K, used 35877K [0x32aa0000, 0x34de0000, 0x36aa0000)
       the space 36096K,  99% used [0x32aa0000, 0x34da9560, 0x34da9600, 0x34de0000)
    No shared spaces configured.Do note that the AWT-EventQueue-1 has installed a new event pump like it should for a new JDialog. The org.tbee.swing.EventQueue does nothing more than examining mouse click and uses that to install a popup menu on any swing component (copy, paste, etc). It has been used unchanged for two years now. The change would be the JRE.
    I've rolled back to 1.6.0_01, since that is what was used before and I'll monitor if the problem goes away.

    Hi,
    I've experienced something very similar to what you describe under JRE 1.6.0_10. I've rolled back to 1.6.0_03 and this appears to work thus far. When displaying a JDialog sometimes the dialog contents do not paint - the border is drawn but the contents of the dialog are not. JButtons present on the dialog work when clicked but are not drawn. Operation continues as normal when the dialog is closed and if the user closes the dialog and re-opens it then the problem does not repeat. The problem is very intermittent, occuring every couple days.
    We're using XP on Dell Optiplex PCs in case there is some link to the hardware here?
    I'd be very grateful if you would let me know if you manage to identify the cause of this problem. I will of course do the same. I'd really like to be able to ship my software with JRE 1.6.0_10 or later as these releases fix a long standing bug in the JFileChooser.
    Best regards

  • Help Needed with showMessageDialog in awt

    Yes! I'm back with another problem. I'm trying to use showMessageDialog for my about popup. But, all the examples I have looked at use with Swing. I did see in the tutorials that this could work in java.awt.dialog. But, that doesn't seem to be in the docs, though. Anyway, below is my attempt at inserting showMessageDialog in my code. I'm receiving 2 compile errors on the line of code. Can anyone tell me where I have gone wrong?
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    class ChatClient extends Frame
       private TextField tf1 = new TextField("", 50);
        private TextArea ta;
        private Button sendButton;
        private Button quitButton;
        private Button okButton;
        private MenuItem exitMT, aboutMT;
        private Choice choice;
        private String user;
       public ChatClient()
           super("ChatClient");
          addWindowListener(new WindowAdapter()
          {public void windowClosing(WindowEvent e) {System.exit(0); }});
            addWindowListener(new WindowAdapter()
          {public void windowActivated(WindowEvent e)
                    tf1.requestFocusInWindow();
         setTitle("Chat Room");
          Panel p = new Panel(new BorderLayout());
          Panel p1 = new Panel(new BorderLayout());
          Panel p2 = new Panel(new GridLayout(3,1));
          MenuBar mb = new MenuBar ();
          setMenuBar (mb);
          Menu fileMenu = new Menu ("File");
         mb.add(fileMenu);
        Menu helpMenu = new Menu ("Help");
          mb.add(helpMenu);
          fileMenu.add (exitMT= new MenuItem ("Quit"));
         helpMenu.add (aboutMT = new MenuItem ("About"));
         exitMT.addActionListener(new ExitCommand());
          aboutMT.addActionListener(new AboutCommand());
       //creating main panel
       add(p, BorderLayout.NORTH);
          ta = new TextArea(10, 50);
          add(ta, BorderLayout.CENTER);
          ta.setSize(500,300);
          ta.setEditable(false);
        //adding buttons  and choice box to the right side of the window
          sendButton = new Button("Send");
          Panel p3 = new Panel();
          sendButton.setSize(15,15);
          sendButton.setBackground(Color.green);
          p3.add(sendButton);
          p2.add(p3);
         sendButton.addActionListener(new CopyCommand());
        quitButton = new Button("Quit");
         Panel p4 = new Panel();
        quitButton.setSize(15,15);
         quitButton.setBackground(Color.red);
         p4.add(quitButton);
         p2.add(p4);
        quitButton.addActionListener(new ExitCommand());
         Panel p5 = new Panel();
        choice = new Choice();
        choice.addItem("John");
        choice.addItem("Jena");
        choice.addItem("Colleen");
        choice.addItem("Steve");
        user=choice.getItem(0);
        p5.add(choice);
        choice.addItemListener(new CopyCommand());
        p2.add(p5);
         add(p2, BorderLayout.EAST);
       //adding the textfield to the south end of the window
          p1.add(tf1);
          add(p1, BorderLayout.SOUTH);
          tf1.addActionListener(new CopyCommand());
    //handling ActionEvent from buttons and menu items
      class ExitCommand implements ActionListener
        public void actionPerformed (ActionEvent e)
                   tf1.setText("");
                  ta.setText("");
                  choice.select(0);
                  System.exit(0);
      class AboutCommand implements ActionListener
         public void actionPerformed (ActionEvent e)
             OptionPane.showMessageDialog(OptionDialogFrame.this, "ChatClient ver. 1.0 written by Jennifer McAuliffe", "About Screen");
             System.out.print("About menu was pressed!");
      class CopyCommand implements ActionListener, ItemListener
        public void itemStateChanged(ItemEvent e)
        {  if (e.getSource() instanceof Choice)
            user = (String)e.getItem();
        public void actionPerformed (ActionEvent e)
            ta.append(user + ": " + tf1.getText() + "\n");
              tf1.setText("");
                tf1.requestFocus();
         public void keyPressed (KeyEvent ke)
             //figure out if the enter key was pressed
             if (ke.getKeyCode() == KeyEvent.VK_ENTER)
         ta.append(user + ": " + tf1.getText() + "\n");
         tf1.setText("");
         tf1.requestFocus();
         public void keyTyped (KeyEvent ke) { }
         public void keyReleased (KeyEvent ke) { }
       public static void main(String[] args)
       {  Frame f = new ChatClient();
          f.setSize(600, 400);
          f.show();
    }

    they aren't really stupid questions, you need to rely on the api to know exactly what classes you are using and the methods available. here is a really crude example that might give you some ideas. it could use lots of improvements.
    import java.awt.*;
    import java.awt.event.*;
    class DialogExample extends Frame
         public static void main(String[] args)
              Frame f = new Frame();
              //f.setVisible(true);
              Dialog d = new Dialog(f,"About Screen", true);
              d.add(new Label("ChatClient ver. 1.0 written by Jennifer McAuliffe"));
              d.addWindowListener(new WindowAdapter(){
                   public void windowClosing(WindowEvent we) {
                           ((Dialog)(we.getSource())).setVisible(false);
              d.pack();
              d.setLocationRelativeTo(null);
              d.setVisible(true);
              d.dispose();
              System.exit(0);
    }

  • Saving parameters entered in a gui dialog to be used in the main panel

    Hi,
    I'm having a nightmare at the moment.
    I've finished creating a program for my final year project, that is all comand line at the moment.
    i'm required to design a GUI for this. i've started already and have a main panel that has a few buttons one of which is a setParameters button. which opens up a file dialog that allows the user to enter parameters that will be used by the main panel later on.
    I'm having trouble imagining how these parameters will be accessed by the main Panel once they are saved.
    At the moment, without the GUI i have get and set methods in my main program which works fine. Is this the kind of thing i'll be using for this?
    my code for the parameters dialog
    public class Parameters  extends JDialog
         private GridLayout grid1, grid2, grid3;
         JButton ok, cancel;
            public Parameters()
                    setTitle( "Parameters" );
                    setSize( 400,500 );
                    setDefaultCloseOperation( DISPOSE_ON_CLOSE );
              grid1 = new GridLayout(7,2);
              grid2 = new GridLayout(1,2);
                    JPanel topPanel = new JPanel();
                    topPanel.setLayout(grid1);
              JPanel buttonPanel = new JPanel();
                    buttonPanel.setLayout(grid2);
              ok = new JButton("OK");
                  ok.addActionListener(new ActionListener() {
                  public void actionPerformed(ActionEvent e) {
                  //when pressed i want to save the parameters that the user has entered
              //and be able to access these in the RunPanel class
              cancel = new JButton("Cancel");
                 cancel.addActionListener(new ActionListener() {
                          public void actionPerformed(ActionEvent e) {
                        //when pressed just want the Jdialog  to close
              buttonPanel.add(ok);
              buttonPanel.add(cancel);
              JTextArea affinityThresholdScalar = new JTextArea();
              JTextArea clonalRate = new JTextArea();
              JTextArea stimulationValue = new JTextArea();
              JTextArea totalResources = new JTextArea();
              JLabel aTSLabel = new JLabel("affinityThresholdScalar");
              JLabel cRLabel = new JLabel("clonalRate");
              topPanel.add(aTSLabel);
              topPanel.add(affinityThresholdScalar);
              topPanel.add(cRLabel);
              topPanel.add(clonalRate);
                    Container container = getContentPane();//.add( topPanel );
              container.add( topPanel, BorderLayout.CENTER );
              container.add( buttonPanel, BorderLayout.SOUTH );
         }the main panel class is:
    public class RunPanel extends JPanel implements ActionListener
         JButton openButton, setParametersButton, saveButton;
         static private final String newline = "\n";
         JTextArea log;
             JFileChooser fc;
         Data d = new Data();
         Normalise rf = new Normalise();
         Parameters param = new Parameters();
        public RunPanel()
            super(new BorderLayout());
            log = new JTextArea(5,20);
            log.setMargin(new Insets(5,5,5,5));
            log.setEditable(false);
            JScrollPane logScrollPane = new JScrollPane(log);
            fc = new JFileChooser();
            openButton = new JButton("Open a File...")
            openButton.addActionListener(this);
         setParametersButton = new JButton("Set User Parameters");
            setParametersButton.addActionListener(this);
         saveButton = new JButton("save");
            saveButton.addActionListener(this);
            JPanel buttonPanel = new JPanel(); //use FlowLayout
            buttonPanel.add(openButton);
         buttonPanel.add(setParametersButton);
         JPanel savePanel = new JPanel();
         savePanel.add(saveButton);
            add(buttonPanel, BorderLayout.PAGE_START);
            add(logScrollPane, BorderLayout.CENTER);
         add(savePanel, BorderLayout.SOUTH);
        public void actionPerformed(ActionEvent e) {
            if (e.getSource() == openButton) {
                int returnVal = fc.showOpenDialog(RunPanel.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    log.append("Opening: " + file.getName() + "." + newline);
              Vector data = d.readFile(file);
              log.append("Reading file into Vector " +data+ "." + newline);
              Vector dataNormalised = rf.normalise(data);
             else {
                    log.append("Open command cancelled by user." + newline);
                log.setCaretPosition(log.getDocument().getLength());
         else if (e.getSource() == saveButton) {
                int returnVal = fc.showSaveDialog(RunPanel.this);
                if (returnVal == JFileChooser.APPROVE_OPTION) {
                    File file = fc.getSelectedFile();
                    log.append("Saving: " + file.getName() + "." + newline);
                } else {
                    log.append("Save command cancelled by user." + newline);
                log.setCaretPosition(log.getDocument().getLength());
         else
              if (e.getSource() == setParametersButton)
                    log.append("loser." + newline);
                          param.show();
        private static void createAndShowGUI() {
            JFrame.setDefaultLookAndFeelDecorated(true);
            JDialog.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("AIRS");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JComponent newContentPane = new RunPanel();
            newContentPane.setOpaque(true);
            frame.setContentPane(newContentPane);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }Can anybody offer any suggestions?
    Cheers

    What you need is my ParamDialog. I think it could be perfect for this sort of thing. There are a few references in it to some of my other classes namely
    StandardDialog. Which you can find by searching for other posts on this forum. But if you'd rather not find that you could just use JDialog instead
    WindowUtils.visualize() this is just a helper method for getting things visualized on the screen. You can just use setBounds and setVisible and you'll be fine.
    You are welcome to use and modify this code but please don't change the package or take credit for it as your own work.
    If you need to bring up a filedialog or a color chooser you will need to make some modifications. If you do this, would you mind posting that when you are done so that myself and others can use it? :)
    StandardDialog.java
    ================
    package tjacobs.ui;
    import java.awt.Dialog;
    import java.awt.Frame;
    import java.awt.GraphicsConfiguration;
    import java.awt.HeadlessException;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JPasswordField;
    import javax.swing.JTextField;
    import java.awt.*;
    import java.util.HashMap;
    import java.util.Properties;
    /** Usage:
    * *      ParamDialog pd = new ParamDialog(new String[] {"A", "B", "C"});
    * pd.pack();
    * pd.setVisible(true);
    * Properties p = pd.getProperties();
    public class ParamDialog extends StandardDialog {
         public static final String SECRET = "(SECRET)";
         String[] fields;
         HashMap<String, JTextField> mValues = new HashMap<String, JTextField>();
         public ParamDialog(String[] fields) throws HeadlessException {
              this(null, fields);
         public ParamDialog(JFrame owner, String[] fields) {
              super(owner);
              setModal(true);
              this.fields = fields;
              JPanel main = new JPanel();
              main.setLayout(new GridLayout(fields.length, 1));
              for (int i = 0; i < fields.length; i++) {
                   JPanel con = new JPanel(new FlowLayout());
                   main.add(con);
                   JTextField tf;
                   if (fields.endsWith(SECRET)) {
                        con.add(new JLabel(fields[i].substring(0, fields[i].length() - SECRET.length())));
                        tf = new JPasswordField();
                   else {
                        con.add(new JLabel(fields[i]));
                        tf = new JTextField();
                   tf.setColumns(12);
                   con.add(tf);
                   mValues.put(fields[i], tf);
              this.setMainContent(main);
         public boolean showApplyButton() {
              return false;
         public void apply() {
         private boolean mCancel = false;
         public void cancel() {
              mCancel = true;
              super.cancel();
         public Properties getProperties() {
              if (mCancel) return null;
              Properties p = new Properties();
              for (int i = 0; i < fields.length; i++) {
                   p.put(fields[i], mValues.get(fields[i]).getText());
              return p;
         public static void main (String[] args) {
              ParamDialog pd = new ParamDialog(new String[] {"A", "B", "C"});
              WindowUtilities.visualize(pd);     
         public static Properties getProperties(String[] fields) {
              ParamDialog pd = new ParamDialog(fields);
              WindowUtilities.visualize(pd);
              return pd.getProperties();          

  • Problem in Displaying JOptionpane Message Dialog (JRE 1.5.0_04 or later)

    Hi! All,
    I am getting a deadlock kind a situation while displaying JOptionpane message dialog. It's very rare to simulate also. I am also posting the Thread dump which i have taken programmatically, when this situation arises.
    For your Information, I am using JRE 1.5.0_04 or later version on Windows XP.
    We searched on Java.sun.com site, & we got that two bugs are related to our problem, but there are arises in JRE 1.4.2 or before version & have been fixed at JRE 1.5 .
    Follwing are the bugs ID in Sun Bugs Database: 4978089, 4828019.
    Can anyone suggest me which is the stable JRE 1.5 version to avoid this problem. Also can anyone suggest me the workaround of this problem. I want to fix this in our application ASAP.
    following is My Thread Dump :
    Thread[Finalizer,8,system]
         java.lang.Object.wait(Native Method)
         java.lang.ref.ReferenceQueue.remove(Unknown Source)
         java.lang.ref.ReferenceQueue.remove(Unknown Source)
         java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
    Thread[Java2D Disposer,10,javawsApplicationThreadGroup]
         java.lang.Object.wait(Native Method)
         java.lang.ref.ReferenceQueue.remove(Unknown Source)
         java.lang.ref.ReferenceQueue.remove(Unknown Source)
         sun.java2d.Disposer.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[JCIL_Sess(813251)_EvtThd(24880015),5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         java.awt.EventQueue.invokeAndWait(Unknown Source)
         javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
         in.co.netsol.telecom.desktop.CallAppearanceTable$EventAdapter.OnCallEstablished(CallAppearanceTable.java:982)
         in.co.netsol.telecom.ctios.events.EventSinkAdapter.OnEvent(EventSinkAdapter.java:142)
         com.cisco.cti.ctios.cil.EventPublisher.PostEvent(EventPublisher.java:175)
         com.cisco.cti.ctios.cil.EventPublisher.FireEvent(EventPublisher.java:142)
         com.cisco.cti.ctios.cil.CtiOsSession.FireEvent(CtiOsSession.java:1849)
         com.cisco.cti.ctios.cil.Call.FireEvent(Call.java:254)
         com.cisco.cti.ctios.cil.Call.OnCallEstablishedEvent(Call.java:1136)
         com.cisco.cti.ctios.cil.Call.OnEvent(Call.java:943)
         com.cisco.cti.ctios.cil.CtiOsSession.OnEvent(CtiOsSession.java:2107)
         com.cisco.cti.ctios.cil.CilServiceEvent.ReceiverThread(CilServiceEvent.java:256)
         com.cisco.cti.ctios.cil.CilServiceEvent$1.run(CilServiceEvent.java:173)
    Thread[pool-1-thread-5,5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         java.awt.EventQueue.invokeAndWait(Unknown Source)
         javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
         in.co.netsol.telecom.desktop.command.MakeAgentReadyCommand$EventAdapter$1.run(MakeAgentReadyCommand.java:190)
         java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[DestroyJavaVM,5,main]
    Thread[AWT-Shutdown,5,javawsApplicationThreadGroup]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         sun.awt.AWTAutoShutdown.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[JCIL_Conn(18096534)_Watchdog,5,main]
         java.lang.Object.wait(Native Method)
         com.cisco.cti.ctios.util.UnNamedEvent.WaitForSingleObject(UnNamedEvent.java:147)
         com.cisco.cti.ctios.cil.CilConnection.WatchdogThread(CilConnection.java:527)
         com.cisco.cti.ctios.cil.CilConnection$1.run(CilConnection.java:1071)
    Thread[AWT-EventQueue-0,6,main]
         java.awt.Container.getComponents_NoClientCode(Unknown Source)
         java.awt.Container.getComponents(Unknown Source)
         javax.swing.JToolBar.getComponentAtIndex(Unknown Source)
         javax.swing.plaf.basic.BasicToolBarUI.navigateFocusedComp(Unknown Source)
         javax.swing.plaf.basic.BasicToolBarUI$Actions.actionPerformed(Unknown Source)
         javax.swing.SwingUtilities.notifyAction(Unknown Source)
         javax.swing.JComponent.processKeyBinding(Unknown Source)
         javax.swing.JComponent.processKeyBindings(Unknown Source)
         javax.swing.SwingUtilities.processKeyBindings(Unknown Source)
         javax.swing.UIManager$2.postProcessKeyEvent(Unknown Source)
         java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
         java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
         java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
         java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
         java.awt.Component.dispatchEventImpl(Unknown Source)
         java.awt.Container.dispatchEventImpl(Unknown Source)
         java.awt.Window.dispatchEventImpl(Unknown Source)
         java.awt.Component.dispatchEvent(Unknown Source)
         java.awt.EventQueue.dispatchEvent(Unknown Source)
         java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         java.awt.EventDispatchThread.run(Unknown Source)
    Thread[AWT-Windows,6,main]
         sun.awt.windows.WToolkit.eventLoop(Native Method)
         sun.awt.windows.WToolkit.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[Timer-0,5,javawsApplicationThreadGroup]
         java.lang.Thread.dumpThreads(Native Method)
         java.lang.Thread.getAllStackTraces(Unknown Source)
         in.co.netsol.telecom.log.ThreadDumpLoggingTask.getStackTraces(ThreadDumpLoggingTask.java:47)
         in.co.netsol.telecom.log.ThreadDumpLoggingTask.run(ThreadDumpLoggingTask.java:36)
         java.util.TimerThread.mainLoop(Unknown Source)
         java.util.TimerThread.run(Unknown Source)
    Thread[JCIL_Conn(18096534)_Rcvr,5,main]
         java.net.SocketInputStream.socketRead0(Native Method)
         java.net.SocketInputStream.read(Unknown Source)
         com.cisco.cti.ctios.cil.NetPort.ReceiveData(NetPort.java:405)
         com.cisco.cti.ctios.cil.NetPort.ReceiveData(NetPort.java:363)
         com.cisco.cti.ctios.cil.CilPacket.ReadFromPort(CilPacket.java:649)
         com.cisco.cti.ctios.cil.CilConnection.ReadPacket(CilConnection.java:670)
         com.cisco.cti.ctios.cil.Connection.ReceiverThread(Connection.java:398)
         com.cisco.cti.ctios.cil.Connection$1.run(Connection.java:472)
    Thread[pool-1-thread-2,5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         java.awt.EventQueue.invokeAndWait(Unknown Source)
         javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
         in.co.netsol.telecom.desktop.command.SupervisorAssistCommand$EventAdapter$1.run(SupervisorAssistCommand.java:152)
         java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[pool-1-thread-1,5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         java.awt.EventQueue.invokeAndWait(Unknown Source)
         javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
         in.co.netsol.telecom.desktop.command.ConferenceCallCommand$EventAdapter$1.run(ConferenceCallCommand.java:144)
         java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[JCIL_Svc(5450181)_TxQThd(3083604),5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         com.cisco.cti.ctios.util.QueueThread.GetQItem(QueueThread.java:152)
         com.cisco.cti.ctios.util.QueueThread.run(QueueThread.java:259)
    Thread[pool-2-thread-1,5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         java.awt.Dialog.show(Unknown Source)
         javax.swing.JOptionPane.showOptionDialog(Unknown Source)
         javax.swing.JOptionPane.showMessageDialog(Unknown Source)
         javax.swing.JOptionPane.showMessageDialog(Unknown Source)
         in.co.netsol.telecom.desktop.DesktopMainPanel$3.run(DesktopMainPanel.java:1871)
         java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[Signal Dispatcher,9,system]
    Thread[Reference Handler,10,system]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
    Thread[TimerQueue,5,javawsApplicationThreadGroup]
         java.lang.Object.wait(Native Method)
         javax.swing.TimerQueue.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[pool-1-thread-4,5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         java.awt.EventQueue.invokeAndWait(Unknown Source)
         javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
         in.co.netsol.telecom.desktop.command.MakeAgentNotReadyCommand$EventAdapter$1.run(MakeAgentNotReadyCommand.java:146)
         java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[pool-1-thread-6,5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         java.awt.EventQueue.invokeAndWait(Unknown Source)
         javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
         in.co.netsol.telecom.desktop.command.TransferCallCommand$EventAdapter$1.run(TransferCallCommand.java:136)
         java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[traceMsgQueueThread,5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         com.sun.deploy.util.Trace$TraceMsgQueueChecker.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thread[pool-1-thread-3,5,main]
         java.lang.Object.wait(Native Method)
         java.lang.Object.wait(Unknown Source)
         java.awt.EventQueue.invokeAndWait(Unknown Source)
         javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
         in.co.netsol.telecom.desktop.command.EmergencyCommand$EventAdapter$1.run(EmergencyCommand.java:146)
         java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         java.lang.Thread.run(Unknown Source)
    Thanks & Regards,
    Pradeep Gupta

    Update to the latest version 1.5.0_06 available from:
    http://java.sun.com/j2se/1.5.0/download.jsp
    It is advisable to remove previous version(s) installations unless required otherwise for a specfic application.

  • Window Loses Focus After Modal Dialog is Dismissed

    hi,
    I need a JDialog to be opened when i click on a button in JFrame.and it should be modal so that user must not get control to its parent window and rest of the windows can be accessed.
    So, i tried setting property like setModalityType(Dialog.ModalityType.DOCUMENT_MODAL), but still unable to access all the windows not only its parent until the dialog gets closed.
    Another issue i was facing is when i close out the dialog i need to get the parent to Front of other windows in application. But in my case it was not happening.After closing the dialog, i am getting the last focussed window to front but not its parent. I tried calling getParent().toFront() in windowClosing() Listener of that dialog, But still not able to solve the problem.
    Hope someone understands my problems and give me solution.
    Hoping for quick response and thanks in advance.

    shrikanthhyd wrote:
    I need a JDialog to be opened when i click on a button in JFrame.and it should be modal so that user must not get control to its parent window and rest of the windows can be accessed.
    So, i tried setting property like setModalityType(Dialog.ModalityType.DOCUMENT_MODAL), but still unable to access all the windows not only its parent until the dialog gets closed.Perhaps you can fix this by calling the first dialog either without a parent or not as a JDialog but rather as a JFrame. Then the second dialog's modality will not impinge on the visibility of the original parent window. For instance:
    import java.awt.Dimension;
    import java.awt.Window;
    import java.awt.Dialog.ModalityType;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.SwingUtilities;
    class SwingFu2
        private JPanel mainPanel = new JPanel();
        public SwingFu2()
            mainPanel.setPreferredSize(new Dimension(400, 400));
            JButton showDlg1Btn = new JButton("Show Dialog 1");
            showDlg1Btn.addActionListener(new ActionListener()
                @Override
                public void actionPerformed(ActionEvent e)
                    showDlg1Action(e);
            mainPanel.add(showDlg1Btn);
        private void showDlg1Action(ActionEvent e)
            Window frame = SwingUtilities.getWindowAncestor((JButton)e.getSource());
            JPanel dlg1Panel = new JPanel();
            dlg1Panel.setPreferredSize(new Dimension(300, 300));
            JButton showDlg2Btn = new JButton("Show Dialog 2");
            showDlg2Btn.addActionListener(new ActionListener()
                @Override
                public void actionPerformed(ActionEvent e)
                    showDlg2Action(e);
            dlg1Panel.add(showDlg2Btn);
            //JDialog dialog1 = new JDialog(null, "Dialog 1", ModalityType.MODELESS); // either of these will work
            JFrame dialog1 = new JFrame("Dialog 1");  // either of these will work
            dialog1.getContentPane().add(dlg1Panel);
            dialog1.pack();
            dialog1.setLocationRelativeTo(null);
            dialog1.setVisible(true);
        private void showDlg2Action(ActionEvent e)
            Window window = SwingUtilities.getWindowAncestor((JButton)e.getSource());
            JPanel dlg2Panel = new JPanel();
            dlg2Panel.setPreferredSize(new Dimension(200, 200));
            JButton showDlg2Btn = new JButton("Show Dialog 2");
            showDlg2Btn.addActionListener(new ActionListener()
                @Override
                public void actionPerformed(ActionEvent e)
                    showDlg2Action(e);
            dlg2Panel.add(showDlg2Btn);
            JDialog dialog2 = new JDialog(window, "Dialog 2", ModalityType.DOCUMENT_MODAL);
            dialog2.getContentPane().add(dlg2Panel);
            dialog2.pack();
            dialog2.setLocationRelativeTo(null);
            dialog2.setVisible(true);
        public JPanel getMainPanel()
            return mainPanel;
        private static void createAndShowUI()
            JFrame frame = new JFrame("SwingFu2");
            frame.getContentPane().add(new SwingFu2().getMainPanel());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
        public static void main(String[] args)
            java.awt.EventQueue.invokeLater(new Runnable()
                public void run()
                    createAndShowUI();
    Another issue i was facing I don't know on this one. Good luck.

  • AMA Dialog throws Exception : java.lang.NoSuchMethodError

    Hi,
    I am trying to create my own Search Rules for the Application Migration Assistant v1.0, I am following the online tutorial. I am using JDev 10.1.2.0.0 ( Build 1811 ).
    If I try to specify the New Search Rules File, the dialog throws this error :-
    Exception occurred during event dispatching:
    java.lang.NoSuchMethodError: oracle.xml.parser.schema.XSDBuilder.build(Ljava/io/
    InputStream;Ljava/net/URL;)Ljava/lang/Object;
            at oracle.mtg.sqllocator.addin.analyzer.RulesValidator._buildXMLSchema(U
    nknown Source)
            at oracle.mtg.sqllocator.addin.analyzer.RulesValidator.validateXML(Unkno
    wn Source)
            at oracle.mtg.sqllocator.addin.project.ui.EditSearchRulesFilePanel._comm
    it(Unknown Source)
            at oracle.mtg.sqllocator.addin.project.ui.EditSearchRulesFilePanel.acces
    s$000(Unknown Source)
            at oracle.mtg.sqllocator.addin.project.ui.EditSearchRulesFilePanel$1.vet
    oableChange(Unknown Source)
            at java.beans.VetoableChangeSupport.fireVetoableChange(VetoableChangeSup
    port.java:300)
            at java.beans.VetoableChangeSupport.fireVetoableChange(VetoableChangeSup
    port.java:217)
            at oracle.bali.ewt.dialog.JEWTDialog.fireVetoableChange(Unknown Source)
            at oracle.bali.ewt.dialog.JEWTDialog.dismissDialog(Unknown Source)
            at oracle.bali.ewt.dialog.JEWTDialog$UIListener.actionPerformed(Unknown
    Source)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    86)
            at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1839)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:420)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:245)
            at java.awt.Component.processMouseEvent(Component.java:5100)
            at java.awt.Component.processEvent(Component.java:4897)
            at java.awt.Container.processEvent(Container.java:1569)
            at java.awt.Component.dispatchEventImpl(Component.java:3615)
            at java.awt.Container.dispatchEventImpl(Container.java:1627)
            at java.awt.Component.dispatchEvent(Component.java:3477)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
            at java.awt.Container.dispatchEventImpl(Container.java:1613)
            at java.awt.Window.dispatchEventImpl(Window.java:1606)
            at java.awt.Component.dispatchEvent(Component.java:3477)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:201)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:151)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:141)
            at java.awt.Dialog$1.run(Dialog.java:540)
            at java.awt.Dialog.show(Dialog.java:561)
            at java.awt.Component.show(Component.java:1133)
            at java.awt.Component.setVisible(Component.java:1088)
            at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
            at oracle.ide.dialogs.WizardLauncher.runDialog(WizardLauncher.java:55)
            at oracle.mtg.sqllocator.addin.project.ui.EditSearchRulesFilePanel._modi
    fySearchRulesFile(Unknown Source)
            at oracle.mtg.sqllocator.addin.project.ui.EditSearchRulesFilePanel.creat
    eCOMBean(Unknown Source)
            at oracle.mtg.sqllocator.addin.project.ui.SearchRulesListPanel._newCOMBe
    an(Unknown Source)
            at oracle.mtg.sqllocator.addin.project.ui.SearchRulesListPanel$UIObserve
    r.actionPerformed(Unknown Source)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    86)
            at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1839)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:420)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:245)
            at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:2
    31)
            at java.awt.Component.processMouseEvent(Component.java:5100)
            at java.awt.Component.processEvent(Component.java:4897)
            at java.awt.Container.processEvent(Container.java:1569)
            at java.awt.Component.dispatchEventImpl(Component.java:3615)
            at java.awt.Container.dispatchEventImpl(Container.java:1627)
            at java.awt.Component.dispatchEvent(Component.java:3477)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
            at java.awt.Container.dispatchEventImpl(Container.java:1613)
            at java.awt.Window.dispatchEventImpl(Window.java:1606)
            at java.awt.Component.dispatchEvent(Component.java:3477)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:201)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:151)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:141)
            at java.awt.Dialog$1.run(Dialog.java:540)
            at java.awt.Dialog.show(Dialog.java:561)
            at java.awt.Component.show(Component.java:1133)
            at java.awt.Component.setVisible(Component.java:1088)
            at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
            at oracle.ide.dialogs.WizardLauncher.runDialog(WizardLauncher.java:55)
            at oracle.ide.panels.TDialogLauncher.showDialog(TDialogLauncher.java:276
            at oracle.jdeveloper.model.JProjectSettingsPanel.showDialog(JProjectSett
    ingsPanel.java:185)
            at oracle.jdeveloper.model.JProjectSettingsPanel.showDialog(JProjectSett
    ingsPanel.java:110)
            at oracle.jdeveloper.model.JProjectSettingsPanel.showDialog(JProjectSett
    ingsPanel.java:101)
            at oracle.jdeveloper.model.JProjectStructureController.handleEvent(JProj
    ectStructureController.java:342)
            at oracle.ide.IdeAction.performAction(IdeAction.java:649)
            at oracle.ide.IdeAction$1.run(IdeAction.java:857)
            at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:201)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:151)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)I am not sure what other relevant information is necessary to debug this. I found the procedure really straightforward, but it's just this naggin error which is stopping me from completing my work.
    Can you please help me with this ?
    Regards,
    Sandeep

    Hi Donal,
    Thanks for your response. I found an archived version of JDeveloper v 9.0.4.1.1 ( Build 1436 ). However, AMA refuses to show up in this versiontoo.
    I even tried to add AMA as an "External Tool" , by trying to invoke the class oracle.mtg.sqllocator.addin.SQLLocatorExtension that is listed in jdev-ext.xml. I even tried with oracle.mtg.sqllocator.addin.sqlnav.SqlNavigatorAddin, but it still doesn't work.
    If I try to call one of the two classes directly, I get this error :-
    java.io.IOException: CreateProcess: D:\JDev9.0.4\jdev\lib\ext\ama.jar!\oracle\mtg\sqllocator\addin\SQLLocatorExtension.class error=3
            at java.lang.Win32Process.create(Native Method)
         at java.lang.Win32Process.<init>(Win32Process.java:66)
         at java.lang.Runtime.execInternal(Native Method)
         at java.lang.Runtime.exec(Runtime.java:566)
         at oracle.ide.runner.Starter.start(Starter.java:195)
         at oracle.ide.runner.RunProcess.startTarget(RunProcess.java:524)
         at oracle.ide.runner.RunProcess.start(RunProcess.java:477)
         at oracle.ide.runner.SimpleProcess.exec(SimpleProcess.java:203)
         at oracle.jdevimpl.toolmanager.Tool.invoke(Tool.java:355)
         at oracle.jdevimpl.toolmanager.ToolManager.handleEvent(ToolManager.java:581)
         at oracle.ide.IdeAction$1.run(IdeAction.java:634)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)We'll be soon engaged in a major effort to revamp a big Java Application & AMA will be of big help to us.
    Regards,
    Sandeep

  • NPE in Project Settings Dialog - jdev 9.0.3

    This error occured while browsing my project settings.
    java.lang.NullPointerException
    oracle.jdeveloper.model.JProject oracle.jdeveloper.ejb.EjbModuleContainer.getProjectFromEjbUrl(java.net.URL)EjbModuleContainer.java:1240
    oracle.jdeveloper.model.JProject oracle.jdeveloper.ejb.EjbContainer.getProject() EjbContainer.java:122
    oracle.jdeveloper.ejb.EjbModuleContainer oracle.jdeveloper.ejb.EjbContainer.getEjbModuleContainer()EjbContainer.java:138
    void oracle.jdeveloper.ejb.EjbContainer.gatherChildren() EjbContainer.java:377
    java.util.Iterator oracle.jdeveloper.ejb.EjbContainer.getChildren() EjbContainer.java:362
    oracle.jdeveloper.compiler.ant.BuildfileItem[] oracle.jdeveloper.compiler.ant.ProjectBuildfilePanel.getBuildfiles(oracle.jdeveloper.model.JProject) ProjectBuildfilePanel.java:242
    void oracle.jdeveloper.compiler.ant.ProjectBuildfilePanel.loadFrom(oracle.jdeveloper.compiler.ant.AntConfiguration, oracle.jdeveloper.model.JProject) ProjectBuildfilePanel.java:153
    void oracle.jdeveloper.compiler.ant.AntPanel.loadFrom(oracle.jdeveloper.compiler.ant.AntConfiguration, oracle.jdeveloper.model.JProject) AntPanel.java:112
    void oracle.jdeveloper.compiler.ant.AntPanel.onEntry(oracle.ide.panels.TraversableContext) AntPanel.java:92
    void oracle.ide.panels.MDDPanel.enterTraversableImpl(oracle.ide.panels.Traversable, oracle.ide.panels.TraversableContext) MDDPanel.java:649
    void oracle.ide.panels.MDDPanel.enterTraversable(oracle.ide.panels.Traversable)     MDDPanel.java:630
    void oracle.ide.panels.MDDPanel.access$7000571(oracle.ide.panels.MDDPanel, oracle.ide.panels.Traversable) MDDPanel.java:86
    void oracle.ide.panels.MDDPanel$Tsl.updateSelectedNavigable(javax.swing.JTree, javax.swing.tree.TreePath) MDDPanel.java:933
    void oracle.ide.panels.MDDPanel$Tsl.actionPerformed(java.awt.event.ActionEvent)     MDDPanel.java:803
    void javax.swing.Timer.fireActionPerformed(java.awt.event.ActionEvent)     Timer.java:150
    void javax.swing.Timer$DoPostEvent.run() Timer.java:108
    void java.awt.event.InvocationEvent.dispatch()     InvocationEvent.java:154
    void java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent) EventQueue.java:337
    boolean java.awt.EventDispatchThread.pumpOneEventForHierarchy(java.awt.Component) EventDispatchThread.java:131
    void java.awt.EventDispatchThread.pumpEventsForHierarchy(java.awt.Conditional, java.awt.Component)EventDispatchThread.java:98
    void java.awt.Dialog.show()Dialog.java:380
    void java.awt.Component.show(boolean)Component.java:946
    void java.awt.Component.setVisible(boolean)Component.java:903
    boolean oracle.bali.ewt.dialog.JEWTDialog.runDialog()
    boolean oracle.ide.dialogs.WizardLauncher.runDialog(javax.swing.JDialog)WizardLauncher.java:55
    boolean oracle.ide.panels.TDialogLauncher.showDialog()TDialogLauncher.java:190
    void oracle.jdeveloper.model.JProjectSettingsPanel.showDialog(java.awt.Frame, oracle.jdeveloper.model.JProject, boolean, java.lang.String, java.lang.String[])JProjectSettingsPanel.java:165
    void oracle.jdeveloper.model.JProjectSettingsPanel.showDialog(java.awt.Frame, oracle.jdeveloper.model.JProject)JProjectSettingsPanel.java:99
    void oracle.jdeveloper.model.JProjectSettingsPanel.showDialog(oracle.jdeveloper.model.JProject)JProjectSettingsPanel.java:90
    boolean oracle.jdeveloper.model.JProjectStructureController.handleEvent(oracle.ide.IdeAction, oracle.ide.addin.Context)JProjectStructureController.java:275
    void oracle.ide.IdeAction$1.run()IdeAction.java:579
    void java.awt.event.InvocationEvent.dispatch()InvocationEvent.java:154
    void java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent)EventQueue.java:337
    boolean java.awt.EventDispatchThread.pumpOneEventForHierarchy(java.awt.Component)EventDispatchThread.java:131
    void java.awt.EventDispatchThread.pumpEventsForHierarchy(java.awt.Conditional, java.awt.Component)EventDispatchThread.java:98
    void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional)EventDispatchThread.java:93
    void java.awt.EventDispatchThread.run()     EventDispatchThread.java:85

    Thanks, this should be harmless (just annoying). We'll get this fixed in our upcomming release.
    Rob

  • Dialog.show () does not return

    the documentation for java.awt.Dialog.show () says "If the dialog is modal and is not already visible, this call will not return until the dialog is hidden by calling hide or dispose.", but I was wondering why it does that and if theres any way to get around it...
    I want to have a Frame with a modal Dialog, show the Frame only, then when a button is pressed in the Frame show the Dialog, call some methods, put a message in the Dialog to say that it's finished, then have the user close the Dialog to ensure they saw the message. When the button is pressed, though, my program calls Dialog.show () and gets stuck there.
    ...I don't want to make it non-modal and I don't just want to show the Dialog after I've called all the methods - it should be showing the whole time.
    Any suggestions?
    Thanks, John

    import java.awt.*;
    import java.awt.event.*;
    public class DialogTest
        Dialog dialog;
        Label label;
        public DialogTest()
            Frame f = new Frame();
            initDialog(f);
            f.addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    System.exit(0);
            f.add(getPanel(), "North");
            f.setSize(300,200);
            f.setLocation(200,200);
            f.setVisible(true);
        private void initDialog(Frame f)
            label = new Label("dialog label", Label.CENTER);
            dialog = new Dialog(f, "modal", true);
            dialog.addWindowListener(new WindowAdapter()
                public void windowClosing(WindowEvent e)
                    dialog.dispose();
            dialog.add(label);
            dialog.setSize(200,100);
            dialog.setLocationRelativeTo(f);
        private void showDialog()
            new Thread(new Runnable()
                public void run()
                    dialog.setVisible(true);
            }).start();
            label.setText("after call to setVisible");
        private Panel getPanel()
            Button launch = new Button("launch dialog");
            launch.addActionListener(new ActionListener()
                public void actionPerformed(ActionEvent e)
                    showDialog();
                    System.out.println("after call to showDialog");
            Panel panel = new Panel();
            panel.add(launch);
            return panel;
        public static void main(String[] args)
            new DialogTest();
    }

  • BUG Remote Debug Dialog Problem

    When I Try open Remote Open Dialog:
    Project Properties -> Run/Debug -> Edit(Default) -> Tools Settings/Debugger/Remote
    I get this Exception:
    java.lang.NoClassDefFoundError
         at oracle.jdevimpl.runner.debug.RemoteDebugSettingsPanel$Protocol.<init>(RemoteDebugSettingsPanel.java:205)
         at oracle.jdevimpl.runner.debug.RemoteDebugSettingsPanel.<init>(RemoteDebugSettingsPanel.java:57)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at oracle.ide.panels.MetaTraversable.newTraversable(MetaTraversable.java:315)
         at oracle.ide.panels.MetaTraversable.newTraversable(MetaTraversable.java:219)
         at oracle.ide.panels.MDDPanel.getTraversable(MDDPanel.java:1061)
         at oracle.ide.panels.MDDPanel.mav$getTraversable(MDDPanel.java)
         at oracle.ide.panels.MDDPanel$Tsl.updateSelectedNavigable(MDDPanel.java:1308)
         at oracle.ide.panels.MDDPanel$Tsl.updateSelection(MDDPanel.java:1216)
         at oracle.ide.panels.MDDPanel$Tsl.actionPerformed(MDDPanel.java:1210)
         at javax.swing.Timer.fireActionPerformed(Timer.java:271)
         at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:515)
         at java.awt.Dialog.show(Dialog.java:536)
         at java.awt.Component.show(Component.java:1300)
         at java.awt.Component.setVisible(Component.java:1253)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ide.dialogs.WizardLauncher.runDialog(WizardLauncher.java:55)
         at oracle.ide.panels.TDialogLauncher.showDialog(TDialogLauncher.java:276)
         at oracle.jdevimpl.runner.RunConfigurationEditor.showDialog(RunConfigurationEditor.java:58)
         at oracle.jdevimpl.runner.RunConfigurationsPanel.editRunConfiguration(RunConfigurationsPanel.java:340)
         at oracle.jdevimpl.runner.RunConfigurationsPanel.editRunConfiguration(RunConfigurationsPanel.java:322)
         at oracle.jdevimpl.runner.RunConfigurationsPanel.actionPerformed(RunConfigurationsPanel.java:212)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
         at java.awt.Component.processMouseEvent(Component.java:5488)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:153)
         at java.awt.Dialog$1.run(Dialog.java:515)
         at java.awt.Dialog.show(Dialog.java:536)
         at java.awt.Component.show(Component.java:1300)
         at java.awt.Component.setVisible(Component.java:1253)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ide.dialogs.WizardLauncher.runDialog(WizardLauncher.java:55)
         at oracle.ide.panels.TDialogLauncher.showDialog(TDialogLauncher.java:276)
         at oracle.ide.model.panels.ProjectPropertiesDialog.showDialog(ProjectPropertiesDialog.java:223)
         at oracle.ide.model.panels.ProjectPropertiesDialog.showDialog(ProjectPropertiesDialog.java:89)
         at oracle.ide.model.panels.ProjectPropertiesDialog.showDialog(ProjectPropertiesDialog.java:80)
         at oracle.jdeveloper.model.JProjectStructureController.handleEvent(JProjectStructureController.java:111)
         at oracle.jdeveloper.model.JProjectStructureController$JProjectMenuListener.handleDefaultAction(JProjectStructureController.java:576)
         at oracle.ide.controller.ContextMenu.fireDefaultAction(ContextMenu.java:343)
         at oracle.ideimpl.explorer.BaseTreeExplorer.fireDefaultAction(BaseTreeExplorer.java:1504)
         at oracle.ideimpl.explorer.BaseTreeExplorer.dblClicked(BaseTreeExplorer.java:1841)
         at oracle.ideimpl.explorer.BaseTreeExplorer.mouseReleased(BaseTreeExplorer.java:1862)
         at oracle.ideimpl.explorer.CustomTree.processMouseEvent(CustomTree.java:176)
         at java.awt.Component.processEvent(Component.java:5253)
         at java.awt.Container.processEvent(Container.java:1966)
         at java.awt.Component.dispatchEventImpl(Component.java:3955)
         at java.awt.Container.dispatchEventImpl(Container.java:2024)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
         at java.awt.Container.dispatchEventImpl(Container.java:2010)
         at java.awt.Window.dispatchEventImpl(Window.java:1774)
         at java.awt.Component.dispatchEvent(Component.java:3803)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    I use JDeveloper version 10.1.3.0.4.3679 (Build JDEVADF 10.1.3. NT 060125.0900.3673)
    and JDK: Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
    When I use JDK: Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
    I get this Exception if I try show Remote Debug Dialog:
    java.lang.ClassCastException
         at oracle.jdeveloper.ejb.BaseEjbModuleContainer.getEjbJarNode(BaseEjbModuleContainer.java:324)
         at oracle.jdeveloper.ejb.BaseEjbModuleContainer.getEjbModuleEngine(BaseEjbModuleContainer.java:704)
         at oracle.jdeveloper.ejb.EjbAppManager.getEjbModuleEngine(EjbAppManager.java:648)
         at oracle.jdevimpl.runner.oc4j.Ejb30StarterFactory.checkIsEjb30Node(Ejb30StarterFactory.java:57)
         at oracle.jdevimpl.runner.oc4j.Ejb30StarterFactory.canStartImpl(Ejb30StarterFactory.java:40)
         at oracle.jdevimpl.runner.oc4j.Oc4jStarterFactory.canStart(Oc4jStarterFactory.java:71)
         at oracle.ide.runner.AbstractStarterFactory.canStart(AbstractStarterFactory.java:35)
         at oracle.ide.runner.RunProcess.canGetStarterForTarget(RunProcess.java:588)
         at oracle.jdevimpl.runner.DefaultRunnablePanel.validateDefaultRunTarget(DefaultRunnablePanel.java:144)
         at oracle.jdevimpl.runner.RunConfigurationLaunchPanel.commitTo(RunConfigurationLaunchPanel.java:203)
         at oracle.jdevimpl.runner.RunConfigurationLaunchPanel.onExit(RunConfigurationLaunchPanel.java:170)
         at oracle.ide.panels.MDDPanel.exitTraversable(MDDPanel.java:977)
         at oracle.ide.panels.MDDPanel.mav$exitTraversable(MDDPanel.java)
         at oracle.ide.panels.MDDPanel$Tsl.updateSelectedNavigable(MDDPanel.java:1272)
         at oracle.ide.panels.MDDPanel$Tsl.updateSelection(MDDPanel.java:1216)
         at oracle.ide.panels.MDDPanel$Tsl.actionPerformed(MDDPanel.java:1210)
         at javax.swing.Timer.fireActionPerformed(Timer.java:271)
         at javax.swing.Timer$DoPostEvent.run(Timer.java:201)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
         at java.awt.Dialog$1.run(Dialog.java:540)
         at java.awt.Dialog.show(Dialog.java:561)
         at java.awt.Component.show(Component.java:1133)
         at java.awt.Component.setVisible(Component.java:1088)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ide.dialogs.WizardLauncher.runDialog(WizardLauncher.java:55)
         at oracle.ide.panels.TDialogLauncher.showDialog(TDialogLauncher.java:276)
         at oracle.jdevimpl.runner.RunConfigurationEditor.showDialog(RunConfigurationEditor.java:58)
         at oracle.jdevimpl.runner.RunConfigurationsPanel.editRunConfiguration(RunConfigurationsPanel.java:340)
         at oracle.jdevimpl.runner.RunConfigurationsPanel.editRunConfiguration(RunConfigurationsPanel.java:322)
         at oracle.jdevimpl.runner.RunConfigurationsPanel.actionPerformed(RunConfigurationsPanel.java:212)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
         at java.awt.Component.processMouseEvent(Component.java:5100)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:141)
         at java.awt.Dialog$1.run(Dialog.java:540)
         at java.awt.Dialog.show(Dialog.java:561)
         at java.awt.Component.show(Component.java:1133)
         at java.awt.Component.setVisible(Component.java:1088)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.bali.ewt.dialog.JEWTDialog.runDialog(Unknown Source)
         at oracle.ide.dialogs.WizardLauncher.runDialog(WizardLauncher.java:55)
         at oracle.ide.panels.TDialogLauncher.showDialog(TDialogLauncher.java:276)
         at oracle.ide.model.panels.ProjectPropertiesDialog.showDialog(ProjectPropertiesDialog.java:223)
         at oracle.ide.model.panels.ProjectPropertiesDialog.showDialog(ProjectPropertiesDialog.java:89)
         at oracle.ide.model.panels.ProjectPropertiesDialog.showDialog(ProjectPropertiesDialog.java:80)
         at oracle.jdeveloper.model.JProjectStructureController.handleEvent(JProjectStructureController.java:111)
         at oracle.jdeveloper.model.JProjectStructureController$JProjectMenuListener.handleDefaultAction(JProjectStructureController.java:576)
         at oracle.ide.controller.ContextMenu.fireDefaultAction(ContextMenu.java:343)
         at oracle.ideimpl.explorer.BaseTreeExplorer.fireDefaultAction(BaseTreeExplorer.java:1504)
         at oracle.ideimpl.explorer.BaseTreeExplorer.dblClicked(BaseTreeExplorer.java:1841)
         at oracle.ideimpl.explorer.BaseTreeExplorer.mouseReleased(BaseTreeExplorer.java:1862)
         at oracle.ideimpl.explorer.CustomTree.processMouseEvent(CustomTree.java:176)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    But after confirm Exception, dialog will open corectly.

    I Find, that problem was in project configure file, where was incorrect path to the workspace configuration file:
    <hash n="oracle.ide.model.DependencyConfiguration">
    <list n="dependencyList">
    <hash>
    <value n="class" v="oracle.jdeveloper.library.ProjectLibrary"/>
    <url n="sourceOwnerURL" path="../WorkspaceVersion2.jws"/>
    <url n="sourceURL" path="../ejb/ejb.jpr"/>
    </hash>
    </list>
    </hash>

  • Swing Dialog not Showing Content

    Hello,
    I am currently developing code for a complex GUI system and I am experiencing a big problem
    when I try to popup JDialogs. I have a JProgressBar inside a JDialog that pops up when our
    system is doing work. The JDialog pops up but I cannot see the JProgressBar inside the dialog.
    (I also tried to just add a JLabel to the dialog but that doesnt show up either.) When I run my progress
    dialog "stand-alone" I can see the progress bar fine.
    The code for my progress dialog even creates its own thread when it runs so I am pretty sure that
    its not blocking inside my own code.
    This leads me to believe that somewhere in our GUI code we have somehow "blocked" some critical
    AWT (or Swing?) thread and it cannot update the contents of the JDialog.
    Does anyone have an idea as to what could be going on here or how I might find out? I have tried using
    JProbe and Optimizeit Thread profiling tools but they have not really been much help.
    Thanks!
    M.
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Dialog;
    import java.awt.Dimension;
    import java.awt.Frame;
    import java.awt.Point;
    import javax.swing.JDialog;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JProgressBar;
    import javax.swing.SwingConstants;
    public class ProgressAnimationDialog implements Runnable {
         private static final Dimension DIALOGSIZE = new Dimension(200,100);
         private JDialog theDialog;
         private JProgressBar progressBar = new JProgressBar();
         private String string = null;
         private Component owner = null;
         private boolean plainDialog = false;
         public ProgressAnimationDialog(Frame owner, String title) {
              theDialog = new JDialog(owner,true);
              theDialog.setTitle(title);
              this.owner = owner;
              init();
         public ProgressAnimationDialog(Dialog owner, String title) {
              theDialog = new JDialog(owner,true);
              theDialog.setTitle(title);
              this.owner = owner;
              init();
         public ProgressAnimationDialog(Frame owner, String title, String message) {
              theDialog = new JDialog(owner,true);
              theDialog.setTitle(title);
              string = message;
              this.owner = owner;
              init();
         public ProgressAnimationDialog(Dialog owner, String title, String message) {
              theDialog = new JDialog(owner,true);
              theDialog.setTitle(title);
              string = message;
              this.owner = owner;
              init();
         public ProgressAnimationDialog(Frame owner, String title, String message, boolean usePlainDialog) {
              theDialog = new JDialog(owner,true);
              theDialog.setTitle(title);
              string = message;
              this.owner = owner;
              plainDialog = usePlainDialog;
              init();
         public ProgressAnimationDialog(Dialog owner, String title, String message, boolean usePlainDialog) {
              theDialog = new JDialog(owner,true);
              theDialog.setTitle(title);
              string = message;
              this.owner = owner;
              plainDialog = usePlainDialog;
              init();
         private void init() {
              theDialog.setSize(DIALOGSIZE);
              theDialog.setResizable(false);          
              theDialog.getContentPane().setLayout(new BorderLayout());
              if (!plainDialog) {
                   theDialog.getContentPane().add(progressBar,BorderLayout.CENTER);
                   progressBar.setIndeterminate(true);
                   if (string != null) {
                        progressBar.setStringPainted(true);
                        progressBar.setString(string);
              } else {
                   JLabel label = new JLabel("loading region....",SwingConstants.CENTER);               
                   theDialog.getContentPane().add(label,BorderLayout.CENTER);
         public void start() {
              Thread t = new Thread(this);
              t.start();
         public void run() {
              Point p0 = owner.getLocation();
              Point p1 = new Point();
              p1.setLocation(p0.getX()+owner.getWidth()/2.0,p0.getY()+owner.getHeight()/2.0);
              Point p2 = GUIUtilities.getMidPoint(p1,theDialog);
              theDialog.setLocation(p2);          
              theDialog.show();
         public void stop() {
              theDialog.dispose();
         public static void main(String[] args) {
              JFrame frame = new JFrame("Test ProgressAnimationDialog");
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(600,400);
              frame.setVisible(true);
              ProgressAnimationDialog pad =
                   new ProgressAnimationDialog(frame,"Please Wait","Loading Region",true);
              pad.start();
              try {
                   Thread.sleep(5000);
              } catch (InterruptedException e) {
                   e.printStackTrace();
              pad.stop();
    }

    Hi Michelle!
    I tried out your code: besides the GUIUtilities class, whose reference I commented out, the program ran perfectly. I got a JProgressBar, with the text in the middle, and the indeterminate bar floating across...
    What version of Java are you using?
    regards,
    lutha

  • Hard awt problem.

    Introduction:
    An applet opens a modal java.awt.Dialog. The dialog contains a grid for displaying data. When the dialog is opened a separate thread is fetching data from the server. When the data arrives it is displayed in the grid in the dialog. The grid adds a scrollbar to itself whenever required (if the number of rows to be displayed is greater than the number of rows that fit inside the visible part of the grid).
    The code for adding/ removing the scrollbar is in the doLayout() method of the Grid.
    Problem:
    When I call invalidate() or validate() on the grid in the modal dialog the call hangs until the modal dialog returns from it�s setVisible() method. Why ???! It seems to be impossible to trigger a refresh of the layout of the grid programmatically. If I do not refresh the layout the scrollbar will only get added if I resize the window or in any other way make the system trigger a refresh of the layout. When I use the same Grid in any Container that is not a modal dialog there is no problem at all.
    What is the reason for this behavior, and how do I solve the problem?
    Ragnvald

    Thanks Luke, but that doesn�t work for me.
    This is an awt- applet, supposed to run on IE without signing or any additional downloading. That implies java 1.1.8 only. awt and no swing. And all the security restrictions apply as well.
    There must be a workaround!!!!
    The swing you provided has it�s equivalent in awt://1.1.8:
    Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(event);
    //and 1.2:
    Toolkit.getEventQueue().postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(), runnable));The problem is the applet restriction. I get an exception:
    SecurityException at getSystemEventQueue
    There has got to be another solution!
    Ragnvald.

Maybe you are looking for