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


Groups > comp.lang.java.programmer > #18247 > unrolled thread

How to remove line around label image

Started by"clusardi2k" <clusardi2k@1:261/38.remove-fzq-this>
First post2012-08-20 18:58 +0000
Last post2012-08-20 20:01 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  How to remove line around label image "clusardi2k" <clusardi2k@1:261/38.remove-fzq-this> - 2012-08-20 18:58 +0000
    Re: How to remove line around label image "Knute Johnson" <knute.johnson@1:261/38.remove-z93-this> - 2012-08-20 20:01 +0000
    Re: How to remove line around label image "Eric Sosman" <eric.sosman@1:261/38.remove-z93-this> - 2012-08-20 20:01 +0000

#18247 — How to remove line around label image

From"clusardi2k" <clusardi2k@1:261/38.remove-fzq-this>
Date2012-08-20 18:58 +0000
SubjectHow to remove line around label image
Message-ID<50327C3E.57172.calajapr@time.synchro.net>
From: clusardi2k@aol.com

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,

--- BBBS/Li6 v4.10 Dada-1
 * Origin: Prism bbs (1:261/38)
--- Synchronet 3.16a-Win32 NewsLink 1.98
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#18250

From"Knute Johnson" <knute.johnson@1:261/38.remove-z93-this>
Date2012-08-20 20:01 +0000
Message-ID<50328B17.57175.calajapr@time.synchro.net>
In reply to#18247
  To: clusardi2k
From: Knute Johnson <nospam@knutejohnson.com>

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

--- BBBS/Li6 v4.10 Dada-1
 * Origin: Prism bbs (1:261/38)
--- Synchronet 3.16a-Win32 NewsLink 1.98
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#18251

From"Eric Sosman" <eric.sosman@1:261/38.remove-z93-this>
Date2012-08-20 20:01 +0000
Message-ID<50328B19.57176.calajapr@time.synchro.net>
In reply to#18247
  To: clusardi2k
From: Eric Sosman <esosman@ieee-dot-org.invalid>

On 8/20/2012 1:18 PM, 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,
>

If you're sure the line is not part of the image itself (a border, perhaps), 
please post an SSSCE.  This works fine for me:


     import javax.swing.ImageIcon;
     import javax.swing.JFrame;
     import javax.swing.JLabel;
     import javax.swing.SwingUtilities;
     public class Foo {
        public static void main(String[] unused) {
           SwingUtilities.invokeLater(new Runnable(){
              @Override
              public void run() {
                 JFrame frame = new JFrame("Foo");
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                 ImageIcon icon = new ImageIcon("icon.jpg");
                 frame.add(new JLabel(icon));
                 frame.pack();
                 frame.setVisible(true);
              }
           });
        }
     }

--
Eric Sosman
esosman@ieee-dot-org.invalid

--- BBBS/Li6 v4.10 Dada-1
 * Origin: Prism bbs (1:261/38)
--- Synchronet 3.16a-Win32 NewsLink 1.98
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web