@Override public void paintComponent(Graphics g) { super.paintComponent(g); if (drawOverlay) { g = g.create(); AntialiasingManager.activateAntialiasing(g); try { // Paint a roll over fade out. FadeTracker fadeTracker = FadeTracker.getInstance(); float visibility = 0.0f; if (fadeTracker.isTracked(this, FadeKind.ROLLOVER)) { visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER); visibility /= 4; } else visibility = 0.5f; // Draw black overlay g.setColor(new Color(0.0f, 0.0f, 0.0f, visibility)); g.fillRoundRect(1, 1, width - 2, height - 2, 10, 10); // Draw arrow g.setColor(Color.WHITE); int[] arrowX = new int[] {width - 17, width - 7, width - 12}; int[] arrowY = new int[] {height - 12, height - 12, height - 7}; g.fillPolygon(arrowX, arrowY, arrowX.length); } finally { g.dispose(); } } }
/** * Paint a background for all groups and a round blue border and background when a cell is * selected. * * @param g the <tt>Graphics</tt> object */ private void internalPaintComponent(Graphics g) { AntialiasingManager.activateAntialiasing(g); Graphics2D g2 = (Graphics2D) g; if (isSelected) { g2.setColor(selectedColor); g2.fillRect(0, 0, this.getWidth(), this.getHeight()); } }
/** * Draws the "Round Disabled Border" which is used throughout the SIPComm L&F. * * @param g the <tt>Graphics</tt> object used for painting * @param x the x coordinate to start the border * @param y the y coordinate to start the border * @param w the width of the border * @param h the height of the border * @param r1 the arc width * @param r2 the arc height */ static void drawRoundDisabledBorder(Graphics g, int x, int y, int w, int h, int r1, int r2) { AntialiasingManager.activateAntialiasing(g); Graphics2D g2 = (Graphics2D) g.create(); try { g2.setColor(SIPCommLookAndFeel.getControlShadow()); g2.drawRoundRect(0, 0, w - 1, h - 1, r1, r2); } finally { g.dispose(); } }
/** * Customizes the background of this panel, by painting a round rectangle in the background color * previously set. * * @param g the <tt>Graphics</tt> object to use for painting */ public void paintComponent(Graphics g) { super.paintComponent(g); g = g.create(); try { AntialiasingManager.activateAntialiasing(g); g.setColor(backgroundColor); g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 20, 20); } finally { g.dispose(); } }
/** @{inheritDoc} */ @Override public void paintComponent(Graphics g) { super.paintComponent(g); g = g.create(); try { AntialiasingManager.activateAntialiasing(g); g.setColor(Color.DARK_GRAY); g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 10, 10); } finally { g.dispose(); } }
/** * Draws the "Bold Round Disabled Border" which is used throughout the SIPComm L&F. * * @param g the <tt>Graphics</tt> object used for painting * @param x the x coordinate to start the border * @param y the y coordinate to start the border * @param w the width of the border * @param h the height of the border * @param r1 the arc width * @param r2 the arc height */ static void drawBoldRoundBorder(Graphics g, int x, int y, int w, int h, int r1, int r2) { g = g.create(); try { AntialiasingManager.activateAntialiasing(g); Graphics2D g2 = (Graphics2D) g; g2.setColor(Constants.BORDER_COLOR); g2.setStroke(new BasicStroke(1.5f)); g2.drawRoundRect(x, y, w - 1, h - 1, r1, r2); } finally { g.dispose(); } }
private void internalPaintTabBackground( Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) { BufferedImage leftImg = null; BufferedImage middleImg = null; BufferedImage rightImg = null; Graphics2D g2 = (Graphics2D) g; AntialiasingManager.activateAntialiasing(g2); int tabOverlap = 0; if (isSelected) { if (tabPane.isEnabledAt(tabIndex)) { leftImg = DesktopUtilActivator.getImage(SELECTED_TAB_LEFT_BG); middleImg = DesktopUtilActivator.getImage(SELECTED_TAB_MIDDLE_BG); rightImg = DesktopUtilActivator.getImage(SELECTED_TAB_RIGHT_BG); tabOverlap = TAB_OVERLAP; } else { leftImg = DesktopUtilActivator.getImage(TAB_LEFT_BG); middleImg = DesktopUtilActivator.getImage(TAB_MIDDLE_BG); rightImg = DesktopUtilActivator.getImage(TAB_RIGHT_BG); } } else { leftImg = DesktopUtilActivator.getImage(TAB_LEFT_BG); middleImg = DesktopUtilActivator.getImage(TAB_MIDDLE_BG); rightImg = DesktopUtilActivator.getImage(TAB_RIGHT_BG); } // Remove the existing gap between the tabs and the panel, which is due // to the removal of the tabbed pane border. y++; // If the current tab is not the selected tab we paint it 2 more pixels // to the bottom in order to create the disabled look. if (!isSelected) y += 2; g2.drawImage(leftImg, x, y, null); g2.drawImage( middleImg, x + leftImg.getWidth(), y, w - leftImg.getWidth() - rightImg.getWidth() + tabOverlap, leftImg.getHeight(), null); g2.drawImage(rightImg, x + w - rightImg.getWidth() + tabOverlap, y, null); }
/** * Paints a customized background. * * @param g the <tt>Graphics</tt> object through which we paint */ @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g = g.create(); if (!(treeNode instanceof GroupNode) && !isSelected) return; AntialiasingManager.activateAntialiasing(g); Graphics2D g2 = (Graphics2D) g; try { internalPaintComponent(g2); } finally { g.dispose(); } }
/** * Paints a custom gradient background for selected cells. * * @param g the <tt>Graphics</tt> object used for painting */ private void internalPaintComponent(Graphics g) { AntialiasingManager.activateAntialiasing(g); Graphics2D g2 = (Graphics2D) g; int width = getWidth(); int height = getHeight(); if (this.isSelected) { GradientPaint p = new GradientPaint( width / 2, 0, SELECTED_START_COLOR, width / 2, height, SELECTED_END_COLOR); g2.setPaint(p); g2.fillRoundRect(1, 1, width, height - 1, 7, 7); } g2.setColor(SELECTED_START_COLOR); g2.drawLine(0, height - 1, width, height - 1); }
/** * Draw the icon at the specified location. Paints this component as an icon. * * @param c the component which can be used as observer * @param g the <tt>Graphics</tt> object used for painting * @param x the position on the X coordinate * @param y the position on the Y coordinate */ public void paintIcon(Component c, Graphics g, int x, int y) { g = g.create(); try { Graphics2D g2 = (Graphics2D) g; AntialiasingManager.activateAntialiasing(g2); g2.setColor(Color.WHITE); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f)); g2.fillRoundRect(x, y, getIconWidth() - 1, getIconHeight() - 1, 10, 10); g2.setColor(Color.DARK_GRAY); g2.drawRoundRect(x, y, getIconWidth() - 1, getIconHeight() - 1, 10, 10); // Indent component content from the border. g2.translate(x + 5, y + 5); super.paint(g2); g2.translate(x, y); } finally { g.dispose(); } }
/** * Paints this button. * * @param g the <tt>Graphics</tt> object used for painting */ private void internalPaintComponent(Graphics2D g) { AntialiasingManager.activateAntialiasing(g); // Paint a roll over fade out. FadeTracker fadeTracker = FadeTracker.getInstance(); float visibility = this.getModel().isRollover() ? 1.0f : 0.0f; if (fadeTracker.isTracked(this, FadeKind.ROLLOVER)) { visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER); } visibility /= 2; if (visibility != 0.0f) { g.setColor(new Color(borderColor[0], borderColor[1], borderColor[2], visibility)); if (bgImage != null) g.fillRoundRect( (this.getWidth() - bgImage.getWidth(null)) / 2, (this.getHeight() - bgImage.getHeight(null)) / 2, bgImage.getWidth(null) - 1, bgImage.getHeight(null) - 1, 20, 20); else g.fillRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, 20, 20); } if (bgImage != null) { g.drawImage( bgImage, (this.getWidth() - bgImage.getWidth(null)) / 2, (this.getHeight() - bgImage.getHeight(null)) / 2, null); } else { g.setColor(getBackground()); g.fillRoundRect(1, 1, this.getWidth() - 2, this.getHeight() - 2, 20, 20); } }
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); g = g.create(); try { AntialiasingManager.activateAntialiasing(g); Graphics2D g2 = (Graphics2D) g; if (bgImage != null) g2.drawImage(bgImage.getImage(), 30, 30, null); g2.drawImage( ImageLoader.getImage(ImageLoader.AUTH_WINDOW_BACKGROUND), 0, 0, this.getWidth(), this.getHeight(), null); } finally { g.dispose(); } }
/** * Overrides the <code>paintComponent</code> method in <tt>JComponent</tt> to paint the screen * capture image as a background of this component. */ @Override protected void paintComponent(Graphics g) { g = g.create(); try { AntialiasingManager.activateAntialiasing(g); Graphics2D g2 = (Graphics2D) g; int width = getWidth(); int height = getHeight(); g2.drawImage(this.background, 0, 0, null); g2.setColor(new Color(255, 255, 255, 180)); g2.fillRoundRect(0, 0, width, height, 10, 10); g2.setColor(Constants.BORDER_COLOR); g2.drawRoundRect(0, 0, width - 1, height - 1, 10, 10); } finally { g.dispose(); } }
/** * Paints the UI for the given component through the given graphics object. * * @param g the <tt>Graphics</tt> object used for painting * @param c the component to paint */ public void paint(Graphics g, JComponent c) { AntialiasingManager.activateAntialiasing(g); super.paint(g, c); }