Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
enter image description here
Is it possible to put a button in the table like the attached image?
NatTable is a custom painted table control. Putting real buttons in the table is possible, but actually does not really make sense and could even lead to resource issues in larger tables.
You can actually render anything if you have a corresponding painter. And for a button you of course also need the action binding. NatTable has the ButtonCellPainter to render a cell as a button. But actually the implementation to mimik the button press is a bit outdated IMHO. The corresponding example should give you an idea what you can do and how to do it.
https://git.eclipse.org/c/nattable/org.eclipse.nebula.widgets.nattable.git/tree/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/examples/_102_Configuration/Rendering_cells_as_a_link_and_button.java
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I want to use a JSlider to display my data, and as such I don't want users to be able to move them as then it would no longer display the correct value. At the moment I'm disabling the JSlider so the user can't move the slider, but doing that makes the visibility of the slider really poor.
I would recommend against showing an enabled, but inspirational slider, as it is against typical UI conventions and will likely confuse the users.
Nonetheless, if you really want to do it: The default JSlider is either enabled or not, so you cannot do what you want directly. A workaround would be to have it enabled and add an ActionListener to it. This would be called once the user changes the value. In this ActionListener, you could just reset the value of the slider to its original value, so the slider would snap back. Again, this is very atypical behaviour of UI elements and might confuse users.
In the end, I would suggest coming up with your own component that displays a bar or other slider-like element to visualize your values, but which do not accept any user input.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am using JPopup menu to implement an autocomplete model in java. everything works fine but the problem is when showing a lot of data that could be irritating. How could I implement arrows for up and down and limit the number of items to let's say to 5?
Is there any better approach for autocomplete model?
You essentially want what a JComboBox does. See BasicComboPopup What you would basically do is wrap your popup in a JScrollPane
Check out Darryl's Menu Scroller.
It has a few features you can customize:
the number of items to display
fixed items at the top/bottom
scrolling speed
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm trying to place some images on a JPanel and make them "relocatable" so I can click on one of the images and move to somewhere else on the JPanel while holding the button. It works fine with one image but I just can't come up with a solution for more images than one. I have checked many examples and tried many different ways. If you have any idea please share with me. Thanks!
It works fine with one image but I just can't come up with a solution for more images than one.
You can use the Component Mover. You register the component with the class and then you can move any component.
Or if you don't need the full features of the ComponentMover class you can just use the basic listener for dragging a component.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am developing a web-based POS,
I have a grid of items which can be purchased.
I want to display the name of the chosen Items
in a text area, as they are being selected.
How can I do that? Java Label? HTML Text Area?
I am a bit lost.
Thank You.
Take a look at this tutorial on Oracle's site. Intially you can set the text value in the constructor but as you add items to your transaction, you can use the append() method to add more lines to the textarea.
You could use a JList which will allow you to add items to a list. It will also allow you to customise the way that the content is rendered as well.
Take a look at How to use Lists
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I would like to implement a game board in swing (needs to be a table, though about either jtable or gridlayout etc ...) where I will be able to drag and drop a picture on to this game board and all the cells that the picture fell on will get a notification that they were chosen.
Can anyone help with that? how do I get a couple of cells in a table know that an object was dropped on them?
Have a look at this tutorial.
I think you have to spent some time with Google. I found the following with a little time with Google.
Introduction to DnD
How to drag and drop with Java 2, Part 1
How to drag and drop with Java 2, Part 2
Drag and Drop Effects
Hope this helps :)
Read this and if you have an more specific questions come back and ask them.