Results 1 to 4 of 4

Thread: Class with graphics

  1. #1

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Class with graphics

    When I use a textfield class, I declare an object and then I add it to the form and I can interact with it. I wanted to make a dice class (click and get a new random number). But how would I go about the drawing part? All the graphics/drawing I've come accross so far is on a JFrame (and the void paint method). Also do I need anything else special to be able to add it to a JFrame and interact with the class?

    Hope this makes sense

    Thanks


    Has someone helped you? Then you can Rate their helpful post.

  2. #2

    Thread Starter
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: Class with graphics

    Well, I got pointed towards awt. I guess I have a lot of searching to do... Another idea someone had was to inherit another class (like textfield or something) and alter that...

    Any thoughts on this?


    Has someone helped you? Then you can Rate their helpful post.

  3. #3
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: Class with graphics

    java.awt.Graphics. Just turn the number into a String and use g.drawString(String s, int x, int y)

  4. #4
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: Class with graphics

    I always like created a differernt class for the drawing that extends Canvas. I liked the split functionality, and it makes it easier for the painting because sometimes it can get messy in the same class.

Posting Permissions

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



Click Here to Expand Forum to Full Width