| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Java Programming Ask your Java programming question and help out others with theirs. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
java
hi, does anybody know how to position a JFrame-Window in a java APPLICATION? for example: center the window in the middle of the screen. thanks in advance werner hutmacher |
|
#2
|
|||
|
|||
|
Re: java
//Center frame Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = frame.getSize(); screenSize.height = screenSize.height/2; screenSize.width = screenSize.width/2; size.height = size.height/2; size.width = size.width/2; int y = screenSize.height - size.height; int x = screenSize.width - size.width; frame.setLocation(x, y); |
|
#3
|
|||
|
|||
|
Re: java
use component.setLocaton(int x, int y)
|
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|