| 18 |
import javafx.scene.control.ButtonType; |
import javafx.scene.control.ButtonType; |
| 19 |
import javafx.scene.control.DialogPane; |
import javafx.scene.control.DialogPane; |
| 20 |
import javafx.scene.image.Image; |
import javafx.scene.image.Image; |
| 21 |
|
import javafx.scene.text.Font; |
| 22 |
import javafx.stage.Stage; |
import javafx.stage.Stage; |
| 23 |
import javafx.stage.Window; |
import javafx.stage.Window; |
| 24 |
|
|
| 25 |
public class Dialogs { |
public class Dialogs { |
| 26 |
|
|
| 27 |
protected static final Map<ButtonType, String> buttonTexts = new HashMap<ButtonType, String>(); |
protected static final Map<ButtonType, String> buttonTexts = new HashMap<ButtonType, String>(); |
| 28 |
|
private static double fontSize = 0; |
| 29 |
|
|
| 30 |
static { |
static { |
| 31 |
String BASE_NAME = "com/sun/javafx/scene/control/skin/resources/controls"; |
String BASE_NAME = "com/sun/javafx/scene/control/skin/resources/controls"; |
| 54 |
} |
} |
| 55 |
} |
} |
| 56 |
|
|
| 57 |
|
public static void setFontSize(double fontSize) { |
| 58 |
|
Dialogs.fontSize = fontSize; |
| 59 |
|
} |
| 60 |
|
|
| 61 |
public static ButtonType showInformation(String message) { |
public static ButtonType showInformation(String message) { |
| 62 |
return show(AlertType.INFORMATION, null, null, null, message, new ButtonType[] { ButtonType.OK }); |
return show(AlertType.INFORMATION, null, null, null, message, new ButtonType[] { ButtonType.OK }); |
| 63 |
} |
} |
| 140 |
} |
} |
| 141 |
} |
} |
| 142 |
|
|
| 143 |
|
boolean isWindows = System.getProperty("os.name", "").toLowerCase().startsWith("windows"); |
| 144 |
|
if(isWindows) { |
| 145 |
|
if(fontSize > 0) { |
| 146 |
|
dialog.getDialogPane().setStyle("-fx-font-family: Meiryo; -fx-font-size: " + fontSize); |
| 147 |
|
} else { |
| 148 |
|
dialog.getDialogPane().setStyle("-fx-font-family: Meiryo"); |
| 149 |
|
} |
| 150 |
|
} else { |
| 151 |
|
if(fontSize > 0) { |
| 152 |
|
dialog.getDialogPane().setStyle("-fx-font-size: " + fontSize); |
| 153 |
|
} else { |
| 154 |
|
dialog.getDialogPane().setStyle(""); |
| 155 |
|
} |
| 156 |
|
} |
| 157 |
|
|
| 158 |
dialog.setTitle(title); |
dialog.setTitle(title); |
| 159 |
dialog.setHeaderText(null); |
dialog.setHeaderText(null); |
| 160 |
if(icon != null) { |
if(icon != null) { |