本文整理汇总了Java中javafx.scene.Scene.getStylesheets方法的典型用法代码示例。如果您正苦于以下问题:Java Scene.getStylesheets方法的具体用法?Java Scene.getStylesheets怎么用?Java Scene.getStylesheets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.Scene
的用法示例。
在下文中一共展示了Scene.getStylesheets方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EditorDialog
import javafx.scene.Scene; //导入方法依赖的package包/类
/**
* Instantiates a new Editor dialog.
*/
public EditorDialog() {
this.showedTime = LocalTime.now();
container = new VBox();
container.setAlignment(CENTER);
final EditorConfig editorConfig = EditorConfig.getInstance();
final CssColorTheme theme = editorConfig.getTheme();
final Scene scene = new Scene(container);
final ObservableList<String> stylesheets = scene.getStylesheets();
stylesheets.addAll(CSS_REGISTRY.getAvailableCssFiles());
stylesheets.add(theme.getCssFile());
createControls(container);
dialog = new Stage();
dialog.setTitle(getTitleText());
dialog.initStyle(StageStyle.UTILITY);
dialog.initModality(Modality.WINDOW_MODAL);
dialog.setResizable(isResizable());
dialog.setScene(scene);
configureSize(container);
}
示例2: start
import javafx.scene.Scene; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
Flow flow = new Flow(MainController.class);
DefaultFlowContainer container = new DefaultFlowContainer();
flowContext = new ViewFlowContext();
flowContext.register("Stage", stage);
flow.createHandler(flowContext).start(container);
JFXDecorator decorator = new JFXDecorator(stage, container.getView());
decorator.setCustomMaximize(true);
double width = 700;
double height = 200;
try {
Rectangle2D bounds = Screen.getScreens().get(0).getBounds();
width = bounds.getWidth() / 2.5;
height = bounds.getHeight() / 1.35;
} catch (Exception e) {
}
Scene scene = new Scene(decorator, width, height);
final ObservableList<String> stylesheets = scene.getStylesheets();
stylesheets.addAll(Main.class.getResource("/css/jfoenix-fonts.css").toExternalForm(),
Main.class.getResource("/css/jfoenix-design.css").toExternalForm(),
Main.class.getResource("/css/jhosts-main.css").toExternalForm());
stage.setScene(scene);
stage.show();
}
示例3: setPreferredStylesheets
import javafx.scene.Scene; //导入方法依赖的package包/类
public static void setPreferredStylesheets(Configuration config, Scene scene) {
ObservableList<String> stylesheets = scene.getStylesheets();
stylesheets.add(config.getCssfile());
Utils.addStylesheets(stylesheets);
log.info(stylesheets.toString());
}