📄 matrixframe.java
字号:
package datastructure;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
class MatrixFrame
extends AnimationFrame
implements ActionListener {
private JButton helpButton;
private JButton closeButton;
private Matrix matrix;
static MatrixDia matrixdia;
private boolean flag = true;
// private JButton closeButton;
// private JButton musicButton = new JButton("播放音乐");
private JButton musicButton = new JButton("播放音乐");
public MatrixFrame(Root rootui) {
super("矩阵快速转置算法演示窗口 (南昌航空工业学院-软件学院)", rootui);
helpButton = new JButton("帮 助");
helpButton.setToolTipText("查看帮助");
helpButton.addActionListener(this);
closeButton = new JButton("退 出");
closeButton.setToolTipText("退出演示窗口");
closeButton.addActionListener(this);
musicButton.addActionListener(this);
matrix = new Matrix();
matrixdia = new MatrixDia(this, "建立演示数据对话框", true);
init();
}
public void kill() {
matrix.stop();
}
public void Start() {
matrix.start();
}
public void init() {
addWindowListener(new WindowClose(this, false));
super.initBase();
super.controlPanel.add(matrix.newButton);
super.controlPanel.add(matrix.runButton);
super.controlPanel.add(matrix.stepButton);
super.controlPanel.add(matrix.stayButton);
super.controlPanel.add(helpButton);
super.controlPanel.add(closeButton);
super.controlPanel.add(musicButton);
Container con = this.getContentPane();
con.add(matrix, BorderLayout.CENTER);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == helpButton) {
if (Root.helpFrame != null) {
Root.helpFrame.dispose();
}
Root.helpFrame = new HelpFrame("/help/matrix.html", super.root);
Root.helpFrame.setLocation(200, 100);
Root.helpFrame.showNewHtmlPage("/help/matrix.html");
Root.helpIsOn = true;
Root.helpFrame.setVisible(true);
}
else if (e.getSource() == closeButton) {
Root.clip.stop();
this.setVisible(false);
}
else if (e.getSource() == musicButton) {
if (flag) {
Root.clip.loop();
musicButton.setText("关闭音乐");
flag = !flag;
}
else {
Root.clip.stop();
musicButton.setText("播放音乐");
flag = !flag;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -