Java Examples for javafx.scene.control.ToggleGroup
The following java examples will help you to understand the usage of javafx.scene.control.ToggleGroup. These source code samples are taken from different open source projects.
Example 1
| Project: JFoenix-master File: RadioButtonDemo.java View source code |
@Override
public void start(Stage primaryStage) {
final ToggleGroup group = new ToggleGroup();
JFXRadioButton javaRadio = new JFXRadioButton("JavaFX");
javaRadio.setPadding(new Insets(10));
javaRadio.setToggleGroup(group);
JFXRadioButton jfxRadio = new JFXRadioButton("JFoenix");
jfxRadio.setPadding(new Insets(10));
jfxRadio.setToggleGroup(group);
VBox vbox = new VBox();
vbox.getChildren().add(javaRadio);
vbox.getChildren().add(jfxRadio);
vbox.setSpacing(10);
HBox hbox = new HBox();
hbox.getChildren().add(vbox);
hbox.setSpacing(50);
hbox.setPadding(new Insets(40, 10, 10, 120));
Scene scene = new Scene(hbox);
primaryStage.setScene(scene);
primaryStage.setWidth(500);
primaryStage.setHeight(400);
primaryStage.setTitle("JFX RadioButton Demo ");
scene.getStylesheets().add(RadioButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
primaryStage.show();
}Example 2
| Project: many-ql-master File: BooleanRenderedQuestion.java View source code |
@Override
protected Region createQuestionControl() {
VBox container = new VBox(5);
ToggleGroup group = createToggleGroup(container);
group.selectedToggleProperty().addListener(( observable, oldValue, newValue) -> {
String value = observable.getValue().toString();
value = value.substring(value.indexOf("'") + 1, value.lastIndexOf("'"));
questionAnswered(value);
});
return container;
}Example 3
| Project: NoticEditor-master File: WebImportController.java View source code |
@Override
public void initialize(URL location, ResourceBundle resources) {
importer = new WebImporter();
importMode = HtmlImportMode.ORIGINAL;
ObservableList<Node> nodes = modesBox.getChildren();
nodes.clear();
final ToggleGroup modesGroup = new ToggleGroup();
for (HtmlImportMode value : HtmlImportMode.values()) {
RadioButton radio = new RadioButton(resources.getString(value.getName()));
if (value == importMode)
radio.setSelected(true);
radio.setOnAction( e -> onModeChanged(value));
radio.setToggleGroup(modesGroup);
nodes.add(radio);
}
pagePreview.getEngine().loadContent(resources.getString("preview"), "text/html");
}Example 4
| Project: sportstracker-master File: BindingUtilsToggleGroupTest.java View source code |
@Before
public void setUp() {
rbOptionA = new RadioButton("Option A");
rbOptionA.setUserData(Options.OptionA);
rbOptionB = new RadioButton("Option B");
rbOptionB.setUserData(Options.OptionB);
tgOptions = new ToggleGroup();
tgOptions.getToggles().add(rbOptionA);
tgOptions.getToggles().add(rbOptionB);
optionsProperty = new SimpleObjectProperty<>(Options.OptionB);
}Example 5
| Project: Enzo-master File: OnOffSwitch.java View source code |
@Override
protected void invalidated() {
final ToggleGroup toggleGroup = get();
if (null != toggleGroup && !toggleGroup.getToggles().contains(OnOffSwitch.this)) {
if (oldToggleGroup != null) {
oldToggleGroup.getToggles().remove(OnOffSwitch.this);
}
toggleGroup.getToggles().add(OnOffSwitch.this);
} else if (null == toggleGroup) {
oldToggleGroup.getToggles().remove(OnOffSwitch.this);
}
oldToggleGroup = toggleGroup;
}Example 6
| Project: geotoolkit-master File: FXRasterSymbolizer.java View source code |
@Override
public void initialize() {
super.initialize();
uiChannelSelection = new FXChannelSelection();
uiColorMap = new FXColorMap();
uiLineSymbolizer = new FXLineSymbolizer();
uiPolygonSymbolizer = new FXPolygonSymbolizer();
final ToggleGroup groupColor = new ToggleGroup();
uiChoiceColorNone.setToggleGroup(groupColor);
uiChoiceColorRGB.setToggleGroup(groupColor);
uiChoiceColorMap.setToggleGroup(groupColor);
uiChoiceColorNone.setSelected(true);
final ToggleGroup groupOutline = new ToggleGroup();
uiChoiceOutlineNone.setToggleGroup(groupOutline);
uiChoiceOutlineLine.setToggleGroup(groupOutline);
uiChoiceOutlinePolygon.setToggleGroup(groupOutline);
uiChoiceOutlineNone.setSelected(true);
final ChangeListener changeListener = (ChangeListener) (ObservableValue observable, Object oldValue, Object newValue) -> {
if (updating)
return;
value.set(create());
};
uiOpacity.valueProperty().addListener(changeListener);
uiReliefShading.valueProperty().addListener(changeListener);
uiContrast.valueProperty().addListener(changeListener);
uiInfo.valueProperty().addListener(changeListener);
uiLineSymbolizer.valueProperty().addListener(changeListener);
uiPolygonSymbolizer.valueProperty().addListener(changeListener);
uiChannelSelection.valueProperty().addListener(changeListener);
uiColorMap.valueProperty().addListener(changeListener);
}Example 7
| Project: JRebirth-master File: FXMLShowCaseView.java View source code |
/**
* {@inheritDoc}
*/
@Override
protected void initView() {
this.showEmbedded = new ToggleButton("Embedded");
this.showStandalone = new ToggleButton("Standalone");
this.showHybrid = new ToggleButton("Hybrid");
this.showIncluded = new ToggleButton("Included");
final ToggleGroup group = new PersistentButtonToggleGroup();
group.getToggles().addAll(this.showEmbedded, this.showStandalone, this.showHybrid, this.showIncluded);
getRootNode().setTop(FlowPaneBuilder.create().children(this.showEmbedded, this.showStandalone, this.showIncluded, this.showHybrid).build());
}Example 8
| Project: closurefx-builder-master File: JSCheckSectionController.java View source code |
public AnchorPane create() throws Exception {
AnchorPane anchorPane12 = new AnchorPane();
anchorPane12.setId("AnchorPane");
anchorPane12.setMinHeight(Control.USE_COMPUTED_SIZE);
anchorPane12.setMinWidth(Control.USE_COMPUTED_SIZE);
anchorPane12.setPrefHeight(Control.USE_COMPUTED_SIZE);
anchorPane12.setPrefWidth(Control.USE_COMPUTED_SIZE);
TitledPane titledPane11 = new TitledPane();
titledPane11.setAnimated(false);
titledPane11.setCollapsible(false);
titledPane11.setFocusTraversable(true);
titledPane11.setPrefHeight(Control.USE_COMPUTED_SIZE);
titledPane11.setPrefWidth(Control.USE_COMPUTED_SIZE);
titledPane11.setText(bundle.getString("JSChecksSection"));
AnchorPane.setBottomAnchor(titledPane11, 0.0);
AnchorPane.setLeftAnchor(titledPane11, 0.0);
AnchorPane.setRightAnchor(titledPane11, 0.0);
AnchorPane.setTopAnchor(titledPane11, 0.0);
VBox vBox20 = new VBox();
vBox20.setPrefHeight(Control.USE_COMPUTED_SIZE);
vBox20.setPrefWidth(Control.USE_COMPUTED_SIZE);
vBox20.setSpacing(6.0);
Label label22 = new Label();
label22.setText(bundle.getString("JSChecksSection_Desc"));
vBox20.getChildren().add(label22);
GridPane gridPane28 = new GridPane();
gridPane28.setId("GridPane");
gridPane28.setHgap(5.0);
VBox.setVgrow(gridPane28, Priority.NEVER);
controlSkipAllPasses = new ToggleButton();
controlSkipAllPasses.setMaxWidth(1.7976931348623157E308);
controlSkipAllPasses.setMnemonicParsing(false);
controlSkipAllPasses.setText(bundle.getString("JSChecksSection_SkipAllPasses"));
GridPane.setColumnIndex(controlSkipAllPasses, 0);
GridPane.setRowIndex(controlSkipAllPasses, 0);
toggleGroup = new ToggleGroup();
controlSkipAllPasses.setToggleGroup(toggleGroup);
gridPane28.getChildren().add(controlSkipAllPasses);
controlFunctionsOnly = new ToggleButton();
controlFunctionsOnly.setMaxWidth(1.7976931348623157E308);
controlFunctionsOnly.setMnemonicParsing(false);
controlFunctionsOnly.setText(bundle.getString("JSChecksSection_FunctionsOnly"));
controlFunctionsOnly.setToggleGroup(toggleGroup);
GridPane.setColumnIndex(controlFunctionsOnly, 1);
GridPane.setRowIndex(controlFunctionsOnly, 0);
gridPane28.getChildren().add(controlFunctionsOnly);
controlPerformCheck = new ToggleButton();
controlPerformCheck.setMaxWidth(1.7976931348623157E308);
controlPerformCheck.setMnemonicParsing(false);
controlPerformCheck.setText(bundle.getString("JSChecksSection_PerformChecks"));
controlPerformCheck.setToggleGroup(toggleGroup);
GridPane.setColumnIndex(controlPerformCheck, 2);
GridPane.setRowIndex(controlPerformCheck, 0);
gridPane28.getChildren().add(controlPerformCheck);
ColumnConstraints columnConstraints54 = new ColumnConstraints();
columnConstraints54.setHgrow(Priority.ALWAYS);
columnConstraints54.setMinWidth(10.0);
gridPane28.getColumnConstraints().add(columnConstraints54);
ColumnConstraints columnConstraints55 = new ColumnConstraints();
columnConstraints55.setHgrow(Priority.ALWAYS);
columnConstraints55.setMinWidth(10.0);
gridPane28.getColumnConstraints().add(columnConstraints55);
ColumnConstraints columnConstraints56 = new ColumnConstraints();
columnConstraints56.setHgrow(Priority.ALWAYS);
columnConstraints56.setMinWidth(10.0);
gridPane28.getColumnConstraints().add(columnConstraints56);
RowConstraints rowConstraints52 = new RowConstraints();
rowConstraints52.setMinHeight(Control.USE_PREF_SIZE);
rowConstraints52.setVgrow(Priority.NEVER);
gridPane28.getRowConstraints().add(rowConstraints52);
vBox20.getChildren().add(gridPane28);
GridPane gridPane29 = new GridPane();
gridPane29.setId("GridPane");
gridPane29.setHgap(5.0);
VBox.setVgrow(gridPane29, Priority.NEVER);
Button button21 = new Button();
button21.setAlignment(Pos.CENTER_RIGHT);
button21.setContentDisplay(ContentDisplay.RIGHT);
button21.setMnemonicParsing(false);
button21.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
handleUncheckAllChecksAction(event);
}
});
button21.setText("");
GridPane.setColumnIndex(button21, 2);
GridPane.setHalignment(button21, HPos.RIGHT);
GridPane.setRowIndex(button21, 0);
ImageView imageView10 = new ImageView();
imageView10.setFitHeight(16.0);
imageView10.setFitWidth(16.0);
imageView10.setMouseTransparent(true);
imageView10.setPickOnBounds(true);
imageView10.setPreserveRatio(true);
Image image10 = new Image(getClass().getResource("/com/digiarea/closurefx/resources/editor-uncheck.png").openStream());
imageView10.setImage(image10);
button21.setGraphic(imageView10);
Tooltip tooltip4 = new Tooltip();
tooltip4.setText(bundle.getString("JSChecksSection_UncheckAll"));
button21.setTooltip(tooltip4);
gridPane29.getChildren().add(button21);
Button button22 = new Button();
button22.setAlignment(Pos.CENTER_RIGHT);
button22.setContentDisplay(ContentDisplay.RIGHT);
button22.setMnemonicParsing(false);
button22.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
handleCheckAllChecksAction(event);
}
});
button22.setText("");
GridPane.setColumnIndex(button22, 1);
GridPane.setHalignment(button22, HPos.RIGHT);
GridPane.setRowIndex(button22, 0);
ImageView imageView11 = new ImageView();
imageView11.setFitHeight(16.0);
imageView11.setFitWidth(16.0);
imageView11.setMouseTransparent(true);
imageView11.setPickOnBounds(true);
imageView11.setPreserveRatio(true);
Image image11 = new Image(getClass().getResource("/com/digiarea/closurefx/resources/editor-check.png").openStream());
imageView11.setImage(image11);
button22.setGraphic(imageView11);
Tooltip tooltip5 = new Tooltip();
tooltip5.setText(bundle.getString("JSChecksSection_CheckAll"));
button22.setTooltip(tooltip5);
gridPane29.getChildren().add(button22);
ColumnConstraints columnConstraints57 = new ColumnConstraints();
columnConstraints57.setHalignment(HPos.RIGHT);
columnConstraints57.setHgrow(Priority.ALWAYS);
columnConstraints57.setMinWidth(Control.USE_PREF_SIZE);
gridPane29.getColumnConstraints().add(columnConstraints57);
ColumnConstraints columnConstraints58 = new ColumnConstraints();
columnConstraints58.setHalignment(HPos.RIGHT);
columnConstraints58.setHgrow(Priority.NEVER);
columnConstraints58.setMinWidth(Control.USE_PREF_SIZE);
gridPane29.getColumnConstraints().add(columnConstraints58);
ColumnConstraints columnConstraints59 = new ColumnConstraints();
columnConstraints59.setHalignment(HPos.RIGHT);
columnConstraints59.setHgrow(Priority.NEVER);
columnConstraints59.setMinWidth(Control.USE_PREF_SIZE);
gridPane29.getColumnConstraints().add(columnConstraints59);
RowConstraints rowConstraints53 = new RowConstraints();
rowConstraints53.setMinHeight(Control.USE_PREF_SIZE);
rowConstraints53.setValignment(VPos.CENTER);
rowConstraints53.setVgrow(Priority.NEVER);
gridPane29.getRowConstraints().add(rowConstraints53);
vBox20.getChildren().add(gridPane29);
controlCheck = new TableView();
controlCheck.setMaxHeight(Control.USE_COMPUTED_SIZE);
controlCheck.setMinHeight(Control.USE_COMPUTED_SIZE);
controlCheck.setPrefHeight(100.0);
controlCheck.setPrefWidth(Control.USE_COMPUTED_SIZE);
controlCheck.setTableMenuButtonVisible(false);
VBox.setVgrow(controlCheck, Priority.ALWAYS);
conrolCheckBox = new TableColumn();
conrolCheckBox.setMaxWidth(25.0);
conrolCheckBox.setMinWidth(25.0);
conrolCheckBox.setPrefWidth(25.0);
conrolCheckBox.setText(".");
controlCheck.getColumns().add(conrolCheckBox);
conrolCheckDescription = new TableColumn();
conrolCheckDescription.setMinWidth(100.0);
conrolCheckDescription.setPrefWidth(400.0);
conrolCheckDescription.setText(bundle.getString("JSChecksSection_Column_Checks"));
conrolCheckDescription.setVisible(true);
controlCheck.getColumns().add(conrolCheckDescription);
vBox20.getChildren().add(controlCheck);
GridPane gridPane30 = new GridPane();
gridPane30.setId("GridPane");
gridPane30.setHgap(5.0);
VBox.setVgrow(gridPane30, Priority.NEVER);
Button button23 = new Button();
button23.setAlignment(Pos.CENTER_RIGHT);
button23.setContentDisplay(ContentDisplay.RIGHT);
button23.setMnemonicParsing(false);
button23.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
handleUncheckAllOptimizationsAction(event);
}
});
button23.setText("");
GridPane.setColumnIndex(button23, 2);
GridPane.setHalignment(button23, HPos.RIGHT);
GridPane.setRowIndex(button23, 0);
ImageView imageView12 = new ImageView();
imageView12.setFitHeight(16.0);
imageView12.setFitWidth(16.0);
imageView12.setMouseTransparent(true);
imageView12.setPickOnBounds(true);
imageView12.setPreserveRatio(true);
Image image12 = new Image(getClass().getResource("/com/digiarea/closurefx/resources/editor-uncheck.png").openStream());
imageView12.setImage(image12);
button23.setGraphic(imageView12);
Tooltip tooltip6 = new Tooltip();
tooltip6.setText(bundle.getString("JSChecksSection_UncheckAll"));
button23.setTooltip(tooltip6);
gridPane30.getChildren().add(button23);
Button button24 = new Button();
button24.setAlignment(Pos.CENTER_RIGHT);
button24.setContentDisplay(ContentDisplay.RIGHT);
button24.setMnemonicParsing(false);
button24.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
handleCheckAllOptimizationsAction(event);
}
});
button24.setText("");
GridPane.setColumnIndex(button24, 1);
GridPane.setHalignment(button24, HPos.RIGHT);
GridPane.setRowIndex(button24, 0);
ImageView imageView13 = new ImageView();
imageView13.setFitHeight(16.0);
imageView13.setFitWidth(16.0);
imageView13.setMouseTransparent(true);
imageView13.setPickOnBounds(true);
imageView13.setPreserveRatio(true);
Image image13 = new Image(getClass().getResource("/com/digiarea/closurefx/resources/editor-check.png").openStream());
imageView13.setImage(image13);
button24.setGraphic(imageView13);
Tooltip tooltip7 = new Tooltip();
tooltip7.setText(bundle.getString("JSChecksSection_CheckAll"));
button24.setTooltip(tooltip7);
gridPane30.getChildren().add(button24);
ColumnConstraints columnConstraints60 = new ColumnConstraints();
columnConstraints60.setHalignment(HPos.RIGHT);
columnConstraints60.setHgrow(Priority.ALWAYS);
columnConstraints60.setMinWidth(Control.USE_PREF_SIZE);
gridPane30.getColumnConstraints().add(columnConstraints60);
ColumnConstraints columnConstraints61 = new ColumnConstraints();
columnConstraints61.setHalignment(HPos.RIGHT);
columnConstraints61.setHgrow(Priority.NEVER);
columnConstraints61.setMinWidth(Control.USE_PREF_SIZE);
gridPane30.getColumnConstraints().add(columnConstraints61);
ColumnConstraints columnConstraints62 = new ColumnConstraints();
columnConstraints62.setHalignment(HPos.RIGHT);
columnConstraints62.setHgrow(Priority.NEVER);
columnConstraints62.setMinWidth(Control.USE_PREF_SIZE);
gridPane30.getColumnConstraints().add(columnConstraints62);
RowConstraints rowConstraints54 = new RowConstraints();
rowConstraints54.setMinHeight(Control.USE_PREF_SIZE);
rowConstraints54.setValignment(VPos.CENTER);
rowConstraints54.setVgrow(Priority.NEVER);
gridPane30.getRowConstraints().add(rowConstraints54);
vBox20.getChildren().add(gridPane30);
controlOptimization = new TableView();
controlOptimization.setMaxHeight(Control.USE_COMPUTED_SIZE);
controlOptimization.setMinHeight(Control.USE_COMPUTED_SIZE);
controlOptimization.setPrefHeight(100.0);
controlOptimization.setPrefWidth(Control.USE_COMPUTED_SIZE);
VBox.setVgrow(controlOptimization, Priority.ALWAYS);
conrolOptimizationBox = new TableColumn();
conrolOptimizationBox.setMaxWidth(25.0);
conrolOptimizationBox.setMinWidth(25.0);
conrolOptimizationBox.setPrefWidth(25.0);
conrolOptimizationBox.setText(".");
controlOptimization.getColumns().add(conrolOptimizationBox);
conrolOptimizationDescription = new TableColumn();
conrolOptimizationDescription.setMinWidth(100.0);
conrolOptimizationDescription.setPrefWidth(400.0);
conrolOptimizationDescription.setText(bundle.getString("JSChecksSection_Column_Optimizations"));
controlOptimization.getColumns().add(conrolOptimizationDescription);
vBox20.getChildren().add(controlOptimization);
Insets insets28 = new Insets(10.0, 10.0, 10.0, 10.0);
vBox20.setPadding(insets28);
titledPane11.setContent(vBox20);
anchorPane12.getChildren().add(titledPane11);
initialize(null, bundle);
return anchorPane12;
}Example 9
| Project: erlyberly-master File: PreferencesView.java View source code |
@Override
public void initialize(URL url, ResourceBundle r) {
selectFormattingButton();
final ToggleGroup group;
group = new ToggleGroup();
group.selectedToggleProperty().addListener((Observable o) -> {
storeFormattingPreferenceChange();
});
erlangTermsButton.setToggleGroup(group);
elixirTermsButton.setToggleGroup(group);
lfeTermsButton.setToggleGroup(group);
PrefBind.bind("targetNodeName", nodeNameField.textProperty());
PrefBind.bind("cookieName", cookieField.textProperty());
PrefBind.bindBoolean("autoConnect", autoConnectField.selectedProperty());
PrefBind.bindBoolean("hideProcesses", hideProcesses.selectedProperty());
PrefBind.bindBoolean("hideModules", hideModules.selectedProperty());
PrefBind.bindBoolean("showSourceInSystemEditor", showSourceInSystemEditorBox.selectedProperty());
}Example 10
| Project: mytime-master File: ManagerOneVolunteerController.java View source code |
/**
* Creates the context menu.
*/
private void setupContextMenu() {
menuSort = new Menu("Sorter efter:");
Image image2 = new Image("mytime/gui/view/css/Table.png");
// simple displays ImageView the image as is
ImageView iv2 = new ImageView(image2);
iv2.setPreserveRatio(true);
iv2.setSmooth(true);
iv2.setCache(true);
iv2.setFitHeight(8);
iv2.setFitWidth(8);
menuSort.setGraphic(iv2);
ToggleGroup groupSorts = new ToggleGroup();
RadioMenuItem sortByFirstName = new RadioMenuItem("Fornavn");
sortByFirstName.setOnAction( e -> {
mgrModel.applySortingStrategy(new Sortings(new SortingStrategyFirstName()), null);
mgrModel.setCurrentToggle(0);
mgrModel.reloadVolunteerNodes();
});
RadioMenuItem sortByLastName = new RadioMenuItem("Efternavn");
sortByLastName.setOnAction( e -> {
mgrModel.applySortingStrategy(new Sortings(new SortingStrategyLastName()), null);
mgrModel.setCurrentToggle(1);
mgrModel.reloadVolunteerNodes();
});
sortByFirstName.setToggleGroup(groupSorts);
sortByLastName.setToggleGroup(groupSorts);
menuSort.getItems().add(sortByFirstName);
menuSort.getItems().add(sortByLastName);
MenuItem delete = new MenuItem("Slet denne frivillig");
Image image = new Image("mytime/gui/view/css/Delete.png");
// simple displays ImageView the image as is
ImageView iv1 = new ImageView(image);
iv1.setPreserveRatio(true);
iv1.setSmooth(true);
iv1.setCache(true);
iv1.setFitHeight(8);
iv1.setFitWidth(8);
delete.setGraphic(iv1);
delete.setOnAction( r -> {
mgrModel.getAllPersonNodes().stream().parallel().forEach( k -> {
Person p = (Person) k.getUserData();
if (p.getId().get() == volunteer.getId().get()) {
Platform.runLater(() -> {
try {
mgrModel.deleteVolunteer(volunteer);
} catch (SQLException ex) {
Logger.getLogger(ManagerOneVolunteerController.class.getName()).log(Level.SEVERE, null, ex);
}
mgrModel.getAllPersonNodes().remove(k);
mgrModel.getReloadNodes().set(true);
mgrModel.showSnackbar("Slettede " + volunteer.getFullName() + " med success!");
});
}
});
});
MenuItem edit = new MenuItem("Ret i denne frivillig");
edit.setVisible(false);
// edit.setOnAction(o
// ->
// {
// //TODO
// });
test.getItems().addAll(delete, edit, menuSort);
btnVolunteer.setContextMenu(test);
}Example 11
| Project: bitcoin-exchange-master File: AccountSettingsView.java View source code |
@Override
public void initialize() {
listener = viewPath -> {
if (viewPath.size() != 4 || viewPath.indexOf(AccountSettingsView.class) != 2)
return;
selectedViewClass = viewPath.tip();
loadView(selectedViewClass);
};
ToggleGroup toggleGroup = new ToggleGroup();
paymentAccount = new MenuItem(navigation, toggleGroup, "National currency accounts", FiatAccountsView.class, AwesomeIcon.MONEY);
altCoinsAccountView = new MenuItem(navigation, toggleGroup, "Altcoin accounts", AltCoinAccountsView.class, AwesomeIcon.LINK);
arbitratorSelection = new MenuItem(navigation, toggleGroup, "Arbitrator selection", ArbitratorSelectionView.class, AwesomeIcon.USER_MD);
password = new MenuItem(navigation, toggleGroup, "Wallet password", PasswordView.class, AwesomeIcon.UNLOCK_ALT);
seedWords = new MenuItem(navigation, toggleGroup, "Wallet seed", SeedWordsView.class, AwesomeIcon.KEY);
backup = new MenuItem(navigation, toggleGroup, "Backup", BackupView.class, AwesomeIcon.CLOUD_DOWNLOAD);
leftVBox.getChildren().addAll(paymentAccount, altCoinsAccountView, arbitratorSelection, password, seedWords, backup);
}Example 12
| Project: bitsquare-master File: AccountSettingsView.java View source code |
@Override
public void initialize() {
listener = viewPath -> {
if (viewPath.size() != 4 || viewPath.indexOf(AccountSettingsView.class) != 2)
return;
selectedViewClass = viewPath.tip();
loadView(selectedViewClass);
};
ToggleGroup toggleGroup = new ToggleGroup();
paymentAccount = new MenuItem(navigation, toggleGroup, "National currency accounts", FiatAccountsView.class, AwesomeIcon.MONEY);
altCoinsAccountView = new MenuItem(navigation, toggleGroup, "Altcoin accounts", AltCoinAccountsView.class, AwesomeIcon.LINK);
arbitratorSelection = new MenuItem(navigation, toggleGroup, "Arbitrator selection", ArbitratorSelectionView.class, AwesomeIcon.USER_MD);
password = new MenuItem(navigation, toggleGroup, "Wallet password", PasswordView.class, AwesomeIcon.UNLOCK_ALT);
seedWords = new MenuItem(navigation, toggleGroup, "Wallet seed", SeedWordsView.class, AwesomeIcon.KEY);
backup = new MenuItem(navigation, toggleGroup, "Backup", BackupView.class, AwesomeIcon.CLOUD_DOWNLOAD);
leftVBox.getChildren().addAll(paymentAccount, altCoinsAccountView, arbitratorSelection, password, seedWords, backup);
}Example 13
| Project: CSTIB-Echo-master File: ConfrenceLoadScreenController.java View source code |
/**
* Initializes the controller class.
* @param url currently unused
* @param rb MUST be of type ECHOResource to allow correct operation
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
ToggleGroup group = new ToggleGroup();
radio_button_url.setToggleGroup(group);
radio_button_ip.setToggleGroup(group);
EventHandler enter = new EventHandler<KeyEvent>() {
@Override
public void handle(KeyEvent t) {
if (t.getCode() == KeyCode.ENTER) {
Launch_button.fire();
}
}
};
Launch_button.setOnKeyPressed(enter);
Confrence_Name_textfield.setOnKeyPressed(enter);
IP_Adress_textfield1.setOnKeyPressed(enter);
IP_Adress_textfield2.setOnKeyPressed(enter);
IP_Adress_textfield3.setOnKeyPressed(enter);
IP_Adress_textfield4.setOnKeyPressed(enter);
Port_textfield.setOnKeyPressed(enter);
Confrence_ID_textfield.setOnKeyPressed(enter);
textfield_url.setOnKeyPressed(enter);
radio_button_url.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
textfield_url.setDisable(false);
IP_Adress_textfield1.setDisable(true);
IP_Adress_textfield2.setDisable(true);
IP_Adress_textfield3.setDisable(true);
IP_Adress_textfield4.setDisable(true);
Port_textfield.setDisable(true);
}
});
radio_button_ip.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
textfield_url.setDisable(true);
IP_Adress_textfield1.setDisable(false);
IP_Adress_textfield2.setDisable(false);
IP_Adress_textfield3.setDisable(false);
IP_Adress_textfield4.setDisable(false);
Port_textfield.setDisable(false);
}
});
if (rb instanceof ECHOResource) {
er = (ECHOResource) rb;
} else {
System.err.println("the wrong resource type has been provided to the confrenceloadscreencontroller class a resource of type ECHOResource must be provided");
System.exit(1);
}
final FileChooser fileChooser = new FileChooser();
FileChooser.ExtensionFilter ECHOFilter = new FileChooser.ExtensionFilter("ECHO file (*.echo)", "*.echo");
fileChooser.getExtensionFilters().add(ECHOFilter);
fileChooser.setTitle("Load a confrence settings file (.echo)");
Open_button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
File file = fileChooser.showOpenDialog(Open_button.getScene().getWindow());
if (file != null) {
load(file);
}
}
});
Launch_button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
Stage stage = (Stage) Launch_button.getScene().getWindow();
Parent root = null;
try {
root = FXMLLoader.load(getClass().getResource("GUI.fxml"), er);
} catch (IOException ex) {
Logger.getGlobal().log(Level.SEVERE, null, ex);
}
Scene scene = new Scene(root);
try {
er.getTouchClient().setConfrenceName(Confrence_Name_textfield.getText());
if (!IP_Adress_textfield1.isDisabled()) {
er.getTouchClient().setConfrenceIP(ip());
er.getTouchClient().setConfrencePort(port(Port_textfield.getText()));
} else {
er.getTouchClient().setConfrenceURL(textfield_url.getText());
}
er.getTouchClient().setConfrenceID(id(Confrence_ID_textfield.getText()));
} catch (InvalidServerCredentialsException ex) {
error_message.setText("The inputted values are incorrect or incomplete");
return;
}
ServerConnection sc = new ServerConnection(er.getTouchClient());
(new Thread(sc)).start();
try {
stage.setTitle(er.getTouchClient().getConfrenceName());
} catch (NotInstantiatedYetException ex) {
stage.setTitle("ECHO");
}
stage.setFullScreen(true);
stage.setScene(scene);
stage.show();
}
});
}Example 14
| Project: FXGL-master File: GTAVMenu.java View source code |
private HBox makeMenuBar() {
ToggleButton tb1 = new ToggleButton("MAIN MENU");
ToggleButton tb2 = new ToggleButton("OPTIONS");
ToggleButton tb3 = new ToggleButton("EXTRA");
tb1.setFont(FXGL.getUIFactory().newFont(18));
tb2.setFont(FXGL.getUIFactory().newFont(18));
tb3.setFont(FXGL.getUIFactory().newFont(18));
ToggleGroup group = new ToggleGroup();
tb1.setToggleGroup(group);
tb2.setToggleGroup(group);
tb3.setToggleGroup(group);
tb1.setUserData(menuBody);
tb2.setUserData(makeOptionsMenu());
tb3.setUserData(makeExtraMenu());
group.selectedToggleProperty().addListener(( obs, old, newToggle) -> {
if (newToggle == null) {
group.selectToggle(old);
return;
}
switchMenuTo((Node) newToggle.getUserData());
});
group.selectToggle(tb1);
HBox hbox = new HBox(10, tb1, tb2, tb3);
hbox.setAlignment(Pos.TOP_CENTER);
return hbox;
}Example 15
| Project: FxProjects-master File: Font.java View source code |
/**
* build. Helper method to build the layout.
*/
private void build() {
// GridPane used to layout the components.
GridPane layout = new GridPane();
// Grid Lines to help layout buttons.
layout.setGridLinesVisible(false);
// Set vertical spacing b/n ChoiceBox and ToggleButtons
layout.setVgap(2);
// Build UI Controls
buildFontFamilyChoiceBox();
buildFontSizeChoiceBox();
buildBoldButton();
buildItalicsButton();
buildUnderlineButton();
buildSuperScriptButton();
buildSubScriptButton();
buildEraserButton();
buildIncreaseFontSizeButton();
buildDecreaseFontSizeButton();
// Group the Superscript and Subscript buttons into a ToggleGroup.
ToggleGroup group = new ToggleGroup();
group.getToggles().addAll(this.btnSuper, this.btnSub);
// layout3 GridPane is for increase/decrease font size buttons.
GridPane layout3 = new GridPane();
layout3.add(this.btnIncreaseFontSize, 3, 0);
layout3.add(this.btnDecreaseFontSize, 4, 0);
// layout2 GridPane is for top row of choiceBoxes and layout3.
GridPane layout2 = new GridPane();
layout2.setHgap(5);
layout2.add(this.cbxFontFamily, 0, 0);
layout2.add(this.cbxFontSize, 1, 0);
layout2.add(this.btnEraser, 2, 0);
layout2.add(layout3, 3, 0);
// Add All Componets to the GridPane.
layout.add(layout2, 0, 0, 6, 1);
layout.add(this.btnBold, 1, 1);
layout.add(this.btnItalics, 2, 1);
layout.add(this.btnUnderline, 3, 1);
layout.add(this.btnSuper, 4, 1);
layout.add(this.btnSub, 5, 1);
// Build the Toolbar Container Label.
Label label = new Label("Font");
label.getStyleClass().add("ribbonLabel");
label.setTooltip(new Tooltip("Specify font styles."));
// TODO: find a better way to center a label.
VBox vbox = new VBox();
vbox.getChildren().add(label);
VBox.setVgrow(label, Priority.ALWAYS);
vbox.setAlignment(Pos.BOTTOM_CENTER);
vbox.setStyle("-fx-padding: 5 0 0 0");
layout.add(vbox, 0, 2, 6, 1);
// Center alignment in the VBox, add GridPane, set VBox CSS Selector.
this.root.setAlignment(Pos.CENTER);
this.root.getChildren().add(layout);
this.root.getStyleClass().add("toolbarContainer");
}Example 16
| Project: KoreanDictionary-master File: KoreanDictionary.java View source code |
@Override
public void start(Stage stage) throws Exception {
//Init window
stage.setMinWidth(250);
stage.setMinHeight(500);
stage.setWidth(400);
stage.setHeight(600);
stage.setTitle("KoreanDictionary");
stage.setOnCloseRequest( value -> System.exit(0));
//Create nodes
EventHandler<ActionEvent> searchHandler = value -> this.search();
input = new TextField();
input.setOnAction(searchHandler);
input.setPromptText("검색어를 ìž…ë ¥í•˜ì„¸ìš”");
HBox.setHgrow(input, Priority.ALWAYS);
Button searchButton = new Button("검색");
searchButton.setOnAction(searchHandler);
filterNonUniversalWords = new CheckBox("ë°©ì–¸, ë¶?한어, 옛ë§? ì œì™¸");
filterNonUniversalWords.setSelected(true);
ToggleGroup group = new ToggleGroup();
startsWith = new RadioButton("시작 문�");
RadioButton endsWith = new RadioButton("ë?? 문ìž?");
startsWith.setToggleGroup(group);
endsWith.setToggleGroup(group);
startsWith.setSelected(true);
list = new ListView<>();
list.setOnMouseClicked( click -> {
if (click.getClickCount() == 2) {
KoreanDictionary.copyToClipboard(list.getSelectionModel().getSelectedItem());
}
});
list.setItems(FXCollections.observableArrayList("간단한 한êµì–´ ì‚¬ì „", "- êµë¦½êµì–´ì›? 표준êµì–´ëŒ€ì‚¬ì „ì?„ 사용했습니다", "", "Copyright (c) 2015 ChalkPE", "Licensed under GNU General Public License v3.0", "", "https://github.com/ChalkPE/KoreanDictionary"));
progress = new ProgressIndicator();
StackPane.setMargin(progress, new Insets(50));
//Init layouts
BorderPane optionPane = new BorderPane();
optionPane.setLeft(filterNonUniversalWords);
optionPane.setRight(new HBox(6, startsWith, endsWith));
VBox top = new VBox(6, new HBox(6, input, searchButton), optionPane);
top.setPadding(new Insets(6));
contents = new StackPane(list);
BorderPane root = new BorderPane();
root.setTop(top);
root.setCenter(contents);
Scene scene = new Scene(new Group());
scene.setRoot(root);
stage.setScene(scene);
stage.show();
}Example 17
| Project: graph-editor-master File: GraphEditorDemoController.java View source code |
/**
* Initializes the menu bar.
*/
private void initializeMenuBar() {
scaleTransform = new Scale(currentZoomFactor, currentZoomFactor, 0, 0);
scaleTransform.yProperty().bind(scaleTransform.xProperty());
graphEditor.getView().getTransforms().add(scaleTransform);
final ToggleGroup skinGroup = new ToggleGroup();
skinGroup.getToggles().addAll(defaultSkinButton, treeSkinButton, titledSkinButton);
final ToggleGroup connectionStyleGroup = new ToggleGroup();
connectionStyleGroup.getToggles().addAll(gappedStyleButton, detouredStyleButton);
final ToggleGroup connectorTypeGroup = new ToggleGroup();
connectorTypeGroup.getToggles().addAll(inputConnectorTypeButton, outputConnectorTypeButton);
final ToggleGroup positionGroup = new ToggleGroup();
positionGroup.getToggles().addAll(leftConnectorPositionButton, rightConnectorPositionButton);
positionGroup.getToggles().addAll(topConnectorPositionButton, bottomConnectorPositionButton);
graphEditor.getProperties().gridVisibleProperty().bind(showGridButton.selectedProperty());
graphEditor.getProperties().snapToGridProperty().bind(snapToGridButton.selectedProperty());
minimapButton.setGraphic(AwesomeIcon.MAP.node());
initializeZoomOptions();
final ListChangeListener<? super GNode> selectedNodesListener = change -> {
checkConnectorButtonsToDisable();
};
graphEditor.getSelectionManager().getSelectedNodes().addListener(selectedNodesListener);
checkConnectorButtonsToDisable();
}Example 18
| Project: jfxvnc-master File: SessionContext.java View source code |
public void bind(final ToggleGroup toggleGroup, final String propertyName) {
try {
String value = props.getProperty(propertyName);
if (value != null) {
int selectedToggleIndex = Integer.parseInt(value);
toggleGroup.selectToggle(toggleGroup.getToggles().get(selectedToggleIndex));
}
} catch (Exception ignored) {
}
toggleGroup.selectedToggleProperty().addListener( o -> {
if (toggleGroup.getSelectedToggle() == null) {
props.remove(propertyName);
} else {
props.setProperty(propertyName, Integer.toString(toggleGroup.getToggles().indexOf(toggleGroup.getSelectedToggle())));
}
});
}Example 19
| Project: htm.java-examples-master File: BreakingNewsDemoView.java View source code |
/**
* Demonstrates the construction and usage of the {@link SegmentedButtonBar}
* @return
*/
public HBox createSegmentedButtonBar() {
ToggleButton button1 = new ToggleButton("Start");
button1.getStyleClass().addAll("first");
button1.setOnAction( e -> {
Platform.runLater(() -> {
if (mode == Mode.MANUAL) {
runOneBtn.setDisable(false);
}
startActionProperty.set(true);
});
});
ToggleButton button2 = new ToggleButton("Stop");
button2.getStyleClass().addAll("last");
button2.setOnAction( e -> {
Platform.runLater(() -> {
startActionProperty.set(false);
});
});
ToggleButton button3 = new ToggleButton("Auto");
button3.getStyleClass().addAll("first");
button3.setOnAction( e -> {
Platform.runLater(() -> {
mode = Mode.AUTO;
autoModeProperty.set(mode);
});
});
ToggleButton button4 = new ToggleButton("Manual");
button4.getStyleClass().addAll("last");
button4.setOnAction( e -> {
Platform.runLater(() -> {
mode = Mode.MANUAL;
autoModeProperty.set(mode);
});
});
Button button5 = runOneBtn = new Button("Run One");
button5.getStyleClass().addAll("only");
button5.setDisable(true);
button5.setOnAction( e -> {
Platform.runLater(() -> {
runOneProperty.set(runOneProperty.get() + 1);
});
});
runDisableProperty.addListener(( v, o, n) -> {
button5.setDisable(n);
});
ToggleGroup group = new ToggleGroup();
group.getToggles().addAll(button1, button2);
group.selectToggle(button2);
ToggleGroup group2 = new ToggleGroup();
group2.getToggles().addAll(button3, button4);
group2.selectToggle(button3);
group2.selectedToggleProperty().addListener(( v, o, n) -> {
if (n == null)
return;
if (n.equals(button4)) {
Platform.runLater(() -> {
mode = Mode.MANUAL;
group.selectToggle(button2);
startActionProperty.set(false);
});
} else {
Platform.runLater(() -> {
mode = Mode.AUTO;
startActionProperty.set(false);
group.selectToggle(button2);
button5.setDisable(true);
});
}
});
HBox displayBox = new HBox();
displayBox.setSpacing(20);
displayBox.setAlignment(Pos.CENTER);
SegmentedButtonBar buttonBar = new SegmentedButtonBar();
buttonBar.getChildren().addAll(button1, button2);
SegmentedButtonBar buttonBar2 = new SegmentedButtonBar();
buttonBar2.getChildren().addAll(button3, button4);
SegmentedButtonBar buttonBar3 = new SegmentedButtonBar();
buttonBar3.getChildren().addAll(button5);
displayBox.getChildren().addAll(buttonBar, buttonBar2, buttonBar3);
return displayBox;
}Example 20
| Project: jitwatch-master File: SandboxConfigStage.java View source code |
private HBox buildHBoxAssemblySyntax() {
final RadioButton rbATT = new RadioButton("AT&T syntax");
final RadioButton rbIntel = new RadioButton("Intel syntax");
final ToggleGroup groupAssemblySyntax = new ToggleGroup();
boolean intelMode = config.isSandboxIntelMode();
rbATT.setToggleGroup(groupAssemblySyntax);
rbIntel.setToggleGroup(groupAssemblySyntax);
rbATT.setStyle(DEFAULT_DISPLAY_STYLE);
rbATT.setSelected(!intelMode);
rbIntel.setSelected(intelMode);
groupAssemblySyntax.selectedToggleProperty().addListener(getChangeListenerForGroupAssemblySyntax(rbIntel, groupAssemblySyntax));
HBox hbox = new HBox();
hbox.getChildren().add(buildCheckBoxPrintAssembly());
hbox.getChildren().add(rbATT);
hbox.getChildren().add(rbIntel);
return hbox;
}Example 21
| Project: VisibleTesla-master File: GraphController.java View source code |
/*------------------------------------------------------------------------------
*
* PRIVATE - Utility Methods for attaching a ContextMenu to the LineChart
*
*----------------------------------------------------------------------------*/
private void createContextMenu() {
final ContextMenu contextMenu = new ContextMenu();
final ToggleGroup toggleGroup = new ToggleGroup();
displayLinesMI = new RadioMenuItem("Display Only Lines");
displayLinesMI.setOnAction(displayMIHandler);
displayLinesMI.setSelected(displayLines);
displayLinesMI.setToggleGroup(toggleGroup);
displayMarkersMI = new RadioMenuItem("Display Only Markers");
displayMarkersMI.setOnAction(displayMIHandler);
displayMarkersMI.setSelected(displayMarkers);
displayMarkersMI.setToggleGroup(toggleGroup);
displayBothMI = new RadioMenuItem("Display Both");
displayBothMI.setOnAction(displayMIHandler);
displayBothMI.setSelected(displayMarkers);
displayBothMI.setToggleGroup(toggleGroup);
if (displayLines && displayMarkers) {
displayBothMI.setSelected(true);
} else if (displayLines) {
displayLinesMI.setSelected(true);
} else if (displayMarkers) {
displayMarkersMI.setSelected(true);
}
contextMenu.getItems().addAll(displayLinesMI, displayMarkersMI, displayBothMI);
chart.addContextMenu(contextMenu);
}Example 22
| Project: javafx-TKMapEditor-master File: MainLayoutController.java View source code |
@Override
public void initialize(URL location, ResourceBundle resources) {
TiledMap.getInstance().setMapProperty(64, 64, 13, 7);
// 文件选择器
fileChooser = new FileChooser();
fileChooser.getExtensionFilters().add(new ExtensionFilter("图片文件", "*.jpg", "*.png", "*.bmp"));
altasCanvas = new AltasCanvas(altasCanvasScrollPane.getWidth(), altasCanvasScrollPane.getHeight());
altasCanvas.BrushTypeProperty().bind(brushTypeProperty);
// 打开地图
openMapChooser = new FileChooser();
openMapChooser.getExtensionFilters().add(new ExtensionFilter("地图文件", "*.xml"));
saveAsFileChooser = new FileChooser();
saveAsFileChooser.getExtensionFilters().add(new ExtensionFilter("XML文件", "*.xml"));
exportFileChooser = new FileChooser();
exportFileChooser.getExtensionFilters().add(new ExtensionFilter("图片文件", "*.png"));
// 贴图集绘制
altasCanvas.widthProperty().bind(altasCanvasScrollPane.widthProperty());
altasCanvas.heightProperty().bind(altasCanvasScrollPane.heightProperty());
altasCanvasScrollPane.setContent(altasCanvas);
// 地图绘制
mapCanvas = new MapCanvas(TiledMap.getInstance().getMapWidth(), TiledMap.getInstance().getMapHeight());
mapCanvas.NowSelectLayerProperty().bind(layerListView.getSelectionModel().selectedIndexProperty());
mapCanvas.BrushTypeProperty().bind(brushTypeProperty);
mapCanvas.setMapLayerList(tiledMapLayerList);
mapCanvas.NowChooseProperty().bind(altasCanvas.NowChooseProperty());
// mapCanvas.ScaleProperty().bind(scaleSlider.valueProperty());
scaleSlider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
String value = newValue.toString().subSequence(0, 3).toString();
mScaleLabel.setText(value);
mapCanvas.setScale(newValue.doubleValue());
double width = TiledMap.getInstance().getRealTileMapWidth() * mapCanvas.getScale();
double height = TiledMap.getInstance().getRealTileMapHeight() * mapCanvas.getScale();
mapCanvas.setWidth(width);
mapCanvas.setHeight(height);
}
});
mapScrollPane.setContent(mapCanvas);
drawThread.start();
// 图层列表
layerListView.setItems(layerList);
layerListView.setEditable(true);
layerListView.setCellFactory(TextFieldListCell.forListView());
layerListView.setOnEditCommit(new EventHandler<ListView.EditEvent<String>>() {
@Override
public void handle(EditEvent<String> event) {
layerList.set(event.getIndex(), event.getNewValue());
tiledMapLayerList.get(event.getIndex()).setLayerName(event.getNewValue());
}
});
layerListView.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
int index = newValue.intValue();
if (index >= 0 && index < tiledMapLayerList.size()) {
TiledMapLayer mapLayer = tiledMapLayerList.get(index);
layerAlphaSlider.setValue(mapLayer.getAlpha());
layerShowCheck.setSelected(mapLayer.isVisible());
layerColliderCheck.setSelected(mapLayer.isCollider());
}
}
});
// 图层alpha值的修改
layerAlphaSlider.valueProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
int index = layerListView.getSelectionModel().selectedIndexProperty().get();
if (index >= 0 && index < tiledMapLayerList.size()) {
TiledMapLayer mapLayer = tiledMapLayerList.get(index);
mapLayer.setAlpha(newValue.doubleValue());
}
}
});
layerShowCheck.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
int index = layerListView.getSelectionModel().selectedIndexProperty().get();
if (index >= 0) {
TiledMapLayer mapLayer = tiledMapLayerList.get(index);
mapLayer.setVisible(newValue);
}
}
});
layerColliderCheck.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
int index = layerListView.getSelectionModel().selectedIndexProperty().get();
if (index >= 0) {
TiledMapLayer mapLayer = tiledMapLayerList.get(index);
mapLayer.setCollider(newValue);
}
}
});
// 贴图集列表
altasListView.setItems(imagePathList);
altasListView.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
@Override
public ListCell<String> call(ListView<String> param) {
return new ImageCell();
}
});
altasListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
AltasResource altasResource = AltasResourceManager.getInstance().getResourceById(newValue);
if (altasResource != null && altasResource.getImage() != null) {
Image image = altasResource.getImage();
altasCanvas.setImage(image);
mapCanvas.setNowAltasResource(altasResource);
} else {
altasCanvas.setImage(null);
mapCanvas.setNowAltasResource(null);
}
}
});
nowSelectAltasIdProperty.bind(altasListView.getSelectionModel().selectedItemProperty());
// 对�框
newMapDialog = new NewMapDialog();
newMapDialog.setOnNewMapDialogActionListener(new OnNewMapDialogActionListener() {
@Override
public void onNewMapOkAction() {
clearAll();
newOrOpenMap();
openMapFile = null;
// 设置地图画布大�
mapCanvas.setWidth(TiledMap.getInstance().getRealTileMapWidth());
mapCanvas.setHeight(TiledMap.getInstance().getRealTileMapHeight());
mapSizeLabel.setText(TiledMap.getInstance().getMapWidth() + " x " + TiledMap.getInstance().getMapHeight());
}
@Override
public void onNewMapCancelAction() {
}
});
// ��
ToggleGroup tGroup = new ToggleGroup();
normalBrushItem.setToggleGroup(tGroup);
paintPailItem.setToggleGroup(tGroup);
eraserItem.setToggleGroup(tGroup);
rectItem.setToggleGroup(tGroup);
normalBrushItem.setSelected(true);
mapCanvas.ShowGridProperty().bind(showMapGridItem.selectedProperty());
altasCanvas.ShowGridProperty().bind(showAltasGridItem.selectedProperty());
mapCanvas.ShowProProperty().bind(showPropertyGridItem.selectedProperty());
// 读�最近打开的文件
initRecentFiles();
}Example 23
| Project: mqtt-spy-master File: NewPublicationController.java View source code |
public static void updateScriptList(final List<Script> scripts, final Menu scriptsMenu, final ToggleGroup toggleGroup, final String format, final EventHandler<ActionEvent> eventHandler) {
while (scriptsMenu.getItems().size() > 0) {
scriptsMenu.getItems().remove(0);
}
if (scripts.size() > 0) {
for (final Script script : scripts) {
final RadioMenuItem item = new RadioMenuItem(String.format(format, script.getName()));
item.setOnAction(eventHandler);
item.setToggleGroup(toggleGroup);
item.setUserData(script);
scriptsMenu.getItems().add(item);
}
}
}Example 24
| Project: javafxdemo-master File: Main.java View source code |
private void initPrefPane() {
Label header = new Label("Preferences");
header.setFont(Fonts.robotoRegular(24));
header.setTextFill(Color.WHITE);
AnchorPane.setLeftAnchor(header, 10d);
AnchorPane.setTopAnchor(header, 10d);
// FlipPanel frontside
radioButtonGauge = new RadioButton("Gauge");
radioButtonSimpleGauge = new RadioButton("SimpleGauge");
radioButtonOneEightyGauge = new RadioButton("OneEightyGauge");
radioButtonSimpleRadarChart = new RadioButton("SimpleRadarChart");
radioButtonLedBargraph = new RadioButton("LedBargraph");
radioButtonGauge.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonSimpleGauge.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonOneEightyGauge.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonSimpleRadarChart.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonLedBargraph.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonGauge.setSelected(true);
VBox front1ButtonBox = new VBox(radioButtonGauge, radioButtonSimpleGauge, radioButtonOneEightyGauge, radioButtonSimpleRadarChart, radioButtonLedBargraph);
front1ButtonBox.relocate(10, 0);
front1ButtonBox.setPrefSize(400, 250);
front1ButtonBox.setFillWidth(true);
front1ButtonBox.setSpacing(10);
front1ButtonBox.setAlignment(Pos.CENTER_LEFT);
// FlipPanel backside
radioButtonLed = new RadioButton("Led");
radioButtonClock = new RadioButton("Clock");
radioButtonSplitFlap = new RadioButton("SplitFlap");
radioButtonLcdClock = new RadioButton("LcdClock");
radioButtonSegments = new RadioButton("Segments");
radioButtonLed.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonClock.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonSplitFlap.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonLcdClock.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonSegments.setOnAction( event -> handleRadioButtonActionEvent(event));
VBox back1ButtonBox = new VBox(radioButtonLed, radioButtonClock, radioButtonSplitFlap, radioButtonLcdClock, radioButtonSegments);
back1ButtonBox.setPrefSize(400, 250);
back1ButtonBox.relocate(10, 0);
back1ButtonBox.setFillWidth(true);
back1ButtonBox.setSpacing(10);
back1ButtonBox.setAlignment(Pos.CENTER_LEFT);
// FlipPanel1
Region flipToBack1Button = new Region();
flipToBack1Button.relocate(10, 10);
flipToBack1Button.getStyleClass().add("flip-button");
flipToBack1Button.addEventHandler(MouseEvent.MOUSE_CLICKED, EVENT -> flipPanel1.flipToBack());
Region flipToFront1Button = new Region();
flipToFront1Button.relocate(10, 10);
flipToFront1Button.getStyleClass().add("flip-button");
flipToFront1Button.addEventHandler(MouseEvent.MOUSE_CLICKED, EVENT -> flipPanel1.flipToFront());
Pane frontPane1 = new Pane(front1ButtonBox, flipToBack1Button);
frontPane1.setMaxSize(front1ButtonBox.getPrefWidth(), front1ButtonBox.getPrefHeight());
frontPane1.setPadding(new Insets(20, 20, 20, 20));
frontPane1.getStyleClass().add("panel");
Pane backPane1 = new Pane(back1ButtonBox, flipToFront1Button);
backPane1.setMaxSize(back1ButtonBox.getPrefWidth(), back1ButtonBox.getPrefHeight());
backPane1.setPadding(new Insets(20, 20, 20, 20));
backPane1.getStyleClass().add("panel");
flipPanel1 = new FlipPanel(Orientation.VERTICAL);
flipPanel1.getFront().getChildren().add(frontPane1);
flipPanel1.getBack().getChildren().add(backPane1);
//flipPanel1.addEventHandler(FlipEvent.FLIP_TO_FRONT_FINISHED, event -> System.out.println("Flip to front finished"));
//flipPanel1.addEventHandler(FlipEvent.FLIP_TO_BACK_FINISHED, event -> System.out.println("Flip to back finished"));
AnchorPane.setLeftAnchor(flipPanel1, 25d);
AnchorPane.setTopAnchor(flipPanel1, 50d);
// FlipPanel2 frontside
radioButtonLcd = new RadioButton("Lcd");
radioButtonSimpleIndicator = new RadioButton("SimpleIndicator");
radioButtonRoundLcdClock = new RadioButton("RoundLcdClock");
radioButtonNotification = new RadioButton("Notification");
radioButtonRadialMenu = new RadioButton("RadialMenu");
radioButtonLcd.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonSimpleIndicator.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonRoundLcdClock.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonNotification.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonRadialMenu.setOnAction( event -> handleRadioButtonActionEvent(event));
VBox front2ButtonBox = new VBox(radioButtonLcd, radioButtonSimpleIndicator, radioButtonRoundLcdClock, radioButtonNotification, radioButtonRadialMenu);
front2ButtonBox.relocate(10, 0);
front2ButtonBox.setPrefSize(400, 250);
front2ButtonBox.setFillWidth(true);
front2ButtonBox.setSpacing(10);
front2ButtonBox.setAlignment(Pos.CENTER_LEFT);
// FlipPanel backside
radioButtonSignalTower = new RadioButton("SignalTower");
radioButtonOnOffSwitch = new RadioButton("OnOffSwitch");
radioButtonQlockTwo = new RadioButton("QlockTwo");
radioButtonPushButton = new RadioButton("PushButton");
radioButtonSignalTower.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonOnOffSwitch.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonQlockTwo.setOnAction( event -> handleRadioButtonActionEvent(event));
radioButtonPushButton.setOnAction( event -> handleRadioButtonActionEvent(event));
VBox back2ButtonBox = new VBox(radioButtonSignalTower, radioButtonOnOffSwitch, radioButtonQlockTwo, radioButtonPushButton);
back2ButtonBox.setPrefSize(400, 250);
back2ButtonBox.relocate(10, 0);
back2ButtonBox.setFillWidth(true);
back2ButtonBox.setSpacing(10);
back2ButtonBox.setAlignment(Pos.CENTER_LEFT);
// FlipPanel1
Region flipToBack2Button = new Region();
flipToBack2Button.relocate(10, 10);
flipToBack2Button.getStyleClass().add("flip-button");
flipToBack2Button.addEventHandler(MouseEvent.MOUSE_CLICKED, EVENT -> flipPanel2.flipToBack());
Region flipToFront2Button = new Region();
flipToFront2Button.relocate(10, 10);
flipToFront2Button.getStyleClass().add("flip-button");
flipToFront2Button.addEventHandler(MouseEvent.MOUSE_CLICKED, EVENT -> flipPanel2.flipToFront());
Pane frontPane2 = new Pane(front2ButtonBox, flipToBack2Button);
frontPane2.setMaxSize(front2ButtonBox.getPrefWidth(), front2ButtonBox.getPrefHeight());
frontPane2.setPadding(new Insets(20, 20, 20, 20));
frontPane2.getStyleClass().add("panel");
Pane backPane2 = new Pane(back2ButtonBox, flipToFront2Button);
backPane2.setMaxSize(back2ButtonBox.getPrefWidth(), back2ButtonBox.getPrefHeight());
backPane2.setPadding(new Insets(20, 20, 20, 20));
backPane2.getStyleClass().add("panel");
flipPanel2 = new FlipPanel(Orientation.HORIZONTAL);
flipPanel2.getFront().getChildren().add(frontPane2);
flipPanel2.getBack().getChildren().add(backPane2);
//flipPanel1.addEventHandler(FlipEvent.FLIP_TO_FRONT_FINISHED, event -> System.out.println("Flip to front finished"));
//flipPanel1.addEventHandler(FlipEvent.FLIP_TO_BACK_FINISHED, event -> System.out.println("Flip to back finished"));
AnchorPane.setLeftAnchor(flipPanel2, 25d);
AnchorPane.setBottomAnchor(flipPanel2, 50d);
Button close = new Button();
close.getStyleClass().add("back-button");
close.setOnAction( event -> {
preparePaperfold();
animatedClose(500);
});
AnchorPane.setRightAnchor(close, 10d);
AnchorPane.setTopAnchor(close, 10d);
toggleGroup = new ToggleGroup();
toggleGroup.getToggles().addAll(radioButtonGauge, radioButtonSimpleGauge, radioButtonOneEightyGauge, radioButtonSimpleRadarChart, radioButtonLedBargraph, radioButtonLed, radioButtonClock, radioButtonSplitFlap, radioButtonLcdClock, radioButtonSegments, radioButtonLcd, radioButtonSimpleIndicator, radioButtonRoundLcdClock, radioButtonNotification, radioButtonRadialMenu, radioButtonSignalTower, radioButtonOnOffSwitch, radioButtonQlockTwo, radioButtonPushButton);
prefPane = new AnchorPane();
prefPane.getStyleClass().add("preferences-background");
prefPane.setPrefSize(PREF_PANE_WIDTH, SIZE.getHeight());
prefPane.setMaxSize(PREF_PANE_WIDTH, SIZE.getHeight());
unManageNode(prefPane);
prefPane.getChildren().addAll(header, flipPanel1, flipPanel2, close);
prefPane.applyCss();
prefPane.layout();
}Example 25
| Project: jfxtras-master File: EditRecurrenceRuleVBox.java View source code |
// INITIALIZATION - runs when FXML is initialized
@FXML
public void initialize() {
// REPEATABLE CHECKBOX
repeatableCheckBox.selectedProperty().addListener(( observable, oldSelection, newSelection) -> {
if (newSelection) {
// removeListeners();
if (rrule == null) {
if (oldRRule != null) {
rrule = oldRRule;
vComponent.setRecurrenceRule(rrule);
} else {
// setup new default RRule
rrule = new RecurrenceRuleValue().withFrequency(FrequencyType.WEEKLY).withByRules(new ByDay(DayOfWeek.from(dateTimeStartRecurrenceNew.get())));
vComponent.setRecurrenceRule(rrule);
setInitialValues(vComponent);
}
}
repeatableGridPane.setDisable(false);
startDatePicker.setDisable(false);
} else {
oldRRule = rrule;
rrule = null;
vComponent.setRecurrenceRule(rrule);
repeatableGridPane.setDisable(true);
startDatePicker.setDisable(true);
}
});
// DAY OF WEEK CHECK BOX LISTENERS (FOR WEEKLY)
checkBoxDayOfWeekMap.put(sundayCheckBox.selectedProperty(), DayOfWeek.SUNDAY);
checkBoxDayOfWeekMap.put(mondayCheckBox.selectedProperty(), DayOfWeek.MONDAY);
checkBoxDayOfWeekMap.put(tuesdayCheckBox.selectedProperty(), DayOfWeek.TUESDAY);
checkBoxDayOfWeekMap.put(wednesdayCheckBox.selectedProperty(), DayOfWeek.WEDNESDAY);
checkBoxDayOfWeekMap.put(thursdayCheckBox.selectedProperty(), DayOfWeek.THURSDAY);
checkBoxDayOfWeekMap.put(fridayCheckBox.selectedProperty(), DayOfWeek.FRIDAY);
checkBoxDayOfWeekMap.put(saturdayCheckBox.selectedProperty(), DayOfWeek.SATURDAY);
dayOfWeekCheckBoxMap = checkBoxDayOfWeekMap.entrySet().stream().collect(Collectors.toMap( e -> e.getValue(), e -> e.getKey()));
checkBoxDayOfWeekMap.entrySet().stream().forEach( entry -> entry.getKey().addListener(dayOfWeekCheckBoxListener));
// Setup frequencyComboBox items
FrequencyType[] supportedFrequencyProperties = new FrequencyType[] { FrequencyType.DAILY, FrequencyType.WEEKLY, FrequencyType.MONTHLY, FrequencyType.YEARLY };
frequencyComboBox.setItems(FXCollections.observableArrayList(supportedFrequencyProperties));
frequencyComboBox.setConverter(new StringConverter<FrequencyType>() {
@Override
public String toString(FrequencyType frequencyType) {
return Settings.REPEAT_FREQUENCIES.get(frequencyType);
}
@Override
public FrequencyType fromString(String string) {
throw new RuntimeException("not required for non editable ComboBox");
}
});
// INTERVAL SPINNER
// Make frequencySpinner and only accept numbers (needs below two listeners)
intervalSpinner.setEditable(true);
intervalSpinner.getEditor().addEventHandler(KeyEvent.KEY_PRESSED, ( event) -> {
if (event.getCode() == KeyCode.ENTER) {
String s = intervalSpinner.getEditor().textProperty().get();
boolean isNumber = s.matches("[0-9]+");
if (!isNumber) {
String lastValue = intervalSpinner.getValue().toString();
intervalSpinner.getEditor().textProperty().set(lastValue);
notNumberAlert();
}
}
});
intervalSpinner.focusedProperty().addListener(( obs, wasFocused, isNowFocused) -> {
if (!isNowFocused) {
int value;
String s = intervalSpinner.getEditor().textProperty().get();
boolean isNumber = s.matches("[0-9]+");
if (isNumber) {
value = Integer.parseInt(s);
if (value > 1) {
rrule.setInterval(value);
refreshSummary();
refreshExceptionDates();
}
} else {
String lastValue = intervalSpinner.getValue().toString();
intervalSpinner.getEditor().textProperty().set(lastValue);
notNumberAlert();
}
}
});
startDatePicker.valueProperty().addListener(( obs, oldValue, newValue) -> {
if (oldValue != null) {
synchStartDatePickerAndComponent(oldValue, newValue);
}
});
startDatePicker.focusedProperty().addListener(( obs, wasFocused, isNowFocused) -> {
if (!isNowFocused) {
try {
String s = startDatePicker.getEditor().getText();
LocalDate d = startDatePicker.getConverter().fromString(s);
startDatePicker.setValue(d);
} catch (DateTimeParseException e) {
String exampleDate = startDatePicker.getConverter().toString(LocalDate.now());
notDateAlert(exampleDate);
LocalDate d = startDatePicker.getValue();
String s = startDatePicker.getConverter().toString(d);
startDatePicker.getEditor().setText(s);
}
}
});
// END AFTER LISTENERS
endAfterEventsSpinner.valueProperty().addListener(( observable, oldSelection, newSelection) -> {
if (endAfterRadioButton.isSelected()) {
rrule.setCount(newSelection);
refreshSummary();
refreshExceptionDates();
}
if (newSelection == 1) {
eventLabel.setText(resources.getString("event"));
} else {
eventLabel.setText(resources.getString("events"));
}
});
endAfterRadioButton.selectedProperty().addListener(( observable, oldSelection, newSelection) -> {
if (newSelection) {
endAfterEventsSpinner.setDisable(false);
eventLabel.setDisable(false);
rrule.setCount(endAfterEventsSpinner.getValue());
refreshSummary();
refreshExceptionDates();
} else {
rrule.setCount(null);
endAfterEventsSpinner.setValueFactory(null);
endAfterEventsSpinner.setDisable(true);
eventLabel.setDisable(true);
}
});
// Make endAfterEventsSpinner and only accept numbers in text field (needs below two listeners)
endAfterEventsSpinner.setEditable(true);
endAfterEventsSpinner.getEditor().addEventHandler(KeyEvent.KEY_PRESSED, ( event) -> {
if (event.getCode() == KeyCode.ENTER) {
String s = endAfterEventsSpinner.getEditor().textProperty().get();
boolean isNumber = s.matches("[0-9]+");
if (!isNumber) {
String lastValue = endAfterEventsSpinner.getValue().toString();
endAfterEventsSpinner.getEditor().textProperty().set(lastValue);
notNumberAlert();
}
}
});
endAfterEventsSpinner.focusedProperty().addListener(( obs, wasFocused, isNowFocused) -> {
if (!isNowFocused) {
int value;
String s = endAfterEventsSpinner.getEditor().getText();
boolean isNumber = s.matches("[0-9]+");
if (isNumber) {
value = Integer.parseInt(s);
rrule.setCount(value);
} else {
String lastValue = endAfterEventsSpinner.getValue().toString();
endAfterEventsSpinner.getEditor().textProperty().set(lastValue);
notNumberAlert();
}
}
});
untilDatePicker.valueProperty().addListener(untilListener);
untilRadioButton.selectedProperty().addListener(untilRadioButtonListener);
// Day of week tooltips
sundayCheckBox.setTooltip(new Tooltip(resources.getString("sunday")));
mondayCheckBox.setTooltip(new Tooltip(resources.getString("monday")));
tuesdayCheckBox.setTooltip(new Tooltip(resources.getString("tuesday")));
wednesdayCheckBox.setTooltip(new Tooltip(resources.getString("wednesday")));
thursdayCheckBox.setTooltip(new Tooltip(resources.getString("thursday")));
fridayCheckBox.setTooltip(new Tooltip(resources.getString("friday")));
saturdayCheckBox.setTooltip(new Tooltip(resources.getString("saturday")));
// Monthly ToggleGroup
monthlyGroup = new ToggleGroup();
dayOfMonthRadioButton.setToggleGroup(monthlyGroup);
dayOfWeekRadioButton.setToggleGroup(monthlyGroup);
// End criteria ToggleGroup
endGroup = new ToggleGroup();
endNeverRadioButton.setToggleGroup(endGroup);
endAfterRadioButton.setToggleGroup(endGroup);
untilRadioButton.setToggleGroup(endGroup);
ListChangeListener<? super Temporal> exceptionsListChangeListener = ( change) -> {
while (change.next()) {
if (change.wasAdded()) {
List<? extends Temporal> added1 = change.getAddedSubList();
final List<ExceptionDates> exceptionDates = (vComponent.getExceptionDates() == null) ? Collections.emptyList() : vComponent.getExceptionDates();
boolean isEmpty = exceptionDates.isEmpty();
DateTimeType startType = DateTimeType.of(vComponent.getDateTimeStart().getValue());
DateTimeType newType = DateTimeType.of(added1.get(0));
boolean isTemporalTypeChanged = startType != newType;
if (isEmpty || isTemporalTypeChanged) {
List<? extends Temporal> list = change.getList();
Temporal[] allExceptions = list.toArray(new Temporal[list.size()]);
ExceptionDates ed = new ExceptionDates(allExceptions);
vComponent.setExceptionDates(new ArrayList<>(Arrays.asList(ed)));
} else {
// NOTE: Only works for one EXDATE property
vComponent.getExceptionDates().get(0).getValue().addAll(added1);
}
} else if (change.wasRemoved()) {
List<? extends Temporal> removed = change.getRemoved();
vComponent.getExceptionDates().get(0).getValue().removeAll(removed);
}
}
};
exceptionsListView.getItems().addListener(exceptionsListChangeListener);
}Example 26
| Project: JXTN-master File: RadioMenuItemMaker.java View source code |
/**
* è¨å®šå±¬æ€§{@link RadioMenuItem#setToggleGroup(javafx.scene.control.ToggleGroup)}。
*
* @param value 新的屬性值
* @return 目�的建構器(this)
*/
@SuppressWarnings("unchecked")
public B toggleGroup(javafx.scene.control.ToggleGroup value) {
this.hasToggleGroup = true;
this.valToggleGroup = value;
return (B) this;
}Example 27
| Project: AsciidocFX-master File: CheckItemBuilt.java View source code |
public CheckItemBuilt group(ToggleGroup toggleGroup) {
menuItem.setToggleGroup(toggleGroup);
return this;
}Example 28
| Project: XR3Player-master File: GeneralSettingsController.java View source code |
/**
* @return the sideBarSideGroup
*/
public ToggleGroup getSideBarSideGroup() {
return sideBarSideGroup;
}Example 29
| Project: SIFResourceExplorer-master File: ExportSingleTexbStage.java View source code |
public void initToggleBtn(Parent root) {
ToggleGroup tg = new ToggleGroup();
RadioButton rb1 = (RadioButton) root.lookup("#tg1");
RadioButton rb2 = (RadioButton) root.lookup("#tg2");
rb1.setToggleGroup(tg);
rb2.setToggleGroup(tg);
}Example 30
| Project: CCAutotyper-master File: FXGuiUtils.java View source code |
public static boolean addTogglesToGroup(ToggleGroup group, Toggle... toggles) {
return group.getToggles().addAll(toggles);
}Example 31
| Project: ShootOFF-master File: ItemSelectionPane.java View source code |
public ToggleGroup getToggleGroup() {
return toggleGroup;
}