📄 myjmenuitem.java
字号:
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package documenteditor;import java.awt.Color;import javax.swing.Icon;import javax.swing.JMenuItem;/** * * @author Administrator */public class MyJMenuItem extends JMenuItem{ private JMenuItem self = null; private Color oldBack = null; public MyJMenuItem(){ super(null,(Icon)null); oldBack = this.getBackground(); self = this; addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { @Override public void mouseMoved(java.awt.event.MouseEvent evt) { self.setBackground(Color.BLUE); self.setForeground(Color.WHITE); } }); addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mouseExited(java.awt.event.MouseEvent evt) { self.setBackground(oldBack); self.setForeground(Color.BLACK); } }); } public void Huanyuan(){ self.setBackground(oldBack); self.setForeground(Color.BLACK); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -