• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to position dialogs relative to their parent frame

 
Andy Jung
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

1. how can I dynamically position a JDialog in the center of its parent JFrame?
2. how can I initially set the size of a JFrame in relation to the current graphics environment, screen resolution etc.?

Please send me some code example.

Thanks,
Andy
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. how can I dynamically position a JDialog in the center of its parent JFrame?


Look at the JDialog API for methods contain "location" in the method name.

2. how can I initially set the size of a JFrame in relation to the current graphics environment, screen resolution etc.?


Look at the Toolkit class for methods of interest.

Look at the API for Graphics related classes.
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Camick wrote:
2. how can I initially set the size of a JFrame in relation to the current graphics environment, screen resolution etc.?


Look at the Toolkit class for methods of interest.

Look at the API for Graphics related classes.

On a 1-screen setup the very same method can be used by providing null as the argument.
 
Darryl Burke
Bartender
Posts: 5153
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:
Rob Camick wrote:
2. how can I initially set the size of a JFrame in relation to the current graphics environment, screen resolution etc.?


Look at the Toolkit class for methods of interest.

Look at the API for Graphics related classes.

On a 1-screen setup the very same method can be used by providing null as the argument.

Um, the second question was about setting the size of a JFrame, not its location.
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must have misread that part. My apologies.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!