0

Welcome

https://i.stack.imgur.com/CV6Ko.png

In this table, I made the column mentioned cells editable to let the users make the needed value as they want ... But they told me the values of this column can take just one of the values: 25,50,75,100, so, they asked me I make an options menu (like it is mention in the pic) allow them to choose directly the needed value and working fast. So, how can I solve it, please! (note: I'm working with java swing)

camickr
  • 321,443
  • 19
  • 166
  • 288
يونس
  • 37
  • 4
  • You would use a combo box as the editor for the cell. Read the section from the Swing tutorial on [Using a Combo Box as an Editor](https://docs.oracle.com/javase/tutorial/uiswing/components/table.html#combobox) for more information and working examples. – camickr Oct 11 '20 at 14:51

1 Answers1

0

It's not the same question, but you can take a look on solution from below question:

How do I create a right click context menu in Java Swing?

you should create such listener, and add it to your Cell / Table.
you can take a look on below question to understand how to add listener to your Cell (it's not obvious :/) JTable cell listener?

Adir Dayan
  • 1,308
  • 13
  • 21