-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0, 1.3.1
-
beta
-
generic, x86
-
generic, windows_2000
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2116779 | 5.0u3 | Konstantin Eremin | P4 | Closed | Won't Fix |
Name: yyT116575 Date: 08/15/2001
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
When using the Windows Look-and-Feel, JTable renders header
with zero height if the first column has empty title ("").
The following example demonstrates the problem:
import javax.swing.*;
import javax.swing.table.*;
public class SwingHeaderProblem extends JFrame {
static String columnNames[] = {"", "First", "Last"};
SwingHeaderProblem() {
TableModel dataModel = new AbstractTableModel() {
public String getColumnName(int col) {return columnNames[col];}
public int getColumnCount() { return columnNames.length; }
public int getRowCount() { return 8; }
public Object getValueAt(int row, int col) {
switch(col) {
case 0: return "x"; break;
case 1: return "John"; break;
case 2: return "Smith"; break;
default: return null;
}
}
};
JTable table = new JTable(dataModel);
JScrollPane scrollPane = new JScrollPane(table);
getContentPane().add(scrollPane);
}
public void setVisible(boolean b) {
if (!b) System.exit(0);
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception ex) {
ex.printStackTrace();
System.exit(-1);
}
SwingHeaderProblem w = new SwingHeaderProblem();
w.setSize(300,200);
w.show();
}
}
(Review ID: 130031)
======================================================================
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
When using the Windows Look-and-Feel, JTable renders header
with zero height if the first column has empty title ("").
The following example demonstrates the problem:
import javax.swing.*;
import javax.swing.table.*;
public class SwingHeaderProblem extends JFrame {
static String columnNames[] = {"", "First", "Last"};
SwingHeaderProblem() {
TableModel dataModel = new AbstractTableModel() {
public String getColumnName(int col) {return columnNames[col];}
public int getColumnCount() { return columnNames.length; }
public int getRowCount() { return 8; }
public Object getValueAt(int row, int col) {
switch(col) {
case 0: return "x"; break;
case 1: return "John"; break;
case 2: return "Smith"; break;
default: return null;
}
}
};
JTable table = new JTable(dataModel);
JScrollPane scrollPane = new JScrollPane(table);
getContentPane().add(scrollPane);
}
public void setVisible(boolean b) {
if (!b) System.exit(0);
}
public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch (Exception ex) {
ex.printStackTrace();
System.exit(-1);
}
SwingHeaderProblem w = new SwingHeaderProblem();
w.setSize(300,200);
w.show();
}
}
(Review ID: 130031)
======================================================================
- backported by
-
JDK-2116779 Win L&F: JTable fails to draw header containing empty string under Windows Look-
- Closed
- duplicates
-
JDK-4510857 Some PLAFs display no JTable column headings if the first heading is blank
- Closed
- relates to
-
JDK-6442918 REGRESSION: Empty column headers in JTable are rendered incorrectly
- Resolved
-
JDK-4250173 JTable fails to draw Column Header if first header is assigned an empty string
- Closed