📄 testframe.java
字号:
package test.gui;import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.GridLayout;import javax.swing.JButton;import javax.swing.JFrame;public class TestFrame { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub JFrame frame = new JFrame("hello"); frame.setSize(500,200); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.setLayout(new GridLayout(3,2)); frame.setLayout(new FlowLayout()); JButton button1 = new JButton("傻"); JButton button2 = new JButton("孟"); JButton button3 = new JButton("是"); JButton button4 = new JButton("傻"); JButton button5 = new JButton("孟"); frame.add(button1,BorderLayout.WEST); frame.add(button2,BorderLayout.EAST); frame.add(button3,BorderLayout.SOUTH); frame.add(button4,BorderLayout.NORTH); frame.add(button5,BorderLayout.CENTER); System.out.println(frame.getLayout()); frame.setVisible(true); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -