Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2003

Tip: Looking for answers? Try searching our database.

JTable and selects

Thread view: 
Rafal Bielec - 21 Dec 2003 21:49 GMT
Hello
I'm having problem with selecting rows in my JTable with mouse clicks. I can
create my own model and renderers for certain types but I don't know where I
can find select operations.
What I'd like to do is:
I click on cell A, it's ready for editing (goes into CellEditor), then I
click on cell B and it instantly goes into the editing mode as well (leaving
cell A not selected of course)
What I have now:
I click on cell A, it's ready for editing, then I click on cell B, cell A
loses it's focus (goes out of the editing mode) and I have to click ONE MORE
TIME to get into B.
I'd like to thank you in advance for any kind of clue with JTable.
R.Bielec
Vincent Vollers - 22 Dec 2003 12:10 GMT
> Hello
> I'm having problem with selecting rows in my JTable with mouse clicks. I can
[quoted text clipped - 10 lines]
> I'd like to thank you in advance for any kind of clue with JTable.
> R.Bielec

I believe this should work:

table.addMouseListener(
   new MouseListener() {
       public void mouseClicked(MouseEvent e) {
           Point p = e.getPoint();
           int row = table.rowAtPoint(p);
           int column = table.columnAtPoint(p);
           if(table.isEditing()) {
               table.removeEditor();
           }
           table.editCellAt(
               row,
               column);
       }
       public void mousePressed(MouseEvent arg0) {}
       public void mouseReleased(MouseEvent arg0) {}
       public void mouseEntered(MouseEvent arg0) {}
       public void mouseExited(MouseEvent arg0) {}
   }
);

Regards,
- Vincent
Rafal Bielec - 24 Dec 2003 17:59 GMT
> Regards,
> - Vincent
THX :]


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.