本文整理汇总了Java中javafx.scene.control.ToggleButton.setId方法的典型用法代码示例。如果您正苦于以下问题:Java ToggleButton.setId方法的具体用法?Java ToggleButton.setId怎么用?Java ToggleButton.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.ToggleButton
的用法示例。
在下文中一共展示了ToggleButton.setId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: WeekPage
import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
/**
* Constructs a new week page.
*/
public WeekPage() {
getStyleClass().add("week-page"); //$NON-NLS-1$
setDateTimeFormatter(DateTimeFormatter.ofPattern(Messages.getString("WeekPage.DATE_FORMAT"))); //$NON-NLS-1$
this.detailedWeekView = new DetailedWeekView();
ToggleButton layoutButton = new ToggleButton();
layoutButton.setTooltip(new Tooltip(Messages.getString("WeekPage.TOOLTIP_LAYOUT"))); //$NON-NLS-1$
layoutButton.setId("layout-button");
Text layoutIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.TABLE);
layoutIcon.getStyleClass().addAll("button-icon", "layout-button-icon"); //$NON-NLS-1$ //$NON-NLS-2$
layoutButton.setGraphic(layoutIcon);
layoutButton.setSelected(getLayout().equals(Layout.SWIMLANE));
layoutButton.setOnAction(evt -> {
if (layoutButton.isSelected()) {
setLayout(Layout.SWIMLANE);
} else {
setLayout(Layout.STANDARD);
}
});
showLayoutButtonProperty().addListener(it -> updateToolBarControls(layoutButton));
updateToolBarControls(layoutButton);
}
示例2: createMaximizeButton
import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
private ToggleButton createMaximizeButton() {
ToggleButton button = new ToggleButton();
button.setId("maximizeButton");
button.setOnAction((e) -> {
JFrame frame = (JFrame) parent;
if (frame.isResizable()) {
if ((frame.getExtendedState() & JFrame.MAXIMIZED_BOTH) == 0) {
frame.getRootPane().setBorder(BorderFactory.createEmptyBorder());
frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
} else {
frame.getRootPane().setBorder(BorderFactory.createMatteBorder(
0, 3, 3, 3,
Color.decode("#222222")));
frame.setExtendedState(JFrame.NORMAL);
}
}
});
return button;
}
示例3: YearPage
import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
/**
* Constructs a new year page.
*/
public YearPage() {
getStyleClass().add("year-page"); //$NON-NLS-1$
this.yearView = new YearView();
this.monthSheetView = new MonthSheetView();
this.monthSheetView.setCellFactory(param -> new MonthSheetView.DetailedDateCell(param.getView(), param.getDate()));
this.monthSheetView.setClickBehaviour(ClickBehaviour.SHOW_DETAILS);
bind(yearView, true);
bind(monthSheetView, true);
Bindings.bindBidirectional(monthSheetView.showTodayProperty(), showTodayProperty());
setDateTimeFormatter(DateTimeFormatter.ofPattern(Messages.getString("YearPage.DATE_FORMAT"))); //$NON-NLS-1$
displayModeProperty().addListener(it -> updateDisplayModeIcon());
displayModeButton = new ToggleButton();
displayModeButton.setId("display-mode-button");
displayModeButton.setTooltip(new Tooltip(Messages.getString("YearPage.TOOLTIP_DISPLAY_MODE")));
displayModeButton.setSelected(getDisplayMode().equals(DisplayMode.COLUMNS));
displayModeButton.selectedProperty().addListener(it -> {
if (displayModeButton.isSelected()) {
setDisplayMode(DisplayMode.COLUMNS);
} else {
setDisplayMode(DisplayMode.GRID);
}
});
displayModeProperty().addListener(it -> displayModeButton.setSelected(getDisplayMode().equals(DisplayMode.COLUMNS)));
updateDisplayModeIcon();
}
示例4: createCategoryToggleButton
import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
/**
* This method creates a new toggle button for a given engine category.
*
* @param category The engine category, for which a new toggle button should be created
* @return The created toggle button
*/
private ToggleButton createCategoryToggleButton(EngineCategoryDTO category) {
ToggleButton categoryButton = new SidebarToggleButton(category.getName());
categoryButton.setId(String.format("%sButton", category.getName().toLowerCase()));
categoryButton.setOnAction(event -> onCategorySelection.accept(category));
return categoryButton;
}
示例5: createToolBarControls
import javafx.scene.control.ToggleButton; //导入方法依赖的package包/类
private Node createToolBarControls() {
ToggleButton agendaOnlyButton = new ToggleButton();
ToggleButton dayOnlyButton = new ToggleButton();
ToggleButton standardButton = new ToggleButton();
Text listIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.LIST);
listIcon.getStyleClass().addAll("button-icon");
agendaOnlyButton.setGraphic(listIcon);
agendaOnlyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
Text calendarIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.CALENDAR);
calendarIcon.getStyleClass().addAll("button-icon");
dayOnlyButton.setGraphic(calendarIcon);
dayOnlyButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
Text standardIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.COLUMNS);
standardIcon.getStyleClass().addAll("button-icon");
standardButton.setGraphic(standardIcon);
standardButton.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
agendaOnlyButton.setOnAction(evt -> setDayPageLayout(DayPageLayout.AGENDA_ONLY));
dayOnlyButton.setOnAction(evt -> setDayPageLayout(DayPageLayout.DAY_ONLY));
standardButton.setOnAction(evt -> setDayPageLayout(DayPageLayout.STANDARD));
SegmentedButton segmentedButton = new SegmentedButton(agendaOnlyButton, standardButton, dayOnlyButton);
segmentedButton.getStyleClass().add("layout-button"); //$NON-NLS-1$
segmentedButton.visibleProperty().bind(showDayPageLayoutControlsProperty());
switch (getDayPageLayout()) {
case AGENDA_ONLY:
agendaOnlyButton.setSelected(true);
break;
case DAY_ONLY:
dayOnlyButton.setSelected(true);
break;
case STANDARD:
standardButton.setSelected(true);
break;
default:
break;
}
agendaOnlyButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_MAXIMIZE_AGENDA_LIST"))); //$NON-NLS-1$
dayOnlyButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_MAXIMIZE_DAY_VIEW"))); //$NON-NLS-1$
standardButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_STANDARD_LAYOUT"))); //$NON-NLS-1$
ToggleButton layoutButton = new ToggleButton();
layoutButton.setTooltip(new Tooltip(Messages.getString("DayPage.TOOLTIP_LAYOUT"))); //$NON-NLS-1$
layoutButton.setId("layout-button");
Text layoutIcon = FontAwesomeIconFactory.get().createIcon(FontAwesomeIcon.TABLE);
layoutIcon.getStyleClass().addAll("button-icon", "layout-button-icon"); //$NON-NLS-1$ //$NON-NLS-2$
layoutButton.setGraphic(layoutIcon);
layoutButton.setSelected(getLayout().equals(Layout.SWIMLANE));
layoutButton.setOnAction(evt -> {
if (layoutButton.isSelected()) {
setLayout(Layout.SWIMLANE);
} else {
setLayout(Layout.STANDARD);
}
});
toolbarControls = new HBox();
toolbarControls.setSpacing(10);
updateToolBarControls(segmentedButton, layoutButton);
showLayoutButtonProperty().addListener(it -> updateToolBarControls(segmentedButton, layoutButton));
return toolbarControls;
}