tags:

views:

74

answers:

1

Hey Guys,

I have made one project in java. Now in this particular module, i am showing the user , so i am showing them a stock inventory.

Now for doing this.

As you will see in the screen shot [ i have put screenshot so you can understand well ].
To show the images , i have made one table and i have put labels in that and then i am setting the icon at the label.

Now as soon as user click on the any image, then that image i put on big label.
But this works perfect on mouse click but client want that , if user navigate the by keyboard arrow keys then in same should be happen.

Means : User navigate by key board then it should reflect on that table [user should know that which is currently seleted ] and then as soon as the user navigate by key board arrow events and then click enter then that image should reflect on big label.

Here is the Link for that screenshot.

A: 

Sounds like there are two steps in what you need to do.

First, the user needs to know which image is selected. Unfortunately I can't help you with that, since I don't know how you're displaying that grid. From a UI point of view, I'd suggest exploiting that white border you've got in each cell -- change it black, blue, or whatever color you like to indicate that it's the selected cell. You seem to be using a JTable, in which case you can write a TableCellRenderer (probably by extending DefaultTableCellRenderer) and call its setBackground() method.

Then you need to listen for keyboard input. This part shouldn't be too bad; write a KeyListener and add it to the JTable itself. For each key event, see if the key code matches the arrow keys; if so, move your cursor around accordingly. Don't forget to watch out for the edges of the JTable.

Etaoin
I have to put only cell selection enabled. and bcz of i had written such a code that i don't require that key listener class.i am trying on that table cell renderer... i will do that...thanks 4 ur replay....
Nitz