javafx.scene.control.TabPane.TabClosingPolicy#javafx.scene.layout.Pane源码实例Demo

下面列出了javafx.scene.control.TabPane.TabClosingPolicy#javafx.scene.layout.Pane 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: thundernetwork   文件: Main.java
/**
 * Loads the FXML file with the given name, blurs out the main UI and puts this one on top.
 */
public <T> OverlayUI<T> overlayUI (String name) {
    try {
        checkGuiThread();
        // Load the UI from disk.
        URL location = GuiUtils.getResource(name);
        FXMLLoader loader = new FXMLLoader(location);
        Pane ui = loader.load();
        T controller = loader.getController();
        OverlayUI<T> pair = new OverlayUI<T>(ui, controller);
        // Auto-magically set the overlayUI member, if it's there.
        try {
            if (controller != null) {
                controller.getClass().getField("overlayUI").set(controller, pair);
            }
        } catch (IllegalAccessException | NoSuchFieldException ignored) {
            ignored.printStackTrace();
        }
        pair.show();
        return pair;
    } catch (IOException e) {
        throw new RuntimeException(e);  // Can't happen.
    }
}
 
源代码2 项目: bisq   文件: TradesChartsView.java
private void layout() {
    UserThread.runAfter(() -> {
        double available;
        if (root.getParent() instanceof Pane)
            available = ((Pane) root.getParent()).getHeight();
        else
            available = root.getHeight();

        available = available - volumeChartPane.getHeight() - toolBox.getHeight() - nrOfTradeStatisticsLabel.getHeight() - 75;
        if (priceChart.isManaged())
            available = available - priceChartPane.getHeight();
        else
            available = available + 10;
        tableView.setPrefHeight(available);
    }, 100, TimeUnit.MILLISECONDS);
}
 
源代码3 项目: trex-stateless-gui   文件: PortHardwareCounters.java
private void update() {
    try {
        if (savedXStatsNames == null) {
            savedXStatsNames = ConnectionManager.getInstance().sendPortXStatsNamesRequest(port);
        }
        String xStatsValues = ConnectionManager.getInstance().sendPortXStatsValuesRequest(port);
        Map<String, Long> loadedXStatsList = Util.getXStatsFromJSONString(savedXStatsNames, xStatsValues);
        port.setXstats(loadedXStatsList);
        Pane pane = statsTableGenerator.generateXStatPane(true, port, statXTableNotEmpty.isSelected(), statXTableFilter.getText(), resetCountersRequested);
        statXTableContainer.setContent(pane);
        statXTableContainer.setVisible(true);
        if (resetCountersRequested) {
            resetCountersRequested = false;
        }
    } catch (Exception ignored) {
    }
}
 
源代码4 项目: charts   文件: XYZPane.java
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", "xyz-chart");

    canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ctx    = canvas.getGraphicsContext2D();

    pane = new Pane(canvas);

    getChildren().setAll(pane);
}
 
源代码5 项目: desktoppanefx   文件: TitleBar.java
private Pane makeTitlePane(String title) {
    HBox hbLeft = new HBox();
    hbLeft.setSpacing(10d);
    lblTitle = new Label();
    lblTitle.textProperty().bind(titleProperty());
    setTitle(title);
    lblTitle.getStyleClass().add("internal-window-titlebar-title");

    if (icon != null) { hbLeft.getChildren().add(icon); }
    hbLeft.getChildren().add(lblTitle);
    hbLeft.setAlignment(Pos.CENTER_LEFT);
    AnchorPane.setLeftAnchor(hbLeft, 10d);
    AnchorPane.setBottomAnchor(hbLeft, 0d);
    AnchorPane.setRightAnchor(hbLeft, 20d);
    AnchorPane.setTopAnchor(hbLeft, 0d);
    return hbLeft;
}
 
源代码6 项目: FXTutorials   文件: LoadingScreenDemo.java
@Override
public void start(Stage primaryStage) throws Exception {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("ui.fxml"));
    loader.setController(this);

    Pane root = loader.load();

    primaryStage.setScene(new Scene(root));
    primaryStage.show();

    progressBar.progressProperty().bind(task.progressProperty());

    loadingCircleAnimation.play();

    Thread t = new Thread(task);
    t.start();
}
 
源代码7 项目: exit_code_java   文件: Plugin.java
public static void createAppWindow() {
    //Create a new window
    WindowBuilder window = new WindowBuilder("jSnake");
    window.setPrefSize(450, 350); // Window Size (Width, height)
    window.setProcessName("jsnake.app");

    //App
    Pane browserRoot = new Pane();
    window.setCenter(browserRoot);

    WebView browser = new WebView();
    browser.prefWidthProperty().bind(browserRoot.widthProperty());
    browser.prefHeightProperty().bind(browserRoot.heightProperty());
    browserRoot.getChildren().add(browser);
    
    WebEngine webEngine = browser.getEngine();
    try {
        webEngine.load((Plugin.class.getResource("/web/index.html")).toString());
    } catch(Exception e) {}
    
    //Spawn the window
    window.spawnWindow();
    window.placeApp();
}
 
源代码8 项目: phoebus   文件: XYPlotRepresentation.java
@Override
public Pane createJFXNode() throws Exception
{
    // Plot is only active in runtime mode, not edit mode
    plot = new RTValuePlot(! toolkit.isEditMode());
    plot.setUpdateThrottle(Preferences.plot_update_delay, TimeUnit.MILLISECONDS);
    plot.showToolbar(false);
    plot.showCrosshair(false);
    plot.setManaged(false);

    // Create PlotMarkers once. Not allowing adding/removing them at runtime
    if (! toolkit.isEditMode())
        for (MarkerProperty marker : model_widget.propMarkers().getValue())
            createMarker(marker);

    // Add button to reset ranges of X and Y axes to the values when plot was first rendered.
    Button resetAxisRanges =
            plot.addToolItem(JFXUtil.getIcon("reset_axis_ranges.png"), Messages.Reset_Axis_Ranges);

    resetAxisRanges.setOnMouseClicked(me -> {
        plot.resetAxisRanges();
    });

    return plot;
}
 
源代码9 项目: thundernetwork   文件: GuiUtils.java
public static void runAlert(BiConsumer<Stage, AlertWindowController> setup) {
    try {
        // JavaFX2 doesn't actually have a standard alert template. Instead the Scene Builder app will create FXML
        // files for an alert window for you, and then you customise it as you see fit. I guess it makes sense in
        // an odd sort of way.
        Stage dialogStage = new Stage();
        dialogStage.initModality(Modality.APPLICATION_MODAL);
        FXMLLoader loader = new FXMLLoader(GuiUtils.class.getResource("alert.fxml"));
        Pane pane = loader.load();
        AlertWindowController controller = loader.getController();
        setup.accept(dialogStage, controller);
        dialogStage.setScene(new Scene(pane));
        dialogStage.showAndWait();
    } catch (IOException e) {
        // We crashed whilst trying to show the alert dialog (this should never happen). Give up!
        throw new RuntimeException(e);
    }
}
 
源代码10 项目: UndoFX   文件: CircleProperties.java
@Override
public void start(Stage primaryStage) {
    Pane pane = new Pane();
    pane.setPrefWidth(400);
    pane.setPrefHeight(400);
    pane.getChildren().add(circle);

    HBox undoPanel = new HBox(20.0, undoBtn, redoBtn, saveBtn);

    VBox root = new VBox(10.0,
            pane,
            labeled("Color", colorPicker),
            labeled("Radius", radius),
            labeled("X", centerX),
            labeled("Y", centerY),
            undoPanel);
    root.setAlignment(Pos.CENTER);
    root.setFillWidth(false);

    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.show();
}
 
源代码11 项目: Cardshifter   文件: DeckBuilderWindow.java
private void displayActiveDeck() {
	this.activeDeckBox.getChildren().clear();
	List<String> sortedKeys = new ArrayList<>(this.activeDeckConfig.getChosen().keySet());
	Collections.sort(sortedKeys);
	for (String cardId : sortedKeys) {
		if (!cardList.containsKey(cardId)) {
			activeDeckConfig.setChosen(cardId, 0);
			continue;
		}
		DeckCardController card = new DeckCardController(this.cardList.get(cardId), this.activeDeckConfig.getChosen().get(cardId));
		Pane cardPane = card.getRootPane();
		cardPane.setOnMouseClicked(e -> {this.removeCardFromDeck(e, cardId);});
		this.activeDeckBox.getChildren().add(cardPane);
	}
	this.cardCountLabel.setText(String.format("%d / %d", this.activeDeckConfig.total(), this.activeDeckConfig.getMaxSize()));
}
 
源代码12 项目: openchemlib-js   文件: MoleculeViewSkin.java
private void releaseGlassPane()
{
    dragCanvas.setVisible(false);
    dragCanvas = null;

    if (glassPane != null) {
        if (rootNode.getScene() != null) {
            final Parent parent = rootNode.getScene().getRoot();
            if (parent instanceof Pane) {
                Pane p = (Pane) parent;
                p.getChildren().remove(glassPane);

                glassPane.setOnDragOver(null);
                glassPane.setOnDragDropped(null);
                glassPane = null;
            }
        }
    }
}
 
源代码13 项目: Motion_Profile_Generator   文件: MainApp.java
@Override
public void start( Stage primaryStage )
{
    try
    {
        Pane root = FXMLLoader.load( getClass().getResource("/com/mammen/ui/javafx/main/MainUI.fxml") );
        root.autosize();

        primaryStage.setScene( new Scene( root ) );
        primaryStage.sizeToScene();
        primaryStage.setTitle("Motion Profile Generator");
        primaryStage.setMinWidth( 1280 ); //1170
        primaryStage.setMinHeight( 720 ); //790
        primaryStage.setResizable( true );

        primaryStage.show();
    }
    catch( Exception e )
    {
        e.printStackTrace();
    }
}
 
源代码14 项目: mars-sim   文件: MainScene.java
/**
	 * Create the desktop swing node
	 */
	private void createDesktopNode() {
		// Create group to hold swingNode which in turns holds the Swing desktop
		desktopNode = new SwingNode();
		// desktopNode.setStyle("-fx-background-color: black; ");
		desktop = new MainDesktopPane(this);
		desktopNode.setStyle("-fx-background-color: transparent; -fx-border-color: black; ");	
		desktopPane = new Pane(desktopNode);
		desktopPane.setMaxSize(screen_width - 25, screen_height); // TAB_PANEL_HEIGHT

		// Add main pane
		WebPanel mainPane = new WebPanel(new BorderLayout());
		mainPane.setSize(screen_width - 25 , screen_height - 15);
		mainPane.add(desktop, BorderLayout.CENTER);	
//		desktopNode.setContent(mainPane);
		SwingUtilities.invokeLater(() -> desktopNode.setContent(mainPane));

//		desktopNode.requestFocus();
	}
 
源代码15 项目: ShootOFF   文件: ArenaCoursesSlide.java
private Pane buildCoursePanes() {
	final File coursesDirectory = new File(System.getProperty("shootoff.courses"));

	final ItemSelectionPane<File> uncategorizedPane = buildCategoryPane(coursesDirectory);
	coursePanes.getChildren().add(new TitledPane("Uncategorized Courses", uncategorizedPane));
	categoryMap.put(coursesDirectory.getPath(), uncategorizedPane);

	final File[] courseFolders = coursesDirectory.listFiles(FOLDER_FILTER);

	if (courseFolders != null) {
		for (final File courseFolder : courseFolders) {
			coursePanes.getChildren().add(new TitledPane(courseFolder.getName().replaceAll("_", "") + " Courses",
					buildCategoryPane(courseFolder)));
		}
	} else {
		logger.error("{} does not appear to be a valid course directory", coursesDirectory.getPath());
	}

	return coursePanes;
}
 
源代码16 项目: JFoenix   文件: JFXSnackbar.java
public void registerSnackbarContainer(Pane snackbarContainer) {
    if (snackbarContainer != null) {
        if (this.snackbarContainer != null) {
            //since listeners are added the container should be properly registered/unregistered
            throw new IllegalArgumentException("Snackbar Container already set");
        }
        this.snackbarContainer = snackbarContainer;
        this.snackbarContainer.getChildren().add(this);
        this.snackbarContainer.heightProperty().addListener(weakSizeListener);
        this.snackbarContainer.widthProperty().addListener(weakSizeListener);
    }
}
 
源代码17 项目: FxDock   文件: DragAndDropHandler.java
protected static Stage createDragWindow(FxDockPane client)
{
	Window owner = FX.getParentWindow(client);
	Image im = createDragImage(client);
	Pane p = new Pane(new ImageView(im));
	Stage s = new Stage(StageStyle.TRANSPARENT);
	s.initOwner(owner);
	s.setScene(new Scene(p, im.getWidth(), im.getHeight()));
	s.setOpacity(DRAG_WINDOW_OPACITY);
	return s;
}
 
源代码18 项目: logbook-kai   文件: Deck.java
@Override
protected void updateItem(AppDeck item, boolean empty) {
    super.updateItem(item, empty);
    if (!empty) {
        if (item != null) {
            Label text = new Label(item.getName());
            Pane pane = new Pane();
            Button del = new Button("除去");
            del.getStyleClass().add("delete");
            del.setOnAction(e -> {
                Alert alert = new Alert(AlertType.INFORMATION);
                alert.getDialogPane().getStylesheets().add("logbook/gui/application.css");
                InternalFXMLLoader.setGlobal(alert.getDialogPane());
                alert.initOwner(Deck.this.deckList.getScene().getWindow());
                alert.setTitle("編成記録の除去");
                alert.setContentText("「" + item.getName() + "」を除去しますか?");
                alert.getButtonTypes().clear();
                alert.getButtonTypes().addAll(ButtonType.YES, ButtonType.NO);
                if (alert.showAndWait().orElse(null) == ButtonType.YES) {
                    Deck.this.modified.set(false);
                    Deck.this.deckList.getItems().remove(item);
                }
            });
            HBox box = new HBox(text, pane, del);
            HBox.setHgrow(pane, Priority.ALWAYS);

            this.setGraphic(box);
        } else {
            this.setGraphic(null);
        }
    } else {
        this.setGraphic(null);
    }
}
 
源代码19 项目: pcgen   文件: RadioChooserDialog.java
/**
 * Build up a single columns of buttons
 * @return pane with radio buttons
 */
private Pane buildNormalColLayout()
{
	GridPane boxPane = new GridPane();
	int numButtons = avaRadioButton.length;
	for (int row = 0; row < numButtons; ++row)
	{
		boxPane.add(avaRadioButton[row], 0, row);
	}
	return boxPane;
}
 
源代码20 项目: Intro-to-Java-Programming   文件: Exercise_15_20.java
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	// Create a pane
	Pane pane = new Pane();

	// Create three points and add them to a list
	Circle p1 = new Circle(50, 100, 5);
	Circle p2 = new Circle(100, 25, 5);
	Circle p3 = new Circle(150, 80, 5);
	ArrayList<Circle> points = new ArrayList<>();
	points.add(p1);
	points.add(p2);
	points.add(p3);

	// Place nodes in the pane
	drawTriangle(pane, points);
	pane.getChildren().addAll(p1, p2, p3);
	placeText(pane, points);

	// Create and register the handle
	pane.setOnMouseDragged(e -> {
		for (int i = 0; i < points.size(); i++) {
			if (points.get(i).contains(e.getX(), e.getY())) {
				pane.getChildren().clear();
				points.get(i).setCenterX(e.getX());
				points.get(i).setCenterY(e.getY());
				drawTriangle(pane, points);
				pane.getChildren().addAll(p1, p2, p3);
				placeText(pane, points);
			}
		}
	});			

	// Create a scene and place it in the stage
	Scene scene = new Scene(pane, 200, 200);
	primaryStage.setTitle("Exercise_15_20"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage
}
 
源代码21 项目: constellation   文件: ParameterListInputPane.java
private ParameterItem(final Pane parameterPane) {
    this.parameterPane = parameterPane;
    buttonBar = new VBox();
    buttonBar.setMinWidth(45);
    removeItemButton = new Button(null, new ImageView(UserInterfaceIconProvider.CROSS.buildImage(16)));
    moveUpButton = new Button(null, new ImageView(UserInterfaceIconProvider.CHEVRON_UP.buildImage(16)));
    moveDownButton = new Button(null, new ImageView(UserInterfaceIconProvider.CHEVRON_DOWN.buildImage(16)));
    buttonBar.getChildren().addAll(removeItemButton, moveUpButton, moveDownButton);
    buttonBar.setSpacing(10);
    getChildren().addAll(parameterPane, buttonBar);
    HBox.setHgrow(parameterPane, Priority.ALWAYS);

}
 
源代码22 项目: ariADDna   文件: CloudSettingsFactory.java
/**
 * Generate cloud settings page
 * @param value name of cloud
 * @param loaderProvider FXML loader
 * @return cloud settings page
 * @throws IOException
 */
public Node getNode(String value, FXMLLoaderProvider loaderProvider) throws IOException {
    FXMLLoader fxmlLoader = loaderProvider
            .get("/com/stentix/ariaddna/desktopgui/fxmlViews/settingsTemplate.fxml");
    Pane parent = fxmlLoader.load();

    Clouds elem = Clouds.valueOf(value);

    SettingsTemplateController controller = fxmlLoader.getController();
    controller.setHeaders(elem.header, elem.name);
    controller.setContent(loaderProvider
            .get("/com/stentix/ariaddna/desktopgui/fxmlViews/cloudSettingsView.fxml").load());
    return parent;
}
 
源代码23 项目: Schillsaver   文件: MainView.java
/**
 * Constructs a new MainView.
 *
 * @param model
 *          The model.
 */
public MainView(final Model model) {
    initializeComponents();
    setComponentTooltips();

    final Pane menuBar = createMenuBar();
    contentArea = createContentArea();

    super.setPane(new VBox(menuBar, contentArea));
    super.getPane().setMinSize(512, 512);
}
 
源代码24 项目: RichTextFX   文件: StyledTextField.java
private Node traverse( Parent p, Node from, int dir )
{
    if ( p == null ) return null;

    List<Node> nodeList = p.getChildrenUnmodifiable();
    int len = nodeList.size();
    int neighbor = -1;
    
    if ( from != null ) while ( ++neighbor < len && nodeList.get(neighbor) != from );
    else if ( dir == 1 ) neighbor = -1;
    else neighbor = len;
    
    for ( neighbor += dir; neighbor > -1 && neighbor < len; neighbor += dir ) {

        Node target = nodeList.get( neighbor );

        if ( target instanceof Pane || target instanceof Group ) {
            target = traverse( (Parent) target, null, dir ); // down
            if ( target != null ) return target;
        }
        else if ( target.isVisible() && ! target.isDisabled() && target.isFocusTraversable() ) {
            target.requestFocus();
            return target;
        }
    }

    return traverse( p.getParent(), p, dir ); // up
}
 
源代码25 项目: erlyberly   文件: ErlyBerly.java
/**
 * All I know is pane.
 */
public static Pane wrapInPane(Node node) {
    if(node instanceof Pane)
        return (Pane) node;
    VBox.setVgrow(node, Priority.ALWAYS);
    VBox vBox = new VBox(node);
    return vBox;
}
 
源代码26 项目: ET_Redux   文件: TopsoilPlotEvolution.java
@Override
public Pane initializePlotPane() {
    TopsoilPlotController.setTopsoilPlot(this);
    Pane topsoilPlotUI = null;
    try {
        topsoilPlotUI = FXMLLoader.load(getClass().getResource("TopsoilPlot.fxml"));
    } catch (IOException iOException) {
    }

    return topsoilPlotUI;
}
 
源代码27 项目: Cryogen   文件: Utils.java
private static List<Node> recurse(List<Node> children) {
    List<Node> output = new ArrayList<Node>();
    for (Node obj : children) {
        if (obj instanceof Pane) {
            output.addAll(recurse(((Pane)obj).getChildren()));
        } else {
            output.add(obj);
        }
    }
    return output;
}
 
源代码28 项目: ShootOFF   文件: Slide.java
private void show(Pane parentContainer, List<Node> slideList, List<Node> savedList) {
	// Do not show twice
	if (!savedList.isEmpty()) return;

	savedList.addAll(parentContainer.getChildren());
	parentContainer.getChildren().setAll(slideList);
}
 
源代码29 项目: erlyberly   文件: ErlyBerly.java
/**
 * Show a new control in the tab pane. The tab is closable.
 */
public static void showPane(String title, Pane parentControl) {
    assert Platform.isFxApplicationThread();
    Tab newTab;
    newTab = new Tab(title);
    newTab.setContent(parentControl);
    addAndSelectTab(newTab);
}
 
源代码30 项目: GreenBits   文件: GuiUtils.java
public static Animation fadeOutAndRemove(Duration duration, Pane parentPane, Node... nodes) {
    nodes[0].setCache(true);
    FadeTransition ft = new FadeTransition(duration, nodes[0]);
    ft.setFromValue(nodes[0].getOpacity());
    ft.setToValue(0.0);
    ft.setOnFinished(actionEvent -> parentPane.getChildren().removeAll(nodes));
    ft.play();
    return ft;
}