📄 utilities.java
字号:
import java.awt.*;
import javax.swing.*;
/** This is a utility class that stores information about the software.Information including
* colors, fonts, size of different components etc.
*/
class Utilities{
private static String name="Typing Fingers";
private static Color backcolor=new Color(200,255,200),forecolor=Color.orange;
private static Color textColor=Color.black;
private static int typingFrameWidth;
private static int typingFrameHeight;
private static Color highlightColor=Color.black;
private static Font dialogFont=new Font("Times new Roman",Font.BOLD,16);
private static Color foreColor=Color.cyan;
private static Color errorColor=Color.red;
private static int labelHeight;
public static final int ALPHABETIC=0,NUMERIC=1,BOTH=2;
public static final int SPEED_GRAPH_WIDTH=225;
public static final int SPEED_GRAPH_HEIGHT=365;
public static final int KEYBOARD_WIDTH=440;
public static final int KEYBOARD_HEIGHT=175;
private static Dimension screen;
//static block to initialize variables
static {
screen=getScreenSize();
labelHeight=20;
typingFrameWidth=(int)((screen.width - SPEED_GRAPH_WIDTH ) * .95);
typingFrameHeight=(int)((screen.height - KEYBOARD_HEIGHT) * .85 );
}
public static ImageIcon getIcon(){
return new ImageIcon(System.getProperty("user.dir")+"images/icon.gif");
}
public static String getName(){
return name;
}
public static Color getBackground(){
return backcolor;
}
public static Color getTextColor(){
return textColor;
}
public static Color getHighLightColor(){
return highlightColor;
}
public static int getTypingComponentHeight(){
return typingFrameHeight;
}
public static Font getDialogFont(){
return dialogFont;
}
public static Color getForeColor(){
return foreColor;
}
public static int getLabelHeight(){
return labelHeight;
}
public static int getLineWidth(){
return (typingFrameWidth-20);
}
public static int getIndent(){
return (int)(screen.width/32);
}
public static Dimension getTypingFrameSize(){
return new Dimension(typingFrameWidth,typingFrameHeight);
}
public static Color getErrorColor(){
return errorColor;
}
public static int getFrameIndent(){
return screen.height/100;
}
public static Dimension getScreenSize(){
return Toolkit.getDefaultToolkit().getScreenSize();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -