-
Bug
-
Resolution: Unresolved
-
P3
-
8, 25, 26
-
x86_64
-
os_x
ADDITIONAL SYSTEM INFORMATION :
MacOS Sequoia 15.6.1 (24G90), Java Temurin 25.0.0+36
A DESCRIPTION OF THE PROBLEM :
On MacOS, using Aqua, the system Look & Feel, a multi-line tab title does display with enough height and the text gets clipped.
It does not matter whether the multi-line tab is created via HTML and a `JTabbedPane::addTab` call, or via an explicit `JLabel` and `JTabbedPane::setTabComponentAt`. I also tried calling
```java
tabbedPane.setPreferredSize(null);
tabbedPane.revalidate();
```
to try to force it to recalculate the heights, but it looks like it simply ignores the preferred sizes completely.
Other Look & Feels work correctly and adjust the height of the tab to fit all the content.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. MacOS and Aqua LaF
2. JTabbedPane
3. a multi-line tab title, in any way imaginable
4. sadness
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The tab (preferred) height should be respected and the whole multi-line text should be displayed.
ACTUAL -
Instead the tab height stays default. It ignores the content and any explicitly-set preferred height (width works fine).
---------- BEGIN SOURCE ----------
public class Playground {
public static void main(String... args) {
SwingUtilities.invokeLater(() -> {
setSystemLookAndFeel();
displayUi();
});
}
private static void displayUi() {
var tabbedPane = new JTabbedPane();
tabbedPane.addTab("single-line", new JLabel("1"));
tabbedPane.addTab("<html>multi-line<br>multi-line</html>", new JLabel("2"));
tabbedPane.addTab("<html>triple-line<br>triple-line<br>triple-line</html>", new JLabel("3"));
var window = new JFrame();
window.setBounds(200, 200, 400, 400);
window.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
window.setContentPane(tabbedPane);
window.setVisible(true);
}
private static void setSystemLookAndFeel() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception _) {
throw new AssertionError("Impossible condition triggered");
}
}
}
---------- END SOURCE ----------
MacOS Sequoia 15.6.1 (24G90), Java Temurin 25.0.0+36
A DESCRIPTION OF THE PROBLEM :
On MacOS, using Aqua, the system Look & Feel, a multi-line tab title does display with enough height and the text gets clipped.
It does not matter whether the multi-line tab is created via HTML and a `JTabbedPane::addTab` call, or via an explicit `JLabel` and `JTabbedPane::setTabComponentAt`. I also tried calling
```java
tabbedPane.setPreferredSize(null);
tabbedPane.revalidate();
```
to try to force it to recalculate the heights, but it looks like it simply ignores the preferred sizes completely.
Other Look & Feels work correctly and adjust the height of the tab to fit all the content.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. MacOS and Aqua LaF
2. JTabbedPane
3. a multi-line tab title, in any way imaginable
4. sadness
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The tab (preferred) height should be respected and the whole multi-line text should be displayed.
ACTUAL -
Instead the tab height stays default. It ignores the content and any explicitly-set preferred height (width works fine).
---------- BEGIN SOURCE ----------
public class Playground {
public static void main(String... args) {
SwingUtilities.invokeLater(() -> {
setSystemLookAndFeel();
displayUi();
});
}
private static void displayUi() {
var tabbedPane = new JTabbedPane();
tabbedPane.addTab("single-line", new JLabel("1"));
tabbedPane.addTab("<html>multi-line<br>multi-line</html>", new JLabel("2"));
tabbedPane.addTab("<html>triple-line<br>triple-line<br>triple-line</html>", new JLabel("3"));
var window = new JFrame();
window.setBounds(200, 200, 400, 400);
window.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
window.setContentPane(tabbedPane);
window.setVisible(true);
}
private static void setSystemLookAndFeel() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception _) {
throw new AssertionError("Impossible condition triggered");
}
}
}
---------- END SOURCE ----------