ahbrahim2's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Active Members
Active Posts:
58 (0.03 per day)
Joined:
21-September 09
Profile Views:
2,907
Last Active:
User is offline Mar 24 2014 07:14 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0

Latest Visitors

Icon   ahbrahim2 has not set their status

Posts I've Made

  1. In Topic: Creating a Clock as an Applet

    Posted 23 Mar 2014

    View Postx68zeppelin80x, on 24 March 2014 - 12:56 AM, said:

    Try using the ClassLoader from your class:
    java.net.URL url = getClass().getClassLoader().getResource("audio/am.au");
    System.out.println(url)
    


    You should see something print out like:

    file:/C:/Users/ahbrahim2/path/to/project/com/exercises/audio/am.au

    No I didn't even try to print the url. also i didn't create an html for .I just want to use the applet viewer.
  2. In Topic: Creating a Clock as an Applet

    Posted 23 Mar 2014

    View PostStrongJoshua, on 24 March 2014 - 12:36 AM, said:

    Make sure the audio folder is in the same folder as your class files. Then, if that's correct, try putting a backwards slash "/" in front of the folder name. I haven't programmed in Java in a while so I don't remember how ClassLoader works, so I don't know if the slash is necessary, but try it anyway.

    All I have to do is to move the audio file in the same directory as thr .class file without any extra"/". Hey Thanks a lot for the adivise.
  3. In Topic: Creating a Clock as an Applet

    Posted 23 Mar 2014

    View Postahbrahim2, on 24 March 2014 - 12:27 AM, said:

    View PostStrongJoshua, on 23 March 2014 - 11:58 PM, said:

    Seeing as the error is pointing to line 20 in the ClockWithAudio class there must be something wrong with the line
    Applet.newAudioClip(this.getClass().getResource("audio/am.au"));
    
    Also, it is a nullPointerException meaning something in that line of code must be null. Since this.class will not likely ever be null it would have to be either the Applet.newAudioClip method or the audio file you are referencing. Since the error message indicates that the code went into the newAudioClip method the only thing left is the resource you are referencing. Make sure that that file is within the correct folder and everything is named exactly as it is supposed to be!
    Hope this helps :)/>/>

    I checked and everything seems to be correct. Where the audio file should be? I have in the exercise folder!Also I've added another "/" eventhough I don't think I need it. but still showing me the same error.
  4. In Topic: Creating a Clock as an Applet

    Posted 23 Mar 2014

    View PostStrongJoshua, on 23 March 2014 - 11:58 PM, said:

    Seeing as the error is pointing to line 20 in the ClockWithAudio class there must be something wrong with the line
    Applet.newAudioClip(this.getClass().getResource("audio/am.au"));
    
    Also, it is a nullPointerException meaning something in that line of code must be null. Since this.class will not likely ever be null it would have to be either the Applet.newAudioClip method or the audio file you are referencing. Since the error message indicates that the code went into the newAudioClip method the only thing left is the resource you are referencing. Make sure that that file is within the correct folder and everything is named exactly as it is supposed to be!
    Hope this helps :)/>

    I checked and everything seems to be correct. Where the audio file should be? I have in the exercise folder!
  5. In Topic: trying to find the area of a triangle

    Posted 29 Nov 2013

    View Postjon.kiparsky, on 30 November 2013 - 05:56 AM, said:

    If you don't call them, it doesn't matter whether they're there or not. You'll only notice the lack of a method if you try to call it. As far as I can see, you're not calling those methods here.

    In general, getters are not necessary - that is, you should only include them if there's a real need for another class to access that particular piece of data. Usually, for simple state of the object, there won't be any such need.

    It's possible that you might want to make the sides of a triangle accessible - if so, I would suggest returning them as an array, rather than as three distinct calls, since it's hard to imagine a case where anyone would need just one side of a triangle. However, you should only add such a method if you actually have a need for it. For example, you might want to allow a GUI component to draw these triangles. One way to do this would be to send their side lengths to some object whose business it is to draw triangles. This would make sense if, for example, you didn't want your triangles to have to worry about the details of rendering. (of course in this case you're relying on the drawing object to make responsible choices about location and orientation - is this reasonable? Maybe it is, maybe it isn't)

    I got the point and thank you very much for taking the time to give me a very informative and helpful details.

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Comments

ahbrahim2 has no profile comments yet. Why not say hello?