|
Thanks for your quick reply.
Will you be more specific on checking the value?
As I'm selecting the value from Jlist that is showing thumbnails.
I'm not getting the exact way for selecting next item.
|
|
|
|
|
"TorstenH" want to say you that you have to check the "index" value before using it to set the selected item. You should check "index" value whether it is in the range of your image list size.
Regards
Shubhashish
|
|
|
|
|
Well I did this.
The only problem was SwingUtlities.InvokeLater().
|
|
|
|
|
That's a function, not a problem.
The problem would be that you tried to update the GUI while you where using it.
SwingUtilities.InvokeLater()[^] would cause the Thread to wait and update the GUI when possible.
|
|
|
|
|
How can I perform arrow key event for a GUI in my Java Program?
Thanks!
|
|
|
|
|
|
|
Thanks, all I did was go to the 'K' section in the documentation index.
Use the best guess
|
|
|
|
|
Thanks for your suggestions..
My problem is I want to change the item in a Jlist Programmatically.
That's why I wanted to use this but Robot(AWT key Press Event)not working.
My code is:
listener = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
Object o = imageList.getSelectedValue();
if (o instanceof BufferedImage) {
imageView.setIcon(new ImageIcon((BufferedImage)o));
}
}
}
imageList.addListSelectionListener(listener);
Well the code is working fine but I want to change the next image using a button or something else
How can I do this?
Please help me in this?
|
|
|
|
|
Sorry, I don't understand the problem. Maybe you need to look at some of the GUI tutorials[^].
Use the best guess
|
|
|
|
|
As "Rechard" suggest, add KeyListener to your imageList and put your logic on KeyPress event to move the next item on the list on up/down arrow key.
Regards
Shubhashish
|
|
|
|
|
Read the tutorial.
and maybe make a little "Area51"-project where you try and test things aside from normal coding.
|
|
|
|
|
Thanks for your suggestions!!!
If I'm not concerning in my project then the main task of mine is to change the
item in a list on an event(Button or String Pass).
...I can do it on press of right key so I thought to read the right key programmatically.
I think you can understand what I want to say..
Thanks!
|
|
|
|
|
Indian Coder1989 wrote: I thought to read the right key programmatically. Yes, and you do this with a KeyListener, as we have said.
Use the best guess
|
|
|
|
|
KeyListener + passing the focus properly:
@Override
public void keyTyped(KeyEvent ke) {
if(ke.getKeyChar() == KeyEvent.VK_LEFT){
}else if(ke.getKeyChar() == KeyEvent.VK_RIGHT){
}
}
@Override
public void keyPressed(KeyEvent e) {
keyTyped(e);
}
also by input mapping:
private void inputMap(){
this.getInputMap().put(KeyStroke.getKeyStroke(
KeyEvent.VK_LEFT, 0), "left");
this.getActionMap().put("left", new AbstractAction() {
@Override
public void actionPerformed(ActionEvent ae) {
}
});
}
|
|
|
|
|
any body knows something about visual midlet?
|
|
|
|
|
|
Hi
How i can use bluetooth in j2me?
i want to connect another device with mobile by bluetooth.
|
|
|
|
|
Hello,
You may want to read following tutorials available on oracle site.
Regards,
Prasad P. Khandekar
Knowledge exists, man only discovers it.
|
|
|
|
|
is it possible to create a fake wifi connection for Android(Something like FakeGPS)?
modified 8-May-13 13:42pm.
|
|
|
|
|
I would suspect it is possible and also rather difficult to do.
|
|
|
|
|
I managed to create a mockup for unit testing.. but I need a dedicated app
|
|
|
|
|
hi i am using netbeans 7.2.1 for my java development . Recently i found that i cant compile the java programs. The compiler shows that "error could not find or load main class". So please help me to solve this problem
|
|
|
|
|
This is a common error. Its told you that classes ,you have used in your application, not in project classpath. So make sure that you have add the location of your .class file to your classpath.
Regards
Shubhashish
|
|
|
|
|
You are trying to run a program that has the wrong class name or no class with a public static void main(String [] args) method.
Use the best guess
|
|
|
|