Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2008

Tip: Looking for answers? Try searching our database.

JButton with Multiple ImageIcons

Thread view: 
karlschmitt1969@googlemail.com - 19 May 2008 20:25 GMT
Hi,

I am evaluating the Java Swing toolkit
for a new project, and I would like to ask
if it is possible to add or place more than one ImageIcon
on top of a JButton?

Furthermore, is it possible to add multiple Strings with diffrent
text sizes and in diffrent fonts between to ImageIcons on to
a JButton surface.

____________________
|                                  |
|     <One Big Picture>  |
|     <Big Text>              |
|     <Small Text>          |
|     <Small Pictures>    |
-----------------------------------|

Thanks in advance,

Karl
Steve W. Jackson - 19 May 2008 20:32 GMT
In article
<541732aa-8ed2-46fc-9b8a-826bcd956742@a23g2000hsc.googlegroups.com>,

> Hi,
>
[quoted text clipped - 18 lines]
>
> Karl

If you work hard enough, practically anything *might* be possible to put
on a JButton.  But the real question is why you might want to try such a
thing.

A JButton represents a pushbutton, where you click it in order to invoke
some action.  If your goal is to display various images and text, it
might be better to use multiple components for that purpose.  If merely
for display, you could use JLabel.  If the idea is that interaction with
a different part of the "button" invokes different actions, then
multiple buttons (and even JLabels or other things) might be a more
appropriate solution.
Signature

Steve W. Jackson
Montgomery, Alabama

Daniel Pitts - 19 May 2008 22:49 GMT
> In article
> <541732aa-8ed2-46fc-9b8a-826bcd956742@a23g2000hsc.googlegroups.com>,
[quoted text clipped - 33 lines]
> multiple buttons (and even JLabels or other things) might be a more
> appropriate solution.
More specifically, since JComponent is a container, all JComponent
descendants are also containers.  You can put a JPanel with all those
things inside it into a JButton.

Steve is right though, you should ask yourself not "is it possible", but
"is it sensible."

Good luck.
Signature

Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.