Click here to Skip to main content
15,887,135 members
Home / Discussions / Java
   

Java

 
GeneralRe: Server Socket is closed on client closed Pin
Sachin k Rajput 22-May-13 2:10
Sachin k Rajput 22-May-13 2:10 
Questiontomcat and eclipse Pin
prithaa20-May-13 0:50
prithaa20-May-13 0:50 
AnswerRe: tomcat and eclipse Pin
Prasad Khandekar21-May-13 4:31
professionalPrasad Khandekar21-May-13 4:31 
QuestionWindows Media Player Pin
MAYNUL18-May-13 10:28
MAYNUL18-May-13 10:28 
AnswerRe: Windows Media Player Pin
Richard MacCutchan18-May-13 21:20
mveRichard MacCutchan18-May-13 21:20 
Questionanalysing utterances Pin
HopePerson14-May-13 18:09
HopePerson14-May-13 18:09 
QuestionRe: analysing utterances Pin
Richard MacCutchan14-May-13 21:26
mveRichard MacCutchan14-May-13 21:26 
QuestionJList is returning null value Pin
Sachin k Rajput 13-May-13 20:15
Sachin k Rajput 13-May-13 20:15 
I'm showing or selecting images from a list.
My code for listselectionlistener is:
Java
listener = new ListSelectionListener() {

           @Override
           public void valueChanged(ListSelectionEvent e) {

         index = imageList.getSelectedIndex();
           imageList.setSelectedIndex(index);
                 o = imageList.getSelectedValue();
               if (o instanceof BufferedImage) {
                   imageView.setIcon(new ImageIcon((BufferedImage)o));

           }

           }

       };

      imageList.addListSelectionListener(listener);


to get next item in JList (imageList) I'm coding like this:
Java
public void nextimage() 
      {
         index ++;
 
imageList.addListSelectionListener(listener);

       imageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 
       imageList.setSelectedIndex(index); -----here is error: Null Pointer Exception

}

I initialize index as int index=0;

Program in starting returning right value but after 4 or 5 images it's not working.
How can I change the Item in this list?
Please suggest your opinions.
AnswerRe: JList is returning null value Pin
TorstenH.13-May-13 21:36
TorstenH.13-May-13 21:36 
GeneralRe: JList is returning null value Pin
Sachin k Rajput 13-May-13 21:44
Sachin k Rajput 13-May-13 21:44 
GeneralRe: JList is returning null value Pin
Shubhashish_Mandal14-May-13 3:24
professionalShubhashish_Mandal14-May-13 3:24 
GeneralRe: JList is returning null value Pin
Sachin k Rajput 14-May-13 18:09
Sachin k Rajput 14-May-13 18:09 
GeneralRe: JList is returning null value Pin
TorstenH.15-May-13 20:26
TorstenH.15-May-13 20:26 
QuestionPerform -> key press Event on GUI programmatically Pin
Sachin k Rajput 12-May-13 20:10
Sachin k Rajput 12-May-13 20:10 
AnswerRe: Perform -> key press Event on GUI programmatically Pin
Richard MacCutchan12-May-13 21:20
mveRichard MacCutchan12-May-13 21:20 
GeneralRe: Perform -> key press Event on GUI programmatically Pin
TorstenH.12-May-13 22:40
TorstenH.12-May-13 22:40 
GeneralRe: Perform -> key press Event on GUI programmatically Pin
Richard MacCutchan12-May-13 23:07
mveRichard MacCutchan12-May-13 23:07 
GeneralRe: Perform -> key press Event on GUI programmatically Pin
Sachin k Rajput 13-May-13 0:50
Sachin k Rajput 13-May-13 0:50 
GeneralRe: Perform -> key press Event on GUI programmatically Pin
Richard MacCutchan13-May-13 1:07
mveRichard MacCutchan13-May-13 1:07 
GeneralRe: Perform -> key press Event on GUI programmatically Pin
Shubhashish_Mandal13-May-13 1:37
professionalShubhashish_Mandal13-May-13 1:37 
GeneralRe: Perform -> key press Event on GUI programmatically Pin
TorstenH.13-May-13 1:52
TorstenH.13-May-13 1:52 
GeneralRe: Perform -> key press Event on GUI programmatically Pin
Sachin k Rajput 13-May-13 2:09
Sachin k Rajput 13-May-13 2:09 
GeneralRe: Perform -> key press Event on GUI programmatically Pin
Richard MacCutchan13-May-13 2:41
mveRichard MacCutchan13-May-13 2:41 
AnswerRe: Perform -> key press Event on GUI programmatically Pin
MarlBermudoNights3-Jul-13 22:52
professionalMarlBermudoNights3-Jul-13 22:52 
Questionj2me Pin
Member 100379738-May-13 9:50
Member 100379738-May-13 9:50 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.