Why Joptionpan does not show on TOP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sezanawa
    New Member
    • Sep 2007
    • 9

    #1

    Why Joptionpan does not show on TOP

    Hi Guys,

    I have a problem with JOptionpan. I m using JOption pane for showing messages or even Exceptions etc. But it does not poped up on TOP.

    Its always behind parent windows.

    I think i need to specifiy JOptionpane to display on TOP of all windows or dialogs. But how should i do? i really dont know. Can any one tell me how it works. I past my code below.

    [HTML]
    import java.io.Filenam eFilter;

    import javax.swing.JFr ame;
    import javax.swing.JOp tionPane;

    public class MessageBox extends JFrame{

    private static final long serialVersionUI D = 1L;


    public static void ShowMessage(Str ing message, String title,int MessageType){

    JOptionPane.sho wMessageDialog( null, message, title, MessageType);

    }

    public static String ShowInputDialog (String message, String title,int MessageType){


    return JOptionPane.sho wInputDialog(nu ll,message,titl e,MessageType);
    }


    }
    [/HTML]

    I worte this class and always use static methods of this class where ever i need to show a message or exception.

    What should i do to show it always on TOP.

    It would be much easier if some one send working example.

    Thanks in advance

    Best regard
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    You should pass your JOptionPane a parent, not null, if you want it to be in front
    of that parent.

    kind regards,

    Jos

    Comment

    • sezanawa
      New Member
      • Sep 2007
      • 9

      #3
      Originally posted by JosAH
      You should pass your JOptionPane a parent, not null, if you want it to be in front
      of that parent.

      kind regards,

      Jos
      Thanks man,

      But what should be a parent. I searched for an example but i did not find. Can u please write me a little code example.

      Thanking u in advance

      best regards

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Originally posted by sezanawa
        Thanks man,

        But what should be a parent. I searched for an example but i did not find. Can u please write me a little code example.

        Thanking u in advance

        best regards
        You keep on talking about displaying that option pane 'on top'; on top of what?
        The parameter I was talking about is the thing on top of which the option pane
        should be displayed; iow, the parameter should be a non null JDialog or JFrame.

        kind regards,

        Jos

        Comment

        Working...