• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About "Button Size"

 
Michail Petrov
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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





 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic