📄 demoflowlayout.java
字号:
/*
* DemoFlowLayout.java
*
* Created on 2007年7月31日, 下午9:16
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.Adam;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
/**
*
* @author Administrator
*/
public class DemoFlowLayout extends JFrame implements ActionListener{
JButton buttonAction;
/** Creates a new instance of DemoFlowLayout */
public DemoFlowLayout() {
this.setLayout(new FlowLayout());
buttonAction=new JButton("动作按钮");
buttonAction.addActionListener(this);
this.add(buttonAction);
this.setBounds(150,150,350,120);
this.setTitle("FlowLayout完整示例");
this.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==buttonAction){
JButton buttonCommon=new JButton("普通按钮");
this.add(buttonCommon);
this.validate();
}
}
public static void main(String[] args) {
new DemoFlowLayout().setVisible(true);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -