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 2004

Tip: Looking for answers? Try searching our database.

Adding Icon to a JLabel

Thread view: 
J. Babe - 27 May 2004 00:01 GMT
I'm new to Java GUI and I'm trying to add an icon to an object that
extends a JLabel. I have the following code, but the icon doesn't
appear, I was wondering what my problem would be (paintIcon()?)
Thanks.

public class FileTarget extends javax.swing.JLabel implements
DropTargetListener, DragGestureListener {
   
   private Vector filearr = new Vector();
   
   public FileTarget(Icon image) {
       super(image, (int)JLabel.CENTER_ALIGNMENT);
       this.dTarget = new DropTarget(this, this);
   }
Steve W. Jackson - 27 May 2004 14:18 GMT
>:I'm new to Java GUI and I'm trying to add an icon to an object that
>:extends a JLabel. I have the following code, but the icon doesn't
[quoted text clipped - 10 lines]
>:        this.dTarget = new DropTarget(this, this);
>:    }

There's nothing in the code you've shown that would demonstrate your
problem.  If that's the only constructor you have, then the problem
could be in how the Icon parameter was constructed before you invoke
this constructor.  If you're asking about paintIcon(), then why?  Did
you write some code that overrides the built-in one in Icon, ImageIcon,
or one of the various UI classes?

More detail will be necessary in order to provide useful assistance.  
Perhaps a small code example that shows exactly how you're getting the
Icon and is a compilable example showing the problem.

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

J. Babe - 28 May 2004 21:40 GMT
I actually overlooked something, but figured it out now, thanks.


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.