Visual Java/SWING Components Library: Manually set ELTableHeader to ELTable(Read 7410 times)
In a case I need to override the getTooltipText() method in the TableHeader so I manually set my TableHeader class to ELTable like this:

[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']
First Case:
tblOrderData.setTableHeader(new ELTableHeader() {
    @Override
    public String getToolTipText(MouseEvent mouseevent) {
        return "mytooltip";
    }
});

Second Case:
tblOrderData.setTableHeader(new ELTableHeader());
[/div]

At first I wonder it is my overriden method doing something wrong, so I simply new a ELTableHeader for a test.  Both case get me the ClassCastException as below

[div class=\'codetop\']CODE[/div][div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.table.DefaultTableColumnModel
   at com.eltima.components.plaf.basic.BasicELTableHeaderUI.getPreferredSize(Ljavax.sw
ng.JComponent;)Ljava.awt.Dimension;(Unknown Source)
   at javax.swing.JComponent.getPreferredSize(JComponent.java:1615)
   at javax.swing.ViewportLayout.preferredLayoutSize(ViewportLayout.java:78)
   at java.awt.Container.preferredSize(Container.java:1558)
   at java.awt.Container.getPreferredSize(Container.java:1543)
   at javax.swing.JComponent.getPreferredSize(JComponent.java:1617)
   at javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:507)
   at java.awt.Container.preferredSize(Container.java:1558)
   at java.awt.Container.getPreferredSize(Container.java:1543)
   at javax.swing.JComponent.getPreferredSize(JComponent.java:1617)
   at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:911)
   at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:816)
   at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:636)
   at java.awt.Container.preferredSize(Container.java:1558)
   at java.awt.Container.getPreferredSize(Container.java:1543)
   at javax.swing.JComponent.getPreferredSize(JComponent.java:1617)
   at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:911)
   at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:816)
   at java.awt.GridBagLayout.preferredLayoutSize(GridBagLayout.java:636)
   at java.awt.Container.preferredSize(Container.java:1558)
   at java.awt.Container.getPreferredSize(Container.java:1543)
   at javax.swing.JComponent.getPreferredSize(JComponent.java:1617)
   at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:911)
   at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:816)
   at java.awt.GridBagLayout.ArrangeGrid(GridBagLayout.java:1412)
   at java.awt.GridBagLayout.arrangeGrid(GridBagLayout.java:1372)
   at java.awt.GridBagLayout.layoutContainer(GridBagLayout.java:712)
   at java.awt.Container.layout(Container.java:1401)
   at java.awt.Container.doLayout(Container.java:1390)
   at java.awt.Container.validateTree(Container.java:1473)
   at java.awt.Container.validate(Container.java:1448)
[/div]

Please help!!!!!!
« Last Edit: November 21, 2007, 04:08:33 PM by Maria »



Manually set ELTableHeader to ELTable Reply #1 on: July 23, 2007, 09:25:00 AM
In order to avoid the error message you have reported us about I would like to advise you to apply the following settings:

Code: [Select]
tblOrderData.setTableHeader(new ELTableHeader(tblOrderData.getColumnModel()));
« Last Edit: July 23, 2007, 09:25:33 AM by Maria »



 

Sitemap 1 2 3 4 5