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 / General / November 2005

Tip: Looking for answers? Try searching our database.

JTable combobox editor

Thread view: 
awvvo@hotmail.com - 14 Nov 2005 13:11 GMT
I have a JTable with 17 columns. The last 15 columns contain airport
codes (this is used
for entering a flight schedule). The application uses a list of 5000
airport codes.

When I do:
  column.setCellEditor(new MyComboBoxEditor(airportValues));

for each column it is very slow.

Is it possible to only use 1 combobox and reuse and activate it as a
celleditor when I click on a particular cell?

Can someone give me a hint how to do this?

regards
john
Roedy Green - 14 Nov 2005 14:08 GMT
>Can someone give me a hint how to do this?
You could build a static JComboBox, populate it, and just add/remove
it as needed.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

zero - 14 Nov 2005 18:56 GMT
awvvo@hotmail.com wrote in news:1131973892.061247.56910
@g44g2000cwa.googlegroups.com:

> I have a JTable with 17 columns. The last 15 columns contain airport
> codes (this is used
[quoted text clipped - 13 lines]
> regards
> john

I assume MyComboBoxEditor extends TableCellEditor?

Subclass the JTable and override the TableCellEditor getCellEditor(int
row, int column) method.  Like this:

public class MyJTable extends JTable
{
  private MyComboBoxEditor comboEditor =
     new MyComboBoxEditor(airportValues);

  // ...

  public TableCellEditor getCellEditor(int row, int column)
  {
     if(column > 2)
     {
        // if necessary, change the comboEditor values
        return comboEditor;
     }

     return super.getTableCellEditor(row, column);
  }
}

Customize to suit your needs.

zero


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.