📄 frame1.java~4~
字号:
package myproject;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author unascribed * @version 1.0 */public class Frame1 extends JFrame { private JPanel contentPane; private BorderLayout borderLayout1 = new BorderLayout(); private JMenuBar jMenuBar1 = new JMenuBar(); private JMenu jMenu1 = new JMenu(); private JMenuItem jMenuItem2 = new JMenuItem(); private JMenuItem jMenuItem3 = new JMenuItem(); private JMenuItem jMenuItem4 = new JMenuItem(); private JMenu jMenu2 = new JMenu(); private JPanel jPanel1 = new JPanel(); private XYLayout xYLayout1 = new XYLayout(); private JButton jButton1 = new JButton(); private JButton jButton2 = new JButton(); private JPanel jPanel2 = new JPanel(); private JButton jButton3 = new JButton(); private JButton jButton4 = new JButton(); private JButton jButton5 = new JButton(); //Construct the frame public Frame1() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]"))); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(borderLayout1); this.setJMenuBar(jMenuBar1); this.setSize(new Dimension(400, 300)); this.setTitle("Frame Title"); jMenu1.setText("文件"); jMenuItem2.setText("打开"); jMenuItem3.setText("打印"); jMenuItem4.setText("关闭"); jMenu2.setText("新建"); jPanel1.setLayout(xYLayout1); jButton1.setText("jButton1"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); jButton2.setText("jButton2"); jButton3.setText("jButton3"); jButton4.setText("jButton4"); jButton5.setText("jButton5"); jMenuBar1.add(jMenu1); jMenu1.add(jMenu2); jMenu1.add(jMenuItem2); jMenu1.add(jMenuItem3); jMenu1.add(jMenuItem4); contentPane.add(jPanel1, BorderLayout.CENTER); jPanel1.add(jButton1, new XYConstraints(165, 88, -1, -1)); jPanel1.add(jButton2, new XYConstraints(165, 138, -1, -1)); jPanel1.add(jPanel2, new XYConstraints(0, 0, -1, -1)); jPanel2.add(jButton5, null); jPanel2.add(jButton4, null); jPanel2.add(jButton3, null); } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } void jButton1_actionPerformed(ActionEvent e) { }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -