本文整理了Java中javafx.scene.Scene.<init>()
方法的一些代码示例,展示了Scene.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Scene.<init>()
方法的具体详情如下:
包路径:javafx.scene.Scene
类名称:Scene
方法名:<init>
暂无
代码示例来源: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: stackoverflow.com
Stage dialog = new Stage();
dialog.initStyle(StageStyle.UTILITY);
Scene scene = new Scene(new Group(new Text(25, 25, "Hello World!")));
dialog.setScene(scene);
dialog.show();
代码示例来源:origin: stackoverflow.com
@Override
public void start(final Stage primaryStage) {
Button btn = new Button();
btn.setText("Open Dialog");
btn.setOnAction(
new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
final Stage dialog = new Stage();
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.initOwner(primaryStage);
VBox dialogVbox = new VBox(20);
dialogVbox.getChildren().add(new Text("This is a Dialog"));
Scene dialogScene = new Scene(dialogVbox, 300, 200);
dialog.setScene(dialogScene);
dialog.show();
}
});
}
代码示例来源:origin: pmd/pmd
private Stage createEditPropertyDialog() {
EditPropertyDialogController wizard = new EditPropertyDialogController();
FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("edit-property-dialog.fxml"));
loader.setController(wizard);
final Stage dialog = new Stage();
dialog.initOwner(this.getScene().getWindow());
dialog.initModality(Modality.WINDOW_MODAL);
dialog.initStyle(StageStyle.UNDECORATED);
Parent root;
try {
root = loader.load();
} catch (IOException e) {
throw new IllegalStateException(e);
}
Scene scene = new Scene(root);
dialog.setTitle("Edit property");
dialog.setScene(scene);
dialog.setUserData(wizard);
return dialog;
}
代码示例来源:origin: stackoverflow.com
Group group = new Group();
Scene scene = new Scene(group);
fxPanel.setScene(scene);
代码示例来源:origin: pmd/pmd
private Stage createStage(Stage mainStage) {
FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("event-log.fxml"));
loader.setController(this);
final Stage dialog = new Stage();
dialog.initOwner(mainStage.getScene().getWindow());
dialog.initModality(Modality.NONE);
Parent root;
try {
root = loader.load();
} catch (IOException e) {
throw new IllegalStateException(e);
}
Scene scene = new Scene(root);
dialog.setScene(scene);
return dialog;
}
代码示例来源:origin: stackoverflow.com
final Group root = new Group();
Button button = new Button("Add more windows");
primaryStage.setScene(new Scene(root, 600, 500));
代码示例来源:origin: speedment/speedment
@Override
public Parent loadAsModal(String name) {
final Stage mainStage = requireNonNull(userInterfaceComponent.getStage());
final Stage dialog = new Stage();
final Parent root = (Parent) load(name);
final Scene scene = new Scene(root);
BrandUtil.applyBrandToScene(injector, scene);
dialog.setTitle("About " + infoComponent.getTitle());
dialog.initModality(APPLICATION_MODAL);
brand.logoSmall().map(Image::new).ifPresent(dialog.getIcons()::add);
dialog.initOwner(mainStage);
dialog.setScene(scene);
dialog.show();
return root;
}
}
代码示例来源:origin: stackoverflow.com
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.text.Text;
import javafx.stage.Stage;
// displays the width in pixels of an arbitrary piece of text.
public class MeasureText extends Application {
public static void main(String[] args) { launch(args); }
@Override public void start(Stage stage) throws Exception {
final Text text = new Text("XYZZY");
new Scene(new Group(text));
// java 7 =>
// text.snapshot(null, null);
// java 8 =>
text.applyCss();
final double width = text.getLayoutBounds().getWidth();
stage.setScene(new Scene(new Label(Double.toString(width))));
stage.show();
}
}
代码示例来源:origin: stackoverflow.com
Group group = new Group();
group.getChildren().add(progressBar);
setScene(new Scene(group));
...
代码示例来源:origin: stackoverflow.com
Button b = new Button("Create new console");
b.setOnAction(new EventHandler<ActionEvent>(){
... action() {
new Stage(new Scene(new Group(new TextArea(DeploymentTaskController.actLogTArea.getText()))))).show();
}
});
代码示例来源: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
import javafx.application.Application;
import javafx.scene.*;
import javafx.scene.media.*;
import javafx.stage.Stage;
public class VideoPlayerExample extends Application {
public static void main(String[] args) throws Exception { launch(args); }
@Override public void start(final Stage stage) throws Exception {
final MediaPlayer oracleVid = new MediaPlayer(
new Media("http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv")
);
stage.setScene(new Scene(new Group(new MediaView(oracleVid)), 540, 208));
stage.show();
oracleVid.play();
}
}
代码示例来源:origin: stackoverflow.com
Group root= new Group();
AnchorPane frame=FXMLLoader.load(getClass().getResource("frame.fxml"));
AnchorPane content= FXMLLoader.load(getClass().getResource("principal.fxml"));
root.getChildren().add(window);
root.getChildren().add(frame);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
代码示例来源:origin: stackoverflow.com
public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
form1().show();
form2().show();
}
public static void main(String[] args) {
launch(args);
}
private Stage form1(){
Stage stage=new Stage();
stage.setTitle("Window 1");
stage.setScene(new Scene(new Group(new Button("Window 1"))));
return stage;
}
private Stage form2(){
Stage stage=new Stage();
stage.setTitle("Window 2");
stage.setScene(new Scene(new Group(new Button("Window 2"))));
return stage;
}
}
代码示例来源:origin: jfoenixadmin/JFoenix
@Override
public void start(Stage stage) {
FlowPane main = new FlowPane();
main.setVgap(20);
main.setHgap(20);
javafx.scene.control.ColorPicker picker = new javafx.scene.control.ColorPicker(Color.RED);
picker.getStyleClass().add("button");
// picker.getStyleClass().add("split-button");
main.getChildren().add(picker);
main.getChildren().add(new JFXColorPicker());
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: 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: stackoverflow.com
// Rotate camera to use Y up.
camera.setRotationAxis(Rotate.Z_AXIS);
camera.setRotate(180.0);
// Rotate scene content for correct drawing.
Group yUp = new Group();
yUp.setRotationAxis(Rotate.Z_AXIS);
yUp.setRotate(180.0);
Scene scene = new Scene(yUp);
scene.setCamera(camera);
代码示例来源: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
public void start(Stage stage) {
Scene scene = new Scene(new Group(), 300, 200);
stage.setScene(scene);
stage.titleProperty().bind(
scene.widthProperty().asString().
concat(" : ").
concat(scene.heightProperty().asString()));
stage.show();
}
内容来源于网络,如有侵权,请联系作者删除!