Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Serious problems on GUI with NetBeans.....
Closed Thread
Old 10-18-2005, 07:23 AM   #1 (permalink)
 
Newb Techie

Join Date: Jul 2004

Posts: 27

albertlee

Default Serious problems on GUI with NetBeans.....

Code:
package supershare;
 
import java.awt.event.*;
import javax.swing.*;
 
public class testGUI extends javax.swing.JFrame implements java.awt.event.ActionListener{
    
 
    public testGUI() {
        initComponents();
    }
    
 
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
        jButton1 = new javax.swing.JButton();
 
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        jButton1.setText("test");
 
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                .add(48, 48, 48)
                .add(jButton1)
                .addContainerGap(305, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                .add(68, 68, 68)
                .add(jButton1)
                .addContainerGap(209, Short.MAX_VALUE))
        );
        pack();
    }
    // </editor-fold>
  
    public static void main(String args[]) {
        
                new testGUI().setVisible(true);
         
    }
    public void actionPerformed(ActionEvent e) 
    {
        /*JProgressBar jp = new JProgressBar(0, 100);
        jp.setValue(0);
        jp.setStringPainted(true);
        
        this.add(jp);
        this.validate();*/
        
        this.remove(0);
        this.validate();
        this.repaint();
    }
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    // End of variables declaration
    
}
Above is the code I made under NetBeans....

As you know, NetBeans has a function called "JFrameForm", which allows you to design GUI more conviniently....

if you are familar with NetBeans, you can easily understand the above code...

You know what I am trying to do is that when I click the button, the button should disappear, but it doesnot....

as you see in the code, the initComponents() is generated by NetBeans.., which is something often you dont have to understand, because as you know, NetBeans has its own GUI making function that makes GUI design easier for the developer.


please help

thanks
albertlee is offline  
Old 10-18-2005, 04:03 PM   #2 (permalink)
 
True Techie

Join Date: Sep 2005

Posts: 223

nezzari

Send a message via AIM to nezzari
Default

private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
jButton1.setVisible(false);
}


nezzari is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On