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


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

Re: Layout Doesn't Work

From clusardi2k@aol.com
Newsgroups comp.lang.java.programmer
Subject Re: Layout Doesn't Work
Date 2012-08-08 11:15 -0700
Organization http://groups.google.com
Message-ID <8132d479-6580-4c7a-945b-550058db3119@googlegroups.com> (permalink)
References (4 earlier) <jvsijp$u5l$1@dont-email.me> <e26bb607-9645-4ae7-9a43-4603d4bfcfce@googlegroups.com> <jvu03u$4ok$1@dont-email.me> <bddfefd2-26be-4ebe-ba11-7bec2710fc19@googlegroups.com> <7a7e6564-2761-4592-ad45-b071e0b25f0e@googlegroups.com>

Show all headers | View raw


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.LEADING) 
            .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.LEADING) 
            .addGroup(layout.createSequentialGroup() 
                .addGap(270, 270, 270) 
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.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 
} 

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


Thread

jLabel setVisible(true) Doesn't Work clusardi2k@aol.com - 2012-08-07 12:15 -0700
  Re: jLabel setVisible(true) Doesn't Work markspace <-@.> - 2012-08-07 12:33 -0700
    Re: jLabel setVisible(true) Doesn't Work clusardi2k@aol.com - 2012-08-07 15:22 -0700
      Re: jLabel setVisible(true) Doesn't Work Jeff Higgins <jeff@invalid.invalid> - 2012-08-07 19:08 -0400
        Layout Doesn't Work (was: jLabel setVisible(true) Doesn't Work) Jeff Higgins <jeff@invalid.invalid> - 2012-08-07 22:27 -0400
          Re: Layout Doesn't Work (was: jLabel setVisible(true) Doesn't Work) clusardi2k@aol.com - 2012-08-08 05:54 -0700
            Re: Layout Doesn't Work Jeff Higgins <jeff@invalid.invalid> - 2012-08-08 11:22 -0400
              Re: Layout Doesn't Work Jeff Higgins <jeff@invalid.invalid> - 2012-08-08 14:00 -0400
            Re: Layout Doesn't Work markspace <-@.> - 2012-08-08 08:20 -0700
              Re: Layout Doesn't Work clusardi2k@aol.com - 2012-08-08 09:24 -0700
                Re: Layout Doesn't Work clusardi2k@aol.com - 2012-08-08 10:22 -0700
                Re: Layout Doesn't Work markspace <-@.> - 2012-08-08 10:31 -0700
                Re: Layout Doesn't Work Jeff Higgins <jeff@invalid.invalid> - 2012-08-08 13:49 -0400
                Re: Layout Doesn't Work clusardi2k@aol.com - 2012-08-08 11:15 -0700
                Re: Layout Doesn't Work markspace <-@.> - 2012-08-08 11:48 -0700
                Re: Layout Doesn't Work Jeff Higgins <jeff@invalid.invalid> - 2012-08-10 10:09 -0400
                Re: Layout Doesn't Work Jeff Higgins <jeff@invalid.invalid> - 2012-08-10 10:20 -0400
                Re: Layout Doesn't Work Jeff Higgins <jeff@invalid.invalid> - 2012-08-10 13:48 -0400
  Re: jLabel setVisible(true) Doesn't Work "John B. Matthews" <nospam@nospam.invalid> - 2012-08-07 22:09 -0400
  Re: jLabel setVisible(true) Doesn't Work Roedy Green <see_website@mindprod.com.invalid> - 2012-08-09 05:38 -0700

csiph-web