Java Code Examples for javafx.scene.layout.BorderPane#setBottom()

The following examples show how to use javafx.scene.layout.BorderPane#setBottom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientDisplay.java    From Open-Lowcode with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * @return a display with no page shown
 */
public Node getEmptyDisplay() {
	logger.severe("Setting empty display");
	BorderPane mainpane = new BorderPane();
	mainpane.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null)));
	connectionbar = new ConnectionBar(this, urltoconnectto, this.questionmarkicon);

	this.userinteractionwidgets.add(connectionbar);

	Pane connectionpanel = connectionbar.getPane();
	mainpane.setTop(connectionpanel);
	BorderPane.setMargin(connectionpanel, new Insets(3, 5, 3, 5));
	Pane statusbar = generateStatusBar();

	mainpane.setBottom(statusbar);
	BorderPane.setMargin(statusbar, new Insets(3, 5, 3, 5));
	ScrollPane contentholder = new ScrollPane();
	contentholder.setStyle("-fx-background: rgb(255,255,255);");
	contentholder.setBorder(Border.EMPTY);
	mainpane.setCenter(contentholder);
	this.contentholder = contentholder;
	return mainpane;

}
 
Example 2
Source File: JFXUtil.java    From jfxutils with Apache License 2.0 5 votes vote down vote up
/**
 * Make a best attempt to replace the original component with the replacement, and keep the same
 * position and layout constraints in the container.
 * <p>
 * Currently this method is probably not perfect. It uses three strategies:
 * <ol>
 *   <li>If the original has any properties, move all of them to the replacement</li>
 *   <li>If the parent of the original is a {@link BorderPane}, preserve the position</li>
 *   <li>Preserve the order of the children in the parent's list</li>
 * </ol>
 * <p>
 * This method does not transfer any handlers (mouse handlers for example).
 *
 * @param original    non-null Node whose parent is a {@link Pane}.
 * @param replacement non-null Replacement Node
 */
public static void replaceComponent( Node original, Node replacement ) {
	Pane parent = (Pane) original.getParent();
	//transfer any properties (usually constraints)
	replacement.getProperties().putAll( original.getProperties() );
	original.getProperties().clear();

	ObservableList<Node> children = parent.getChildren();
	int originalIndex = children.indexOf( original );
	if ( parent instanceof BorderPane ) {
		BorderPane borderPane = (BorderPane) parent;
		if ( borderPane.getTop() == original ) {
			children.remove( original );
			borderPane.setTop( replacement );

		} else if ( borderPane.getLeft() == original ) {
			children.remove( original );
			borderPane.setLeft( replacement );

		} else if ( borderPane.getCenter() == original ) {
			children.remove( original );
			borderPane.setCenter( replacement );

		} else if ( borderPane.getRight() == original ) {
			children.remove( original );
			borderPane.setRight( replacement );

		} else if ( borderPane.getBottom() == original ) {
			children.remove( original );
			borderPane.setBottom( replacement );
		}
	} else {
		//Hope that preserving the properties and position in the list is sufficient
		children.set( originalIndex, replacement );
	}
}
 
Example 3
Source File: TestApplication.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public TestApplication(Stage parent, Properties props) {
    initOwner(parent);
    MPFUtils.replaceEnviron(props);
    String model = props.getProperty(Constants.PROP_PROJECT_LAUNCHER_MODEL);
    if (model == null || model.equals("")) {
        commandField.setText("Select a launcher and set the parameters required.");
        show();
    } else {
        IRuntimeLauncherModel launcherModel = LauncherModelHelper.getLauncherModel(model);
        launchCommand = launcherModel.createLauncher(props);
    }
    initModality(Modality.APPLICATION_MODAL);
    BorderPane content = new BorderPane();
    VBox builder = new VBox();
    builder.setSpacing(5);
    outputArea.setEditable(false);
    errorArea.setEditable(false);
    VBox.setVgrow(errorArea, Priority.ALWAYS);
    builder.getChildren().addAll(new Label("Command"), commandField, new Label("Standard Output & Error"), outputArea,
            new Label("Message"), errorArea);
    closeButton.setOnAction((event) -> {
        if (launchCommand != null) {
            launchCommand.destroy();
        }
        close();
    });
    content.setCenter(builder);
    content.setBottom(new HBox(5, FXUIUtils.createFiller(), closeButton));
    setScene(new Scene(content));
}
 
Example 4
Source File: TabController.java    From mars-sim with GNU General Public License v3.0 5 votes vote down vote up
private void configureTab(Tab tab, String title, String iconPath, AnchorPane containerPane, URL resourceURL, EventHandler<Event> onSelectionChangedEvent) {
    double imageWidth = 40.0;

    ImageView imageView = new ImageView(new Image(iconPath));
    imageView.setFitHeight(imageWidth);
    imageView.setFitWidth(imageWidth);

    Label label = new Label(title);
    label.setMaxWidth(tabWidth - 20);
    label.setPadding(new Insets(5, 0, 0, 0));
    label.setStyle("-fx-text-fill: black; -fx-font-size: 10pt; -fx-font-weight: bold;");
    label.setTextAlignment(TextAlignment.CENTER);

    BorderPane tabPane = new BorderPane();
    tabPane.setRotate(90.0);
    tabPane.setMaxWidth(tabWidth);
    tabPane.setCenter(imageView);
    tabPane.setBottom(label);

    tab.setText("");
    tab.setGraphic(tabPane);

    tab.setOnSelectionChanged(onSelectionChangedEvent);

    if (containerPane != null && resourceURL != null) {
        try {
            Parent contentView = FXMLLoader.load(resourceURL);
            containerPane.getChildren().add(contentView);
            AnchorPane.setTopAnchor(contentView, 0.0);
            AnchorPane.setBottomAnchor(contentView, 0.0);
            AnchorPane.setRightAnchor(contentView, 0.0);
            AnchorPane.setLeftAnchor(contentView, 0.0);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
 
Example 5
Source File: AboutDialog.java    From classpy with MIT License 5 votes vote down vote up
private static BorderPane createAboutPane(Stage dialogStage) {
    BorderPane pane = new BorderPane();
    //pane.setTop(new Label("Classpy"));
    pane.setCenter(ImageHelper.createImageView("/spy128.png"));
    pane.setBottom(createHomeLink());
    pane.setOnMouseClicked(e -> dialogStage.close());
    
    return pane;
}
 
Example 6
Source File: Exercise_15_32.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	// Create a clock pane
	ClockPane clock = new ClockPane();

	// Create a hBox and set it porperties
	HBox hBox = new HBox(5);
	hBox.setAlignment(Pos.CENTER);

	// Create two buttons
	Button btStop = new Button("Stop");
	Button btStart = new Button("Start");

	// Create and register handler
	btStop.setOnAction(e -> clock.pause());
	btStart.setOnAction(e -> clock.play());

	// Place buttons in hBox
	hBox.getChildren().addAll(btStop, btStart);

	// Create a border pane and place the nodes in to it
	BorderPane borderPane = new BorderPane();
	borderPane.setCenter(clock);
	borderPane.setBottom(hBox);

	// Create a scene and place it in the stage
	Scene scene = new Scene(borderPane, 250, 270);
	primaryStage.setTitle("Exercise_15_32"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage
}
 
Example 7
Source File: Main.java    From ShootOFF with GNU General Public License v3.0 5 votes vote down vote up
public ProgressDialog(String dialogTitle, String dialogMessage, final Task<?> task) {
	stage.setTitle(dialogTitle);
	stage.initModality(Modality.APPLICATION_MODAL);

	pb.setProgress(-1F);
	pin.setProgress(-1F);

	messageLabel.setText(dialogMessage);

	final HBox hb = new HBox();
	hb.setSpacing(5);
	hb.setAlignment(Pos.CENTER);
	hb.getChildren().addAll(pb, pin);

	pb.prefWidthProperty().bind(hb.widthProperty().subtract(hb.getSpacing() * 6));

	final BorderPane bp = new BorderPane();
	bp.setTop(messageLabel);
	bp.setBottom(hb);

	final Scene scene = new Scene(bp);

	stage.setScene(scene);
	stage.show();

	pb.progressProperty().bind(task.progressProperty());
	pin.progressProperty().bind(task.progressProperty());
}
 
Example 8
Source File: Exercise_15_28.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	FanPane fanPane = new FanPane();

	// Create three buttons
	Button btPause = new Button("Pause");
	Button btResume = new Button("Resume");
	Button btReverse = new Button("Reverse");
	HBox hBox = new HBox(5);
	hBox.setAlignment(Pos.CENTER);

	// Place nodes in panes
	hBox.getChildren().addAll(btPause, btResume, btReverse);


	// Create a border pane
	BorderPane borderPane = new BorderPane();
	borderPane.setCenter(fanPane);
	borderPane.setBottom(hBox);

	btPause.setOnAction(e -> {
		fanPane.pause();
	});

	btResume.setOnAction(e -> {
		fanPane.play();
	});

	btReverse.setOnAction(e -> {
		fanPane.reverse();
	});

	// Create a scene and place it in the stage
	Scene scene = new Scene(borderPane, 250, 250);
	primaryStage.setTitle("Exercise_15_28"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage

	fanPane.requestFocus();
}
 
Example 9
Source File: Exercise_16_16.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	// Set combo box properties
	cbo.getItems().addAll("SINGLE", "MULTIPLE");
	cbo.setValue("SINGLE");

	// Create a label and set its content display
	Label lblSelectionMode = new Label("Choose Selection Mode:", cbo);
	lblSelectionMode.setContentDisplay(ContentDisplay.RIGHT);

	// Set defaut list view as single
	lv.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);

	// Create and register the handlers
	cbo.setOnAction(e -> {
		setMode();
		setText();
	});

	lv.getSelectionModel().selectedItemProperty().addListener(
		ov -> {
		setMode();
		setText();
	});

	// Place nodes in the pane
	BorderPane pane = new BorderPane();
	pane.setTop(lblSelectionMode);
	pane.setCenter(new ScrollPane(lv));
	pane.setBottom(lblSelectedItems);
	pane.setAlignment(lblSelectionMode, Pos.CENTER);

	// Create a scene and place it in the stage
	Scene scene = new Scene(pane, 268, 196);
	primaryStage.setTitle("Exercise_16_16"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage
}
 
Example 10
Source File: Exercise_16_12.java    From Intro-to-Java-Programming with MIT License 5 votes vote down vote up
@Override // Override the start method in the Application class
public void start(Stage primaryStage) {
	// Create a text area
	TextArea textArea = new TextArea();
	textArea.setEditable(false);
	textArea.setWrapText(false);

	// Create a scrollPane
	ScrollPane scrollPane = new ScrollPane(textArea);

	// Create two check boxes
	CheckBox chkEditable = new CheckBox("Editable");
	CheckBox chkWrap = new CheckBox("Wrap");

	// Create a hbox
	HBox paneForButtons = new HBox(5);
	paneForButtons.setAlignment(Pos.CENTER);
	paneForButtons.getChildren().addAll(chkEditable, chkWrap);

	// Create a pane 
	BorderPane pane = new BorderPane();
	pane.setCenter(scrollPane);
	pane.setBottom(paneForButtons);

	// Create and register handlers
	chkEditable.setOnAction(e -> {
		textArea.setEditable(chkEditable.isSelected());
	});

	chkWrap.setOnAction(e -> {
		textArea.setWrapText(chkWrap.isSelected());
	});

	// Create a scene and place it in the stage
	Scene scene = new Scene(pane);
	primaryStage.setTitle("Exercise_16_12"); // Set the stage title
	primaryStage.setScene(scene); // Place the scene in the stage
	primaryStage.show(); // Display the stage
}
 
Example 11
Source File: RunMathSamples.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
@Override
public void start(final Stage primaryStage) {
    final BorderPane root = new BorderPane();

    final FlowPane buttons = new FlowPane();
    buttons.setAlignment(Pos.CENTER_LEFT);
    root.setCenter(buttons);
    root.setBottom(makeScreenShot);

    buttons.getChildren().add(new MyButton("DataSetAverageSample", new DataSetAverageSample()));
    buttons.getChildren().add(new MyButton("DataSetFilterSample", new DataSetFilterSample()));
    buttons.getChildren()
            .add(new MyButton("DataSetIntegrateDifferentiateSample", new DataSetIntegrateDifferentiateSample()));
    buttons.getChildren()
            .add(new MyButton("DataSetIntegrationWithLimitsSample", new DataSetIntegrationWithLimitsSample()));
    buttons.getChildren().add(new MyButton("DataSetSpectrumSample", new DataSetSpectrumSample()));
    buttons.getChildren().add(new MyButton("EMDSample", new EMDSample()));
    buttons.getChildren().add(new MyButton("FourierSample", new FourierSample()));
    buttons.getChildren().add(new MyButton("FrequencyFilterSample", new FrequencyFilterSample()));
    buttons.getChildren().add(new MyButton("GaussianFitSample", new GaussianFitSample()));
    // buttons.getChildren().add(new MyButton("IIRFilterSample", new IIRFilterSample()));
    buttons.getChildren().add(new MyButton("IIRFrequencyFilterSample", new IIRFrequencyFilterSample()));
    buttons.getChildren().add(new MyButton("ShortTermFourierTransform", new ShortTimeFourierTransformSample()));
    buttons.getChildren().add(new MyButton("TSpectrum", new TSpectrumSample()));
    buttons.getChildren().add(new MyButton("WaveletDenoising", new WaveletDenoising()));
    buttons.getChildren().add(new MyButton("WaveletScalogram", new WaveletScalogram()));

    final Scene scene = new Scene(root);

    primaryStage.setTitle(this.getClass().getSimpleName());
    primaryStage.setScene(scene);
    primaryStage.setOnCloseRequest(evt -> System.exit(0));
    primaryStage.show();
}
 
Example 12
Source File: ShowLineDemo.java    From RichTextFX with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void start(Stage primaryStage) throws Exception {
    StringBuilder sb = new StringBuilder();
    int max = 100;
    for (int i = 0; i < max; i++) {
        sb.append("Line Index: ").append(i).append("\n");
    }
    sb.append("Line Index: ").append(max);
    InlineCssTextArea area = new InlineCssTextArea(sb.toString());
    VirtualizedScrollPane<InlineCssTextArea> vsPane = new VirtualizedScrollPane<>(area);

    Function<Integer, Integer> clamp = i -> Math.max(0, Math.min(i, area.getLength() - 1));
    Button showInViewportButton = createButton("Show line somewhere in Viewport", ae -> {
        area.showParagraphInViewport(clamp.apply(field.getTextAsInt()));
    });
    Button showAtViewportTopButton = createButton("Show line at top of viewport", ae -> {
        area.showParagraphAtTop(clamp.apply(field.getTextAsInt()));
    });
    Button showAtViewportBottomButton = createButton("Show line at bottom of viewport", ae -> {
        area.showParagraphAtBottom(clamp.apply(field.getTextAsInt()));
    });

    VBox vbox = new VBox(field, showInViewportButton, showAtViewportTopButton, showAtViewportBottomButton);
    vbox.setAlignment(Pos.CENTER);

    BorderPane root = new BorderPane();
    root.setCenter(vsPane);
    root.setBottom(vbox);

    Scene scene = new Scene(root, 700, 500);
    primaryStage.setScene(scene);
    primaryStage.show();

}
 
Example 13
Source File: ClientBuilderView.java    From Maus with GNU General Public License v3.0 5 votes vote down vote up
BorderPane getClientBuilderView() {
    BorderPane borderPane = new BorderPane();
    borderPane.getStylesheets().add(getClass().getResource("/css/global.css").toExternalForm());
    borderPane.setTop(new TopBar().getTopBar(Maus.getPrimaryStage()));
    borderPane.setLeft(clientBuilderSettingsLeft());
    borderPane.setCenter(clientBuilderSettingsCenter());
    borderPane.setBottom(new BottomBar().getBottomBar());
    return borderPane;
}
 
Example 14
Source File: InputDialog.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create our input dialog.
 */
private InputDialog() {
    initModality(Modality.APPLICATION_MODAL);
    setResizable(false);
    BorderPane mainPane = new BorderPane();
    messageLabel = new Label();
    BorderPane.setMargin(messageLabel, new Insets(5));
    mainPane.setTop(messageLabel);
    textField = new TextField();
    BorderPane.setMargin(textField, new Insets(5));
    mainPane.setCenter(textField);
    okButton = new Button(LabelGrabber.INSTANCE.getLabel("ok.button"), new ImageView(new Image("file:icons/tick.png")));
    okButton.setDefaultButton(true);
    okButton.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            hide();
        }
    });
    BorderPane.setMargin(okButton, new Insets(5));
    BorderPane.setAlignment(okButton, Pos.CENTER);
    mainPane.setBottom(okButton);
    Scene scene = new Scene(mainPane);
    if (QueleaProperties.get().getUseDarkTheme()) {
        scene.getStylesheets().add("org/modena_dark.css");
    }
    setScene(scene);
}
 
Example 15
Source File: PluginParametersDialog.java    From constellation with Apache License 2.0 5 votes vote down vote up
/**
 * Display a dialog box containing the parameters that allows the user to
 * enter values.
 *
 * @param owner The owner for this stage.
 * @param title The dialog box title.
 * @param parameters The plugin parameters.
 * @param options The dialog box button labels, one for each button.
 */
public PluginParametersDialog(final Stage owner, final String title, final PluginParameters parameters, final String... options) {
    initStyle(StageStyle.UTILITY);
    initModality(Modality.WINDOW_MODAL);
    initOwner(owner);

    setTitle(title);

    final BorderPane root = new BorderPane();
    root.setPadding(new Insets(10));
    root.setStyle("-fx-background-color: #DDDDDD;");
    final Scene scene = new Scene(root);
    setScene(scene);

    final PluginParametersPane parametersPane = PluginParametersPane.buildPane(parameters, null);
    root.setCenter(parametersPane);

    final FlowPane buttonPane = new FlowPane();
    buttonPane.setAlignment(Pos.BOTTOM_RIGHT);
    buttonPane.setPadding(new Insets(5));
    buttonPane.setHgap(5);
    root.setBottom(buttonPane);

    final String[] labels = options != null && options.length > 0 ? options : new String[]{OK, CANCEL};
    for (final String option : labels) {
        final Button okButton = new Button(option);
        okButton.setOnAction(event -> {
            result = option;
            parameters.storeRecentValues();
            PluginParametersDialog.this.hide();
        });
        buttonPane.getChildren().add(okButton);
    }

    // Without this, some parameter panes have a large blank area at the bottom. Huh?
    this.sizeToScene();

    result = null;
}
 
Example 16
Source File: Exercise_20_02.java    From Intro-to-Java-Programming with MIT License 4 votes vote down vote up
@Override // Override the start method in the Application class 
public void start(Stage primaryStage) {
	// Create three buttons
	Button btSort = new Button("Sort");
	Button btShuffle = new Button("Shuffle");
	Button btReverse = new Button("Reverse");

	// Create a pane to hold the textfield
	HBox paneForTextField = new HBox(10);
	paneForTextField.getChildren().addAll(
		new Label("Enter a number:"), textField);
	paneForTextField.setAlignment(Pos.CENTER);

	// Create a pane to hold buttons
	HBox paneForButtons = new HBox(5);
	paneForButtons.getChildren().addAll(
		btSort, btShuffle, btReverse);
	paneForButtons.setAlignment(Pos.CENTER);

	// Set text area editable and text wrap properties
	textArea.setEditable(false);
	textArea.setWrapText(true);

	// Create a border pane and add nodes to it
	BorderPane pane = new BorderPane();
	pane.setTop(paneForTextField);
	pane.setCenter(textArea);
	pane.setBottom(paneForButtons);


	// Create and register handles
	textField.setOnAction(e -> add()); // add and integer

	// Sort the list
	btSort.setOnAction(e -> {
		Collections.sort(list);
		displayText();
	});

	// Shuffle the list
	btShuffle.setOnAction(e -> {
		Collections.shuffle(list);
		displayText();
	});

	// Reverse the list
	btReverse.setOnAction(e -> {
		Collections.sort(list, Collections.reverseOrder());
		displayText();
	});


	// Create a Scene and place it in the stage
	Scene scene = new Scene(pane, 400, 150);
	primaryStage.setTitle("Exercise_20_02"); // Set the stage title
	primaryStage.setScene(scene); // Place a scene in the stage
	primaryStage.show(); // Display the stage
}
 
Example 17
Source File: ChatPane.java    From oim-fx with MIT License 4 votes vote down vote up
private void initComponent() {

		textLabel.setStyle("-fx-font-size: 16px;");

		HBox line = new HBox();
		line.setMinHeight(1);
		line.setStyle("-fx-background-color:#d6d6d6;");

		middleToolBarBox.setPadding(new Insets(10, 0, 0, 20));
		middleToolBarBox.setMinHeight(25);
		middleToolBarBox.setSpacing(10);
		middleToolBarBox.setAlignment(Pos.CENTER_LEFT);

		VBox writeTempBox = new VBox();

		writeTempBox.getChildren().add(line);
		writeTempBox.getChildren().add(middleToolBarBox);

		chatShowPane.setStyle("-fx-background-color:#f5f5f5;");
		writeBorderPane.setStyle("-fx-background-color:#ffffff;");

		writeBorderPane.setTop(writeTempBox);
		writeBorderPane.setCenter(chatWritePane);

		splitPane.setTop(chatShowPane);
		splitPane.setBottom(writeBorderPane);
		splitPane.setPrefWidth(780);

		HBox textHBox = new HBox();
		textHBox.setPadding(new Insets(28, 0, 15, 28));
		textHBox.setAlignment(Pos.CENTER_LEFT);
		textHBox.getChildren().add(textLabel);

		topRightButtonBox.setAlignment(Pos.CENTER_RIGHT);
		topRightButtonBox.setPadding(new Insets(25, 20, 0, 0));

		VBox topRightButtonVBox = new VBox();
		topRightButtonVBox.setAlignment(Pos.CENTER);
		topRightButtonVBox.getChildren().add(topRightButtonBox);

		BorderPane topBorderPane = new BorderPane();
		topBorderPane.setCenter(textHBox);
		topBorderPane.setRight(topRightButtonVBox);

		HBox topLine = new HBox();
		topLine.setMinHeight(1);
		topLine.setStyle("-fx-background-color:#d6d6d6;");

		VBox topVBox = new VBox();
		topVBox.setPadding(new Insets(0, 0, 0, 0));
		topVBox.getChildren().add(topBorderPane);
		topVBox.getChildren().add(topLine);

		sendButton.setText("发送");

		sendButton.setPrefSize(72, 24);
		sendButton.setFocusTraversable(false);

		bottomButtonBox.setStyle("-fx-background-color:#ffffff;");
		bottomButtonBox.setPadding(new Insets(0, 15, 0, 0));
		bottomButtonBox.setSpacing(5);
		bottomButtonBox.setAlignment(Pos.CENTER_RIGHT);
		bottomButtonBox.setMinHeight(40);
		bottomButtonBox.getChildren().add(sendButton);

		BorderPane borderPane = new BorderPane();
		borderPane.setCenter(splitPane);
		borderPane.setBottom(bottomButtonBox);

		baseBorderPane.setTop(topVBox);
		baseBorderPane.setCenter(borderPane);

		this.getChildren().add(baseBorderPane);
	}
 
Example 18
Source File: UICodePluginItem.java    From tcMenu with Apache License 2.0 4 votes vote down vote up
public UICodePluginItem(CodePluginManager mgr, CodePluginItem item, UICodeAction action, Consumer<CodePluginItem> evt) {
    super();

    this.eventHandler = evt;

    this.mgr = mgr;
    this.item = item;

    titleLabel = new Label(item.getDescription());
    titleLabel.setStyle("-fx-font-weight: bold; -fx-font-size: 110%;");

    descriptionArea = new Label(item.getExtendedDescription());
    descriptionArea.setWrapText(true);
    descriptionArea.setAlignment(Pos.TOP_LEFT);
    descriptionArea.setPrefWidth(1900);

    whichPlugin = new Label("Plugin loading");
    whichPlugin.setStyle("-fx-font-size: 90%;");
    whichPlugin.setPadding(new Insets(10, 5, 5, 5));

    licenseLink = new Hyperlink("License unknown");
    licenseLink.setDisable(true);
    licenseLink.setPadding(new Insets(10, 0, 5, 0));
    licenseLink.setStyle("-fx-font-size: 90%;");

    vendorLink = new Hyperlink("Vendor unknown");
    vendorLink.setDisable(true);
    vendorLink.setPadding(new Insets(10, 0, 5, 0));
    vendorLink.setStyle("-fx-font-size: 90%;");

    docsLink = new Hyperlink("No Docs");
    docsLink.setDisable(true);
    docsLink.setPadding(new Insets(10, 0, 5, 0));
    docsLink.setStyle("-fx-font-size: 90%;");

    infoContainer = new HBox(5);
    infoContainer.setAlignment(Pos.CENTER_LEFT);
    infoContainer.getChildren().add(whichPlugin);
    infoContainer.getChildren().add(docsLink);
    infoContainer.getChildren().add(licenseLink);
    infoContainer.getChildren().add(vendorLink);

    innerBorder = new BorderPane();
    innerBorder.setPadding(new Insets(4));
    innerBorder.setTop(titleLabel);
    innerBorder.setCenter(descriptionArea);
    innerBorder.setBottom(infoContainer);

    actionButton = new Button(action == UICodeAction.CHANGE ? "Change" : "Select");
    actionButton.setStyle("-fx-font-size: 110%; -fx-font-weight: bold;");
    actionButton.setMaxSize(2000, 2000);
    actionButton.setOnAction(event-> eventHandler.accept(item));

    setRight(actionButton);
    setCenter(innerBorder);

    setItem(item);
}
 
Example 19
Source File: SiteListStage.java    From dm3270 with Apache License 2.0 4 votes vote down vote up
public SiteListStage (Preferences prefs, String key, int max, boolean show3270e)
{
  super (prefs);

  setTitle ("Site Manager");

  readPrefs (key, max);

  fields.add (new PreferenceField (key + " name", 150, Type.TEXT));
  fields.add (new PreferenceField ("URL", 150, Type.TEXT));
  fields.add (new PreferenceField ("Port", 50, Type.NUMBER));
  fields.add (new PreferenceField ("Ext", 50, Type.BOOLEAN));
  fields.add (new PreferenceField ("Model", 40, Type.NUMBER));
  fields.add (new PreferenceField ("Plugins", 50, Type.BOOLEAN));
  fields.add (new PreferenceField ("Save folder", 80, Type.TEXT));

  VBox vbox = getHeadings ();

  // input fields
  for (Site site : sites)
  {
    HBox hbox = new HBox ();
    hbox.setSpacing (5);
    hbox.setPadding (new Insets (0, 5, 0, 5));    // trbl

    for (int i = 0; i < fields.size (); i++)
    {
      PreferenceField field = fields.get (i);
      if (field.type == Type.TEXT || field.type == Type.NUMBER)
      {
        TextField textField = site.getTextField (i);
        textField.setMaxWidth (field.width);
        hbox.getChildren ().add (textField);
      }
      else if (field.type == Type.BOOLEAN)
      {
        HBox box = new HBox ();
        CheckBox checkBox = site.getCheckBoxField (i);
        box.setPrefWidth (field.width);
        box.setAlignment (Pos.CENTER);
        box.getChildren ().add (checkBox);
        hbox.getChildren ().add (box);
      }
    }
    vbox.getChildren ().add (hbox);
  }

  BorderPane borderPane = new BorderPane ();
  borderPane.setCenter (vbox);
  borderPane.setBottom (buttons ());

  Scene scene = new Scene (borderPane);
  setScene (scene);

  saveButton.setOnAction (e -> save (key));
  cancelButton.setOnAction (e -> this.hide ());
  editListButton.setOnAction (e -> this.show ());
}
 
Example 20
Source File: TransfersStage.java    From xframium-java with GNU General Public License v3.0 4 votes vote down vote up
public TransfersStage (Screen screen)
{
  setTitle ("File Transfers");

  setOnCloseRequest (e -> closeWindow ());
  btnHide.setOnAction (e -> closeWindow ());

  tsoCommand = new TSOCommand ();
  screen.getFieldManager ().addScreenChangeListener (tsoCommand);

  datasetTab = new DatasetTab (screen, tsoCommand);
  jobTab = new BatchJobTab (screen, tsoCommand);
  filesTab = new FilesTab (screen, tsoCommand, prefs);
  commandsTab = new CommandsTab (screen, tsoCommand);
  transfersTab = new TransfersTab (screen, tsoCommand);
  tabPane.getTabs ().addAll (datasetTab, jobTab, filesTab, commandsTab, transfersTab);
  tabPane.setTabMinWidth (80);

  screenChangeListeners =
      Arrays.asList (datasetTab, jobTab, filesTab, commandsTab, transfersTab);
  keyboardStatusListeners =
      Arrays.asList (datasetTab, jobTab, filesTab, commandsTab, transfersTab);

  datasetTab.addDatasetSelectionListener (transfersTab);
  filesTab.addFileSelectionListener (transfersTab);
  jobTab.addJobSelectionListener (transfersTab);

  AnchorPane anchorPane = new AnchorPane ();
  AnchorPane.setLeftAnchor (tsoCommand.getBox (), 10.0);
  AnchorPane.setBottomAnchor (tsoCommand.getBox (), 10.0);
  AnchorPane.setTopAnchor (tsoCommand.getBox (), 10.0);
  AnchorPane.setTopAnchor (btnHide, 10.0);
  AnchorPane.setBottomAnchor (btnHide, 10.0);
  AnchorPane.setRightAnchor (btnHide, 10.0);
  anchorPane.getChildren ().addAll (tsoCommand.getBox (), btnHide);

  BorderPane borderPane = new BorderPane ();
  //menuBar = filesTab.getMenuBar ();
  //borderPane.setTop (menuBar);
  borderPane.setCenter (tabPane);
  borderPane.setBottom (anchorPane);

  //menuBar.setUseSystemMenuBar (SYSTEM_MENUBAR);

  Scene scene = new Scene (borderPane, 800, 500);             // width/height
  setScene (scene);

  windowSaver = new WindowSaver (prefs, this, "DatasetStage");
  windowSaver.restoreWindow ();

  tabPane.getSelectionModel ().selectedItemProperty ()
      .addListener ( (obs, oldSelection, newSelection) -> select (newSelection));

  tabPane.getSelectionModel ().select (datasetTab);
}