- 论坛徽章:
- 0
|
setVisible()函数为什么不起作用?
/*
* PlatformJFrame.java
*
* Created on 2007年10月3日, 下午3:25
*/
package testplatform;
/**
*
* @author xiaodwan
*/
public class PlatformJFrame extends javax.swing.JFrame {
/** Creates new form PlatformJFrame */
public PlatformJFrame() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">
private void initComponents() {
helpContentJPanel = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
helpCancelJButton = new javax.swing.JButton();
platformMenu = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
helpMenu = new javax.swing.JMenu();
helpContentMenuItem = new javax.swing.JMenuItem();
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jTextArea1.setText("hello world!");
jScrollPane1.setViewportView(jTextArea1);
helpCancelJButton.setText("Cancel");
javax.swing.GroupLayout helpContentJPanelLayout = new javax.swing.GroupLayout(helpContentJPanel);
helpContentJPanel.setLayout(helpContentJPanelLayout);
helpContentJPanelLayout.setHorizontalGroup(
helpContentJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 469, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, helpContentJPanelLayout.createSequentialGroup()
.addContainerGap(384, Short.MAX_VALUE)
.addComponent(helpCancelJButton)
.addContainerGap())
);
helpContentJPanelLayout.setVerticalGroup(
helpContentJPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(helpContentJPanelLayout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 581, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(helpCancelJButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Test Platform");
jMenu1.setText("File");
platformMenu.add(jMenu1);
jMenu2.setText("Project");
jMenuItem3.setText("New Project");
jMenu2.add(jMenuItem3);
jMenuItem1.setText("Open Project");
jMenu2.add(jMenuItem1);
jMenuItem2.setText("Close Project");
jMenu2.add(jMenuItem2);
platformMenu.add(jMenu2);
helpMenu.setText("Help");
helpContentMenuItem.setText("Content");
helpContentMenuItem.setActionCommand("PanelUI");
helpContentMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
helpContentMenuItemActionPerformed(evt);
}
});
helpMenu.add(helpContentMenuItem);
platformMenu.add(helpMenu);
setJMenuBar(platformMenu);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 275, Short.MAX_VALUE)
);
pack();
}// </editor-fold>
private void helpContentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
helpContentJPanel.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PlatformJFrame().setVisible(true);
}
});
}
// 变量声明 - 不进行修改
private javax.swing.JButton helpCancelJButton;
private javax.swing.JPanel helpContentJPanel;
private javax.swing.JMenuItem helpContentMenuItem;
private javax.swing.JMenu helpMenu;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JMenuBar platformMenu;
// 变量声明结束
} |
|