private void paintLayer(Layer layer, Graphics2D g, Bounds box) { if (layer.getOpacity() < 1) { g.setComposite( AlphaComposite.getInstance(AlphaComposite.SRC_OVER, (float) layer.getOpacity())); } layer.paint(g, this, box); g.setPaintMode(); }