/** * Initialize the initial text. * @param text initial text on the input */ public OpenPatricianDialogInput(String text) { super(); this.text = new SimpleStringProperty(this, "text", text); size = new SimpleIntegerProperty(this, "size", 25); this.getStyleClass().add(this.getClass().getSimpleName()); }
public List<CssMetaData<? extends Styleable, ?>> getControlCssMetaData() { return getClassCssMetaData(); }
@Override protected Table createMainTable() { Table model = new Table(); // Add dummy header which is not rendered TableHeader header = new TableHeader(2); header.add(new StaticTextTableCell("")); header.add(new StaticTextTableCell("")); model.setHeader(header); model.setColumnWidth(150, 200); TableRow row = new TableRow(); row.add(new StaticTextTableCell(messageSource.getMessage("ch.sahits.game.openpatrician.display.dialog.ShipyardRenameDialogV2.shipName", new Object[]{}, locale.getCurrentLocal()))); shipNameInput = new OpenPatricianDialogInput(""); shipNameInput.getStyleClass().add("defaultLabelFont"); shipNameInput.textProperty().bindBidirectional(shipName); row.add(new ControlTableCell(shipNameInput)); model.add(row); return model; }
public OpenPatricianDialogInputSkin(OpenPatricianDialogInput input) { super(input); textField = new TextField(input.getText()); calculateDimensions(input); input.fontProperty().addListener((observable, oldValue, newValue) -> calculateDimensions(input)); textField.textProperty().bindBidirectional(input.textProperty()); textField.getStyleClass().add("openPatricianDialogInput"); Rectangle background = new Rectangle(); background.setHeight(height.doubleValue()); background.setWidth(width.doubleValue()); background.setFill(Color.rgb(150, 150, 150)); background.heightProperty().bind(height); background.widthProperty().bind(width); StackPane stack = new StackPane(); stack.getChildren().addAll(background, textField); Group group = new Group(stack); group.setManaged(false); getChildren().add(group); }