Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-09-2007, 12:24 PM
Member
 
Join Date: Dec 2007
Posts: 15
Soda is on a distinguished road
Label image Question
How do I removed the white part of images in label?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-09-2007, 01:55 PM
Corvin's Avatar
Member
 
Join Date: Dec 2007
Location: Germany
Posts: 2
Corvin is on a distinguished road
Send a message via ICQ to Corvin Send a message via AIM to Corvin Send a message via MSN to Corvin Send a message via Yahoo to Corvin Send a message via Skype™ to Corvin
The easiest way is to use a GIF-image.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-09-2007, 07:07 PM
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
removed the white part of images in label
Do you mean how to remove the color white from an image? You use something like this
Code:
private BufferedImage convertToTransparent(BufferedImage src, Color transparentColor) { int w = src.getWidth(); int h = src.getHeight(); GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration(); BufferedImage dest = gc.createCompatibleImage(w, h, Transparency.BITMASK); int trgb; if (transparentColor != null) { trgb = transparentColor.getRGB() | 0xff000000; } else { trgb = 0xffff00ff; } // Copy pixels a scan line at a time int buf[] = new int[w]; for (int y = 0; y < h; y++) { src.getRGB(0, y, w, 1, buf, 0, w); for (int x = 0; x < w; x++) { if (buf[x] == trgb) { buf[x] = 0; } } dest.setRGB(0, y, w, 1, buf, 0, w); } return dest; }
which you can find in your sdk (1.5) at:
sdk1.5/src/com/sun/java/swing/plaf/windows/XPStyle
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 12-10-2007, 05:38 PM
Member
 
Join Date: Dec 2007
Posts: 15
Soda is on a distinguished road
What does

label.setOpaque

do?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting disk label Java Tip Java Tips 0 02-05-2008 11:07 AM
Example of SWT Label Java Tip Java Tips 0 01-09-2008 02:02 PM
Converting multiple banded image into single banded image... Image enhancement archanajathan Advanced Java 0 01-08-2008 07:29 PM
SWT Label JavaForums Java Blogs 0 12-31-2007 06:53 PM
How to set an Icon in a Label? Soda New To Java 2 12-07-2007 02:38 PM


All times are GMT +3. The time now is 03:54 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org