• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Combobox in JTable

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranch members,
This is the first mail from me, but I have been following you for a while. I am workin on Bodgitt & Scarper assignment and I am almost done with the programming part. Just as you know it - the forum has been a fantastic place to get inspiration and help.
Now to my question:
I am doing all my configuration in a JTable - (property,value)-pairs - and one of my configuration parameters are what log-level to use (I use Java standard logger and only FINE, WARNING and ERROR). My problem is that I would like this choice to be a non-editable JComboBox residing inside a JTable. I have come so far that I have written my own cell editor:
public class LogCellEditor extends DefaultCellEditor
and I use this from inside my table model:

But when I do this it apparently overrides my isCellEditable(int r, int c) method in my TableModel. In this way I can only choose to have all cells in a column using JComboBox (which was not the intention) or to have only the cell using my JComboBox editable - also not the intention.
Before dropping the idea as a whole I though I would ask all of you - anybody has a good idea?
[Andrew: put the source code between [code] and [/code] UBB tags]
[ May 04, 2004: Message edited by: Andrew Monkhouse ]
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martin,
Welcome to JavaRanch and this forum.
I have edited your post to put the code between [code] and [/code] UBB tags. Doing this ensures that indenting is preserved, which makes the code easier to read.
When you are writing your post, there are a number of buttons just below the edit pane, which will insert the tags for you, so you don't have to remember what they are.
If you would like to edit your original post so that you can see what I have done, you can click on the button that is just above your post.
Sorry I don't have time right now to think of what a possible answer might be - hopefully someone else here will give you some ideas shortly.
Regards, Andrew
 
reply
    Bookmark Topic Watch Topic
  • New Topic