testframe.java

来自「自己做的一个QQ聊天系统」· Java 代码 · 共 38 行

JAVA
38
字号
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 + =
减小字号Ctrl + -
显示快捷键?