javafx.scene.control.ComboBoxBase Java Examples

The following examples show how to use javafx.scene.control.ComboBoxBase. 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: RequiredFieldValidator.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void eval() {
    if (srcControl.get() instanceof TextInputControl) {
        evalTextInputField();
    }
    if (srcControl.get() instanceof ComboBoxBase) {
        evalComboBoxField();
    }
}
 
Example #2
Source File: JfxApplication.java    From jmonkeybuilder with Apache License 2.0 4 votes vote down vote up
@Override
@FxThread
public void start(@NotNull Stage stage) throws Exception {
    JfxApplication.instance = this;
    this.stage = stage;

    addWindow(stage);
    try {

        // initialize javaFX events in javaFX thread.
        ArrayFactory.asArray(ComboBoxBase.ON_SHOWN);

        var resourceManager = ResourceManager.getInstance();
        resourceManager.reload();

        var initializationManager = InitializationManager.getInstance();
        initializationManager.onBeforeCreateJavaFxContext();

        var pluginManager = PluginManager.getInstance();
        pluginManager.handlePlugins(editorPlugin -> editorPlugin.register(CssRegistry.getInstance()));

        LogView.getInstance();
        SvgImageLoaderFactory.install();
        ImageIO.read(getClass().getResourceAsStream("/ui/icons/test/test.jpg"));

        var icons = stage.getIcons();
        icons.add(new Image("/ui/icons/app/256x256.png"));
        icons.add(new Image("/ui/icons/app/128x128.png"));
        icons.add(new Image("/ui/icons/app/96x96.png"));
        icons.add(new Image("/ui/icons/app/64x64.png"));
        icons.add(new Image("/ui/icons/app/48x48.png"));
        icons.add(new Image("/ui/icons/app/32x32.png"));
        icons.add(new Image("/ui/icons/app/24x24.png"));
        icons.add(new Image("/ui/icons/app/16x16.png"));

        var config = EditorConfig.getInstance();

        stage.initStyle(StageStyle.DECORATED);
        stage.setMinHeight(600);
        stage.setMinWidth(800);
        stage.setWidth(config.getScreenWidth());
        stage.setHeight(config.getScreenHeight());
        stage.setMaximized(config.isMaximized());
        stage.setTitle(Config.TITLE);
        stage.show();


        if (!stage.isMaximized()) {
            stage.centerOnScreen();
        }

        stage.widthProperty().addListener((observable, oldValue, newValue) -> {
            if (stage.isMaximized()) return;
            config.setScreenWidth(newValue.intValue());
        });
        stage.heightProperty().addListener((observable, oldValue, newValue) -> {
            if (stage.isMaximized()) return;
            config.setScreenHeight(newValue.intValue());
        });

        stage.maximizedProperty()
                .addListener((observable, oldValue, newValue) -> config.setMaximized(newValue));

        buildScene();

    } catch (Throwable e) {
        LOGGER.error(this, e);
        throw e;
    }
}
 
Example #3
Source File: RequiredFieldValidator.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
private void evalComboBoxField() {
    ComboBoxBase comboField = (ComboBoxBase) srcControl.get();
    Object value = comboField.getValue();
    hasErrors.set(value == null || value.toString().isEmpty());
}
 
Example #4
Source File: UITest.java    From HubTurbo with GNU Lesser General Public License v3.0 4 votes vote down vote up
public <T> void waitForValue(ComboBoxBase<T> comboBoxBase) {
    GuiTest.waitUntil(comboBoxBase, c -> c.getValue() != null);
}