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.shape.Line;
import javafx.stage.Stage;
public class BugLine extends Application {
@Override
public void start(Stage stage) {
HBox root = new HBox(20d);
final Line line = new Line(10, 10, 60, 60);
Button btnSetDisabled = new Button("Set disabled");
btnSetDisabled.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
line.setDisable(true);
}
});
Button btnGetValue = new Button("Get disabled");
btnGetValue.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
System.out.println(line.disableProperty().getValue());
}
});
root.getChildren().addAll(line, 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.shape.Line;
import javafx.stage.Stage;
public class BugLine extends Application {
@Override
public void start(Stage stage) {
HBox root = new HBox(20d);
final Line line = new Line(10, 10, 60, 60);
Button btnSetDisabled = new Button("Set disabled");
btnSetDisabled.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
line.setDisable(true);
}
});
Button btnGetValue = new Button("Get disabled");
btnGetValue.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
System.out.println(line.disableProperty().getValue());
}
});
root.getChildren().addAll(line, 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-8120021 [Circle] When the control is set dissabled there are no changes in opacity.
- Closed