• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Java Software Solutions Graphics Example 3.9 noob help

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys
This is my first post, and hope this board is alot more helpful towards new programers then the last one I joined. Apparently something about programing makes people a little rude lol. Anyway Im working on a graphics example listed above and I understand it, but when I run the code the icon gif of the devil doesent show "because I dont have the .gif file for 1" but the question being where would this program be going to find the devil.gif file IE what folder. If some 1 could explain this a little better I think it would help thanks )


also if there is a better way to post code please let me know, I feel bad making huge posts lol
 
lowercase baba
Posts: 13091
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I added code tags to make your source more readable. You can either highlight your java and click the button (just like you want to make it italic or bold), click the button first and paste your code between the tags, or type the tags by hand. the look like this:

[ code=java]
[ /code]

only no space after the open bracket
 
Marshal
Posts: 79969
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

So you think we're helpful? You've fallen into my hands! Mwaaahaaahaahaa!

I see Fred has been at your post and added code tags, and you can see how much better it looks. If you click the code button before writing the code, go left 7 places so your cursor is between the first ] and the second [, where there is no gap. That is by no means a huge post; it fits easily onto my 11 inch screen. I shall move your post, however, because we usually discuss GUIs on another forum.

It works all right for me. I went to GIMP, drew a little devil, which I won't give you because I am embarrassed about its artistic quality (or crappiness), and saved that in a folder created specially for the occasion, called devil. Then I copied your .java file into that, with this one change: public class LabelDemo instead of labelDemo.
So now we have this folder structureThen I compiled it with javac -d . LabelDemo.java and now we have this sort of structure:[Then I ran it with java labelDemo.LabelDemo. And wondered, did he voluntarily choose cyan for the background?

I think you are supposed to use something like getClass().getResource("devil.gif"), which is discussed in a recent thread.
That won't work because you are working in a static context. You ought not to put everything into the main method anyway. It is better to set up a GUI in a constructor or a (private void) method like "initComponents()" or "setUpGUI()".
 
Campbell Ritchie
Marshal
Posts: 79969
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Put your cursor after [code] and before [/code] to gain access to the code tags. Or highlight the code and click the code button afterwards.
And you can show the [ without spaces if you remember its Unicode number is 005b, by writing [code]
 
Bryce Heath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys
Thank you for the quick reply's. I love this board already, as I said had a bad experience with another one I joined after a quick google search " it will remain nameless" and found that even basic noobie questions took days to get a reply, and it was always from the same moderator, who for some one in charge of a forum was very snarky and not at all helpful. That being said glad its behind me lol, thank you for the quick code bracket tutorial I assumed it was something like that, glad to know how it works. I apologize for the miss post also I will try to be more mindful in the future. The example I posted is from the first 4 chapters of the book hence only having a main method, I think they are trying not to be to confusing yet. LOL no I did not choose cyan it was just what they listed in the example love the comment though thank you for the detailed post im going to go over it fully to make sure I understand. Looking forward to posting again, just started the creating your own classes chapter hehe. Thank you again for your help, and have to say that this seems to be a wonderful community here.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bryce Heath wrote:Hey guys
This is my first post, and hope this board is alot more helpful towards new programers then the last one I joined. Apparently something about programing makes people a little rude lol.



Bryce Heath wrote:as I said had a bad experience with another one I joined after a quick google search " it will remain nameless" and found that even basic noobie questions took days to get a reply, and it was always from the same moderator, who for some one in charge of a forum was very snarky and not at all helpful.



16 minutes for a helpful response, actually, and I consider it rude of you to not reply to the response and cross post the question here.
http://www.javaprogrammingforums.com/whats-wrong-my-code/10912-wheres-my-devil.html

Your other two threads on that forum also had very decent responses, by several different members. I don't see any signs of snarkiness on the part of the moderators who responded in your threads. Your response at #7 in this thread could however be considered snarky.
 
Bryce Heath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Darryl
Im sorry that you are upset about how I felt, but I do feel it is my right and was not happy with the comments made. I said my piece, and was respectful in the fact that I dident say any names nor the site itself. Again I am sorry you are upset about how I felt, and hope it wont be a problem for you being apart of this forum instead.
Best wishes
Bryce
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bryce Heath wrote:Hey guys
Thank you for the quick reply's. I love this board already, as I said had a bad experience with another one I joined after a quick google search " it will remain nameless" and found that even basic noobie questions took days to get a reply, and it was always from the same moderator, who for some one in charge of a forum was very snarky and not at all helpful. That being said glad its behind me lol



I don't want to argue here, but I'd like to point out that the three questions you asked in "the other forums" all had answers within 20 minutes (which is even faster than the response time here). If you thought my reply (I assume you're talking about me) was short, it was because you already received the correct answer but were ignoring it. Had you responded with a description of what about the answer you didn't understand instead of simply posting uncompilable code, it would have been much easier to help you.

But oh well. Happy programming.
 
Bryce Heath
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nor I Kevin, and thank you for the well wishes, glad to see that you to are so passionate about this. I guess I could feed in and have a pointless argument, but id rather read my java book. I do hope you guy will be as attentive to my other posts here as you were this one .
Again Best Wishes Bryce
 
"Don't believe every tiny ad you see on the internet. But this one is rock solid." - George Washington
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic