how to use swing/awt controls in a window that uses double-buffering?

L

linuxadmin

hello!


i'm using a JFrame with enabled double-buffering. the window itself
owns several JInternalFrames. my problem is that when double-buffering
is enabled, the internal frames are invisible, with an exception that
they flicker for few milliseconds when i move the mouse over their
position.

is it possible to use internal frames or controls at all along with
double-buffering?
if not, what else could be done?


thanks in advice!
 
K

Knute Johnson

hello!


i'm using a JFrame with enabled double-buffering. the window itself
owns several JInternalFrames. my problem is that when double-buffering
is enabled, the internal frames are invisible, with an exception that
they flicker for few milliseconds when i move the mouse over their
position.

is it possible to use internal frames or controls at all along with
double-buffering?
if not, what else could be done?


thanks in advice!

Can you post a simple example that demonstrates your problem?
 
L

linuxadmin

Can you post a simple example that demonstrates your problem?

well, it is a _lot_ of code. i try to reduce the amount:

////////////////////////////////////////////////////////////////
// main window (extends JFrame) c-tor contains:

// ...
// add JInternalFrames to 'this'
// ...

setIgnoreRepaint(true); // skipping this doesn't help
setExtendedState(JFrame.MAXIMIZED_BOTH);
setVisible(true);
validate();

createBufferStrategy(2);
bufferStrategy = getBufferStrategy();

////////////////////////////////////////////////////////////////
// main loop of the rendering thread contains:

g = (Graphics2D) bufferStrategy.getDrawGraphics();

g.clearRect(0, 0, getContentPane().getWidth(),
getContentPane().getHeight());

// ...
// draw lots of BufferedImages using d.drawImage(...)
// ...

bufferStrategy.show();
g.dispose();
++framesRendered;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top