Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

JLable with Jcheckbox

Posted on 2002-05-18
2
Medium Priority
?
262 Views
Last Modified: 2010-03-31
Hi,
   I am using
JLabel(String text, Icon icon, int horizontalAlignment)

to write code for a image browser.  Right now it displays thumb nail images with
file name on top.
I want to put a checkbox next to file name for user to
select or deselct the image. How can I extend the JLable
class so it not only take a icon, a text string, but
also a checkbox?

Thanks.
shane
0
Comment
Question by:xiaoxiangz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 7018645
 Why do you need to extend JLabel? Can you not just add a check box next to the JLabel and enable/disable the thumbnail? If checkbox is enabled then call the J:Label's constructor that does not require an Icon sa parameter, if it is not enabled called the one that does.

  Hope it helps.
0
 
LVL 3

Accepted Solution

by:
randyd earned 400 total points
ID: 7024058
You could create your own class based on JPanel.

Inside this panel, put your existing label and the new checkbox.

add an event handler to the checkbox, and make the right calls into the label when things are checked.

then plug in this panel wherever you are using your label today.

hth
randy
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question