Problem with the location of a popup
Hi, was hoping someone could help me with this one cause it's got me stumped at the moment.
The current situation is that I have a JXTreeTable containing data, when you double click on a cell a pop-up appears, relative to the cell you clicked on containing a table with extra data.
When I click on a cell in the first row of the TreeTable the popup appears in the correct place without a problem. However if i click on a cell in one of the rows which are subcategories of the first row, ie further down the tree structure then the popup appears in a random location.
The code for setting the position of the popup is identical for both popups, as is the way I obtain the initial point. I've included the code snippets below. I used a debugger to step through the process and track what values are beign used for the x and y co-ordinates of the popup and they're not hugely dissimillar, but they're producing major differences in location.
I haven't got a Runnable Example at the minute as the tree table as whole is quite complex, but I will see if I can cobble one together. The code snippets are below. Any help or suggestions would be greatfully recieved.
Getting the location of the mouse event, and thus the cell clicked on.
Point p = me.getPoint();
int col = this.columnAtPoint(p);
int row = this.rowAtPoint(p);
the call to either popup:
alarmPopup.show(area, headerDate, p.x, p.y);
The code which shows the popup:
Dimension s = Toolkit.getDefaultToolkit().getScreenSize();
this.revalidate();
Dimension pf = this.getPreferredSize();
if (x + pf.width > s.width){
x -= (x + pf.width) - s.width;
}
if (y + pf.height > s.height){
y -= (y + pf.height) - s.height;
}
currentPopup = factory.getPopup(owner, AlarmPopup.this, x, y);
currentPopup.show();
Thanks again

