Wie zeige ich einen langen Titel in schwimmenden Registerkarten in Atlantafx?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie zeige ich einen langen Titel in schwimmenden Registerkarten in Atlantafx?

by Anonymous » 05 Apr 2025, 22:06

Ich verwende atlantafx , eine moderne Javafx -CSS -Themensammlung mit zusätzlichen Steuerelementen. Dies ist mein Code: < /p>

Code: Select all

public class NewMain1 extends Application {

@Override
public void start(Stage primaryStage) {
Application.setUserAgentStylesheet(new CupertinoDark().getUserAgentStylesheet());
TabPane tabPane = new TabPane();
tabPane.getStyleClass().addAll("mytab-pane", TabPane.STYLE_CLASS_FLOATING);

Tab tab1 = new Tab("Short Title");

var button = new Button("Test");
button.setOnAction(e -> tab1.setText("Looooooooooooooooooooooong title"));
var tabContent = new VBox(button);
tab1.setContent(tabContent);

tabPane.getTabs().add(tab1);
Scene scene = new Scene(tabPane, 400, 150);
scene.getStylesheets().add(getClass().getResource("test.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.show();
}

public static void main(String[] args) {
launch(args);
}
}
< /code>
und CSS: < /p>
.mytab-pane > .tab-header-area > .headers-region > .tab {
-fx-min-width: -1;
}
Und dies ist das Ergebnis:

, wie Sie sehen, nur Teil des Titels wird. Gleichzeitig in Modena wird der Titel vollständig angezeigt:

Top