Results 1 to 3 of 3
  1. #1
    hvince95 is offline Member
    Join Date
    Jan 2012
    Adelaide, Australia
    Rep Power

    Default JPanel paintComponent, OS differences

    I've been making a simple tileGame (on windows vista), which paints 2400 pictured tiles on-screen at any given time (using bufferstrategy as is default with swing component). This all runs just dandy on my windows computer, from within eclipse, and when I export it as a runnable JAR.

    My brother uses a mac computer to code java, also using eclipse. When I send him the exact same code and he runs it, it seems to lag with some unpainted white strips whenever the player moves (the background moves, not the player). Why is this???

    I thought that maybe on mac bufferstrategy does not work, as this is how it used to run (on windows) before implementing swing and bufferstrategy (some tiles are being painted before others?, creating the thin unpainted strips?).

    Thanks for the help anyways!

  2. #2
    santa's Avatar
    santa is offline Senior Member
    Join Date
    Nov 2009
    Rep Power

    Default Re: JPanel paintComponent, OS differences

    Hard to say ... set the background color of the component that you are painting to another color ... if the stripes then change colors you have failed in the paintcomponent method. Also what do you mean by 2400 tiles on the screen ? Do you paint all of them? Then you will have memory problems.

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Rep Power

    Default Re: JPanel paintComponent, OS differences

    Swing is double buffered by default. There is no need to implement your own buffer strategy.

Similar Threads

  1. Replies: 5
    Last Post: 10-02-2011, 02:55 AM
  2. Boosting differences
    By belsen in forum Lucene
    Replies: 0
    Last Post: 11-24-2010, 09:26 AM
  3. JPanel PaintComponent
    By capiono in forum AWT / Swing
    Replies: 5
    Last Post: 10-31-2010, 02:36 AM
  4. paint vs paintComponent for a JPanel
    By lightstream in forum AWT / Swing
    Replies: 4
    Last Post: 01-29-2009, 02:26 AM
  5. differences: AWT and Swing
    By baltimore in forum AWT / Swing
    Replies: 1
    Last Post: 08-06-2007, 09:01 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