-
Bug
-
Resolution: Fixed
-
P3
-
6
-
b96
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b84)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b84, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
If a JTable contains empty column headers and the width of these columns is quite small then the header shows superfluous abbreviation dots (...).
This can result in a very ugly appearance of the table.
This is a regression, since the header is rendered properly in 1.5u6 and 1.5u7.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run attached source code with mustang and 1.5u7
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Abbreviation dots (...) must only be shown if column names are abbreviated. They must not be shown if the column header is empty.
ACTUAL -
Abbreviation dots (...) are shown for empty column headers too.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
public class JTableDemo extends JPanel {
public JTableDemo() {
final String[] columnNames = {"A", "B", "", "", ""};
final String[][] data = {{"1", "2", "3", "4", "5"}};
final JTable table = new JTable(data, columnNames);
final DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
final int tableCellWidth = 8 + renderer.getFontMetrics(renderer.getFont()).stringWidth("W");
table.setPreferredScrollableViewportSize(new Dimension(5 * tableCellWidth, 50));
add(new JScrollPane(table));
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ignore) {
}
JFrame frame = new JFrame("JTableDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new JTableDemo());
frame.pack();
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
Release Regression From : 5.0u7
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b84)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b84, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
If a JTable contains empty column headers and the width of these columns is quite small then the header shows superfluous abbreviation dots (...).
This can result in a very ugly appearance of the table.
This is a regression, since the header is rendered properly in 1.5u6 and 1.5u7.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run attached source code with mustang and 1.5u7
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Abbreviation dots (...) must only be shown if column names are abbreviated. They must not be shown if the column header is empty.
ACTUAL -
Abbreviation dots (...) are shown for empty column headers too.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
public class JTableDemo extends JPanel {
public JTableDemo() {
final String[] columnNames = {"A", "B", "", "", ""};
final String[][] data = {{"1", "2", "3", "4", "5"}};
final JTable table = new JTable(data, columnNames);
final DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
final int tableCellWidth = 8 + renderer.getFontMetrics(renderer.getFont()).stringWidth("W");
table.setPreferredScrollableViewportSize(new Dimension(5 * tableCellWidth, 50));
add(new JScrollPane(table));
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ignore) {
}
JFrame frame = new JFrame("JTableDemo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new JTableDemo());
frame.pack();
frame.setVisible(true);
}
});
}
}
---------- END SOURCE ----------
Release Regression From : 5.0u7
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
- relates to
-
JDK-4492484 Win L&F: JTable fails to draw header containing empty string under Windows Look-
- Resolved