Original Post
Howdy ya'll. I'm having problems with my JFrame! about half the time it looks fine, but the other half, it either adds the insets to my components twice or not at all. I'd like to pretend that the error's in my logic somewhere, but I've triple checked everything I can! When I wiggle the frame a bit, it works fine 100% of the time, but that'd be a little embarrassing to tell the users to wiggle the frame before they use the program. Perhaps ya'll can help?? An example of my code (bf is the BufferStrategy of my JFrame):
public Graphics newFrame() throws Exception
{
Graphics g = bf.getDrawGraphics();
g.translate(insets.left, insets.top);
g.setColor(Color.BLACK);
g.fillRect(0, 0, FRAME_WIDTH, FRAME_HEIGHT);
return g;
}
public void showFrame(Graphics g) throws Exception
{
g.dispose();
bf.show();
Toolkit.getDefaultToolkit().sync();
}