⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hellojframe.java

📁 教你如何使用ANT来写JAVA脚本,这里边是ANT教程的示例.
💻 JAVA
字号:
import java.awt.BorderLayout;import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JOptionPane;import javax.swing.UIManager;import javax.swing.UnsupportedLookAndFeelException;import javax.swing.WindowConstants;public class HelloJFrame extends javax.swing.JFrame {	private JButton jButton1;	/**	* Auto-generated main method to display this JFrame	*/	public static void main(String[] args) {		try {			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());					} catch (Exception e) {			try {				UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());			} catch (ClassNotFoundException e1) {				// TODO Auto-generated catch block				e1.printStackTrace();			} catch (InstantiationException e1) {				// TODO Auto-generated catch block				e1.printStackTrace();			} catch (IllegalAccessException e1) {				// TODO Auto-generated catch block				e1.printStackTrace();			} catch (UnsupportedLookAndFeelException e1) {				// TODO Auto-generated catch block				e1.printStackTrace();			}		}		HelloJFrame inst = new HelloJFrame();		inst.setVisible(true);	}		public HelloJFrame() {		super();		initGUI();	}		private void initGUI() {		try {			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);			FlowLayout thisLayout = new FlowLayout();			getContentPane().setLayout(thisLayout);			this.setTitle("Ant Test Frame");			{				jButton1 = new JButton();				getContentPane().add(jButton1);				jButton1.setText("Hello");				jButton1.addActionListener(new ActionListener() {					public void actionPerformed(ActionEvent evt) {						jButton1ActionPerformed(evt);					}				});			}			pack();			setSize(400, 300);		} catch (Exception e) {			e.printStackTrace();		}	}		private void jButton1ActionPerformed(ActionEvent evt) {		System.out.println("jButton1.actionPerformed, event=" + evt);		JOptionPane.showMessageDialog(this, "Hello JFrame!");	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -