Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.ripco.com!news-out.news.tds.net!newsreading01.news.tds.net!53ab2750!not-for-mail From: "clusardi2k" Subject: Re: Layout Doesn't Work Message-ID: <5023FE3C.56485.calajapr@time.synchro.net> X-Comment-To: clusardi2k Newsgroups: comp.lang.java.programmer In-Reply-To: <5023FE3B.56476.calajapr@time.synchro.net> References: <5023FE3B.56476.calajapr@time.synchro.net> X-FTN-AREA: COMP.LANG.JAVA.PROGRAMMER X-FTN-MSGID: 1:261/38 29d940af X-FTN-REPLY: 1:261/38 a43066f2 Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.16a-Win32 NewsLink 1.98] Lines: 113 Date: Thu, 09 Aug 2012 18:44:38 GMT NNTP-Posting-Host: 69.21.70.65 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1344537878 69.21.70.65 (Thu, 09 Aug 2012 13:44:38 CDT) NNTP-Posting-Date: Thu, 09 Aug 2012 13:44:38 CDT Organization: tds.net Xref: csiph.com comp.lang.java.programmer:17536 To: clusardi2k From: "clusardi2k" To: clusardi2k From: clusardi2k@aol.com So, how do you convert the below project to use SwingWorker? Also, in general, how do you stop buttons and things from moving around when things go invisible and vice versa. Thanks, On Wednesday, August 8, 2012 1:22:05 PM UTC-4, (unknown) wrote: //Code: package hide_show_label_with_icon; import java.util.logging.Level; import java.util.logging.Logger; public class Hide_Show_Label_with_Icon extends javax.swing.JFrame { public Hide_Show_Label_with_Icon() { initComponents(); } @SuppressWarnings("unchecked") private void initComponents() { jButton1 = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jButton1.setText("jButton1"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jLabel1.setText("jLabel1"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G) .addGroup(layout.createSequentialGroup() .addGap(46, 46, 46) .addComponent(jButton1) .addGap(60, 60, 60) .addComponent(jLabel1) .addContainerGap(233, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G) .addGroup(layout.createSequentialGroup() .addGap(270, 270, 270) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Al ignment.BASELINE) .addComponent(jButton1) .addComponent(jLabel1)) .addContainerGap(36, Short.MAX_VALUE)) ); pack(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { System.out.println("jLabel1.isVisible is " + jLabel1.isVisible()); jLabel1.setVisible(true); for (int i = 0;i < 100000; i++) for (int i2 = 0;i2 < 100000; i2++); for (int i3 = 0;i3 < 100000; i3++); System.out.println("jLabel1.isVisible is " + jLabel1.isVisible()); jLabel1.setVisible(false); System.out.println("Done"); System.out.println(); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Hide_Show_Label_with_Icon().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; // End of variables declaration } -+- 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 --- 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