aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Positioning JOptionPane on the screen Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Positioning JOptionPane on the screen" Watch "Positioning JOptionPane on the screen" New topic
Author

Positioning JOptionPane on the screen

Rus Corina
Ranch Hand

Joined: Jul 08, 2011
Posts: 90
I have a frame, which occupies almost all the screen, and at some point, if you press some buttons, a JOptionPane opens with a message. The problem is that the JOptionPane opens right below the end of my Frame, and only a very small part of it is visible. Does anybody know if I can modify the position of a JOptionPane on the screen? I want to put it in the center.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2172
    
    7
The JOptionPane is centered on whatever component you specify as the parent component. Try using the frame as the parent component.
Rus Corina
Ranch Hand

Joined: Jul 08, 2011
Posts: 90
I added the frame to a scrollbar, and I specified the scrollbar as parent component
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Positioning JOptionPane on the screen