📄 mediaframe_aboutbox.java
字号:
package javamediaplayer;import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.*;/** * Title: 使用Java制作的媒体播放器 * Description: 这个播放器利用了Java Media Frame API来实现主要功能 * Copyright: Copyright (c) 2003 * Company: 北京师范大学继续教育学院99计算机应用 * @author 郭汉文 * @version 1.0 */public class MediaFrame_AboutBox extends JDialog implements ActionListener { JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); JPanel insetsPanel1 = new JPanel(); JPanel insetsPanel2 = new JPanel(); JPanel insetsPanel3 = new JPanel(); JButton button1 = new JButton(); JLabel imageLabel = new JLabel(); JLabel label1 = new JLabel(); JLabel label2 = new JLabel(); JLabel label3 = new JLabel(); JLabel label4 = new JLabel(); BorderLayout borderLayout1 = new BorderLayout(); BorderLayout borderLayout2 = new BorderLayout(); FlowLayout flowLayout1 = new FlowLayout(); GridLayout gridLayout1 = new GridLayout(); String product = "\u4f7f\u7528Java\u5236\u4f5c\u7684\u5a92\u4f53\u64ad\u653e\u5668"; String version = "1.0"; String copyright = "Copyright (c) 2001"; String comments = "\u8fd9\u4e2a\u64ad\u653e\u5668\u5229\u7528\u4e86Java Media Frame API\u6765\u5b9e\u73b0\u4e3b\u8981\u529f\u80fd"; private JLabel label5 = new JLabel(); private JLabel label6 = new JLabel(); public MediaFrame_AboutBox(Frame parent) { super(parent); enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } pack(); } /**Component initialization*/ private void jbInit() throws Exception { //imageLabel.setIcon(new ImageIcon(MediaFrame_AboutBox.class.getResource("[Your Image]"))); this.setTitle("About"); setResizable(false); panel1.setLayout(borderLayout1); panel2.setLayout(borderLayout2); insetsPanel1.setLayout(flowLayout1); insetsPanel2.setLayout(flowLayout1); insetsPanel2.setBackground(new Color(105, 255, 184)); insetsPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); gridLayout1.setRows(6); gridLayout1.setColumns(1); label1.setForeground(Color.blue); label1.setText("Title: 使用Java制作的媒体播放器"); label2.setForeground(Color.blue); label2.setText("@version: 1.0"); label3.setForeground(Color.blue); label3.setText("Copyright: Copyright (c) 2003"); label4.setForeground(Color.blue); label4.setText("Description: 这个播放器利用了Java Media Frame API来实现主要功能"); insetsPanel3.setLayout(gridLayout1); insetsPanel3.setBackground(new Color(92, 255, 171)); insetsPanel3.setBorder(BorderFactory.createEmptyBorder(10, 60, 10, 10)); button1.setBackground(Color.yellow); button1.setForeground(Color.red); button1.setText("Ok"); button1.addActionListener(this); label5.setForeground(Color.blue); label5.setText("@author: 郭汉文"); label6.setText("Company: 北京师范大学继续教育学院99计算机应用"); label6.setForeground(Color.blue); panel1.setBackground(new Color(112, 255, 151)); insetsPanel1.setBackground(Color.green); panel2.setBackground(Color.green); imageLabel.setBackground(Color.green); insetsPanel3.add(label1, null); insetsPanel3.add(label3, null); insetsPanel3.add(label4, null); insetsPanel3.add(label6, null); insetsPanel3.add(label5, null); insetsPanel3.add(label2, null); panel2.add(insetsPanel2, BorderLayout.CENTER); insetsPanel2.add(imageLabel, null); panel2.add(insetsPanel3, BorderLayout.EAST); panel1.add(insetsPanel1, BorderLayout.SOUTH); insetsPanel1.add(button1, null); panel1.add(panel2, BorderLayout.NORTH); this.getContentPane().add(panel1, BorderLayout.CENTER); } /**Overridden so we can exit when window is closed*/ protected void processWindowEvent(WindowEvent e) { if (e.getID() == WindowEvent.WINDOW_CLOSING) { cancel(); } super.processWindowEvent(e); } /**Close the dialog*/ void cancel() { dispose(); } /**Close the dialog on a button event*/ public void actionPerformed(ActionEvent e) { if (e.getSource() == button1) { cancel(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -