|
@@ -17,8 +17,8 @@ import java.util.Map;
|
|
|
public class GenerateImage {
|
|
|
private static final int WIDTH = 120; // 图片宽度
|
|
|
private static final int HEIGHT = 45; // 图片高度
|
|
|
- private static String IMAGE_FORMAT = "JPG";
|
|
|
- private static Color[] COLORS = new Color[]{
|
|
|
+ private static final String IMAGE_FORMAT = "JPG";
|
|
|
+ private static final Color[] COLORS = new Color[]{
|
|
|
new Color(0, 0, 255),
|
|
|
new Color(0, 255, 0),
|
|
|
new Color(255, 0, 0)
|
|
@@ -57,7 +57,7 @@ public class GenerateImage {
|
|
|
File fontFile = new ClassPathResource("font/SourceHanSansSC-Regular-2.otf").getFile();
|
|
|
font = Font.createFont(Font.TRUETYPE_FONT, fontFile);
|
|
|
}
|
|
|
- font.deriveFont((float) (HEIGHT - 10));
|
|
|
+ font = font.deriveFont((float) (HEIGHT - 10));
|
|
|
graphics.setFont(font);
|
|
|
|
|
|
int desX, desY, distance = 16;
|