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