-
Bug
-
Resolution: Not an Issue
-
P4
-
7u6
A label does not request a proper prefHeight to display the full multiline message as can be seen from the test case below, where "..." is shown. This is a problem when displaying a dialog message to end-users, as dialog messages need to be read in full. I can see why a label which has the labelFor assigned and only contains one or two words would accept to be minimised if other components need the space, but a dialog message should always be displayed in full. The trouble is, we cannot even set a prefHeight because the length of the message may vary depending on the end-user's language. We have worked around the problem by setting a very large prefHeight, but then the UI does not look packed the way it should.
public class LabelSizeBugTestCase extends Application {
private Label message = new Label("Please enter the make and model of the car you are searching for in the field below.");
@Override
public void start(Stage stage) throws Exception {
message.setWrapText(true);
BorderPane borderPane = new BorderPane();
borderPane.setTop(message);
stage.setWidth(300);
stage.setScene(new Scene(borderPane));
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
public class LabelSizeBugTestCase extends Application {
private Label message = new Label("Please enter the make and model of the car you are searching for in the field below.");
@Override
public void start(Stage stage) throws Exception {
message.setWrapText(true);
BorderPane borderPane = new BorderPane();
borderPane.setTop(message);
stage.setWidth(300);
stage.setScene(new Scene(borderPane));
stage.show();
}
public static void main(String[] args) {
Application.launch(args);
}
}
- relates to
-
JDK-8098040 Add possibility to calculate and set window minimum and maximum size automatically
- Closed