Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JList item Doble click

 
Allen Bandela
Ranch Hand
Posts: 128
Eclipse IDE MS IE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What could be the possible reason why I am finding two files opened when I click an item in my JList. The code is as follows. It works well the first time . Thereafter I get this problem.

public void mouseClicked(MouseEvent evt) {

list=(JList)evt.getSource();
if(evt.getClickCount()==2) { //Double Click
System.out.println("MOuse clicked double");
// Get item index
int index2=list.locationToIndex(evt.getPoint());
listelement=(String)model.elementAt(index2);
//System.out.println(listelement);
for(int i=0;i<titleCopy.length;i++)
{
if(titleCopy[i]==listelement)
pdffile=URLCopy[i];
}
try{
website=new URL(getDocumentBase(),pdffile);
this.getAppletContext().showDocument( website, "_blank" );// Requests that the browser show the Web page indicated by the URL document
}catch(Exception e)
{
System.out.println("Some exception has occured boy");
}
}
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!