createGraphics does not work properly ?

52 views
Skip to first unread message

Thomas

unread,
Oct 6, 2012, 5:36:40 AM10/6/12
to sea-glass-l...@googlegroups.com
I created an own glasspane which makes a screendump of the underlying window. This screendump is shown as image of the input blocking glasspane. It work for all look and feels exceptionally seaglass.

private void createBackgroundImages()

{
// content image as screenshot (without menu)
bounds = oldContentPane.getBounds();

contentPaneImage = new BufferedImage(bounds.width, bounds.height, BufferedImage.TYPE_INT_RGB);
graphics = contentPaneImage.createGraphics();

oldContentPane.paintAll(graphics);
graphics.dispose();

// background image
bounds = parent.getBounds();

backgroundImage = new BufferedImage(bounds.width, bounds.height, BufferedImage.TYPE_INT_ARGB);
graphics = backgroundImage.createGraphics();

graphics.setColor(backgroundColor);

graphics.fillRect(0, 0, bounds.width, bounds.height);
graphics.dispose();
}

@Override
protected void paintComponent(Graphics g)
{
...
// screendump of underlying window
if (contentPaneImage != null)
{ g.drawImage(contentPaneImage, bounds.x, bounds.y, null);
}

// background
if (backgroundImage != null)
{ g.drawImage(backgroundImage, bounds.x, bounds.y, null);
}

...
}

Configuration:

JAVA 7
Windows 7

seaglass wait.jpg
liquid wait.jpg
Reply all
Reply to author
Forward
0 new messages