📄 frame1.java
字号:
package xyandgridbaglayout;import java.awt.*;import java.awt.event.*;import javax.swing.*;import com.borland.jbcl.layout.*;public class Frame1 extends JFrame { JPanel contentPane; Button button1 = new Button(); Button button2 = new Button(); Button button3 = new Button(); Button button4 = new Button(); Button button5 = new Button(); XYLayout xYLayout1 = new XYLayout(); /**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(); button1.setLabel("button1"); contentPane.setLayout(xYLayout1); this.setSize(new Dimension(363, 262)); this.setTitle("XYLayout、GridBagLayout演示程序"); button2.setLabel("button2"); button3.setLabel("button3"); button4.setLabel("button4"); button5.setLabel("button5"); contentPane.add(button1, new XYConstraints(22, 29, 198, 54)); contentPane.add(button2, new XYConstraints(7, 92, 79, 146)); contentPane.add(button3, new XYConstraints(103, 97, 215, 20)); contentPane.add(button4, new XYConstraints(230, 15, 127, 67)); contentPane.add(button5, new XYConstraints(93, 131, 265, 106)); } /**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); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -