protected void paintComponentPatch(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); try { if (isPaintingBackground()) { g2.setColor(getBackground()); g2.fillRect(0, 0, getWidth(), getHeight()); } if (getBackgroundPainter() != null) { getBackgroundPainter().paint(g2, this, getWidth(), getHeight()); } fakeTransparent = true; getUI().update(g2, this); } finally { g2.dispose(); fakeTransparent = false; } }
protected void paintComponentPatch(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); try { if (isPaintingBackground()) { g2.setColor(getBackground()); g2.fillRect(0, 0, getWidth(), getHeight()); } if (getBackgroundPainter() != null) { getBackgroundPainter().paint(g2, this, getWidth(), getHeight()); } fakeTransparent = true; getUI().update(g2, this); } finally { g2.dispose(); fakeTransparent = false; } }
/** * Overridden to provide Painter support. It will call backgroundPainter.paint() * if it is not null, else it will call super.paintComponent(). */ @Override protected void paintComponent(Graphics g) { if(backgroundPainter != null) { if (isOpaque()) super.paintComponent(g); Graphics2D g2 = (Graphics2D)g.create(); try { // account for the insets if(isPaintBorderInsets()) { backgroundPainter.paint(g2, this, this.getWidth(), this.getHeight()); } else { Insets ins = this.getInsets(); g2.translate(ins.left, ins.top); backgroundPainter.paint(g2, this, this.getWidth() - ins.left - ins.right, this.getHeight() - ins.top - ins.bottom); } } finally { g2.dispose(); } } else { super.paintComponent(g); } }
protected void paintComponentPatch(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); try { if (isPaintingBackground()) { g2.setColor(getBackground()); g2.fillRect(0, 0, getWidth(), getHeight()); } if (getBackgroundPainter() != null) { getBackgroundPainter().paint(g2, this, getWidth(), getHeight()); } fakeTransparent = true; getUI().update(g2, this); } finally { g2.dispose(); fakeTransparent = false; } }
protected void paintComponentPatch(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); try { if (isPaintingBackground()) { g2.setColor(getBackground()); g2.fillRect(0, 0, getWidth(), getHeight()); } if (getBackgroundPainter() != null) { getBackgroundPainter().paint(g2, this, getWidth(), getHeight()); } fakeTransparent = true; getUI().update(g2, this); } finally { g2.dispose(); fakeTransparent = false; } }
BufferedImage img = createCompatibleTranslucentImage(getWidth(), getHeight()); Graphics2D gfx = img.createGraphics();
BufferedImage img = createCompatibleTranslucentImage(getWidth(), getHeight()); Graphics2D gfx = img.createGraphics();
BufferedImage img = createCompatibleTranslucentImage(getWidth(), getHeight()); Graphics2D gfx = img.createGraphics();
BufferedImage img = createCompatibleTranslucentImage(getWidth(), getHeight()); Graphics2D gfx = img.createGraphics();
} else if (getAlpha() < 1f) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); getBackgroundPainter().paint(g2, this, getWidth(), getHeight()); } else { Insets insets = getInsets(); g.translate(insets.left, insets.top); getBackgroundPainter().paint(g2, this, getWidth() - insets.left - insets.right, getHeight() - insets.top - insets.bottom); g.translate(-insets.left, -insets.top);
} else if (getAlpha() < 1f) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); getBackgroundPainter().paint(g2, this, getWidth(), getHeight()); } else { Insets insets = getInsets(); g.translate(insets.left, insets.top); getBackgroundPainter().paint(g2, this, getWidth() - insets.left - insets.right, getHeight() - insets.top - insets.bottom); g.translate(-insets.left, -insets.top);
} else if (getAlpha() < 1f) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); getBackgroundPainter().paint(g2, this, getWidth(), getHeight()); } else { Insets insets = getInsets(); g.translate(insets.left, insets.top); getBackgroundPainter().paint(g2, this, getWidth() - insets.left - insets.right, getHeight() - insets.top - insets.bottom); g.translate(-insets.left, -insets.top);
} else if (getAlpha() < 1f) { g.setColor(getBackground()); g.fillRect(0, 0, getWidth(), getHeight()); getBackgroundPainter().paint(g2, this, getWidth(), getHeight()); } else { Insets insets = getInsets(); g.translate(insets.left, insets.top); getBackgroundPainter().paint(g2, this, getWidth() - insets.left - insets.right, getHeight() - insets.top - insets.bottom); g.translate(-insets.left, -insets.top);