Kodewerx
https://www.kodewerx.org/forum/

basic java output
https://www.kodewerx.org/forum/viewtopic.php?f=5&t=4354
Page 1 of 1

Author:  KingKiller [ Thu Sep 27, 2007 8:14 am ]
Post subject:  basic java output

ok, in computer science, i need to draw a picture using astrics :shock: . anyone have any suggestions of what i should do?

Author:  NEo_Bazz [ Thu Sep 27, 2007 12:21 pm ]
Post subject:  Re: basic java output

Do something like:


Code:
{

    System.out.print("*  *  *  *");
    System.out.println("*  *  *...etc");
    System.out.println("*  *  *.....etc");
    System.......etc.;

}



And just keep going that until your output is some ASCII picture made with just astrics. PS: Just keep modifying the space inbetween each astric until you make a picture.

Author:  dlong [ Fri Sep 28, 2007 10:28 am ]
Post subject:  Re: basic java output

Java sucks. OK, now that we've got that out of the way, "system" needs to be "System"; Java, like most languages, is case-sensitive.

Author:  NEo_Bazz [ Fri Sep 28, 2007 12:17 pm ]
Post subject:  Re: basic java output

Yeah. I couldn't remember if it was upper or lower case. I just guessed lower.
I'll edit+fix it.

Author:  KingKiller [ Sat Oct 27, 2007 7:56 pm ]
Post subject:  Re: basic java output

Code:
//********************************************************************
//  Snowman.java       Author: Lewis/Loftus/Cocking
//
//  Demonstrates basic drawing methods and the use of color.
//********************************************************************

import java.applet.Applet;
import java.awt.*;

public class pumpkin extends Applet
{
   //-----------------------------------------------------------------
   //  Draws a pumpkin.
   //-----------------------------------------------------------------
   public void paint (Graphics g)
   {
      final int MID = 150;
      final int TOP = 50;


      setBackground (Color.black);
      g.setColor (Color.white);
      g.drawString ("It's the great pumpkin," ,100,50);
      g.drawString ("Charlie Brown.",120,70);


      g.setColor (Color.green);
      g.fillRect (0, 175, 300, 50);  // ground

      g.setColor (Color.yellow);
      g.fillArc (10, -10, 80, 80, 80, 200);  // moon
     

      g.setColor (Color.orange);
      g.fillOval (MID-70, TOP+90, 60, 50);      // first pumpkin
      g.fillOval (MID+90, TOP+90, 60, 50);   // third pumpkin
      g.fillOval (MID+0, TOP+90, 80, 60);  // second pumpkin

      g.setColor (Color.darkGray);
      g.fillOval (MID-50, TOP+105, 10, 10);   // 1st pumpkin's left eye
      g.fillOval (MID-40, TOP+105, 10, 10);   // 1st pumpkin's right eye
      g.fillOval (MID+20, TOP+103, 15, 15);   // 2nd pumpkin's left eye
      g.fillOval (MID+45, TOP+103, 15, 15);   // 2nd pumpkin's right eye
      g.fillOval (MID+105, TOP+105, 10, 10);   // 3rd pumpkin's left eye
      g.fillOval (MID+125, TOP+105, 10, 10);   // 3rd pumpkin's right eye
     
      g.setColor (Color.black);
      g.fillArc (MID-50, TOP+120, 20, 10, 190, 160);   // smile
      g.fillArc (MID+110, TOP+120, 20, 10, 190, 160);  // 3rd pumpkin's smile
      g.fillArc (MID+25, TOP+110, 30, 30, 190, 160);   // 2nd pumpkin's smile
     
      g.setColor (new Color(247,223,91));
      g.fillOval (MID-130,TOP+60,50,50);              //head
      g.setColor (Color.black);                       
      g.drawArc  (MID-105,TOP+85,20,10,190,160);      //smile
      g.fillOval (MID-105, TOP+75,5,5);               //left eye
      g.setColor (new Color(191,131,13));
      g.fillArc  (MID-130, TOP+140, 50, 30, 0, 90);   //shoe
      g.setColor (new Color(255,222,32));
      g.fillRect (MID-120, TOP+100, 30, 40);   //Charlie's body
   }
}




that's my code for an applet. is it possible to make the words flashing, and if so, how?

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/