public class ExamplePane extends javax.swing.JFrame {
public ExamplePane() {
// this is constructor
initComponents();
}
private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {
jPanel1.setVisible(true);
jPanel2.setVisible(false);
jPanel2.invalidate();
}
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {
jPanel2.setVisible(true);
jPanel1.setVisible(false);
jPanel1.invalidate();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ExamplePane().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
// End of variables declaration
}
当您尝试在单击事件上一一显示 jpanel 时,面板会在其中重叠。所以请帮助我。