Click here to Skip to main content
       

Java

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
AnswerRe: JList is returning null valuememberTorstenH.13 May '13 - 21:36 
You need to check if the JList does contain so much values.
 
You're not coding safe. You need to take more care.
You can never expect a value to be there as you need it - always check if the value is valid before you use it!
regards Torsten
When I'm not working

GeneralRe: JList is returning null valuememberIndian Coder198913 May '13 - 21:44 
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.Confused | :confused:
GeneralRe: JList is returning null valuememberShubhashish_Mandal14 May '13 - 3:24 
"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

GeneralRe: JList is returning null valuememberIndian Coder198914 May '13 - 18:09 
Well I did this.
The only problem was SwingUtlities.InvokeLater().
GeneralRe: JList is returning null valuememberTorstenH.15 May '13 - 20:26 
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.
regards Torsten
When I'm not working

QuestionPerform -> key press Event on GUI programmaticallymemberIndian Coder198912 May '13 - 20:10 
How can I perform arrow key event for a GUI in my Java Program?
 
Thanks!
AnswerRe: Perform -> key press Event on GUI programmaticallymvpRichard MacCutchan12 May '13 - 21:20 
Use a KeyListener[^].
Use the best guess

GeneralRe: Perform -> key press Event on GUI programmaticallymemberTorstenH.12 May '13 - 22:40 
+5 - This is how to get this done[^]
regards Torsten
When I'm not working

GeneralRe: Perform -> key press Event on GUI programmaticallymvpRichard MacCutchan12 May '13 - 23:07 
Thanks, all I did was go to the 'K' section in the documentation index. Shucks | :->
Use the best guess

GeneralRe: Perform -> key press Event on GUI programmaticallymemberIndian Coder198913 May '13 - 0:50 
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?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid