gnahzkook
gnahzkook

Reputation: 1

How to move up/down an item in a table

Following is an UI: enter image description here

There is an Up button and a down button in the UI, when clicking the Up/down button, the selected item(e.g. lib/logger.jar) in the left table(I assume it is a table, because I will create a table to show the items in my Application) will be moved up/down.

Question: How to add function to the Up/Down button, so the item in the table will be moved after clicking the Up/Down button?

BTW, I am using Java SWT/JFace.

Upvotes: 2

Views: 1886

Answers (1)

Mario Marinato
Mario Marinato

Reputation: 4617

If it is a table, you will work with TableItems. To move a TableItem, you have to dispose the one you want to move and create a new one using the constructor that receives an index as one of its arguments. This index is where the new TableItem will be placed.

Upvotes: 1

Related Questions