📄 helppanel.java
字号:
package hannota;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class HelpPanel extends JPanel {
BorderLayout bd = new BorderLayout();
JButton jbuttonOne = new JButton(new ImageIcon(
"image/returnButtonImage.jpg"));
JLabel lable = new JLabel(new ImageIcon("image/helpBackground.jpg"));
CardLayout card;
JPanel fatherPanel;
public HelpPanel(CardLayout card, JPanel fatherPanel) {
this.fatherPanel = fatherPanel;
this.card = card;
start();
}
private void start() {
this.setBackground(Color.BLUE);
// 注册键盘事件
//这个代码可以实现快捷方式
jbuttonOne.setMnemonic(KeyEvent.VK_F);
jbuttonOne.setActionCommand("jbuttonOne");
jbuttonOne.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jbuttonOne) {
card.show(fatherPanel, "navigatapanel");
}
}
});
this.setLayout(null);
jbuttonOne.setBounds(272, 359, 100, 30);
lable.setBounds(0, 0, 649, 429);
this.add(jbuttonOne);
this.add(lable);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -