当前位置: 首页>>代码示例>>Java>>正文


Java SceneBuilder类代码示例

本文整理汇总了Java中javafx.scene.SceneBuilder的典型用法代码示例。如果您正苦于以下问题:Java SceneBuilder类的具体用法?Java SceneBuilder怎么用?Java SceneBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SceneBuilder类属于javafx.scene包,在下文中一共展示了SceneBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import javafx.scene.SceneBuilder; //导入依赖的package包/类
@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("JavaFX Video");
    final List<String> args = getParameters().getRaw();
    
    String url = args.size() > 0 ?
        args.get(args.size() - 1) :
            "http://www.mediacollege.com/" +
            "video-gallery/testclips/20051210-w50s.flv";
    Media media = new Media(url);
            
    MediaPlayer player = new MediaPlayer(media);
    player.play();

    MediaView view = new MediaView(player);
    Group root = new Group();
    root.getChildren().add(view);
    Scene scene = SceneBuilder.create().
            width(360).height(288).
            root(root).
            fill(Color.WHITE).
            build();
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
开发者ID:shashanksingh28,项目名称:code-similarity,代码行数:26,代码来源:JfxVideo.java

示例2: execute

import javafx.scene.SceneBuilder; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void execute(final Wave wave) {

    LOGGER.info("Display a pop up from JAT");

    final Stage s = StageBuilder.create()
            .title("Sample Ui Command Test")
            .style(StageStyle.DECORATED)
            .scene(SceneBuilder.create()
                    .root(LabelBuilder.create().text("Run into JAT").build())
                    .build())

            .build();

    s.show();
    // Sample for popup => Attach owner !!!
    // getLocalFacade().getGlobalFacade().getApplication().getStage()
}
 
开发者ID:CompendiumNG,项目名称:fxpoc,代码行数:22,代码来源:SampleUICommand.java

示例3: start

import javafx.scene.SceneBuilder; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

    final Group innerGroup = createSixRectangles();
    final Group outerGroup = new Group(innerGroup);

    final ScrollPane scrollPane = new ScrollPane();
    scrollPane.setContent(outerGroup);
    scrollPane.setOnScroll(new ZoomHandler(innerGroup));

    StackPane stackPane = new StackPane();
    stackPane.getChildren().add(scrollPane);

    Scene scene = SceneBuilder.create()
            .width(WINDOW_WIDTH)
            .height(WINDOW_HEIGHT)
            .root(stackPane)
            .build();

    stage.setScene(scene);
    stage.show();
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:23,代码来源:ZoomApp.java

示例4: handle

import javafx.scene.SceneBuilder; //导入依赖的package包/类
@Override
public void handle(final ActionEvent event) {
	if (item.getStatus().isRunning()) {
		return;
	}
	try {
		final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource("/de/chaosfisch/uploader/view/ConfirmDialog.fxml"), resources);
		final ConfirmDialogController controller = result.getController();
		controller.setTitle(resources.getString("dialog.removeupload.title"));
		controller.setMessage(resources.getString("dialog.removeupload.message"));

		final Parent parent = result.getRoot();
		final Scene scene = SceneBuilder.create().root(parent).build();
		final Stage stage = StageBuilder.create().scene(scene).build();
		stage.initStyle(StageStyle.UNDECORATED);
		stage.initModality(Modality.APPLICATION_MODAL);
		stage.showAndWait();
		stage.requestFocus();
		if (controller.ask()) {
			uploadService.delete(upload);
		}
	} catch (final IOException e) {
		logger.error("Couldn't load ConfirmDialog", e);
	}
}
 
开发者ID:dennisfischer,项目名称:simplejavayoutubeuploader,代码行数:26,代码来源:QueueUploadCellRenderer.java

示例5: showPlaylistAddDialog

import javafx.scene.SceneBuilder; //导入依赖的package包/类
public void showPlaylistAddDialog() {
	try {
		final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource(
				"/de/chaosfisch/uploader/view/PlaylistAddDialog.fxml"), resources);
		final Parent parent = result.getRoot();

		final Scene scene = SceneBuilder.create().root(parent).build();
		final Stage stage = StageBuilder.create().scene(scene).build();
		stage.initStyle(StageStyle.UNDECORATED);
		stage.initModality(Modality.APPLICATION_MODAL);
		stage.requestFocus();
		stage.showAndWait();
	} catch (final IOException e) {
		logger.error("Couldn't load PlaylistAddDialog", e);
	}
}
 
开发者ID:dennisfischer,项目名称:simplejavayoutubeuploader,代码行数:17,代码来源:DialogHelper.java

示例6: showErrorDialog

import javafx.scene.SceneBuilder; //导入依赖的package包/类
public void showErrorDialog(final String title, final String message) {
	try {
		final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource(
				"/de/chaosfisch/uploader/view/ErrorDialog.fxml"), resources);
		final ErrorDialogController controller = result.getController();
		controller.setTitle(title);
		controller.setMessage(message);

		final Parent parent = result.getRoot();
		final Scene scene = SceneBuilder.create().root(parent).build();
		final Stage stage = StageBuilder.create().scene(scene).build();
		stage.initStyle(StageStyle.UNDECORATED);
		stage.initModality(Modality.APPLICATION_MODAL);
		stage.showAndWait();
		stage.requestFocus();
	} catch (final IOException e) {
		logger.error("Couldn't load ConfirmDialog", e);
	}
}
 
开发者ID:dennisfischer,项目名称:simplejavayoutubeuploader,代码行数:20,代码来源:DialogHelper.java

示例7: showInputDialog

import javafx.scene.SceneBuilder; //导入依赖的package包/类
public void showInputDialog(final String title, final String input, final Callback callback, final boolean blocking) {
	try {
		final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource(
				"/de/chaosfisch/uploader/view/InputDialog.fxml"), resources);
		final Parent parent = result.getRoot();
		final InputDialogController controller = result.getController();
		controller.setTitle(resources.containsKey(title) ? resources.getString(title) : title);
		controller.setInput(resources.containsKey(input) ? resources.getString(input) : input);
		controller.setCallback(callback);

		final Scene scene = SceneBuilder.create().fill(Color.TRANSPARENT).root(parent).build();
		final Stage stage = StageBuilder.create().scene(scene).build();
		stage.initStyle(StageStyle.UNDECORATED);
		stage.initModality(Modality.APPLICATION_MODAL);
		if (blocking) {
			stage.showAndWait();
		} else {
			stage.show();
		}
		stage.requestFocus();
	} catch (final IOException e) {
		logger.error("Couldn't load InputDialog", e);
	}
}
 
开发者ID:dennisfischer,项目名称:simplejavayoutubeuploader,代码行数:25,代码来源:DialogHelper.java

示例8: showAccountPermissionsDialog

import javafx.scene.SceneBuilder; //导入依赖的package包/类
public void showAccountPermissionsDialog(final Account account) {
	try {
		final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource(
				"/de/chaosfisch/uploader/view/AccountAddDialog.fxml"), resources);
		final Parent parent = result.getRoot();
		((AccountAddDialogController) result.getController()).initAuth(account);

		final Scene scene = SceneBuilder.create().root(parent).build();
		final Stage stage = StageBuilder.create().scene(scene).build();
		stage.initStyle(StageStyle.DECORATED);
		stage.initModality(Modality.APPLICATION_MODAL);
		stage.setResizable(true);
		stage.requestFocus();
		stage.showAndWait();
	} catch (final Exception e) {
		logger.error("Couldn't load AccountAddDialog", e);
	}
}
 
开发者ID:dennisfischer,项目名称:simplejavayoutubeuploader,代码行数:19,代码来源:DialogHelper.java

示例9: startQueue

import javafx.scene.SceneBuilder; //导入依赖的package包/类
@FXML
void startQueue(final ActionEvent event) {
	try {
		final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource("/de/chaosfisch/uploader/view/ConfirmDialog.fxml"), resources);
		final ConfirmDialogController controller = result.getController();
		controller.setTitle(resources.getString("dialog.youtubetos.title"));
		controller.setMessage(resources.getString("dialog.youtubetos.message"));

		final Parent parent = result.getRoot();
		final Scene scene = SceneBuilder.create().root(parent).build();
		final Stage stage = StageBuilder.create().scene(scene).build();
		stage.initStyle(StageStyle.UNDECORATED);
		stage.initModality(Modality.APPLICATION_MODAL);
		stage.showAndWait();
		stage.requestFocus();
		if (controller.ask()) {
			uploadService.startUploading();
		}
	} catch (final IOException e) {
		logger.error("Couldn't load ConfirmDialog", e);
	}
}
 
开发者ID:dennisfischer,项目名称:simplejavayoutubeuploader,代码行数:23,代码来源:QueueCommandController.java

示例10: handle

import javafx.scene.SceneBuilder; //导入依赖的package包/类
@Override
public void handle(final WindowEvent event) {
	try {
		final GuiceFXMLLoader.Result result = fxmlLoader.load(getClass().getResource("/de/chaosfisch/uploader/view/ConfirmDialog.fxml"), resources);
		final ConfirmDialogController controller = result.getController();
		controller.setTitle(resources.getString("dialog.exitapplication.title"));
		controller.setMessage(resources.getString("dialog.exitapplication.message"));

		final Parent parent = result.getRoot();
		final Scene scene = SceneBuilder.create().root(parent).build();
		final Stage stage = StageBuilder.create().scene(scene).build();
		stage.initStyle(StageStyle.UNDECORATED);
		stage.initModality(Modality.APPLICATION_MODAL);
		stage.showAndWait();
		stage.requestFocus();
		if (!controller.ask()) {
			event.consume();
		} else {
			Platform.exit();
		}
	} catch (final IOException e) {
		LOGGER.error("Couldn't load ConfirmDialog", e);
	}
}
 
开发者ID:dennisfischer,项目名称:simplejavayoutubeuploader,代码行数:25,代码来源:GUIUploader.java

示例11: start

import javafx.scene.SceneBuilder; //导入依赖的package包/类
@Override
public void start (Stage primaryStage) throws Exception
{
	instance = this;

	restClient = new RestClient (SERVER_URI);
	vault = new Vault (fetchKeys ());

	FXMLLoader loader = new FXMLLoader (App.class.getResource ("main.fxml"));
	Parent root = (Parent) loader.load ();

	Scene scene = SceneBuilder.create ()
			.root (root)
			.stylesheets ("com/bitsofproof/btc1k/fx/main.css")
			.build ();

	StageBuilder.create ()
			.title ("BTC-1K")
			.scene (scene)
			.minWidth (600)
			.minHeight (600)
			.applyTo (primaryStage);

	primaryStage.show ();

}
 
开发者ID:bitsofproof,项目名称:btc1k,代码行数:27,代码来源:App.java

示例12: initGui

import javafx.scene.SceneBuilder; //导入依赖的package包/类
private void initGui(final Stage stage) {
	Scene scene = SceneBuilder.create().width(500).height(530)
			.fill(Color.GRAY).root(area).build();
	initBoxes();
	stage.setScene(scene);
	stage.setTitle("hasCode.com - Java FX 2 Ball Game Tutorial");
	stage.getIcons().add(ICON);
	scene.getStylesheets().add(STYLESHEET_FILE);
	stage.show();
}
 
开发者ID:dmpe,项目名称:JavaFX,代码行数:11,代码来源:SingleClassNoXmlBallGame.java

示例13: initGui

import javafx.scene.SceneBuilder; //导入依赖的package包/类
private void initGui(Stage stage) throws IOException {
	Parent root = FXMLLoader.load(getClass().getResource(VIEW_GAME));
	Scene scene = SceneBuilder.create().root(root).width(500).height(530)
			.fill(Color.GRAY).build();
	scene.getStylesheets().add(STYLESHEET_FILE);
	stage.setScene(scene);
	stage.setTitle("hasCo de.com - Java FX 2 Ball Game Tutorial");
	stage.getIcons().add(ICON);
	stage.show();
}
 
开发者ID:dmpe,项目名称:JavaFX,代码行数:11,代码来源:BallGame.java

示例14: start

import javafx.scene.SceneBuilder; //导入依赖的package包/类
@Override
public void start(Stage stage) {
  
  String message = 
    "Earthrise at Christmas: " +
    "[Forty] years ago this Christmas, a turbulent world " +
    "looked to the heavens for a unique view of our home "  +
    "planet. This photo of Earthrise over the lunar horizon " +
    "was taken by the Apollo 8 crew in December 1968, showing " +
    "Earth for the first time as it appears from deep space. " +
    "Astronauts Frank Borman, Jim Lovell and William Anders " +
    "had become the first humans to leave Earth orbit, " +
    "entering lunar orbit on Christmas Eve. In a historic live " +
    "broadcast that night, the crew took turns reading from " +
    "the Book of Genesis, closing with a holiday wish from " +
    "Commander Borman: \"We close with good night, good luck, " +
    "a Merry Christmas, and God bless all of you -- all of " +
    "you on the good Earth.\"";

  // Reference to the Text
  Text textRef = TextBuilder.create()
    .layoutY(100)
    .textOrigin(VPos.TOP)
    .textAlignment(TextAlignment.JUSTIFY)
    .wrappingWidth(400)
    .text(message)
    .fill(Color.rgb(187, 195, 107))
    .font(Font.font("SansSerif", FontWeight.BOLD, 24))
    .build();

   // Provides the animated scrolling behavior for the text
  TranslateTransition transTransition = TranslateTransitionBuilder.create()
    .duration(new Duration(75000))
    .node(textRef)
    .toY(-820)
    .interpolator(Interpolator.LINEAR)
    .cycleCount(Timeline.INDEFINITE)
    .build();

  Scene scene  = SceneBuilder.create()
    .width(516)
    .height(387)
    .root(
      GroupBuilder.create()
        .children(
          ImageViewBuilder.create()
            .image(new Image("http://projavafx.com/images/earthrise.jpg"))
            .build(),
          ScrollPaneBuilder.create()
            .layoutX(50)
            .layoutY(100)
            .prefWidth(440)
            .prefHeight(200)
            .hbarPolicy(ScrollBarPolicy.NEVER)
            .vbarPolicy(ScrollBarPolicy.NEVER)
            .pannable(true)
            .content(textRef)
            .style("-fx-background-color: transparent;")
            .build()
        )
        .build()
    )
    .build();

  stage.setScene(scene);
  stage.setTitle("Hello Earthrise");
  stage.show();
  
  // Start the text animation
  transTransition.play();
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:72,代码来源:Scroll2.java

示例15: start

import javafx.scene.SceneBuilder; //导入依赖的package包/类
@Override public void start(Stage stage) {
  final Group root;
  Scene scene = SceneBuilder.create()
    .width(500).height(500)
    .fill(Color.WHITE)
    .root(root = GroupBuilder.create()
      .children(RectangleBuilder.create()
        .layoutX(5).layoutY(5)
        .width(490).height(490)
        .fill(Color.LIGHTSKYBLUE)
        .onMouseClicked(new EventHandler<MouseEvent>() {
          // Eventhandler for mouse click event
          @Override public void handle(MouseEvent e) {
            if (clickcount > 2) { initialize(); }
            for (int j = clickcount; j < 3; j++) {
              org_x[j].set(e.getSceneX());
              org_y[j].set(e.getSceneY());
            }
            clickcount++;
          }
        }).build(),
      // line for x-axis through the Origin
      LineBuilder.create()
        .startX(5).startY(490)
        .endX(495).endY(490)
        .build(),
      // Line for y-axis through the Origin
      LineBuilder.create()
        .startX(10).startY(5)
        .endX(10).endY(495)
        .build(),
      // grid horizontal lines which interval is of 1cm
      a_x_l[0], a_x_l[1], a_x_l[2], a_x_l[3],
      a_x_l[4], a_x_l[5], a_x_l[6], a_x_l[7],
      a_x_l[8], a_x_l[9], a_x_l[10], a_x_l[11],
      // grid vertical lines which interval is of 1cm
      a_y_l[0], a_y_l[1], a_y_l[2], a_y_l[3],
      a_y_l[4], a_y_l[5], a_y_l[6], a_y_l[7],
      a_y_l[8], a_y_l[9], a_y_l[10], a_y_l[11],
      // Sides
      l[0], l[1], l[2],
      // Vertices
      c[0], c[1], c[2],
      // the printing space of the coordinates and
      // the area of triangle
      HBoxBuilder.create()
        .layoutX(10)
        .padding(new Insets(10, 10, 10, 10)).spacing(3)
        .alignment(Pos.BOTTOM_CENTER)
        .children(
          LabelBuilder.create().text("A(").build(),
          tx[0],
          LabelBuilder.create().text(",").build(),
          ty[0],
          LabelBuilder.create().text("),").build(),
          LabelBuilder.create().text("B(").build(),
          tx[1],
           LabelBuilder.create().text(",").build(),
          ty[1],
          LabelBuilder.create().text("),").build(),
          LabelBuilder.create().text("C(").build(),
          tx[2],
          LabelBuilder.create().text(",").build(),
          ty[2],
          LabelBuilder.create().text(") ⇒ ").build(),
          area_Label
        ).build()
    ).build()
  ).build();

  stage.setTitle("Triangle Area");
  stage.setScene(scene);
  stage.show();
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:75,代码来源:TriangleArea.java


注:本文中的javafx.scene.SceneBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。