英文:
Options menu for one cell in java table
问题
欢迎
在这个表格中,我将提到的列的单元格设置为可编辑,以便用户可以根据需要设置所需的值...
但是他们告诉我,这一列的值只能取这些值之一:25、50、75、100,所以他们要求我制作一个选项菜单(就像图片中所示),让他们可以直接选择所需的值并快速操作。
那么,请问我该如何解决呢?
(注意:我正在使用Java Swing)
英文:
Welcome
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论