netbeans troubles

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Aug 2009
Posts: 13
Reputation: ryno365 is an unknown quantity at this point 
Solved Threads: 0
ryno365 ryno365 is offline Offline
Newbie Poster

netbeans troubles

 
0
  #1
Nov 2nd, 2009
Hello again DW. Tomorrow I have an interview and I'm trying to make a jar of my latest project. Using netbeans, I've created a jar and everything looks fine. I can see all the card IconImages in the Jlabels and it looks fine. But when I repaint the frame, the card images arent repainted. Its like the path is incorrect or something. But when I run the project, the repainting runs fine. Its only in the jar that I'm having this issue. I appreciate any help.

Here is some code:
  1. //---------This code re sets the ImageIcon of the JLabels.
  2. if (comp.equals("pHand1"))
  3. {
  4. try {
  5. pat = getCardImagePath(card);
  6. }
  7. catch(Exception e)
  8. {
  9. System.out.println("Error999: "+e);
  10. }
  11. pHand1.setIcon(new ImageIcon(pat));
  12. }
  13. //............This code is part of getCardImagePath method and gets the path based on param. It returns the path string representing the image path.
  14.  
  15. char sut = card.getSuite();
  16. int nub = card.getNumb();
  17.  
  18. if (sut == 'S')
  19. {
  20. if (nub == 14)
  21. path = "src/poker/resources/spades-a-75.png";
  22. else if (nub == 2)
  23. path = "src/poker/resources/spades-2-75.png";
  24. else if (nub == 3)
  25. path = "src/poker/resources/spades-3-75.png";
  26. else if (nub == 4)
  27. }
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 13
Reputation: ryno365 is an unknown quantity at this point 
Solved Threads: 0
ryno365 ryno365 is offline Offline
Newbie Poster
 
0
  #2
Nov 2nd, 2009
scratch that, I figured it out. I just changed the image paths from "src/poker/resources/spades-a-75.png" to "../src/poker/resources/spades-a-75.png"
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 13
Reputation: ryno365 is an unknown quantity at this point 
Solved Threads: 0
ryno365 ryno365 is offline Offline
Newbie Poster
 
0
  #3
Nov 2nd, 2009
Dangit. I still need help with this. For some reason the image paths work fine if the jar stays in its dist folder. But if moved to another folder (such as desktop) or to another computer, the images still dont show up (I'm guessing due to the file paths).
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 247 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC