forked from jgraph/mxgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFontSize.java
More file actions
43 lines (32 loc) · 808 Bytes
/
FontSize.java
File metadata and controls
43 lines (32 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.mxgraph.test;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
public class FontSize extends JFrame
{
/**
*
*/
private static final long serialVersionUID = -582322953993029295L;
public FontSize()
{
super("Hello, World!");
}
public void paint(Graphics g)
{
super.paint(g);
g.setFont(g.getFont().deriveFont(15.5f));
g.drawString("Hello, World", 50, 50);
g.setFont(g.getFont().deriveFont(10f));
((Graphics2D) g).scale(1.55, 1.55);
g.drawString("Hello, World", (int) (50/1.55) + 1, (int) (50/1.55) + 1);
System.out.println("Done");
}
public static void main(String[] args)
{
FontSize frame = new FontSize();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 320);
frame.setVisible(true);
}
}