Page 5 of 5 FirstFirst ... 345
Results 81 to 85 of 85
Like Tree1Likes

Thread: i want write 2d java game

  1. #81
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,255
    Rep Power
    25

    Default Re: i want write 2d java game

    If you can remove lines of code that cause errors and still have the program do what you want,
    then that should work.

  2. #82
    Join Date
    Oct 2011
    Posts
    50
    Rep Power
    0

    Default Re: i want write 2d java game

    i skip that part. i want show score on screen. how do i do that?

  3. #83
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,255
    Rep Power
    25

    Default Re: i want write 2d java game

    Add some JLabels and set their text.
    Add some code to the paint method and use drawString.

  4. #84
    Join Date
    Oct 2011
    Posts
    50
    Rep Power
    0

    Default Re: i want write 2d java game

    i write this, but not print anything

    Java Code:
    string=Integer.toString(s);
            
            g.drawString(string, 0, 0);
    i try this also,

    Java Code:
    JLabel label = new JLabel();
        	label.setBounds(0, 0, 50, 100);
        	label.setText(score);
        	add(label);
    can i change color of the text?
    Last edited by captain_turkiye; 12-14-2011 at 07:49 PM.

  5. #85
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,255
    Rep Power
    25

    Default Re: i want write 2d java game

    Call the Graphics class's setColor method before calling the drawString method.

    Try changing the x,y locations to many different values until you see where it is drawing the String.

Page 5 of 5 FirstFirst ... 345

Similar Threads

  1. Replies: 7
    Last Post: 11-30-2011, 06:58 PM
  2. trying to write a program for hangman word game
    By durdanto in forum New To Java
    Replies: 1
    Last Post: 02-12-2011, 02:53 AM
  3. How to write it in Java
    By agajantorayev in forum New To Java
    Replies: 8
    Last Post: 08-11-2010, 07:37 AM
  4. how to write except in java??
    By napi1234 in forum New To Java
    Replies: 1
    Last Post: 08-09-2010, 04:49 AM
  5. How do i write this in java...?
    By johnny7white in forum New To Java
    Replies: 1
    Last Post: 11-28-2007, 07:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •