Path: csiph.com!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Knute Johnson Newsgroups: comp.lang.java.programmer Subject: Re: How to remove line around label image Date: Mon, 20 Aug 2012 13:20:50 -0700 Organization: A noiseless patient Spider Lines: 93 Message-ID: References: <824fad70-20cf-4b77-a9f1-296f6f1b8449@googlegroups.com> <85bbe4c1-ffc8-405f-9fb5-53fb05e4941a@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 20:20:50 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="9b3fcb0d22708969e4dc99e7aa0ef1f9"; logging-data="23110"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/IMi8bao6mnkfwKRKENyxL" User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: <85bbe4c1-ffc8-405f-9fb5-53fb05e4941a@googlegroups.com> Cancel-Lock: sha1:UMhOlYvApnjh6iT93ivTKRaQamI= Xref: csiph.com comp.lang.java.programmer:18254 On 8/20/2012 12:11 PM, clusardi2k@aol.com wrote: >> On Monday, August 20, 2012 2:09:26 PM UTC-4, Knute Johnson wrote: >> We need to see some code. I don't see the problem you describe in the code >> below. Are you using AWT? > > Here is code that yields a tiny line around the image. > > public class Line extends javax.swing.JFrame > { > public Line() > { > initComponents(); > } > > @SuppressWarnings("unchecked") > // > private void initComponents() { > > jLabel1 = new javax.swing.JLabel(); > > setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); > setBackground(new java.awt.Color(51, 0, 153)); > setForeground(java.awt.Color.orange); > > jLabel1.setText("Remove Tiny Line"); > > javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); > getContentPane().setLayout(layout); > layout.setHorizontalGroup( > layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) > .addGroup(layout.createSequentialGroup() > .addGap(149, 149, 149) > .addComponent(jLabel1) > .addContainerGap(150, Short.MAX_VALUE)) > ); > layout.setVerticalGroup( > layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) > .addGroup(layout.createSequentialGroup() > .addGap(116, 116, 116) > .addComponent(jLabel1) > .addContainerGap(168, Short.MAX_VALUE)) > ); > > pack(); > }// > > > public static void main(String args[]) > { > try > { > for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) > { > if ("Nimbus".equals(info.getName())) > { > javax.swing.UIManager.setLookAndFeel(info.getClassName()); > > break; > } > } > } catch (ClassNotFoundException ex) { > java.util.logging.Logger.getLogger(Line.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); > } catch (InstantiationException ex) { > java.util.logging.Logger.getLogger(Line.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); > } catch (IllegalAccessException ex) { > java.util.logging.Logger.getLogger(Line.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); > } catch (javax.swing.UnsupportedLookAndFeelException ex) { > java.util.logging.Logger.getLogger(Line.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); > } > // > > java.awt.EventQueue.invokeLater(new Runnable() > { > > public void run() > { > new Line().setVisible(true); > } > }); > } > // Variables declaration - do not modify > private javax.swing.JLabel jLabel1; > // End of variables declaration > > } > One other thing to consider is that look and feel must be changed from the EDT although I don't think that would cause this problem. -- Knute Johnson