SWING example
来源:互联网 发布:类图用什么软件画 编辑:程序博客网 时间:2024/06/08 19:20
Just a start-up example , let you get a rough idea how to init a desktop application:
import java.awt.Image;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;public class TestJFrame {/** * @param args */public static void main(String[] args) {// TODO Auto-generated method stubJFrame frame = new JFrame();JPanel panel = new JPanel();JButton button = new JButton();button.setText("im Paul");button.setSize(50, 50);button.addActionListener(new LoveListener(panel));panel.add("Center", button);frame.add(panel);//frame.show();//frame.setBounds(10, 10, 10, 10);//frame.pack();frame.setSize(100, 100);JFrame.setDefaultLookAndFeelDecorated(true);Image icon = Toolkit.getDefaultToolkit().getImage("icon.png");frame.setIconImage(icon);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setVisible(true);}static class LoveListener implements ActionListener{private JPanel panel;public LoveListener(JPanel panel){this.panel=panel;}@Overridepublic void actionPerformed(ActionEvent e) {JOptionPane.showMessageDialog(panel, "Love Haohao!");System.out.println("Love Haohao!");}}}
to be continued
- SWING example
- Swing Example
- SWING WORKER EXAMPLE
- example
- example
- Example
- example
- Example
- Example
- Example
- Example
- example
- Example
- Example
- Swing
- Swing..........
- swing
- swing
- nginx 的 nginx.conf 中文详解
- Android的SharedPreferences实用技巧
- UVA 11995 I Can Guess the Data Structure!
- Spring 3.1.1使用Mvc配置全局日期转换器,处理日期转换异常
- Ubuntu11.04不能更新软件源
- SWING example
- UVA 11991 Easy Problem from Rujia Liu?
- strcmp函数的使用的一个坑
- STL函数对象:定义、及其在STL中的应用
- UVALive 3135 Argus
- UVA 11997 K Smallest Sums
- 一个疑问
- java内存泄漏的定位与分析
- Java线程范围变量——ThreadLocal的模拟和解释