![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Encoder
|
Size of Button before show()
JButton button = new JButton("Click here");
System.out.println(button.getWidth() + ";" + button.getHeight());The output is always 0;0 Someone in the Yahoo Programming:1 room told me, that we must show() the frame before trying to determine the width and height. But I want to get the width and height of the button before showing the frame. Can anyone solve my problem? |
|
|
|
|
|
#2 |
|
Expert Programmer
|
I think that yahoo guy was right, before you have shown it, it is just an object with no defined size, so the default width and height is 0.
Maybe you could show it on an area of the form which won't be seen.
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|