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


Java Pane类代码示例

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


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

示例1: showQRCode

import javafx.scene.layout.Pane; //导入依赖的package包/类
@FXML
protected void showQRCode(MouseEvent event) {
    // Serialize to PNG and back into an image. Pretty lame but it's the shortest code to write and I'm feeling
    // lazy tonight.
    final byte[] imageBytes = QRCode
            .from(uri())
            .withSize(320, 240)
            .to(ImageType.PNG)
            .stream()
            .toByteArray();
    Image qrImage = new Image(new ByteArrayInputStream(imageBytes));
    ImageView view = new ImageView(qrImage);
    view.setEffect(new DropShadow());
    // Embed the image in a pane to ensure the drop-shadow interacts with the fade nicely, otherwise it looks weird.
    // Then fix the width/height to stop it expanding to fill the parent, which would result in the image being
    // non-centered on the screen. Finally fade/blur it in.
    Pane pane = new Pane(view);
    pane.setMaxSize(qrImage.getWidth(), qrImage.getHeight());
    final Main.OverlayUI<ClickableBitcoinAddress> overlay = Main.instance.overlayUI(pane, this);
    view.setOnMouseClicked(event1 -> overlay.done());
}
 
开发者ID:Techsoul192,项目名称:legendary-guide,代码行数:22,代码来源:ClickableBitcoinAddress.java

示例2: loadSellingAuctions

import javafx.scene.layout.Pane; //导入依赖的package包/类
/**
 * Load box with artworks profile is selling
 * @return  bidedPane
 */
private HBox loadSellingAuctions(){
    HBox bidedPane = new HBox();
    for(Auction auction: dc.getAuctions()){
        if(auction
                .getSeller()
                .getUsername()
                .equals(p.getUsername())){
            ImageView imgView2 = new ImageView(new Image(auction
                    .getArtwork()
                    .getPhoto()
                    .getPath())
            );
            imgView2.setFitWidth(200);
            imgView2.setFitHeight(200);
            bidedPane
                    .getChildren()
                    .addAll(new Pane(imgView2)
                    );
        }
    }
    return bidedPane;
}
 
开发者ID:hadalhw17,项目名称:Artatawe,代码行数:27,代码来源:ProfileScene.java

示例3: addRow

import javafx.scene.layout.Pane; //导入依赖的package包/类
protected void addRow (Transition transition) {
    // load fxml
    try {
        FXMLLoader loader = new FXMLLoader(new File(ROW_FXML).toURI().toURL());

        //set controller
        TransitionRowController controller = new TransitionRowController(this, this.entry, this.index, transition);
        this.controllerList.add(controller);
        loader.setController(controller);

        Pane rootPane = loader.load();//FXMLLoader.load(new File(fxmlPath).toURI().toURL());

        //initialize tab controller
        controller.init(stage, null, rootPane);

        this.listView.getItems().add(rootPane);
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(1);
    }
}
 
开发者ID:leeks-and-dragons,项目名称:dialog-tool,代码行数:22,代码来源:TransitionPaneController.java

示例4: load_as_pane_multiple

import javafx.scene.layout.Pane; //导入依赖的package包/类
@Test
public void load_as_pane_multiple() {
    final Pane testPane = this.assertSuccessAndGet(
        this.easyFxml.loadNode(TEST_NODES.PANE, SELECTOR)
    );

    this.assertAppliedStyle(testPane, "");

    this.assertControllerBoundToTestPane(
        testPane,
        this.controllerManager.getMultiple(TEST_NODES.PANE, SELECTOR)
    );

    assertThat(testPane.getChildren()).hasSize(1);
    assertThat(testPane.getChildren().get(0).getClass()).isEqualTo(Button.class);

}
 
开发者ID:Tristan971,项目名称:EasyFXML,代码行数:18,代码来源:BaseEasyFxmlTest.java

示例5: assertControllerBoundToTestPane

import javafx.scene.layout.Pane; //导入依赖的package包/类
/**
 * We have to sleep here because the event firing in JavaFX can't be waited on all the way.
 * So if we don't wait, as soon as the click is actually sent, but not yet registered,
 * we are already asserting.
 * The wait is a horrific thing that the whole async life promised to save us from. But it did
 * not deliver (yet).
 *
 * @param testPane         The pane to test bounding on
 * @param controllerLookup The controller as an {@link Option} so we can know if the test
 *                         actually failed because of some outside reason.
 */
private void assertControllerBoundToTestPane(final Pane testPane, final Option<FxmlController> controllerLookup) {
    assertThat(controllerLookup.isDefined()).isTrue();
    assertThat(controllerLookup.get().getClass()).isEqualTo(SAMPLE_CONTROL_CLASS.class);

    Stages.stageOf("TEST_PANE", testPane)
        .whenCompleteAsync((stage, err) -> Stages.scheduleDisplaying(stage))
        .whenCompleteAsync((stage, err) -> {
            final Button btn = (Button) stage.getScene().getRoot().getChildrenUnmodifiable().get(0);
            btn.fire();
            Stages.asyncStageOperation(stage, Stage::hide);
        })
        .whenCompleteAsync((stage, err) -> {
            final SAMPLE_CONTROL_CLASS testController = (SAMPLE_CONTROL_CLASS) controllerLookup.get();
            assertThat(testController.locatedInstance).isTrue();
        })
        .toCompletableFuture()
        .join();
}
 
开发者ID:Tristan971,项目名称:EasyFXML,代码行数:30,代码来源:BaseEasyFxmlTest.java

示例6: start

import javafx.scene.layout.Pane; //导入依赖的package包/类
@Override
public void start(final Stage stage) {
    Platform.setImplicitExit(false);
    STAGE_TITLE = "STAGE_TITLE";
    STAGE_TITLE_2 = "STAGE_TITLE_2";
    STAGE_PANE = new Pane();
    TEST_STAGE = stage;
    stage.show();
    stage.hide();
}
 
开发者ID:Tristan971,项目名称:EasyFXML,代码行数:11,代码来源:StagesTest.java

示例7: ControlsPaneController

import javafx.scene.layout.Pane; //导入依赖的package包/类
public ControlsPaneController(UIToolBox toolBox) {
    this.toolBox = toolBox;

    toolBox.getEventBus()
            .toObserverable()
            .ofType(MediaControlsChangedEvent.class)
            .subscribe(e -> updateMediaControlPane(e.get()));

    emptyControlsPane = new Pane();
    emptyControlsPane.setPrefSize(440, 80);
    emptyControlsPane.setMaxSize(440, 80);
    emptyControlsPane.setMinSize(440, 80);

    Runtime.getRuntime()
            .addShutdownHook(new Thread(() -> saveDividerPositions(splitPaneKey, getRoot())));
}
 
开发者ID:mbari-media-management,项目名称:vars-annotation,代码行数:17,代码来源:ControlsPaneController.java

示例8: displayText

import javafx.scene.layout.Pane; //导入依赖的package包/类
private void displayText(final String s, final String title) {
	final Scene scene = new Scene(new Pane());

	String text = s;
	if (s == null || s.isEmpty()) { text = "Whoops! Nothing to see here"; }
	final Text textItem = new Text(text);

	final Button okButton = new Button("OK");

	final GridPane grid = new GridPane();
	grid.setVgap(4);
	grid.setHgap(10);
	grid.setPadding(new Insets(5, 5, 5, 5));
	grid.add(textItem, 0, 0);
	grid.add(okButton, 1, 0);

	final Pane root = (Pane) scene.getRoot();
	root.getChildren().add(grid);

	if (rootModel.darkModeProperty().get()) {
		scene.getStylesheets().add("root/darkMode.css");
		textItem.getStyleClass().add("text");
	}

	final Stage stage = new Stage();
	stage.setScene(scene);
	stage.setTitle(title);
	stage.show();


	okButton.setOnAction(e -> {
		stage.close();
	});
}
 
开发者ID:jakemanning,项目名称:boomer-tuner,代码行数:35,代码来源:RootController.java

示例9: initGraphics

import javafx.scene.layout.Pane; //导入依赖的package包/类
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    getStyleClass().setAll("chart", "matrix-chart");

    matrix = PixelMatrixBuilder.create()
                               .prefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT)
                               .pixelShape(PixelShape.SQUARE)
                               .useSpacer(true)
                               .squarePixels(false)
                               .pixelOnColor(Color.BLACK)
                               .pixelOffColor(Color.TRANSPARENT)
                               .build();

    pane = new Pane(matrix);
    getChildren().setAll(pane);
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:25,代码来源:MatrixPane.java

示例10: ConsoleTab

import javafx.scene.layout.Pane; //导入依赖的package包/类
public ConsoleTab(Button button, Pane pane, TextArea mooConsole, TextField commandInput, Button commandSend) {
    super(button, pane);
    this.mooConsole = mooConsole;
    this.commandInput = commandInput;
    this.commandSend = commandSend;

    // for sending command
    commandSend.setOnAction(event -> {
        String text = commandInput.getText();
        commandInput.clear();
        PacketMessenger.message(new PacketConsoleInput(text));
    });

    // register this as event listener
    EventExecutor.getInstance().register(this);
    PacketAdapting.getInstance().register(this);
}
 
开发者ID:Superioz,项目名称:MooProject,代码行数:18,代码来源:ConsoleTab.java

示例11: init

import javafx.scene.layout.Pane; //导入依赖的package包/类
@Override
public void init(Stage stage, Scene scene, Pane pane) {
    addButton.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            //add transition

            String eventName = eventNameTextField.getText();

            if (eventName.isEmpty()) {
                return;
            }

            RaiseEventTransition transition = new RaiseEventTransition(eventName);
            entry.getTranstionList(index).add(transition);

            //refresh listview
            paneController.refreshListView();

            stage.close();
        }
    });
}
 
开发者ID:leeks-and-dragons,项目名称:dialog-tool,代码行数:24,代码来源:RaiseEventTransitionController.java

示例12: create

import javafx.scene.layout.Pane; //导入依赖的package包/类
private void create(){
        mStage = new Stage();
        mStage.initModality(Modality.APPLICATION_MODAL);
        mStage.initOwner(null);
        mStage.initStyle(StageStyle.TRANSPARENT);
        mStage.setResizable(false);
        viewTuple = createContent();
        if(viewTuple.getView() instanceof BaseView){
            BaseView view = (BaseView) viewTuple.getView();
            view.onDialogSet(this);
            root = (Pane) viewTuple.getRoot();
            alignCenter(root.getPrefWidth(), root.getPrefHeight());
            if(isDragable)
                dragDialogAbleNode(root);
        }else{
            try {
                throw new Exception("your view is not a BaseView!");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        mScene = new Scene(viewTuple.getRoot());
//        mScene.getStylesheets().setAll(TestinStage.getInstance().getStylesheet());
        mStage.setScene(mScene);
    }
 
开发者ID:cmlanche,项目名称:easyMvvmFx,代码行数:26,代码来源:BaseDialog.java

示例13: initGraphics

import javafx.scene.layout.Pane; //导入依赖的package包/类
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    segmentPane = new Pane();

    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCanvas.setMouseTransparent(true);

    chartCtx    = chartCanvas.getGraphicsContext2D();

    pane = new Pane(segmentPane, chartCanvas);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);

    prepareData();
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:26,代码来源:SunburstChart.java

示例14: simpleScene

import javafx.scene.layout.Pane; //导入依赖的package包/类
private Scene simpleScene() {
  try {
    VBox root = new VBox();
    Pane pane = new Pane();
    Rectangle rectangle = new Rectangle(100, 100, Color.AQUA);
    pane.getChildren().addAll(rectangle);
    VerticalResizeContainerController controller = new VerticalResizeContainerController(pane);
    root.getChildren().addAll(controller.getView());
    VBox.setVgrow(controller.getView(), Priority.ALWAYS);
    Scene scene = new Scene(root, 800, 600);
    return scene;
  } catch (Exception e) {
    e.printStackTrace();
    return null;
  }
}
 
开发者ID:VerifAPS,项目名称:stvs,代码行数:17,代码来源:VerticalResizeContainerControllerDemo.java

示例15: updateSidebar

import javafx.scene.layout.Pane; //导入依赖的package包/类
private void updateSidebar() {
    if (docPage != null) {
        ObservableList<SamplePage> relatedSamples = docPage.getRelatedSamples();
        if (!(relatedSamples.isEmpty())) {
            sidePane.setContent(createSideBar(relatedSamples));
            sidePane.setVisible(true);
            webView.getStyleClass().remove(WEB_VIEW_WINDOW_CORNER_STYLECLASS);
        } else {
            sidePane.setContent(new Pane());
            sidePane.setVisible(false);
            webView.getStyleClass().add(WEB_VIEW_WINDOW_CORNER_STYLECLASS);
        }
    } else {
        sidePane.setContent(new Pane());
        sidePane.setVisible(false);
        webView.getStyleClass().add(WEB_VIEW_WINDOW_CORNER_STYLECLASS);
    }
    requestLayout();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:DocPage.java


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