-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDialogExample.java
More file actions
24 lines (20 loc) · 851 Bytes
/
DialogExample.java
File metadata and controls
24 lines (20 loc) · 851 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
import java.awt.Frame;
import java.lang.reflect.InvocationTargetException;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import org.drjekyll.fontchooser.FontDialog;
public class DialogExample implements Runnable {
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
ExampleRunner.useLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
ExampleRunner.invoke(new DialogExample());
}
@Override
public void run() {
FontDialog dialog = new FontDialog((Frame) null, "Select Font", true);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
if (!dialog.isCancelSelected()) {
System.out.printf("Selected font is: %s%n", dialog.getSelectedFont());
}
}
}