diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SpinnerRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SpinnerRepresentation.java index 6575dd7438..0a1a898be5 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SpinnerRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/SpinnerRepresentation.java @@ -14,6 +14,10 @@ import javafx.application.Platform; import javafx.geometry.Pos; import javafx.scene.Cursor; +import javafx.scene.layout.Background; +import javafx.scene.layout.BackgroundFill; +import javafx.scene.layout.CornerRadii; +import javafx.scene.paint.Color; import org.csstudio.display.builder.model.DirtyFlag; import org.csstudio.display.builder.model.UntypedWidgetPropertyListener; import org.csstudio.display.builder.model.WidgetProperty; @@ -217,7 +221,7 @@ else if (((Number)value).doubleValue() > value_max) } logger.log(Level.FINE, "Writing '" + text + "' as " + value + " (" + value.getClass().getName() + ")"); toolkit.fireWrite(model_widget, value); - + // Wrote value. Expected is either // a) PV receives that value, PV updates to // submitted value or maybe a 'clamped' value @@ -535,8 +539,10 @@ public void updateChanges() // http://stackoverflow.com/questions/27700006/how-do-you-change-the-background-color-of-a-textfield-without-changing-the-border final WidgetColor back_color = active ? active_color : model_widget.propBackgroundColor().getValue(); - style.append("-fx-control-inner-background: "); - JFXUtil.appendWebRGB(style, back_color).append(";"); + final Color color = JFXUtil.convert(back_color); + Background background = new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)); + jfx_node.getEditor().setBackground(background); + jfx_node.setBackground(background); jfx_node.editorProperty().getValue().setStyle(style.toString()); jfx_node.editorProperty().getValue().setAlignment(pos); @@ -639,4 +645,3 @@ private void setActive(final boolean active) updateChanges(); } } - diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextEntryRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextEntryRepresentation.java index 5c7a3447f7..a925439c25 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextEntryRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextEntryRepresentation.java @@ -14,8 +14,13 @@ import java.util.logging.Level; import javafx.css.PseudoClass; +import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.input.MouseButton; +import javafx.scene.layout.Background; +import javafx.scene.layout.BackgroundFill; +import javafx.scene.layout.CornerRadii; +import javafx.scene.paint.Color; import org.csstudio.display.builder.model.DirtyFlag; import org.csstudio.display.builder.model.UntypedWidgetPropertyListener; import org.csstudio.display.builder.model.WidgetProperty; @@ -245,12 +250,12 @@ private void submit() if (enabled) { // Strip 'units' etc. from text final String text = jfx_node.getText(); - + final Object value = FormatOptionHandler.parse(model_widget.runtimePropValue().getValue(), text, model_widget.propFormat().getValue()); logger.log(Level.FINE, "Writing '" + text + "' as " + value + " (" + value.getClass().getName() + ")"); toolkit.fireWrite(model_widget, value); - + // Wrote value. Expected is either // a) PV receives that value, PV updates to // submitted value or maybe a 'clamped' value @@ -401,6 +406,8 @@ public void updateChanges() // http://stackoverflow.com/questions/27700006/how-do-you-change-the-background-color-of-a-textfield-without-changing-the-border final WidgetColor back_color = active ? active_color : model_widget.propBackgroundColor().getValue(); + final Color color = JFXUtil.convert(back_color); + jfx_node.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY))); style.append("-fx-control-inner-background: "); JFXUtil.appendWebRGB(style, back_color).append(";"); jfx_node.setStyle(style.toString()); @@ -429,7 +436,7 @@ else if(jfx_node instanceof TextArea){ String alignment = model_widget.propHorizontalAlignment().getValue().toString().toLowerCase(); PseudoClass alignmentClass = PseudoClass.getPseudoClass(alignment); jfx_node.pseudoClassStateChanged(alignmentClass, true); - + if (jfx_node.getScene() != null && !enabled) { // Need to get the TextArea 'content' node to set the cursor // for the whole widget otherwise it will only show on the borders. diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextUpdateRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextUpdateRepresentation.java index fdaf5a8a8a..34d348884c 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextUpdateRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TextUpdateRepresentation.java @@ -275,8 +275,17 @@ public void updateChanges() // http://stackoverflow.com/questions/27700006/how-do-you-change-the-background-color-of-a-textfield-without-changing-the-border final WidgetColor back_color = model_widget.propBackgroundColor().getValue(); - style.append("-fx-control-inner-background: "); - JFXUtil.appendWebRGB(style, back_color).append(";"); + final Color color = JFXUtil.convert(back_color); + if (model_widget.propTransparent().getValue() || color.getOpacity() == 0) + { + jfx_node.setBackground(null); + style.append("-fx-control-inner-background: transparent;"); + } + else + { + style.append("-fx-control-inner-background:"); + JFXUtil.appendWebRGB(style, back_color).append(";"); + } area.setStyle(style.toString()); area.setFont(JFXUtil.convert(model_widget.propFont().getValue())); // Alignment (pos) not supported