📄 myfont.java
字号:
import java.awt.Color;
import java.awt.Font;
import java.util.StringTokenizer;
public class MyFont{
public String color;
public int size;
public String fontName;
public int style;
public boolean isUnderLine;
public MyFont(){
this.color = "black";
size = 3;
fontName = "宋体";
style = Font.PLAIN;
isUnderLine = false;
}
public MyFont(Color color,int size,String fontName,
int style,
boolean isUnderLine){
this.color = MyUtilities.getColor0XFromRGB(color);
this.size = size;
this.fontName = fontName;
this.style = style;
this.isUnderLine = isUnderLine;
}
public String toString(){
StringBuffer sb = new StringBuffer();
sb.append(color);
sb.append("&");
sb.append(size);
sb.append("&");
sb.append(fontName);
sb.append("&");
sb.append(style);
sb.append("&");
sb.append(isUnderLine);
return String.valueOf(sb);
}
public static MyFont createMyFont(String str){
MyFont font = new MyFont();
StringTokenizer st = new StringTokenizer(str,"&");
font.color = st.nextToken();
font.size = Integer.parseInt(st.nextToken());
font.fontName = st.nextToken();
font.style = Integer.parseInt(st.nextToken());
font.isUnderLine = Boolean.parseBoolean(st.nextToken());
return font;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -