> Can someone help me to make a button smaller? I am new to Java
> programming. Thanks!
An excellent resource for new Java programmers is the Java Tutorial. You can
see it online at this URL:
http://java.sun.com/docs/books/tutorial/index.html
The chapter (the authors call them "trails") that you want to see is
entitled "Creating a GUI with JFC/Swing". If you click on that link, then on
"Using Swing Components", then on "A Visual Index to the Swing Components",
then on the "Buttons" link in the Basic Controls section, you will get lots
of information about creating buttons.
Unfortunately, the tutorial article on buttons doesn't have much to say
about sizing of components so this might not be a great resource for your
particular problem.
If you don't find enough information on sizing buttons, do an archive search
of the java newsgroups. This will help you find all discussions of sizing
that have taken place since the discussions have started being saved, which
is sometime in 1997.
Here's a description of the initial search I would do if I had to research
button sizing:
1. Go to http://groups.google.ca/advanced_search
2. Enter the following in the "with all of the words" box: JButton size
3. Enter the following in the "Return only messages with the group at this
location: comp.lang.java.*
4. Click on "Google Search".
I got 800+ threads that discuss the issue when I did this search. You will
probably only need to read the first few of these threads to hear everything
you want to know about button sizing.
Also, don't be afraid to look in the API for JButton. If you do, you will
see methods that affect the size of the button. Please note that the methods
which control the size of a button are not part of JButton itself but are
inherited from its parent classes, specifically JComponent, but you can
access these via links in the JButton API.
--
Rhino
Thomas Weidenfeller - 16 Mar 2006 17:01 GMT
> Also, don't be afraid to look in the API for JButton. If you do, you will
> see methods that affect the size of the button. Please note that the methods
> which control the size of a button are not part of JButton itself but are
> inherited from its parent classes, specifically JComponent, but you can
> access these via links in the JButton API.
One final note. If you feel the need to manually manipulate the size of
a button you are probably trying to circumvent layout managers. Doing
this, however, is the wrong way. The way to enlightenment is via layout
managers.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
> Can someone help me to make a button smaller? I am new to Java
> programming. Thanks!
Normally, the programmer doesn't explicitly specify the size for any of
the components, because doing so usually involves making assumptions that
may not be true across all architectures. For example, perhaps a person with
visual impairement with have their OS set up so that fonts appear twice as
large as they normally would. If you hard-code a size for your button, the
button may be too small to fit the contents of its label.
Usually, it's best if you just leave the sizing and placement of the
buttons and other components up to the layout manager.
- Oliver
> Can someone help me to make a button smaller? I am new to Java
> programming. Thanks!
Look here:
http://java.sun.com/docs/books/tutorial/reallybigindex.html
http://java.sun.com/docs/books/tutorial/uiswing/components/button.html
Examples..
http://javaalmanac.com
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)