The Artima Developer Community
Sponsored Link

Java Answers Forum
problems with JTable

2 replies on 1 page. Most recent reply: Sep 16, 2003 9:33 AM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

problems with JTable Posted: Sep 15, 2003 11:54 PM
Reply to this message Reply
Advertisement
The JTable I use displays panels with several componets in it to display a spcialized data type.

Now I would like to use f.e. PopUp menus or the ToolTip property for the components.

The problem is, that as long a line is not selected (using left click. right click and setRowSelectionIndex don't work), the included components don't get any event.

Now one might say that I should simply check, over wich component the mouse pointer is.
The problem here is, that the mouse events received by the table are not really useful.
getSource() and getComponent() deliver of course the table, but the mouseposition is relative to the top component, not to the table.
If that is not weird enough, here is another:
the panels and inner components used to display the cells have no useful size (x = 0, width = -195, ...), until the cell is selected.

And for last:
What must I do to reallly select a line without left clicking on it (even right clicking doesn't work)?
If I use setRowSelectionInterval, the line get's selected, but It still doesn't get any Mouse Events, first I have to click on it.
I tried different uses of grabFocus and requestFocus without success.

If anyone can help me with any of the problems, ...


mausam

Posts: 243
Nickname: mausam
Registered: Sep, 2003

Re: problems with JTable Posted: Sep 16, 2003 7:53 AM
Reply to this message Reply
Ok.

So you are using diffrenet panels in different cells.

For this you must be over-riding method getCellEditor or similar method in which you must be creating your panels(components.)

Add tool tip to the components there itself.

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: problems with JTable Posted: Sep 16, 2003 9:33 AM
Reply to this message Reply
Thanx for the answer.

Generating the panels is not the problems.

I wrote my own TableCellRenderer and TableCellEditor class.
getTableCellEditorComponent and getTableCellRendererComponent return the correct panel as a result.

I just noticed something interesting.
(I first wrote a long text, but could hardly read it myself, so here is the short version)

1.) row 2 selected (with left click, setRowSelectionInterval does not activate event handling).
1.1) moving the mouse over row 1: small dot over button[2]
1.2) moving the mouse over row 2: Tooltip over button[2]
1.3) moving the mouse over row 3: small dot over button[3]
1.4) rightclick on a component in row 1: table gets event
1.5) rightclick on a component in row 2: component gets event
1.6) rightclick on a component in line 3: table gets event

the small dot from 1.1 appears on the right relative location to the button, but on the wrong row.

Flat View: This topic has 2 replies on 1 page
Topic: How this is possible? Previous Topic   Next Topic Topic: What's Happening to Artima?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use