-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
1.4.2
-
Fix Understood
-
x86
-
windows_xp
Name: gm110360 Date: 04/15/2004
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
After a JTable has been added to a JScrollPane calling JScrollPane.setColumnHeaderView no longer does anything.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create JScrollPane
set ViewportView to JTable (by doing this the JTable adds its TableHeader to the ColumnHeaderView of the JScrollPane)
call JScrollPane.setColumnHeaderView passing in a new component
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The column header view of the JScrollPane should be set to the new component.
ACTUAL -
The column header view is still the TableHeader that was set when adding the JTable.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
^Cimport javax.swing.*;
import java.awt.*;
public class TestHeaderCrap {
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame();
final Container contentPane = frame.getContentPane();
contentPane.setLayout(new BorderLayout());
JScrollPane mainScrollPane = new JScrollPane(new JTable(10, 10));
mainScrollPane.setColumnHeaderView(new JLabel("test"));
contentPane.add(mainScrollPane, BorderLayout.CENTER);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You can overide JTable to not add the TableHeader to the ScrollPane but this is not a valid solution when writing a custom component which takes in a JTable since you can't override it.
(Incident Review ID: 193201)
======================================================================
FULL PRODUCT VERSION :
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
After a JTable has been added to a JScrollPane calling JScrollPane.setColumnHeaderView no longer does anything.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create JScrollPane
set ViewportView to JTable (by doing this the JTable adds its TableHeader to the ColumnHeaderView of the JScrollPane)
call JScrollPane.setColumnHeaderView passing in a new component
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The column header view of the JScrollPane should be set to the new component.
ACTUAL -
The column header view is still the TableHeader that was set when adding the JTable.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
^Cimport javax.swing.*;
import java.awt.*;
public class TestHeaderCrap {
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame();
final Container contentPane = frame.getContentPane();
contentPane.setLayout(new BorderLayout());
JScrollPane mainScrollPane = new JScrollPane(new JTable(10, 10));
mainScrollPane.setColumnHeaderView(new JLabel("test"));
contentPane.add(mainScrollPane, BorderLayout.CENTER);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You can overide JTable to not add the TableHeader to the ScrollPane but this is not a valid solution when writing a custom component which takes in a JTable since you can't override it.
(Incident Review ID: 193201)
======================================================================
- relates to
-
JDK-5043625 LightWeight JPopupMenu does not size correctly if a JTable is part of the popup
-
- Open
-