To reproduce run following code
Unexpected: gray background behind border
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.Label;
import javafx.scene.control.TitledPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
public class Accordions extends Application {
public static void main(String[] args) {
launch(args);
}
private Parent getContent() {
VBox list = new VBox(10);
TitledPane pane1 = new TitledPane();
pane1.setText("title 1\nLong text long text");
pane1.setContent(new Rectangle(100, 40, Color.SKYBLUE));
TitledPane pane2 = new TitledPane();
pane2.setText("title 2\nLong text long text");
pane2.setContent(new Rectangle(100, 40, Color.BLUEVIOLET));
Accordion acc = new Accordion();
acc.getPanes().addAll(pane1, pane2);
acc.setExpandedPane(pane2);
acc.setStyle("-fx-border-width:5;-fx-border-color: green;-fx-border-style: dashed;");
list.getChildren().add(acc);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(300);
stage.setHeight(300);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.show();
}
}
Unexpected: gray background behind border
import javafx.application.Application;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.Label;
import javafx.scene.control.TitledPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;
public class Accordions extends Application {
public static void main(String[] args) {
launch(args);
}
private Parent getContent() {
VBox list = new VBox(10);
TitledPane pane1 = new TitledPane();
pane1.setText("title 1\nLong text long text");
pane1.setContent(new Rectangle(100, 40, Color.SKYBLUE));
TitledPane pane2 = new TitledPane();
pane2.setText("title 2\nLong text long text");
pane2.setContent(new Rectangle(100, 40, Color.BLUEVIOLET));
Accordion acc = new Accordion();
acc.getPanes().addAll(pane1, pane2);
acc.setExpandedPane(pane2);
acc.setStyle("-fx-border-width:5;-fx-border-color: green;-fx-border-style: dashed;");
list.getChildren().add(acc);
return list;
}
public void start(Stage stage) {
stage.setX(100);
stage.setY(100);
stage.setWidth(300);
stage.setHeight(300);
Scene scene = new Scene(getContent());
stage.setScene(scene);
stage.show();
}
}
- relates to
-
JDK-8114622 Accordion has white top border since b34
- Closed