在Java表格中的单元格的选项菜单

huangapple go评论72阅读模式
英文:

Options menu for one cell in java table

问题

欢迎

在这个表格中,我将提到的列的单元格设置为可编辑,以便用户可以根据需要设置所需的值...
但是他们告诉我,这一列的值只能取这些值之一:25、50、75、100,所以他们要求我制作一个选项菜单(就像图片中所示),让他们可以直接选择所需的值并快速操作。
那么,请问我该如何解决呢?
(注意:我正在使用Java Swing)

英文:

Welcome

在Java表格中的单元格的选项菜单

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)

答案1

得分: 0

这不是相同的问题,但你可以查看下面问题中的解决方案:

https://stackoverflow.com/questions/766956/how-do-i-create-a-right-click-context-menu-in-java-swing

你应该创建这样的监听器,并将其添加到你的单元格/表格中。
你可以查看下面的问题,了解如何向你的单元格添加监听器(这并不明显:/)
https://stackoverflow.com/questions/12376826/jtable-cell-listener

英文:

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

https://stackoverflow.com/questions/766956/how-do-i-create-a-right-click-context-menu-in-java-swing

you should create such listener, and add it to your Cell / Table.<br>
you can take a look on below question to understand how to add listener to your Cell (it's not obvious :/)
https://stackoverflow.com/questions/12376826/jtable-cell-listener

huangapple
  • 本文由 发表于 2020年10月11日 22:30:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/64305151.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定