Skip to main content

Strange Error

3 replies [Last post]
Spinnifex
Offline
Joined: 2011-03-29
Points: 0

Hi.

I got some trouble using MutableTreeTableNode class:

</p>
<p>public class SimpleTreeTableNode extends AbstractMutableTreeTableNode {</p>
<p>    private File file;</p>
<p>
    // I pass a File-object to the constructor<br />
    public SimpleTreeTableNode( Object userObject ) {<br />
        super( userObject );<br />
    }</p>
<p>    @Override<br />
    public Object getValueAt( int column ) {<br />
        Object rc = null;<br />
        if( userObject instanceof File ) {<br />
            file = ( File ) userObject;<br />
            switch( column ) {<br />
                case 0 : rc = file.getName(); break;<br />
                case 1 : rc = file.length(); break;<br />
                case 2 : rc = file.exists(); break;<br />
                case 3 : rc = file.lastModified(); break;<br />
            }</p>
<p>        }</p>
<p>
        return rc;<br />
    }</p>
<p>    @Override<br />
    public int getColumnCount() {<br />
        return 4;<br />
    }</p>
<p>}</p>
<p>

I create a root node and add some childs...

After some seconds I get this error

Sometimes I get this error :

</p>
<p>Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: column must be valid, was-1<br />
    at org.jdesktop.swingx.JXTreeTable.isHierarchical(JXTreeTable.java:2022)<br />
    at org.jdesktop.swingx.JXTreeTable.getToolTipText(JXTreeTable.java:1459)<br />
    at javax.swing.ToolTipManager$insideTimerAction.actionPerformed(ToolTipManager.java:662)<br />
    at javax.swing.Timer.fireActionPerformed(Timer.java:271)<br />
    at javax.swing.Timer$DoPostEvent.run(Timer.java:201)<br />
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)</p>
<p>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kschaefe
Offline
Joined: 2006-06-08
Points: 0

I bet we're not taking into consideration that fact that JTable gives the tool tip column value -1 when the cursor is outside the bounds of the table cells.

Was this the case?

Karl

Spinnifex
Offline
Joined: 2011-03-29
Points: 0

Re Karl,

I guess it was. Unfortunately I could not reproduce this bug.

Strange was, that this happens without the creation of a JXTreeTable. I only add some nodes to my subclass of

AbstractTreeTableNode...

Spinnifex

Spinnifex
Offline
Joined: 2011-03-29
Points: 0

Sorry for the html-tags...

How can you put code as code should be formatted?
I used the [code] tags...

Regards,

Spinnifex