Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #18180

Re: How to remove line around label image

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From Knute Johnson <nospam@knutejohnson.com>
Newsgroups comp.lang.java.programmer
Subject Re: How to remove line around label image
Date Mon, 20 Aug 2012 11:09:26 -0700
Organization A noiseless patient Spider
Lines 57
Message-ID <k0tugm$4ed$1@dont-email.me> (permalink)
References <824fad70-20cf-4b77-a9f1-296f6f1b8449@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Mon, 20 Aug 2012 18:09:27 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="9b3fcb0d22708969e4dc99e7aa0ef1f9"; logging-data="4557"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/npdRJ21om9+QF9Y5P4xf3"
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0
In-Reply-To <824fad70-20cf-4b77-a9f1-296f6f1b8449@googlegroups.com>
Cancel-Lock sha1:MdD1BmjTYiJnuECtVqAJWolD4Oo=
Xref csiph.com comp.lang.java.programmer:18180

Show key headers only | View raw


On 8/20/2012 10:18 AM, clusardi2k@aol.com wrote:
> How do I remove a line around a label image. I set the background and
> foreground color to the panel color and put a check in the property
> opaque checkbox.
>
> Thank you,
>

We need to see some code.  I don't see the problem you describe in the 
code below.  Are you using AWT?

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.net.*;
import javax.swing.*;

public class test2 extends JPanel {
     private JLabel l;

     public test2() {
         super(new GridBagLayout());

         GridBagConstraints c = new GridBagConstraints();

         setPreferredSize(new Dimension(240,180));
         try {
             // use blue.png if you want to see the image
             URL url = new URL("http://knutejohnson.com/white.png");
             ImageIcon icon = new ImageIcon(url);
             l = new JLabel(icon);
         } catch (MalformedURLException murle) {
             murle.printStackTrace();
         }

         add(l,c);
     }

     public static void main(String[] args) {
         EventQueue.invokeLater(new Runnable() {
             public void run() {
                 JFrame f = new JFrame("test2");
                 f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                 test2 t2 = new test2();
                 f.add(t2,BorderLayout.CENTER);
                 f.pack();
                 f.setVisible(true);
             }
         });
     }
}



-- 

Knute Johnson

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to remove line around label image clusardi2k@aol.com - 2012-08-20 10:18 -0700
  Re: How to remove line around label image Knute Johnson <nospam@knutejohnson.com> - 2012-08-20 11:09 -0700
    Re: How to remove line around label image clusardi2k@aol.com - 2012-08-20 12:11 -0700
      Re: How to remove line around label image Knute Johnson <nospam@knutejohnson.com> - 2012-08-20 13:14 -0700
        Re: How to remove line around label image clusardi2k@aol.com - 2012-08-21 05:28 -0700
          Re: How to remove line around label image Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-21 09:16 -0400
            Re: How to remove line around label image clusardi2k@aol.com - 2012-08-21 10:49 -0700
          Re: How to remove line around label image Knute Johnson <nospam@knutejohnson.com> - 2012-08-21 08:34 -0700
      Re: How to remove line around label image Knute Johnson <nospam@knutejohnson.com> - 2012-08-20 13:20 -0700
  Re: How to remove line around label image Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-20 14:16 -0400

csiph-web