Ajinkya Jumbad
Member
String a = (String)cb1.getSelectedItem();
String pokedexno = a;
pokedexno = pokedexno.replaceAll("[^\\d]", "");
pokemonimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/"+pokedexno+".png")));
//type1.setIcon(new javax.swing.ImageIcon(getClass().getResource("C:/Program Files/Pokemon Online/Themes/Classic/types/type4.png")));
String trial1 = "";
Scanner x = null;
try{
x = new Scanner(new File("C:/Program Files/Pokemon Online/db/pokes/5G/type1.txt"));
}
catch(Exception e){
System.out.println("Could not find File - Error reading file : type1.txt");
}
while(x.hasNext()){
String trial = x.next();
String trial2 = x.next();
String pokedexno1 = pokedexno + ":0";
if(trial.equals(pokedexno1))
trial1 = trial2;
else
;
String trial4 = "type"+trial1;
type1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Type1Images/"+trial4+".png")));
}
the problem is javax.swing.ImageIcon(getClass().getResource("/Type1Images/"+trial4+".png"))); does not work
but pokemonimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/"+pokedexno+".png")));
works. can u help me slove my prob ?
String pokedexno = a;
pokedexno = pokedexno.replaceAll("[^\\d]", "");
pokemonimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/"+pokedexno+".png")));
//type1.setIcon(new javax.swing.ImageIcon(getClass().getResource("C:/Program Files/Pokemon Online/Themes/Classic/types/type4.png")));
String trial1 = "";
Scanner x = null;
try{
x = new Scanner(new File("C:/Program Files/Pokemon Online/db/pokes/5G/type1.txt"));
}
catch(Exception e){
System.out.println("Could not find File - Error reading file : type1.txt");
}
while(x.hasNext()){
String trial = x.next();
String trial2 = x.next();
String pokedexno1 = pokedexno + ":0";
if(trial.equals(pokedexno1))
trial1 = trial2;
else
;
String trial4 = "type"+trial1;
type1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Type1Images/"+trial4+".png")));
}
the problem is javax.swing.ImageIcon(getClass().getResource("/Type1Images/"+trial4+".png"))); does not work
but pokemonimage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Images/"+pokedexno+".png")));
works. can u help me slove my prob ?