javafx.scene.control.Button Java Examples

The following examples show how to use javafx.scene.control.Button. 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: AwesomeFontDemo.java    From bisq with GNU Affero General Public License v3.0 8 votes vote down vote up
@Override
public void start(Stage primaryStage) {
    FlowPane flowPane = new FlowPane();
    flowPane.setStyle("-fx-background-color: #ddd;");
    flowPane.setHgap(2);
    flowPane.setVgap(2);
    List<AwesomeIcon> values = new ArrayList<>(Arrays.asList(AwesomeIcon.values()));
    values.sort((o1, o2) -> o1.name().compareTo(o2.name()));
    for (AwesomeIcon icon : values) {
        Label label = new Label();
        Button button = new Button(icon.name(), label);
        button.setStyle("-fx-background-color: #fff;");
        AwesomeDude.setIcon(label, icon, "12");
        flowPane.getChildren().add(button);
    }

    primaryStage.setScene(new Scene(flowPane, 1200, 950));
    primaryStage.show();
}
 
Example #2
Source File: RFXButtonBaseTest.java    From marathonv5 with Apache License 2.0 7 votes vote down vote up
@Test
public void click() {
    Button button = (Button) getPrimaryStage().getScene().getRoot().lookup(".button");
    LoggingRecorder lr = new LoggingRecorder();
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            RFXButtonBase rfxButtonBase = new RFXButtonBase(button, null, null, lr);
            Point2D sceneXY = button.localToScene(new Point2D(3, 3));
            PickResult pickResult = new PickResult(button, sceneXY.getX(), sceneXY.getY());
            Point2D screenXY = button.localToScreen(new Point2D(3, 3));
            MouseEvent me = new MouseEvent(button, button, MouseEvent.MOUSE_PRESSED, 3, 3, sceneXY.getX(), screenXY.getY(),
                    MouseButton.PRIMARY, 1, false, false, false, false, true, false, false, false, false, false, pickResult);
            rfxButtonBase.mouseButton1Pressed(me);
        }
    });
    List<Recording> recordings = lr.waitAndGetRecordings(1);
    Recording select = recordings.get(0);
    AssertJUnit.assertEquals("click", select.getCall());
    AssertJUnit.assertEquals("", select.getParameters()[0]);
}
 
Example #3
Source File: FxlDemo.java    From fxldemo-gradle with Apache License 2.0 7 votes vote down vote up
public void start(Stage stage) throws Exception {
    stage.setTitle("Hello World");
    stage.initStyle(StageStyle.UNDECORATED);

    Label label = new Label(stage.getTitle());
    label.setStyle("-fx-font-size: 25");

    // Alibi for including ControlsFX Dependency :)
    SegmentedButton fxcontrol = new SegmentedButton(new ToggleButton("One"), new ToggleButton("Two"), new ToggleButton("Three"));

    Button exitButton = new Button("Exit");
    exitButton.setStyle("-fx-font-weight: bold");
    exitButton.setOnAction(event -> Platform.exit());

    VBox root = new VBox(label, fxcontrol, exitButton);
    root.setAlignment(Pos.CENTER);
    root.setSpacing(20);
    root.setPadding(new Insets(25));
    root.setStyle("-fx-border-color: lightblue");

    stage.setScene(new Scene(root));
    stage.show();
}
 
Example #4
Source File: MetaDeckView.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
public void displayDecks(List<Deck> decks) {
	contentPane.getChildren().clear();
	for (Deck deck : decks) {
		if (deck.isMetaDeck()) {
			continue;
		}
		ImageView graphic = new ImageView(IconFactory.getClassIcon(deck.getHeroClass()));
		graphic.setFitWidth(48);
		graphic.setFitHeight(48);
		Button deckButton = new Button(deck.getName(), graphic);
		deckButton.setMaxWidth(160);
		deckButton.setMinWidth(160);
		deckButton.setMaxHeight(120);
		deckButton.setMinHeight(120);
		deckButton.setWrapText(true);
		deckButton.setContentDisplay(ContentDisplay.LEFT);
		deckButton.setOnAction(event -> NotificationProxy.sendNotification(GameNotification.ADD_DECK_TO_META_DECK, deck));
		deckButton.setUserData(deck);
		contentPane.getChildren().add(deckButton);
	}
}
 
Example #5
Source File: DialogControlTest.java    From WorkbenchFX with Apache License 2.0 6 votes vote down vote up
@Test
void getButton() {
  // when asking for a button type
  Optional<Button> button = dialogControl.getButton(BUTTON_TYPE_1);

  // returns its button in an Optional
  assertNotEquals(Optional.empty(), button);
  assertEquals(dialogControl.getButtons().get(0), button.get());

  // if the buttonType doesn't exist
  button = dialogControl.getButton(ButtonType.CANCEL);

  // return empty optional
  assertEquals(Optional.empty(), button);

  // if there are no buttonTypes
  buttonTypes.clear();
  button = dialogControl.getButton(BUTTON_TYPE_1);

  // return empty optional
  assertEquals(Optional.empty(), button);
}
 
Example #6
Source File: NoteCell.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public NoteCell(Service service, Consumer<Note> edit, Consumer<Note> remove) {
    
    tile = new ListTile();
    tile.setPrimaryGraphic(MaterialDesignIcon.DESCRIPTION.graphic());
    
    Button btnEdit = MaterialDesignIcon.EDIT.button(e -> edit.accept(currentItem));
    Button btnRemove = MaterialDesignIcon.DELETE.button(e -> remove.accept(currentItem));
    HBox buttonBar = new HBox(0, btnEdit, btnRemove);
    buttonBar.setAlignment(Pos.CENTER_RIGHT);

    tile.setSecondaryGraphic(buttonBar);
    
    dateFormat = DateTimeFormatter.ofPattern("EEE, MMM dd yyyy - HH:mm", Locale.ENGLISH);
    
    noteChangeListener = (obs, ov, nv) -> update();
    
    service.settingsProperty().addListener((obs, ov, nv) -> {
        settings = nv;
        update();
    });
    settings = service.settingsProperty().get();
    update();
}
 
Example #7
Source File: GetDataDialog.java    From examples-javafx-repos1 with Apache License 2.0 6 votes vote down vote up
public void init() {
    vbox = new VBox();
    vbox.setSpacing(20.0d);
    vbox.setPadding(new Insets(10.0d));

    TextField tf = new TextField();

    Button btn = new Button("Submit");
    btn.setOnAction( (evt) -> {
        data = tf.getText();
        ((Button)evt.getSource()).getScene().getWindow().hide();
    } );

    vbox.getChildren().add(new Label("Enter Data"));
    vbox.getChildren().add(tf);
    vbox.getChildren().add(btn);
}
 
Example #8
Source File: KitSelectionDialog.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void initComponents()
{
	Container pane = getContentPane();
	pane.setLayout(new BorderLayout());

	pane.add(kitPanel, BorderLayout.CENTER);

	Button closeButton = new Button(LanguageBundle.getString("in_close"));
	closeButton.setOnAction(this::onClose);

	Box buttons = Box.createHorizontalBox();
	buttons.add(GuiUtility.wrapParentAsJFXPanel(closeButton));
	pane.add(buttons, BorderLayout.PAGE_END);

	Utility.installEscapeCloseOperation(this);
}
 
Example #9
Source File: FormBuilder.java    From bisq with GNU Affero General Public License v3.0 6 votes vote down vote up
public static <T> Tuple3<Label, ComboBox<T>, Button> addLabelComboBoxButton(GridPane gridPane,
                                                                            int rowIndex,
                                                                            String title,
                                                                            String buttonTitle,
                                                                            double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);

    HBox hBox = new HBox();
    hBox.setSpacing(10);

    Button button = new AutoTooltipButton(buttonTitle);
    button.setDefaultButton(true);

    ComboBox<T> comboBox = new JFXComboBox<>();

    hBox.getChildren().addAll(comboBox, button);

    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    GridPane.setMargin(hBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(hBox);

    return new Tuple3<>(label, comboBox, button);
}
 
Example #10
Source File: ConfigController.java    From mapper-generator-javafx with Apache License 2.0 6 votes vote down vote up
/**
 * 删除配置
 *
 * @param generatorConfig 配置信息
 */
private void deleteConfig(Button button, GeneratorConfig generatorConfig) {
    ObservableList<Node> children = centerVBox.getChildren();
    int size = children.size();
    if (size == 1) {
        exportController.clearPane();
    } else {
        int i = children.indexOf(button);
        if (i == 0) {
            exportController.showConfig(configNameConfigMap.get(((Button) children.get(1)).getText()));
        } else {
            exportController.showConfig(configNameConfigMap.get(((Button) children.get(0)).getText()));
        }
    }
    children.remove(button);
    configService.deleteConfig(generatorConfig);
}
 
Example #11
Source File: DeployFragment.java    From Notebook with Apache License 2.0 6 votes vote down vote up
@Override
public void initData(Parent node, Map<String, String> bundle) {
	btn_deploy = (Button) node.lookup("#btn_deploy");
	progressbar = (ProgressIndicator) node.lookup("#progressbar");

	btn_deploy.setOnAction(e->{
		progressbar.isIndeterminate();// һ ��������ʾ�����ڷ�ȷ��ģʽ,����progressbar����һ����ֵ�и�Сbug������¡�
		progressbar.setVisible(true);
		progressbar.setProgress(-1f);
		progressbar.setProgress(0.5f);
		progressbar.setProgress(-1f);
		btn_deploy.setDisable(true);// �����ظ����

		AnnotationHandler.sendMessage("work",null);
	});

	AnnotationHandler.register(this);

}
 
Example #12
Source File: HelpDialogController.java    From examples-javafx-repos1 with Apache License 2.0 5 votes vote down vote up
@FXML
public void close(ActionEvent evt) {

    //
    // For some reason, this.getScene() which is on the fx:root returns null
    //

    Scene scene = ((Button)evt.getSource()).getScene();
    if( scene != null ) {
        Window w = scene.getWindow();
        if (w != null) {
            w.hide();
        }
    }
}
 
Example #13
Source File: PreferencesFxDialog.java    From PreferencesFX with Apache License 2.0 5 votes vote down vote up
private void unbindVisibility(Button closeBtn, Button cancelBtn) {
  // make sure if visibleProperty was bound in a previous call to unbind it first
  if (closeBtn != null) {
    closeBtn.visibleProperty().unbind();
  }
  if (cancelBtn != null) {
    cancelBtn.visibleProperty().unbind();
  }
}
 
Example #14
Source File: DefaultBibleSelector.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
private Button createDeleteBibleButton() {
    final Button deleteBibleButton = new Button(LabelGrabber.INSTANCE.getLabel("delete.bible.label"),
            new ImageView(new Image("file:icons/cross.png")));
    deleteBibleButton.setOnAction(t -> {

        Bible bible = BibleManager.get().getBibleFromName(comboBox.getSelectionModel().getSelectedItem());
        if (bible != null && bible.getFilePath() != null) {

            final AtomicBoolean yes = new AtomicBoolean();
            Dialog.buildConfirmation(LabelGrabber.INSTANCE.getLabel("delete.bible.label"),
                    LabelGrabber.INSTANCE.getLabel("delete.bible.confirmation").replace("$1", bible.getBibleName())).
                    addYesButton(ae -> {
                        yes.set(true);
                    }).addNoButton(ae -> {
            }).build().showAndWait();

            if (yes.get()) {
                try {
                    Files.delete(Paths.get(bible.getFilePath()));
                    BibleManager.get().refreshAndLoad();
                } catch (IOException ex) {
                    LOGGER.log(Level.WARNING, "Error deleting bible file", ex);
                    Dialog.showError(LabelGrabber.INSTANCE.getLabel("bible.delete.error.heading"),
                            LabelGrabber.INSTANCE.getLabel("bible.delete.error.text"));
                }
            }
        }
    });
    return deleteBibleButton;
}
 
Example #15
Source File: LogoutController.java    From HealthPlus with Apache License 2.0 5 votes vote down vote up
public LogoutController(Button button,User user) {
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/Logout.fxml"));
    fxmlLoader.setRoot(this);
    fxmlLoader.setController(this);
    
    this.user = user;
    mainLogoutButton = button;
    
    try {
        fxmlLoader.load();            
    } catch (IOException exception) {
        throw new RuntimeException(exception);
    }
}
 
Example #16
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 #17
Source File: AbstractSimpleAction.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public Button getButtonWithText() {
    String cmd = commandName;
    if (cmd == null) {
        cmd = expand(name);
    }
    Button button = FXUIUtils.createButton(name, description, true, cmd);
    button.setOnAction(this);
    buttons.add(button);
    return button;
}
 
Example #18
Source File: DataCollectionUI.java    From SONDY with GNU General Public License v3.0 5 votes vote down vote up
final public void collectDataUI(){
    GridPane gridLEFT = new GridPane();
    Label queryLabel = new Label("Query");
    UIUtils.setSize(queryLabel,Main.columnWidthLEFT/2, 24);
    TextField queryField = new TextField();
    queryField.setPromptText("formatted query");
    UIUtils.setSize(queryField,Main.columnWidthLEFT/2, 24);
    Label durationLabel = new Label("Duration");
    UIUtils.setSize(durationLabel,Main.columnWidthLEFT/2, 24);
    TextField durationField = new TextField();
    durationField.setPromptText("duration in days (e.g. 2)");
    UIUtils.setSize(durationField,Main.columnWidthLEFT/2, 24);
    Label datasetIDLabel = new Label("Dataset ID");
    UIUtils.setSize(datasetIDLabel,Main.columnWidthLEFT/2, 24);
    TextField datasetIDField = new TextField();
    datasetIDField.setPromptText("unique identifier");
    UIUtils.setSize(datasetIDField,Main.columnWidthLEFT/2, 24);
    
    gridLEFT.add(queryLabel,0,0);
    gridLEFT.add(queryField,1,0);
    gridLEFT.add(new Rectangle(0,3),0,1);
    gridLEFT.add(durationLabel,0,2);
    gridLEFT.add(durationField,1,2);
    gridLEFT.add(new Rectangle(0,3),0,3);
    gridLEFT.add(datasetIDLabel,0,4);
    gridLEFT.add(datasetIDField,1,4);
    
    Button button = new Button("Collect");
    UIUtils.setSize(button,Main.columnWidthRIGHT, 24);
    button.setAlignment(Pos.CENTER);
    VBox buttonBox = new VBox();
    buttonBox.setAlignment(Pos.CENTER);
    buttonBox.getChildren().add(button);
    
    HBox collectDataBOTH = new HBox(5);
    collectDataBOTH.getChildren().addAll(gridLEFT,buttonBox);
    grid.add(collectDataBOTH,0,8);
}
 
Example #19
Source File: AssetBarComponent.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Instantiates a new Asset bar component.
 */
public AssetBarComponent() {

    final Button refreshAction = new Button();
    refreshAction.setGraphic(new ImageView(Icons.REFRESH_18));
    refreshAction.setOnAction(event -> FX_EVENT_MANAGER.notify(new RequestedRefreshAssetEvent()));

    FXUtils.addToPane(refreshAction, this);
}
 
Example #20
Source File: ColorButtonSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public ColorButtonSample() {
    HBox hBox = new HBox();
    hBox.setSpacing(5);
    for(int i=0; i<7; i++) {
        Button b = new Button("Color");
        b.setStyle("-fx-base: rgb("+(10*i)+","+(20*i)+","+(10*i)+");");
        hBox.getChildren().add(b);
    }
    HBox hBox2 = new HBox();
    hBox2.setSpacing(5);
    hBox2.setTranslateY(30);
    Button red = new Button("Red");
    red.setStyle("-fx-base: red;");
    Button orange = new Button("Orange");
    orange.setStyle("-fx-base: orange;");
    Button yellow = new Button("Yellow");
    yellow.setStyle("-fx-base: yellow;");
    Button green = new Button("Green");
    green.setStyle("-fx-base: green;");
    Button blue = new Button("Blue");
    blue.setStyle("-fx-base: rgb(30,170,255);");
    Button indigo = new Button("Indigo");
    indigo.setStyle("-fx-base: blue;");
    Button violet = new Button("Violet");
    violet.setStyle("-fx-base: purple;");
    hBox2.getChildren().add(red);
    hBox2.getChildren().add(orange);
    hBox2.getChildren().add(yellow);
    hBox2.getChildren().add(green);
    hBox2.getChildren().add(blue);
    hBox2.getChildren().add(indigo);
    hBox2.getChildren().add(violet);

    VBox vBox = new VBox(20);
    vBox.getChildren().addAll(hBox,hBox2);
    getChildren().add(vBox);
}
 
Example #21
Source File: SettingsWindowController.java    From SmartModInserter with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void updateButton(Button button, Path path) {
    if (path != null) {
        button.setText(".../" + path.getFileName().toString());
    } else {
        button.setText("...");
    }
    closeButton.setDisable(Datastore.getInstance().getDataDir() == null || Datastore.getInstance().getFactorioApplication() == null);
}
 
Example #22
Source File: PropertyCollectionView.java    From pmd-designer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public PropertyCollectionView(@NamedArg("designerRoot") DesignerRoot root) {
    this.root = root;

    this.getStyleClass().addAll("property-collection-view");

    view = new ListView<>();
    initListView(view);
    setOwnerStageFactory(root.getMainStage()); // default

    AnchorPane footer = new AnchorPane();
    footer.setPrefHeight(30);
    footer.getStyleClass().addAll("footer");
    footer.getStylesheets().addAll(DesignerUtil.getCss("flat").toString());


    Button addProperty = new Button("Add property");

    ControlUtil.anchorFirmly(addProperty);

    addProperty.setOnAction(e -> {
        addNewProperty(getUniqueNewName());
        view.requestFocus();
    });
    footer.getChildren().addAll(addProperty);
    this.getChildren().addAll(view, footer);

    myEditPopover = new PopOverWrapper<>(this::rebindPopover);

    myEditPopover.rebind(new PropertyDescriptorSpec());
    myEditPopover.doFirstLoad(root.getMainStage());

}
 
Example #23
Source File: PropertyCollectionView.java    From pmd-designer with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void fireEditLast() {
    view.getSelectionModel().select(view.getItems().size() - 1);
    view.lookupAll(".list-cell").stream()
        .map(it -> (PropertyDescriptorCell) it)
        .max(Comparator.comparingInt(PropertyDescriptorCell::getIndex))
        .map(it -> (Button) it.lookup("." + PropertyDescriptorCell.DETAILS_BUTTON_CLASS))
        .ifPresent(Button::fire);
}
 
Example #24
Source File: ControlStyle.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static ControlStyle getControlStyle(Node node) {
    if (node == null || node.getId() == null) {
        return null;
    }
    String id = node.getId();
    ControlStyle style = null;
    if (id.startsWith("his")) {
        style = getHisControlStyle(id);
    } else if (id.startsWith("settings")) {
        style = getSettingsControlStyle(id);
    } else if (id.startsWith("scope")) {
        style = getScopeControlStyle(id);
    } else if (id.startsWith("color")) {
        style = getColorControlStyle(id);
    } else if (id.startsWith("imageManu")) {
        style = getImageManuControlStyle(id);
    } else if (node instanceof ImageView) {
        style = getImageViewStyle(id);
    } else if (node instanceof RadioButton) {
        style = getRadioButtonStyle(id);
    } else if (node instanceof CheckBox) {
        style = getCheckBoxStyle(id);
    } else if (node instanceof ToggleButton) {
        style = getToggleButtonStyle(id);
    } else if (node instanceof Button) {
        style = getButtonControlStyle(id);
    }
    return style;
}
 
Example #25
Source File: Arrow.java    From LogFX with GNU General Public License v3.0 5 votes vote down vote up
public static Button arrowButton( Direction direction,
                                  EventHandler<ActionEvent> eventEventHandler,
                                  String toolTipText ) {
    Button button = new Button( "", new Arrow( direction ) );
    button.setFont( Font.font( 4.0 ) );
    button.setMinWidth( 16 );
    button.setMinHeight( 8 );
    button.setTooltip( new Tooltip( toolTipText ) );
    button.getTooltip().setFont( Font.font( 12.0 ) );
    button.setOnAction( eventEventHandler );
    return button;
}
 
Example #26
Source File: MainWindowController.java    From tcMenu with Apache License 2.0 5 votes vote down vote up
private void buildDialogButton(MenuButtonType btn1, HBox buttonArea) {
    if(btn1 != MenuButtonType.NONE) {
        Button btn = new Button(btn1.getButtonName());
        btn.setOnAction((e)-> remoteControl.sendDialogAction(btn1));
        btn.getStyleClass().add("flatButton");
        HBox.setHgrow(btn, Priority.ALWAYS);
        btn.setMaxWidth(Double.MAX_VALUE);
        buttonArea.getChildren().add(btn);
    }
}
 
Example #27
Source File: WebViewSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public WebViewSample() {
    WebView webView = new WebView();
    
    final WebEngine webEngine = webView.getEngine();
    webEngine.load(DEFAULT_URL);
    
    final TextField locationField = new TextField(DEFAULT_URL);
    webEngine.locationProperty().addListener(new ChangeListener<String>() {
        @Override public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            locationField.setText(newValue);
        }
    });
    EventHandler<ActionEvent> goAction = new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent event) {
            webEngine.load(locationField.getText().startsWith("http://") 
                    ? locationField.getText() 
                    : "http://" + locationField.getText());
        }
    };
    locationField.setOnAction(goAction);
    
    Button goButton = new Button("Go");
    goButton.setDefaultButton(true);
    goButton.setOnAction(goAction);
    
    // Layout logic
    HBox hBox = new HBox(5);
    hBox.getChildren().setAll(locationField, goButton);
    HBox.setHgrow(locationField, Priority.ALWAYS);
    
    VBox vBox = new VBox(5);
    vBox.getChildren().setAll(hBox, webView);
    VBox.setVgrow(webView, Priority.ALWAYS);

    getChildren().add(vBox);
}
 
Example #28
Source File: ScheduleThemeNode.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
public ScheduleThemeNode(UpdateThemeCallback songCallback, UpdateThemeCallback bibleCallback, Stage popup, Button themeButton) {
    this.songCallback = songCallback;
    this.bibleCallback = bibleCallback;
    this.popup = popup;
    themeDialog = new EditThemeDialog();
    themeDialog.initModality(Modality.APPLICATION_MODAL);
    contentPanel = new VBox();
    BorderPane.setMargin(contentPanel, new Insets(10));
    themeButton.layoutXProperty().addListener(new ChangeListener<Number>() {
        @Override
        public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
            MainWindow mainWindow = QueleaApp.get().getMainWindow();
            double width = mainWindow.getWidth() - t1.doubleValue() - 100;
            if (width < 50) {
                width = 50;
            }
            if (width > 900) {
                width = 900;
            }
            contentPanel.setPrefWidth(width);
            contentPanel.setMaxWidth(width);
        }
    });
    setMaxHeight(300);
    contentPanel.setSpacing(5);
    contentPanel.setPadding(new Insets(3));
    refresh();
    ScrollPane scroller = new ScrollPane(contentPanel);
    scroller.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
    setCenter(scroller);
}
 
Example #29
Source File: ApplicationInformationPanelSkin.java    From phoenicis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Refreshes the shown scripts.
 * When this method is called it begins by clearing the <code>scriptGrid</code>.
 * Afterwards this method refills it.
 */
private void updateScripts(final GridPane scriptGrid) {
    scriptGrid.getChildren().clear();

    for (int i = 0; i < filteredScripts.size(); i++) {
        ScriptDTO script = filteredScripts.get(i);

        final Label scriptName = new Label(script.getScriptName());
        GridPane.setHgrow(scriptName, Priority.ALWAYS);

        if (getControl().isShowScriptSource()) {
            final Tooltip tooltip = new Tooltip(tr("Source: {0}", script.getScriptSource()));
            Tooltip.install(scriptName, tooltip);
        }

        final Button installButton = new Button(tr("Install"));
        installButton.setOnMouseClicked(evt -> {
            try {
                installScript(script);
            } catch (IllegalArgumentException e) {
                final ErrorDialog errorDialog = ErrorDialog.builder()
                        .withMessage(tr("Error while trying to download the installer"))
                        .withException(e)
                        .build();

                errorDialog.showAndWait();
            }
        });

        scriptGrid.addRow(i, scriptName, installButton);
    }
}
 
Example #30
Source File: PeriodicTableDialogController.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
@FXML
public void handleMouseEnter(MouseEvent event) {
  Node source = (Node) event.getSource();
  Button b = (Button) source;
  Elements element = Elements.ofString(b.getText());
  elementSymbol = element.symbol();
  String result = element.name();
  b.setTooltip(new Tooltip(result));
  textLabelup.setText(result + " (" + elementSymbol + ")");
  textLabelup.setFont(new Font(30));
  textLabelbottom.setText("Atomic number" + " " + element.number()
      + (", " + "Group" + " " + element.group()) + ", " + "Period" + " " + element.period()
      + "\n\n\n" + "CAS RN:" + " " + PeriodicTable.getCASId(elementSymbol) + "\n"
      + "Element Category:" + " "
      + serieTranslator(PeriodicTable.getChemicalSeries(elementSymbol)) + "\n" + "State:" + " "
      + phaseTranslator(PeriodicTable.getPhase(elementSymbol)) + "\n" + "Electronegativity:" + " "
      + (PeriodicTable.getPaulingElectronegativity(elementSymbol) == null ? "undefined"
          : PeriodicTable.getPaulingElectronegativity(elementSymbol)));

  StringBuilder sb_up =
      new StringBuilder("<html><FONT SIZE=+2>" + result + " (" + elementSymbol + ")</FONT><br> "
          + "Atomic number" + " " + element.number() + (", " + "Group" + " " + element.group())
          + ", " + "Period" + " " + element.period() + "</html>");


  StringBuilder sb_Center = new StringBuilder("<html><FONT> " + "CAS RN:" + " "
      + PeriodicTable.getCASId(elementSymbol) + "<br> " + "Element Category:" + " "
      + serieTranslator(PeriodicTable.getChemicalSeries(elementSymbol)) + "<br> " + "State:" + " "
      + phaseTranslator(PeriodicTable.getPhase(elementSymbol)) + "<br> " + "Electronegativity:"
      + " "
      + (PeriodicTable.getPaulingElectronegativity(elementSymbol) == null ? "undefined"
          : PeriodicTable.getPaulingElectronegativity(elementSymbol))
      + "<br>" + "</FONT></html>");
}