本文整理了Java中javafx.scene.Scene.getStylesheets()
方法的一些代码示例,展示了Scene.getStylesheets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scene.getStylesheets()
方法的具体详情如下:
包路径:javafx.scene.Scene
类名称:Scene
方法名:getStylesheets
暂无
代码示例来源:origin: stackoverflow.com
public class Test extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
root.setId("pane");
Scene scene = new Scene(root, 300, 250);
scene.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
customScene.setUserAgentStylesheet(ownerScene.getUserAgentStylesheet());
customScene.getStylesheets().addAll(ownerScene.getStylesheets());
this.setPadding(new Insets(0));
dialog.setScene(customScene);
final EventHandler<KeyEvent> keyEventListener = key -> {
switch (key.getCode()) {
代码示例来源:origin: stackoverflow.com
import javafx.stage.*;
import javafx.application.*;
import javafx.scene.control.*;
import javafx.scene.*;
public class Love extends Application {
public void start(Stage stage) throws Exception {
Scene scene = new Scene(new Label("hello, world"));
scene.getStylesheets().add("love.css");
stage.setScene(scene);
stage.show();
}
}
代码示例来源:origin: com.powsybl/powsybl-gse-util
@Override
public void load(Scene scene) {
scene.getStylesheets().add(getClass().getResource("/css/groovy-keywords.css").toExternalForm());
scene.getStylesheets().add(getClass().getResource("/css/searchbar.css").toExternalForm());
}
}
代码示例来源:origin: stackoverflow.com
public void start(Stage primaryStage) throws Exception {
Scene scene = new Scene(new HBox());
primaryStage.setScene(scene);
//add this 3 lines
String css = Main.class.getResource("styles.css").toExternalForm();
scene.getStylesheets().clear();
scene.getStylesheets().add(css);
...
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void start(final Stage stage) throws Exception {
StackPane pane = new StackPane();
JFXSpinner root = new JFXSpinner();
pane.getChildren().add(root);
final Scene scene = new Scene(pane, 300, 300);
scene.getStylesheets().add(MainDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setScene(scene);
stage.setTitle("JFX Spinner Demo");
stage.show();
}
代码示例来源:origin: com.guigarage/ui-basics
public static void addToScene(Scene scene) {
scene.getStylesheets().add(IconFonts.class.getResource("fonts.css").toExternalForm());
}
代码示例来源:origin: stackoverflow.com
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
Scene scene = new Scene(new XOUltimateBoard().getView());
scene.getStylesheets().add("ultimate-board.css");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
代码示例来源:origin: org.loadui/testFx
@Override
public void run()
{
Scene scene = SceneBuilder
.create()
.root( getRootNode() ).build();
if( stylesheet != null )
scene.getStylesheets().add( stylesheet );
stage.setScene( scene );
}
}, 5 );
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void start(Stage primaryStage) throws Exception {
JFXToolbar jfxToolbar = new JFXToolbar();
jfxToolbar.setLeftItems(new Label("Left"));
jfxToolbar.setRightItems(new Label("Right"));
StackPane main = new StackPane();
main.getChildren().add(jfxToolbar);
Scene scene = new Scene(main, 600, 400);
scene.getStylesheets().add(ToolBarDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
}
代码示例来源:origin: io.github.factoryfx/javafxDataEditing
public static void addToScene(Scene scene ){
scene.getStylesheets().add(CssUtil.class.getResource("/de/factoryfx/javafx/css/app.css").toExternalForm());
}
代码示例来源:origin: stackoverflow.com
public void start(Stage primaryStage) {
Scene scene = new Scene(new Group(new Rectangle(100, 100)));
primaryStage.setScene(scene);
scene.getStylesheets().add("/style.css");
primaryStage.show();
}
代码示例来源:origin: at.bestsolution.eclipse/org.eclipse.fx.ui.controls
public DragFeedbackStage(Node n) {
this.n = n;
this.popupWindow = new Stage();
this.popupWindow.initStyle(StageStyle.TRANSPARENT);
// this.popupWindow.initOwner(n.getScene().getWindow());
this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$
this.popupWindow.setAlwaysOnTop(true);
StackPane root = new StackPane();
root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
Scene value = new Scene(root);
value.setFill(Color.TRANSPARENT);
this.popupWindow.setScene(value);
this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets());
this.popupWindow.getScene().setRoot(root);
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void start(Stage stage) {
FlowPane main = new FlowPane();
main.setVgap(20);
main.setHgap(20);
CheckBox cb = new CheckBox("CheckBox");
JFXCheckBox jfxCheckBox = new JFXCheckBox("JFX CheckBox");
JFXCheckBox customJFXCheckBox = new JFXCheckBox("Custom JFX CheckBox");
customJFXCheckBox.getStyleClass().add("custom-jfx-check-box");
main.getChildren().add(cb);
main.getChildren().add(jfxCheckBox);
main.getChildren().add(customJFXCheckBox);
StackPane pane = new StackPane();
pane.getChildren().add(main);
StackPane.setMargin(main, new Insets(100));
pane.setStyle("-fx-background-color:WHITE");
final Scene scene = new Scene(pane, 600, 200);
scene.getStylesheets().add(CheckBoxDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX CheckBox Demo ");
stage.setScene(scene);
stage.setResizable(false);
stage.show();
}
代码示例来源:origin: stackoverflow.com
private Parent replaceSceneContent(String fxml) throws Exception {
Parent page = (Parent)
FXMLLoader.load(
Main.class.getResource(fxml), null, new JavaFXBuilderFactory());
Scene scene = stage.getScene();
if (scene == null) {
scene = new Scene(page, 1366, 720);
scene.getStylesheets().add(
Main.class.getResource(
"../skinFolder/css/defaultSkin.css" ).toExternalForm());
stage.setScene(scene);
} else {
stage.getScene().setRoot(page);
}
stage.sizeToScene();
return page;
}
代码示例来源:origin: stackoverflow.com
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class HighlightOnHover extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Scene scene = new Scene(FXMLLoader.load(getClass().getResource("HighlightOnHover.fxml")));
scene.getStylesheets().add("highlight-on-hover.css");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
代码示例来源:origin: at.bestsolution.efxclipse.rt/org.eclipse.fx.ui.controls
public DragFeedbackStage(Node n) {
this.n = n;
this.popupWindow = new Stage();
this.popupWindow.initStyle(StageStyle.TRANSPARENT);
// this.popupWindow.initOwner(n.getScene().getWindow());
this.popupWindow.setUserData("findNodeExclude"); //$NON-NLS-1$
this.popupWindow.setAlwaysOnTop(true);
StackPane root = new StackPane();
root.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));
Scene value = new Scene(root);
value.setFill(Color.TRANSPARENT);
this.popupWindow.setScene(value);
this.popupWindow.getScene().getStylesheets().setAll(n.getScene().getStylesheets());
this.popupWindow.getScene().setRoot(root);
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void start(Stage stage) {
FlowPane main = new FlowPane();
main.setVgap(20);
main.setHgap(20);
main.getChildren().add(new Button("Java Button"));
JFXButton jfoenixButton = new JFXButton("JFoenix Button");
main.getChildren().add(jfoenixButton);
JFXButton button = new JFXButton("RAISED BUTTON");
button.getStyleClass().add("button-raised");
main.getChildren().add(button);
JFXButton button1 = new JFXButton("DISABLED");
button1.setDisable(true);
main.getChildren().add(button1);
StackPane pane = new StackPane();
pane.getChildren().add(main);
StackPane.setMargin(main, new Insets(100));
pane.setStyle("-fx-background-color:WHITE");
final Scene scene = new Scene(pane, 800, 200);
scene.getStylesheets().add(ButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
stage.setTitle("JFX Button Demo");
stage.setScene(scene);
stage.show();
}
代码示例来源:origin: stackoverflow.com
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
Parent root = null;
try {
root = (Pane) FXMLLoader.load(GameApp.class.getResource("/sample/buttonGrid.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(GameApp.class.getResource("/sample/Board.css").toExternalForm());
currentStage.setScene(scene);
currentStage.setResizable(false);
currentStage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
});
代码示例来源:origin: stackoverflow.com
import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class DynamicBorderColor extends Application {
@Override
public void start(Stage primaryStage) throws IOException {
Scene scene = new Scene(FXMLLoader.load(getClass().getResource("DynamicBorderColor.fxml")));
scene.getStylesheets().add("my-stylesheet.css");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
内容来源于网络,如有侵权,请联系作者删除!