?? frame1.java
字號:
package ex05_06;import java.awt.*;import java.awt.event.*;import javax.swing.*;public class Frame1 extends JFrame { JPanel contentPane; JButton jButton1 = new JButton(); JLabel jLabel1 = new JLabel(); /**Construct the frame*/ public Frame1() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } /**Component initialization*/ private void jbInit() throws Exception { //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]"))); contentPane = (JPanel) this.getContentPane(); jButton1.setText("選擇安裝"); jButton1.setBounds(new Rectangle(60, 29, 97, 29)); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButton1_actionPerformed(e); } }); contentPane.setLayout(null); this.setSize(new Dimension(400, 300)); this.setTitle("Frame Title"); jLabel1.setFont(new java.awt.Font("Dialog", 1, 18)); jLabel1.setForeground(Color.red); jLabel1.setText("安裝模式"); jLabel1.setBounds(new Rectangle(70, 76, 82, 28)); contentPane.add(jButton1, null); contentPane.add(jLabel1, null); } /**Overridden so we can exit when window is closed*/ protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } void jButton1_actionPerformed(ActionEvent e) {int types;types=Integer.parseInt(JOptionPane.showInputDialog(this,"安裝模式:1.標準 2.簡易 3.自定義"));switch (types) { case 1: jLabel1.setText("標準安裝"); break; case 2: jLabel1.setText("簡易安裝"); break; case 3: jLabel1.setText("自定義安裝"); break; } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -