944,087 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Marked Solved
  • Views: 377
  • Java RSS
Nov 2nd, 2009
0

netbeans troubles

Expand Post »
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:
Java Syntax (Toggle Plain Text)
  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. }
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ryno365 is offline Offline
13 posts
since Aug 2009
Nov 2nd, 2009
0
Re: netbeans troubles
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"
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ryno365 is offline Offline
13 posts
since Aug 2009
Nov 2nd, 2009
0
Re: netbeans troubles
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).
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ryno365 is offline Offline
13 posts
since Aug 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Anonymous class
Next Thread in Java Forum Timeline: Error: Missing Return Statement





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC