📄 cubemenu.java
字号:
import javax.swing.*;
import java.awt.*;
/*
* Created on 2005-6-17
*
*/
/**
* @author zhangjian http://www.ismyway.com
*/
public class CubeMenu extends JMenu {
protected final void paintComponent(Graphics g) {
Graphics2D graphics = (Graphics2D) g;
Object oldHint = graphics
.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
super.paintComponent(graphics);
graphics
.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, oldHint);
graphics.setColor(ImageCreator.mainMidColor);
graphics.setBackground(ImageCreator.mainMidColor);
graphics.fillRect(0, 0, this.getWidth(), this.getHeight());
int x = (this.getWidth() - graphics.getFontMetrics().stringWidth(
this.getText())) / 4;
int y = (int) (graphics.getFontMetrics().getLineMetrics(this.getText(),
graphics).getHeight());
graphics.setColor(Color.black);
graphics.drawString(this.getText(), x + 1, y + 1);
graphics.setColor(Color.white);
graphics.drawString(this.getText(), x, y);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -