?? aboutbox.java
字號:
package musicplayer;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.*;public class AboutBox extends JDialog implements ActionListener { private JPanel mainPanel = new JPanel(); private JPanel buttonPanel = new JPanel(); private JButton okBttn = new JButton(); private JLabel imageLabel = new JLabel(); private JLabel productLabel = new JLabel(); private JLabel versionLabel = new JLabel(); private JLabel copyrightLabel = new JLabel(); private GridLayout mainLayout = new GridLayout(); private static final String product = "音頻播放器"; private static final String version = "1.0"; private static final String copyright = "Copyright (c) MusicPlayer"; public AboutBox(Frame parent) { super(parent); enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { GuiInit(); } catch(Exception e) { e.printStackTrace(); } pack(); } private void GuiInit() throws Exception { this.setTitle("關于"); setResizable(false); mainPanel.setLayout(mainLayout); buttonPanel.setLayout(new BorderLayout() ); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); mainLayout.setRows(4); mainLayout.setColumns(1); productLabel.setText(product); versionLabel.setText(version); copyrightLabel.setText(copyright); okBttn.setText("確定"); okBttn.addActionListener(this); buttonPanel.add(okBttn); mainPanel.add(productLabel, null); mainPanel.add(versionLabel, null); mainPanel.add(copyrightLabel, null); this.getContentPane().add(mainPanel, BorderLayout.NORTH); this.getContentPane().add(buttonPanel, null); } protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { dispose(); } super.processWindowEvent(e); } public void actionPerformed(ActionEvent e) { if (e.getSource() == okBttn) { dispose(); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -