cut off the version name if too long

This commit is contained in:
huangyuhui
2018-08-30 22:13:13 +08:00
parent 60454c6af3
commit 8f2f57c543

View File

@@ -25,6 +25,7 @@ import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextAlignment; import javafx.scene.text.TextAlignment;
import org.jackhuang.hmcl.setting.Theme; import org.jackhuang.hmcl.setting.Theme;
@@ -48,15 +49,16 @@ public class AdvancedListItem2 extends StackPane {
imageView.imageProperty().bind(viewModel.imageProperty()); imageView.imageProperty().bind(viewModel.imageProperty());
imageViewContainer.getChildren().setAll(imageView); imageViewContainer.getChildren().setAll(imageView);
BorderPane borderPane = new BorderPane(); VBox vbox = new VBox();
borderPane.setPadding(new Insets(0, 0, 0, 10)); vbox.setAlignment(Pos.CENTER_LEFT);
vbox.setPadding(new Insets(0, 0, 0, 10));
Label title = new Label(); Label title = new Label();
title.textProperty().bind(viewModel.titleProperty()); title.textProperty().bind(viewModel.titleProperty());
title.setMaxWidth(90); title.setMaxWidth(90);
title.setStyle("-fx-font-size: 15;"); title.setStyle("-fx-font-size: 15;");
title.setTextAlignment(TextAlignment.JUSTIFY); title.setTextAlignment(TextAlignment.JUSTIFY);
borderPane.setTop(title); vbox.getChildren().add(title);
if (viewModel.subtitleProperty() != null) { if (viewModel.subtitleProperty() != null) {
Label subtitle = new Label(); Label subtitle = new Label();
@@ -64,12 +66,10 @@ public class AdvancedListItem2 extends StackPane {
subtitle.setMaxWidth(90); subtitle.setMaxWidth(90);
subtitle.setStyle("-fx-font-size: 10;"); subtitle.setStyle("-fx-font-size: 10;");
subtitle.setTextAlignment(TextAlignment.JUSTIFY); subtitle.setTextAlignment(TextAlignment.JUSTIFY);
borderPane.setBottom(subtitle); vbox.getChildren().add(subtitle);
} else {
title.setWrapText(true);
} }
left.getChildren().setAll(imageViewContainer, borderPane); left.getChildren().setAll(imageViewContainer, vbox);
root.setLeft(left); root.setLeft(left);
HBox right = new HBox(); HBox right = new HBox();