📄 test.java
字号:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Test extends JApplet implements ActionListener
{
UseFan f;
JButton BtStart;
JButton BtStop;
JButton BtReverse;
public static Scrollbar srb = new Scrollbar(Scrollbar.HORIZONTAL,100,100,100,1000);
public void init()
{
JPanel p = new JPanel();
BtStart = new JButton("Start");
BtStop = new JButton("Stop");
BtReverse = new JButton("Reverse");
p.setLayout(new FlowLayout(FlowLayout.LEFT));
p.add(BtStart);
p.add(BtStop);
p.add(BtReverse);
f = new UseFan();
getContentPane().add(p,BorderLayout.NORTH);
getContentPane().add(f,BorderLayout.CENTER);
getContentPane().add(srb,BorderLayout.SOUTH);
BtStart.addActionListener(this);
BtStop.addActionListener(this);
BtReverse.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == BtStart)
{
f.resume();
}
else if (e.getSource() == BtStop)
{
f.suspend();
}
else if (e.getSource() == BtReverse)
{
f.reverse();
}
}
public static void main(String[] args)
{
Test fancontrol = new Test();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -