To reproduce:
1. Click button "Set disabled"
The color of the circle will remain. But it is expected to become 40% opacite.
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
public class BugCircleDisabled extends Application {
@Override
public void start(Stage stage) {
HBox root = new HBox(20d);
final Circle circle = new Circle(50, 50, 25, Color.BLUE);
Button btnSetDisabled = new Button("Set disabled");
btnSetDisabled.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
circle.setDisable(true);
}
});
Button btnGetValue = new Button("Get disabled");
btnGetValue.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
System.out.println(circle.disableProperty().getValue());
}
});
root.getChildren().addAll(circle, btnSetDisabled, btnGetValue);
Scene scene = new Scene(root, 300, 250);
stage.setScene(scene);
stage.setTitle(System.getProperty("java.runtime.version") + "; " + System.getProperty("javafx.runtime.version"));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
1. Click button "Set disabled"
The color of the circle will remain. But it is expected to become 40% opacite.
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
public class BugCircleDisabled extends Application {
@Override
public void start(Stage stage) {
HBox root = new HBox(20d);
final Circle circle = new Circle(50, 50, 25, Color.BLUE);
Button btnSetDisabled = new Button("Set disabled");
btnSetDisabled.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
circle.setDisable(true);
}
});
Button btnGetValue = new Button("Get disabled");
btnGetValue.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
System.out.println(circle.disableProperty().getValue());
}
});
root.getChildren().addAll(circle, btnSetDisabled, btnGetValue);
Scene scene = new Scene(root, 300, 250);
stage.setScene(scene);
stage.setTitle(System.getProperty("java.runtime.version") + "; " + System.getProperty("javafx.runtime.version"));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
- relates to
-
JDK-8116359 [Line] When the control is set dissabled there are no changes in opacity.
- Closed