Search code examples
javaswingmenujtablecell

Options menu for one cell in java table


Welcome

https://i.sstatic.net/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)


Solution

  • 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?