📄 binsearchframe.java
字号:
package datastructure;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class BinsearchFrame
extends AnimationFrame
implements ActionListener {
Binsearch Binsearch;
private JButton helpButton;
private JButton closeButton;
private boolean flag = true;
private JButton musicButton = new JButton("播放音乐");
static DataInput newData;
// private JButton codeButton;
public BinsearchFrame(Root rootui) {
super("折半查找算法演示 (南昌航空工业学院-软件学院)", rootui);
Binsearch = new Binsearch();
init();
}
public void kill() {
Binsearch.stop();
}
public void Start() {
Binsearch.start();
}
public void init() {
super.initBase();
addWindowListener(new WindowClose(this, false));
Container con = this.getContentPane();
con.add(Binsearch, BorderLayout.CENTER);
Binsearch.init();
super.controlPanel.add(Binsearch.newButton);
super.controlPanel.add(Binsearch.runButton);
super.controlPanel.add(Binsearch.stepButton);
super.controlPanel.add(Binsearch.stayButton);
helpButton = new JButton("帮 助");
musicButton.addActionListener(this);
closeButton = new JButton("退 出");
closeButton.setToolTipText("退出演示窗口");
closeButton.addActionListener(this);
super.controlPanel.add(helpButton);
super.controlPanel.add(closeButton);
super.controlPanel.add(musicButton);
helpButton.addActionListener(this);
newData = new DataInput(this, "建立有序表", true);
newData.setVisible(false);
}
public void actionPerformed(ActionEvent actionevent) {
if (actionevent.getSource() == helpButton) {
if (Root.helpFrame != null) {
Root.helpFrame.dispose();
}
Root.helpFrame = new HelpFrame("/help/binSearch.html", super.root);
Root.helpFrame.setLocation(200, 100);
Root.helpFrame.showNewHtmlPage("/help/binSearch.html");
Root.helpIsOn = true;
Root.helpFrame.setVisible(true);
}
else if (actionevent.getSource() == closeButton) {
Root.clip.stop();
this.setVisible(false);
}
else if (actionevent.getSource() == musicButton) {
if (flag) {
Root.clip.loop();
musicButton.setText("关闭音乐");
flag = !flag;
}
else {
Root.clip.stop();
musicButton.setText("播放音乐");
flag = !flag;
}
}
/* if(actionevent.getSource()==codeButton)
{
if(codeButton.getText()=="代码显示")
{ Binsearch.eastPanel.remove(Binsearch.codePanel);
Dialog codeDia = new Dialog(this, "折半查找算法演示代码", false);
codeDia.pack();
codeDia.setLayout(new FlowLayout());
codeDia.setBounds(350,50,450,500);
codeDia.setBackground(Color.white);
codeDia.add(Binsearch.codePanel);
Binsearch.codePanel.setLabelFont();
codeDia.setVisible(true);
codeButton.setText("关闭代码");
}
else
{
}
}*/
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -