当前位置: 首页>>代码示例>>Java>>正文


Java CustomTextField类代码示例

本文整理汇总了Java中org.controlsfx.control.textfield.CustomTextField的典型用法代码示例。如果您正苦于以下问题:Java CustomTextField类的具体用法?Java CustomTextField怎么用?Java CustomTextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CustomTextField类属于org.controlsfx.control.textfield包,在下文中一共展示了CustomTextField类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lookupViews

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void lookupViews() {
	playlist = (Button) lookup("#playlist");
	menu = (ListView<CategoryType>) lookup("#menu");
	searchField = (CustomTextField) lookup("#searchField");
	clearSearch = (Label) searchField.getRight();
	volDown = (Label) lookup("#volumeDown");
	volSlider = (Slider) lookup("#volumeSlider");
	volUp = (Label) lookup("#volumeUp");
	shuffle = (Label) lookup("#shuffle");
	previous = (Label) lookup("#previous");
	play = (Label) lookup("#play");
	next = (Label) lookup("#next");
	loop = (Label) lookup("#loop");
	artwork = (ImageView) lookup("#artwork");
	songTitle = (Text) lookup("#songTitle");
	songLength = (Text) lookup("#songLength");
	seekbar = (Slider) lookup("#seekbar");
	currentTime = (Text) lookup("#currentTime");
	menuVBox = (VBox) lookup("#menuVBox");
	controlPane = (BorderPane) lookup("#controlPane");
}
 
开发者ID:jakemanning,项目名称:boomer-tuner,代码行数:23,代码来源:RootView.java

示例2: addToolBar

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
private void addToolBar() {
    TextField textField = new TextField();
    textField.getStyleClass().add("search-field");
    textField.textProperty().bindBidirectional(getSkinnable().filterTextProperty());

    Text clearIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.TIMES_CIRCLE, "18");
    CustomTextField customTextField = new CustomTextField();
    customTextField.getStyleClass().add("search-field");
    customTextField.setLeft(FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.SEARCH, "18px"));
    customTextField.setRight(clearIcon);
    customTextField.textProperty().bindBidirectional(getSkinnable().filterTextProperty());
    clearIcon.setOnMouseClicked(evt -> customTextField.setText(""));

    FlipPanel searchFlipPanel = new FlipPanel();
    searchFlipPanel.setFlipDirection(Orientation.HORIZONTAL);
    searchFlipPanel.getFront().getChildren().add(textField);
    searchFlipPanel.getBack().getChildren().add(customTextField);
    searchFlipPanel.visibleProperty().bind(getSkinnable().enableSortingAndFilteringProperty());

    getSkinnable().useControlsFXProperty().addListener(it -> {
        if (getSkinnable().isUseControlsFX()) {
            searchFlipPanel.flipToBack();
        } else {
            searchFlipPanel.flipToFront();
        }
    });

    showTrailerButton = new Button("Show Trailer");
    showTrailerButton.getStyleClass().add("trailer-button");
    showTrailerButton.setMaxHeight(Double.MAX_VALUE);
    showTrailerButton.setOnAction(evt -> showTrailer());

    BorderPane toolBar = new BorderPane();
    toolBar.setLeft(showTrailerButton);
    toolBar.setRight(searchFlipPanel);
    toolBar.getStyleClass().add("movie-toolbar");

    container.add(toolBar, 1, 0);
}
 
开发者ID:hendrikebbers,项目名称:ExtremeGuiMakeover,代码行数:40,代码来源:MovieViewSkin.java

示例3: makeClearable

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
/**
 * Adds a clear button to the right of the text field. The little cross appears only when the field is not empty.
 *
 * @param customTextField
 *         the text field to decorate
 */
public static void makeClearable(CustomTextField customTextField) {
    try {
        Method method =
                TextFields.class.getDeclaredMethod("setupClearButtonField", TextField.class, ObjectProperty.class);
        method.setAccessible(true);
        method.invoke(null, customTextField, customTextField.rightProperty());
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
        e.printStackTrace();
    }
}
 
开发者ID:joffrey-bion,项目名称:fx-log,代码行数:17,代码来源:UIUtils.java

示例4: SearchHandler

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
public SearchHandler(
    final GuiTaskHandler guiTaskHandler, final SessionModel model, final WordListHandler wordListHandler, final ToolBar barSearch, final CustomTextField fieldSearch,
    final Label labelMatches, final Button buttonCloseSearch, final Button buttonSearchUp, final Button buttonSearchDown) {
    this.guiTaskHandler = guiTaskHandler;
    this.model = model;
    this.wordListHandler = wordListHandler;
    this.barSearch = barSearch;
    this.fieldSearch = fieldSearch;
    this.labelMatches = labelMatches;
    this.buttonCloseSearch = buttonCloseSearch;
    this.buttonSearchUp = buttonSearchUp;
    this.buttonSearchDown = buttonSearchDown;
}
 
开发者ID:VocabHunter,项目名称:VocabHunter,代码行数:14,代码来源:SearchHandler.java

示例5: initEditableFields

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
private void initEditableFields(CustomTextField... fields) {
    for (CustomTextField field : fields) {

        Button editButton = new Button("");
        editButton.setGraphic(new SVGIcon(FontAwesomeIcon.PENCIL, Constants.EXTRA_SMALL_ICON, true));

        editButton.setOnAction((a) -> {

            if (field.isEditable()) {
                try {
                    saveUserSettings();
                    field.setEditable(false);
                    editButton.setGraphic(new SVGIcon(FontAwesomeIcon.PENCIL, Constants.EXTRA_SMALL_ICON, true));
                } catch (InterruptedException ex) {
                    ExceptionPrinter.printHistory("Could not save user settings!", ex, LOGGER);
                    Thread.currentThread().interrupt();
                }

            } else {

                field.setEditable(true);
                editButton.setGraphic(new SVGIcon(FontAwesomeIcon.FLOPPY_ALT, Constants.EXTRA_SMALL_ICON, true));
            }


        });

        field.setEditable(false);
        field.setRight(editButton);
    }
}
 
开发者ID:openbase,项目名称:bco.bcozy,代码行数:32,代码来源:UserSettingsController.java

示例6: SearchPanel

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
/**
 * Creates a new instance of the {@link SearchPanel} class.
 */
public SearchPanel() {

    super((String) null);

    this.stringFilter = new StringFilter<>();

    this.setWrappedControl(TextFields.createClearableTextField());
    this.getWrappedControl().setPromptText("Find");
    if (this.getWrappedControl() instanceof CustomTextField) {

        ((CustomTextField) this.getWrappedControl()).setLeft(new Glyph(
                "FontAwesome", FontAwesome.Glyph.SEARCH));
    }

    GridPane.setHgrow(this.getWrappedControl(), Priority.SOMETIMES);
    this.stringFilter.filterStringProperty().bindBidirectional(
            this.getWrappedControl().textProperty());


    this.close = new Hyperlink("Close");
    this.close.addEventHandler(ActionEvent.ACTION, (actionEvent) -> {

        this.getWrappedControl().setText("");
        this.setVisible(false);
        this.close.setVisited(false);
    });
    this.setCenterRightNode(this.close);
}
 
开发者ID:aftenkap,项目名称:jutility-javafx,代码行数:32,代码来源:SearchPanel.java

示例7: setupClearButtonField

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
/**
 * Workaround taken from https://bitbucket.org/controlsfx/controlsfx/issues/330/making-textfieldssetupclearbuttonfield
 */
private void setupClearButtonField(CustomTextField customTextField) {
    try {
        Method m = TextFields.class.getDeclaredMethod("setupClearButtonField", TextField.class,
                ObjectProperty.class);
        m.setAccessible(true);
        m.invoke(null, customTextField, customTextField.rightProperty());
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
        LOGGER.error("Failed to decorate text field with clear button", ex);
    }
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:14,代码来源:GroupTreeController.java

示例8: makeClearable

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
/**
 * Makes the given textField clearable by adding a clear-button decorator to it.
 * @param textField
 */
public static void makeClearable(CustomTextField textField) {

    ObjectProperty<Node> rightProperty = textField.rightProperty();

    textField.getStyleClass().add("clearable-field"); //$NON-NLS-1$

    Region clearButton = new Region();
    clearButton.getStyleClass().addAll("graphic"); //$NON-NLS-1$
    StackPane clearButtonPane = new StackPane(clearButton);
    clearButtonPane.getStyleClass().addAll("clear-button"); //$NON-NLS-1$
    clearButtonPane.setOpacity(0.0);
    clearButtonPane.setCursor(Cursor.DEFAULT);
    clearButtonPane.setOnMouseReleased(e -> textField.clear());

    rightProperty.set(clearButtonPane);

    final FadeTransition fader = new FadeTransition(FADE_DURATION, clearButtonPane);
    fader.setCycleCount(1);

    textField.textProperty().addListener(new InvalidationListener() {
        @Override public void invalidated(Observable arg0) {
            String text = textField.getText();
            boolean isTextEmpty = text == null || text.isEmpty();
            boolean isButtonVisible = fader.getNode().getOpacity() > 0;

            if (isTextEmpty && isButtonVisible) {
                setButtonVisible(false);
            } else if (!isTextEmpty && !isButtonVisible) {
                setButtonVisible(true);
            }
        }

        private void setButtonVisible( boolean visible ) {
            fader.setFromValue(visible? 0.0: 1.0);
            fader.setToValue(visible? 1.0: 0.0);
            fader.play();
        }
    });
}
 
开发者ID:Vidada-Project,项目名称:vidada-desktop,代码行数:44,代码来源:TextFields.java

示例9: CalendarView

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
/**
 * Constructs a new calendar view.
 */
public CalendarView() {
    getStyleClass().add(DEFAULT_STYLE_CLASS);

    this.dayPage = new DayPage();
    this.weekPage = new WeekPage();
    this.monthPage = new MonthPage();
    this.yearPage = new YearPage();

    this.searchField = (CustomTextField) TextFields.createClearableTextField();
    this.sourceView = new SourceView();
    this.searchResultView = new SearchResultView();
    this.yearMonthView = new YearMonthView();

    if (Boolean.getBoolean("calendarfx.developer")) { //$NON-NLS-1$
        this.developerConsole = new DeveloperConsole();
        this.developerConsole.setDateControl(this);
    }

    selectedPage.set(dayPage);

    Bindings.bindBidirectional(searchField.visibleProperty(), showSearchFieldProperty());

    /*
     * We do have a user agent stylesheet, but it doesn't seem to work
     * properly when run as a standalone jar file.
     */
    getStylesheets().add(CalendarView.class.getResource("calendar.css").toExternalForm()); //$NON-NLS-1$

    /*
     * We are "abusing" the properties map to pass new values of read-only
     * properties from the skin to the control.
     */
    getProperties().addListener((Change<?, ?> change) -> {
        if (change.getKey().equals(SELECTED_PAGE)) {
            if (change.getValueAdded() != null) {
                PageBase page = (PageBase) change.getValueAdded();
                selectedPage.set(page);
                getProperties().remove(SELECTED_PAGE);
            }
        }
    });

    InvalidationListener fixSelectedPageListener = it -> fixSelectedPage();

    dayPage.hiddenProperty().addListener(fixSelectedPageListener);
    weekPage.hiddenProperty().addListener(fixSelectedPageListener);
    monthPage.hiddenProperty().addListener(fixSelectedPageListener);
    yearPage.hiddenProperty().addListener(fixSelectedPageListener);

    fixSelectedPage();
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:55,代码来源:CalendarView.java

示例10: CalendarToolBar

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
public CalendarToolBar(CalendarView calendarView) {
    this.calendarView = calendarView;

    getStyleClass().addAll("module-toolbar", "calendar-toolbar", "primary-color-calendar");

    ToggleGroup group = new ToggleGroup();

    ToggleButton showDay = new ToggleButton("DAY");
    ToggleButton showWeek = new ToggleButton("WEEK");
    ToggleButton showMonth = new ToggleButton("MONTH");
    ToggleButton showYear = new ToggleButton("YEAR");

    showDay.setOnAction(evt -> showDayPage());
    showWeek.setOnAction(evt -> showWeekPage());
    showMonth.setOnAction(evt -> showMonthPage());
    showYear.setOnAction(evt -> showYearPage());

    showDay.getStyleClass().add("first");
    showYear.getStyleClass().add("last");

    showDay.setSelected(true);
    showDay.setMaxHeight(Double.MAX_VALUE);
    showWeek.setMaxHeight(Double.MAX_VALUE);
    showMonth.setMaxHeight(Double.MAX_VALUE);
    showYear.setMaxHeight(Double.MAX_VALUE);

    group.getToggles().addAll(showDay, showWeek, showMonth, showYear);

    HBox switcher = new HBox(showDay, showWeek, showMonth, showYear);
    switcher.getStyleClass().add("switcher");
    switcher.setFillHeight(true);
    switcher.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
    HBox.setHgrow(switcher, Priority.ALWAYS);

    CustomTextField searchField = new CustomTextField();
    Button clearSearchButton = new Button();
    clearSearchButton.getStyleClass().add("clear-search");
    clearSearchButton.setOnAction(evt -> searchField.setText(""));
    searchField.setRight(clearSearchButton);
    searchField.setPromptText("SEARCH");
    searchField.setPrefColumnCount(30);

    SearchResultView searchResultView = calendarView.getSearchResultView();
    searchResultView.searchTextProperty().bind(searchField.textProperty());

    getChildren().addAll(switcher, searchField);
    setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
}
 
开发者ID:dlemmermann,项目名称:JProCalendarFX,代码行数:49,代码来源:CalendarToolBar.java

示例11: initComponents

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
private void initComponents() {
	// JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
	pane = new MigPane();
	findField = new CustomTextField();
	previousButton = new Button();
	nextButton = new Button();
	matchCaseButton = new ToggleButton();
	regexButton = new ToggleButton();
	findInfoLabel = new Label();
	closeButton = new Button();
	replacePane = new MigPane();
	replaceField = new CustomTextField();
	replaceButton = new Button();
	replaceAllButton = new Button();
	replaceInfoLabel = new Label();
	nOfHitCountLabel = new Label();

	//======== pane ========
	{
		pane.setLayout("insets 0,hidemode 3");
		pane.setCols("[shrink 0,fill][fill]0[fill][pref:n,fill]1px[pref:n,fill][grow,fill][fill]");
		pane.setRows("[fill]0[]");

		//---- findField ----
		findField.setPromptText(Messages.get("FindReplacePane.findField.promptText"));
		findField.setPrefColumnCount(15);
		pane.add(findField, "cell 0 0");

		//---- previousButton ----
		previousButton.setFocusTraversable(false);
		pane.add(previousButton, "cell 1 0");

		//---- nextButton ----
		nextButton.setFocusTraversable(false);
		pane.add(nextButton, "cell 2 0");

		//---- matchCaseButton ----
		matchCaseButton.setText("Aa");
		matchCaseButton.setFocusTraversable(false);
		pane.add(matchCaseButton, "cell 3 0");

		//---- regexButton ----
		regexButton.setText(".*");
		regexButton.setFocusTraversable(false);
		pane.add(regexButton, "cell 4 0");
		pane.add(findInfoLabel, "cell 5 0");

		//---- closeButton ----
		closeButton.setFocusTraversable(false);
		pane.add(closeButton, "cell 6 0");

		//======== replacePane ========
		{
			replacePane.setLayout("insets rel 0 0 0");
			replacePane.setCols("[shrink 0,fill][pref:n,fill][pref:n,fill][grow,fill]");
			replacePane.setRows("[]");

			//---- replaceField ----
			replaceField.setPromptText(Messages.get("FindReplacePane.replaceField.promptText"));
			replaceField.setPrefColumnCount(15);
			replacePane.add(replaceField, "cell 0 0");

			//---- replaceButton ----
			replaceButton.setText(Messages.get("FindReplacePane.replaceButton.text"));
			replaceButton.setFocusTraversable(false);
			replacePane.add(replaceButton, "cell 1 0");

			//---- replaceAllButton ----
			replaceAllButton.setText(Messages.get("FindReplacePane.replaceAllButton.text"));
			replaceAllButton.setFocusTraversable(false);
			replacePane.add(replaceAllButton, "cell 2 0");
			replacePane.add(replaceInfoLabel, "cell 3 0");
		}
		pane.add(replacePane, "cell 0 1 7 1");
	}

	//---- nOfHitCountLabel ----
	nOfHitCountLabel.setText(Messages.get("FindReplacePane.nOfHitCountLabel.text"));
	// JFormDesigner - End of component initialization  //GEN-END:initComponents
}
 
开发者ID:JFormDesigner,项目名称:markdown-writer-fx,代码行数:81,代码来源:FindReplacePane.java

示例12: initTableFilter

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
private void initTableFilter() {
    tableFilter = (CustomTextField) TextFields.createClearableTextField();
    filterPlaceholder.getChildren().add(tableFilter);
    filterPlaceholder.setHgrow(tableFilter, Priority.ALWAYS);
    tableFilter.setVisible(false);
}
 
开发者ID:gadelkareem,项目名称:aws-client,代码行数:7,代码来源:Controller.java

示例13: create

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
public static TextField create() {
    CustomTextField textField = (CustomTextField) TextFields.createClearableTextField();
    textField.setPromptText(Localization.lang("Search") + "...");
    textField.setLeft(IconTheme.JabRefIcon.SEARCH.getGraphicNode());
    return textField;
}
 
开发者ID:JabRef,项目名称:jabref,代码行数:7,代码来源:SearchTextField.java

示例14: getSearchField

import org.controlsfx.control.textfield.CustomTextField; //导入依赖的package包/类
/**
 * Returns the search text field.
 *
 * @return the search field
 */
public final CustomTextField getSearchField() {
    return searchField;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:9,代码来源:CalendarView.java


注:本文中的org.controlsfx.control.textfield.CustomTextField类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。