📄 frame1.java
字号:
package ex02_01;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;public class Frame1 extends JFrame { JPanel contentPane; JButton jButton1 = new JButton(); JRadioButton jRadioButton1 = new JRadioButton(); GridLayout gridLayout1 = new GridLayout(); /**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(); jButton1.setFont(new java.awt.Font("Dialog", 3, 16)); jButton1.setActionCommand("我是按钮"); jButton1.setText("我是按钮"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); contentPane.setLayout(gridLayout1); this.setSize(new Dimension(400, 300)); this.setTitle("我是按钮"); jRadioButton1.setText("jRadioButton1"); contentPane.setMaximumSize(new Dimension(327, 327)); contentPane.add(jButton1, null); contentPane.add(jRadioButton1, 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 + -