| Author |
About "Button Size"
|
Michail Petrov
Ranch Hand
Joined: Sep 04, 2008
Posts: 32
|
|
HI
Look this fragment
When i chaing the size in setSize() the Size it is the same always
hfw to chaig the size
Thenkyou
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32689
|
|
|
The layout managers take over the sizing of your Components. Moving to the Swing forum, where we usually discuss this sort of thing.
|
 |
Antany Vasanth
Ranch Hand
Joined: Jan 28, 2009
Posts: 43
|
|
Hi Michail,
Instead of using setSize() use
Here we use the setPreferredSize method and not setSize because the if a container has a layout then it will use the components getPreferredSize() but if a container has an EmptyLayout then we can use setSize method to set the components dimensions.
Just go through the below link. You will get some idea regarding this.
http://osflash.org/projects/aswing/tutorials/messagebox_jframe_flowlayout_jlabel_mcicon
Regards,
Antany
|
 |
Michail Petrov
Ranch Hand
Joined: Sep 04, 2008
Posts: 32
|
|
Thankyou
and i have one more Question
haw to set a JLabel like a links something like CardLayout when i pres a JLabel Label to set me one the next Page like a button
I wana make samthig lije a Book in Java
|
 |
Antany Vasanth
Ranch Hand
Joined: Jan 28, 2009
Posts: 43
|
|
Hi Michail,
You can do this adding mouse listeners to your label.
The below link will be helpfull to understand various mouse events.
http://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html
Regards,
Antany
|
 |
Michail Petrov
Ranch Hand
Joined: Sep 04, 2008
Posts: 32
|
|
Hi agen
i have this code
I have a frame with manu and one Button
i setVisible with one Bulean varible "off"
i wont when i push Firma - NEW to disapear the Button and i change the "off" to false
but the result did not apear
what to do
|
 |
pete stein
Bartender
Joined: Feb 23, 2007
Posts: 1561
|
|
Perhaps what you want to do is to swap JPanels rather than show and disappear components like buttons. Please try out this program and let me know if this is similar to what you are looking for:
If so, then please read the CardLayout tutorial which you can find here: How To Use CardLayout
|
 |
Michail Petrov
Ranch Hand
Joined: Sep 04, 2008
Posts: 32
|
|
No i dont wont to swap the panels i want to the "BOOLEAN off" to shaing in the constructor
i change it hire
and i wont to be change hire
i declarate it like
and i wont to change but i dont know haw to say to the constructor i alredy did this
|
 |
 |
|
|
subject: About "Button Size"
|
|
|