當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。