Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2011
    Posts
    3
    Rep Power
    0

    Default Giant Piece of Code and want it somewhere else.

    I have a giant piece of code that is a bunch of graphics and I want to put it in another class and then call it from their in the class that will run the applet I'm making so it can be more readable. Here is the code I want to put away:

    Java Code:
    g.setColor(biege_color);
    		g.fillRect((x2 - 75), (y2 + 200), (width2 - 50), (height2 - 25));
    		g.fillRect((x2 -25), (y2 + 225), (width2 - 75), (height2 - 75));
    		
    		g.setColor(soggy_green);
    		g.fillRect((x2 - 25), (y2 + 200), (width2 - 75), (height2 - 75));
    		
    		g.setColor(Color.red);
    		g.fillRect((x2 - 25), (y2 + 250), (width2 - 75), (height2 - 50));
    This is just a piece of it since I believe it's too long and I just want to place it somewhere else and to be called so it can show up in the applet, I've tried a few things but they didn't work.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,696
    Rep Power
    8

    Default Re: Giant Piece of Code and want it somewhere else.

    You're going to have to be a little more specific than that. What have you tried? How didn't it work? Your best bet is to create an SSCCE that demonstrates where you're stuck.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Need help with a piece of code
    By sneeak in forum New To Java
    Replies: 13
    Last Post: 08-24-2011, 10:51 AM
  2. Can someone clarify this piece of code for me.
    By DavidPynes in forum New To Java
    Replies: 2
    Last Post: 04-17-2011, 10:22 AM
  3. Code to check if a piece of code is legal.
    By vahshir in forum New To Java
    Replies: 3
    Last Post: 08-30-2010, 04:21 AM
  4. small piece of code: cannot set a max
    By senca in forum New To Java
    Replies: 1
    Last Post: 03-06-2010, 08:26 PM
  5. Decode this piece of Code
    By mikeyl62 in forum New To Java
    Replies: 2
    Last Post: 02-27-2010, 08:59 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
  •