Develop and Download Open Source Software

Browse Subversion Repository

Diff of /fx-util/trunk/src/main/java/net/osdn/util/javafx/scene/control/Dialogs.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 258 by hirukawa_ryo, Wed Nov 18 06:41:28 2020 UTC revision 259 by hirukawa_ryo, Sun Jan 8 08:22:23 2023 UTC
# Line 18  import javafx.scene.control.Button; Line 18  import javafx.scene.control.Button;
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";
# Line 52  public class Dialogs { Line 54  public class Dialogs {
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          }          }
# Line 134  public class Dialogs { Line 140  public class Dialogs {
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) {

Legend:
Removed from v.258  
changed lines
  Added in v.259

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26