Results 1 to 4 of 4
  1. #1
    verd is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

    Default Multi graphic layers

    Ok, well I'm making a simple 2d game, I'm planning on having a grid map,but this map always repaints with player which causes lag, is there a way of making some sort of layer system.

    Would JPanels or panes work?

  2. #2
    kammce's Avatar
    kammce is offline Senior Member
    Join Date
    Dec 2010
    Location
    California
    Posts
    194
    Rep Power
    4

    Default Re: Multi graphic layers

    Well, what I did when I was using paint for my games, was have objects (usually Jpanels or JLabel) that I painted into. The way to keep everything as a layer is to manipulate the add() function. The first thing you added will be at the bottom and the last thing you added will be at the top.
    My API:
    Java Code:
    cat > a.out || cat > main.class

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,300
    Rep Power
    20

    Default Re: Multi graphic layers

    Quote Originally Posted by kammce View Post
    The first thing you added will be at the bottom and the last thing you added will be at the top.
    No, it's the other way round.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    verd is offline Member
    Join Date
    Jul 2012
    Posts
    17
    Rep Power
    0

Similar Threads

  1. Java Different Layers, Need Help For My Game Loaie.
    By Alerhau in forum New To Java
    Replies: 5
    Last Post: 08-07-2011, 06:50 PM
  2. Layers or composite?
    By trishtren in forum Java 2D
    Replies: 1
    Last Post: 04-07-2011, 08:08 PM
  3. Mouse listening across layers
    By dvreed77 in forum AWT / Swing
    Replies: 1
    Last Post: 02-17-2011, 03:42 PM
  4. questions about events in differents layers
    By Jon_Xel in forum AWT / Swing
    Replies: 10
    Last Post: 07-13-2010, 05:37 AM

Posting Permissions

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