use of javafx.scene.control.RadioButton in project JFoenix by jfoenixadmin.
the class JFXRadioButtonSkin method layoutChildren.
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
final RadioButton radioButton = getSkinnable();
contWidth = snapSize(container.prefWidth(-1)) + (invalid ? 2 : 0);
contHeight = snapSize(container.prefHeight(-1)) + (invalid ? 2 : 0);
final double computeWidth = Math.min(radioButton.prefWidth(-1), radioButton.minWidth(-1)) + labelOffset + 2 * padding;
final double labelWidth = Math.min(computeWidth - contWidth, w - snapSize(contWidth)) + labelOffset + 2 * padding;
final double labelHeight = Math.min(radioButton.prefHeight(labelWidth), h);
maxHeight = Math.max(contHeight, labelHeight);
final double xOffset = computeXOffset(w, labelWidth + contWidth, radioButton.getAlignment().getHpos()) + x;
final double yOffset = computeYOffset(h, maxHeight, radioButton.getAlignment().getVpos()) + x;
if (invalid) {
initializeComponents(x, y, w, h);
invalid = false;
}
layoutLabelInArea(xOffset + contWidth, yOffset, labelWidth, maxHeight, radioButton.getAlignment());
((Text) getChildren().get((getChildren().get(0) instanceof Text) ? 0 : 1)).textProperty().set(getSkinnable().textProperty().get());
container.resize(snapSize(contWidth), snapSize(contHeight));
positionInArea(container, xOffset, yOffset, contWidth, maxHeight, 0, radioButton.getAlignment().getHpos(), radioButton.getAlignment().getVpos());
}
use of javafx.scene.control.RadioButton in project SmartCity-Market by TechnionYP5777.
the class ManageCatalogProductTab method initialize.
@Override
public void initialize(URL location, ResourceBundle __) {
barcodeEventHandler.register(this);
barcodeTextField.textProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue.matches("\\d*"))
barcodeTextField.setText(newValue.replaceAll("[^\\d]", ""));
enableRunOperation();
});
productNameTextField.textProperty().addListener((observable, oldValue, newValue) -> enableRunOperation());
productDescriptionTextField.textProperty().addListener((observable, oldValue, newValue) -> enableRunOperation());
createManufacturerMap();
productManufacturerCombo.getItems().addAll(manufacturars.keySet());
productManufacturerCombo.valueProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(@SuppressWarnings("rawtypes") ObservableValue __, String s, String t1) {
enableRunOperation();
}
});
productPriceTextField.textProperty().addListener((observable, oldValue, newValue) -> {
if (!newValue.matches("((\\d*)|(\\d+\\.\\d*))"))
productPriceTextField.setText(oldValue);
enableRunOperation();
});
createIngredientMap();
ingridientsCombo.getItems().addAll(ingredients.keySet());
// productLocationTextField.textProperty().addListener((observable,
// oldValue, newValue) -> {
// });
radioButtonContainerManageCatalogProduct.addRadioButtons(Arrays.asList(new RadioButton[] { addCatalogProductRadioButton, removeCatalogProductRadioButton }));
RequiredFieldValidator validator = new RequiredFieldValidator();
validator.setMessage("Input Required");
validator.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em").styleClass("error").build());
barcodeTextField.getValidators().add(validator);
barcodeTextField.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
barcodeTextField.validate();
});
RequiredFieldValidator validator2 = new RequiredFieldValidator();
validator2.setMessage("Input Required");
validator2.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em").styleClass("error").build());
productNameTextField.getValidators().add(validator2);
productNameTextField.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
productNameTextField.validate();
});
RequiredFieldValidator validator3 = new RequiredFieldValidator();
validator3.setMessage("Input Required");
validator3.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em").styleClass("error").build());
productPriceTextField.getValidators().add(validator3);
productPriceTextField.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
productPriceTextField.validate();
});
enableRunOperation();
}
use of javafx.scene.control.RadioButton in project SmartCity-Market by TechnionYP5777.
the class ManageEmployeesTab method initialize.
@Override
public void initialize(URL location, ResourceBundle __) {
userTxt.textProperty().addListener((observable, oldValue, newValue) -> enableFinishBtn());
passTxt.textProperty().addListener((observable, oldValue, newValue) -> enableFinishBtn());
securityAnswerTxt.textProperty().addListener((observable, oldValue, newValue) -> enableFinishBtn());
radioBtnCont.addRadioButtons(Arrays.asList(new RadioButton[] { workerRadioBtn, managerRadioBtn }));
securityCombo.getItems().addAll(SecurityQuestions.getQuestions());
RequiredFieldValidator validator2 = new RequiredFieldValidator();
validator2.setMessage("Input Required");
validator2.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em").styleClass("error").build());
userTxt.getValidators().add(validator2);
userTxt.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
userTxt.validate();
});
RequiredFieldValidator validator3 = new RequiredFieldValidator();
validator3.setMessage("Input Required");
validator3.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em").styleClass("error").build());
passTxt.getValidators().add(validator3);
passTxt.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
passTxt.validate();
});
RequiredFieldValidator validator4 = new RequiredFieldValidator();
validator4.setMessage("Input Required");
validator4.setIcon(GlyphsBuilder.create(FontAwesomeIconView.class).glyph(FontAwesomeIcon.WARNING).size("1em").styleClass("error").build());
securityAnswerTxt.getValidators().add(validator4);
securityAnswerTxt.focusedProperty().addListener((o, oldVal, newVal) -> {
if (!newVal)
securityAnswerTxt.validate();
});
createEmployeesList();
searchEmployee.textProperty().addListener(obs -> {
String filter = searchEmployee.getText();
filteredDataEmployees.setPredicate(filter == null || filter.length() == 0 ? s -> true : s -> s.contains(filter));
});
employeesList.setCellFactory(CheckBoxListCell.forListView(new Callback<String, ObservableValue<Boolean>>() {
@Override
public ObservableValue<Boolean> call(String item) {
BooleanProperty observable = new SimpleBooleanProperty();
observable.set(selectedEmployees.contains(item));
observable.addListener((obs, wasSelected, isNowSelected) -> {
if (isNowSelected)
selectedEmployees.add(item);
else
selectedEmployees.remove(item);
enableRemoveButton();
});
return observable;
}
}));
securityCombo.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> __, String oldValue, String newValue) {
enableFinishBtn();
}
});
enableFinishBtn();
enableRemoveButton();
}
use of javafx.scene.control.RadioButton in project TeachingInSimulation by ScOrPiOzzy.
the class JudgmentOption method createRadioButton.
private void createRadioButton(String text, boolean selected) {
RadioButton button = new RadioButton(text);
// 单选框要设置选中图标左右位置
// for (Node child : button.getSkin().getNode().) {
// if (child instanceof StackPane) {
// child.setNodeOrientation(NodeOrientation.LEFT_TO_RIGHT);
// }
// }
button.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
button.getStyleClass().add("option");
button.setUserData(text);
button.setWrapText(true);
button.setSelected(selected);
group.getToggles().add(button);
this.getChildren().add(button);
VBox.setVgrow(button, Priority.ALWAYS);
}
use of javafx.scene.control.RadioButton in project jphp by jphp-compiler.
the class RadioGroupPane method updateUi.
protected void updateUi(ObservableList<? extends T> list) {
T selected = getSelected();
buttons.clear();
getChildren().clear();
ObservableList<Node> children = getChildren();
if (orientation == Orientation.HORIZONTAL) {
final HBox hBox = new HBox();
hBox.setSpacing(getSpacing());
hBox.setPrefWidth(-1);
hBox.setPrefHeight(-1);
hBox.setAlignment(Pos.BASELINE_LEFT);
spacingProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
hBox.setSpacing(newValue.intValue());
}
});
children.add(hBox);
children = hBox.getChildren();
}
for (T t : list) {
String label = "" + t;
RadioButton button = new RadioButton(label);
button.setToggleGroup(group);
button.setUserData(t);
button.setFont(font);
button.setTextFill(textColor);
buttons.add(button);
children.add(button);
}
setSelected(selected);
}
Aggregations