Adblock breaks this site

New Programmer, Little help?

Discussion in 'Programming General' started by Ruski76, Jan 1, 2009.

  1. Ruski76

    Ruski76 Newcomer

    Joined:
    Jan 1, 2009
    Posts:
    4
    Referrals:
    0
    Sythe Gold:
    0
    New Programmer, Little help?

    Im new to java programming. I've established this from a tutorial now how do i actually put this somewhere? Like on a client or console or some kind of window?>_<

    Code:
     import java.applet.*;
     import java.awt.*;
    
     public class risingsun extends Applet {
    
     public void paint(Graphics g)
     {
         g.setColor(Color.blue);
         g.fillRect( 0, 0, 200, 100);
         g.setColor(Color.yellow);
         g.fillOval(25,25,50,50);
         g.fillArc(0,0,100,100,180,10);
         g.fillArc(0,0,100,100,160,10);
         g.fillArc(0,0,100,100,140,10);
         g.fillArc(0,0,100,100,120,10);
         g.fillArc(0,0,100,100,100,10);
         g.fillArc(0,0,100,100,800,10);
         g.fillArc(0,0,100,100,60,10);
         g.fillArc(0,0,100,100,40,10);
         g.fillArc(0,0,100,100,20,10);
         g.fillArc(0,0,100,100,0,10);
         Color ground = new Color(128,64,0);
         g.setColor(ground);
         g.fillRect( 0, 50, 200, 50);
         g.setColor(Color.black);
         g.drawString("Hello Sweden!",70,50);
     }
    
     }
    
     
  2. skyline0114

    skyline0114 Member
    Banned

    Joined:
    Jul 31, 2008
    Posts:
    60
    Referrals:
    0
    Sythe Gold:
    0
    New Programmer, Little help?

    Well from this you would need to make this into either a .java or a .class then use a program to make the .class file into a .Jar (java executable)

    if you need help you can add my msn ([email protected])
     
  3. SuF

    SuF Legend
    Pirate Retired Global Moderator

    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary
    New Programmer, Little help?

    You need the java jdk. Then you need to save it as a .java file and compile it, and then run it using command prompt. You may want to search google for a tut on how to compile and run a java program.
     
  4. Ruski76

    Ruski76 Newcomer

    Joined:
    Jan 1, 2009
    Posts:
    4
    Referrals:
    0
    Sythe Gold:
    0
    New Programmer, Little help?

    I added you through my yim please accept. Add my Yahoo instant messenger its [email protected]. I have to go but ill be back on tommorow. Also if anybody else could help me please add either my yim or my aim which is -mmysql.
     
  5. Zyloch

    Zyloch Member

    Joined:
    Apr 21, 2005
    Posts:
    63
    Referrals:
    0
    Sythe Gold:
    0
    New Programmer, Little help?

    Guys, this is an applet so he would need to first embed inside a HTML file and then view in the browser or with appletviewer.
     
  6. SuF

    SuF Legend
    Pirate Retired Global Moderator

    Joined:
    Jan 21, 2007
    Posts:
    14,212
    Referrals:
    28
    Sythe Gold:
    1,234
    Discord Unique ID:
    203283096668340224
    <3 n4n0 Two Factor Authentication User Community Participant Spam Forum Participant Sythe's 10th Anniversary
    New Programmer, Little help?

    Did not even notice... Well he still needs to compile it. :/
     
  7. Ruski76

    Ruski76 Newcomer

    Joined:
    Jan 1, 2009
    Posts:
    4
    Referrals:
    0
    Sythe Gold:
    0
    New Programmer, Little help?

    Could somebody make me a compiler that would convert it into a .class then which i could use to put in an html file?

    nvm i got it.
     
  8. Wehrmacht

    Wehrmacht Newcomer

    Joined:
    Jan 14, 2009
    Posts:
    24
    Referrals:
    0
    Sythe Gold:
    0
    New Programmer, Little help?

  9. xxelitexx

    xxelitexx Newcomer

    Joined:
    Feb 2, 2009
    Posts:
    21
    Referrals:
    0
    Sythe Gold:
    0
    New Programmer, Little help?

    you dont need to embed this into html...
    you can create a jframe and a jpanel.
     
  10. Benz

    Benz Forum Addict

    Joined:
    Apr 30, 2007
    Posts:
    255
    Referrals:
    0
    Sythe Gold:
    0
    New Programmer, Little help?

    I suggest you fix your naming conventions as well.

    Class names are always capitalized.
     
  11. Swan

    Swan When They Cry...
    Retired Global Moderator

    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner
    New Programmer, Little help?

    They don't have to be, but it is the commonly accepted standard that they are.

    Personally, when writing my classes I will name them depending on how many different words I have to string together (depending on the language), for example:

    class myClass

    Just some habit I started for myself.
     
  12. Benz

    Benz Forum Addict

    Joined:
    Apr 30, 2007
    Posts:
    255
    Referrals:
    0
    Sythe Gold:
    0
    New Programmer, Little help?

    Yeah I know they didn't have to be, though it's always nice to encourage a habit of good conventions.
     
< JavaScript is NOT only a web programming language! | Usfull Tutorial Site >


 
 
Adblock breaks this site