Refine search
@Override public void paint(Graphics g) { int percentage = getPercentage(); int topWidth = (int) (getSize().width * (percentage / 100f)); super.paint(g); g.setColor(getForeground()); g.fillRect(0, 0, topWidth, 16); g.setColor(getForeground().darker()); for (final Double position : positions) { final int xCord = (int) (getSize().width * position); if (xCord > topWidth) { g.fillRect(xCord, 0, 1, 16); } } super.paintComponents(g); }
g.drawImage(background, 0, 0, this); double theta = 2 * Math.PI * index++ / 64; g.setColor(Color.blue); rect.setRect( (int) (Math.sin(theta) * w / 3 + w / 2 - RADIUS), 2 * RADIUS, 2 * RADIUS); g.fillOval(rect.x, rect.y, rect.width, rect.height); g.setColor(Color.white); if (frameCount == FRAMES) { averageTime = totalTime / FRAMES; Graphics2D g = background.createGraphics(); g.clearRect(0, 0, w, h); g.setColor(Color.green.darker()); for (int i = 0; i < 128; i++) { g.drawLine(w / 2, h / 2, r.nextInt(w), r.nextInt(h));
g.setColor( getBackground() ); g.fillRoundRect( 1, 1, getWidth()-2 - 1, getHeight()-2 ,2 ,2 ); Graphics2D g2 = (Graphics2D)g; g2.drawRoundRect( x + 1, y + 1, w - 3, h - 3, 2,2 ); g2.setColor( black.darker() ); g2.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON ); g2.setFont( getFont() );
g.setColor(hazAlfa(fila)); g.fillPolygon(carp); g.setColor(darkShadow.darker()); g.drawPolygon(carp); carp.addPoint(0, lines[i + 1]); carp.addPoint(0, lines[i]); g.setColor(hazAlfa(fila + 2)); g.fillPolygon(carp); g.setColor(darkShadow.darker()); g.drawPolygon(carp); g.setColor(Color.BLACK); BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex, textRect.x, textRect.y + metrics.getAscent()); g.setColor(tabPane.getBackgroundAt(tabIndex).darker()); BasicGraphicsUtils.drawStringUnderlineCharAt(g, title, mnemIndex, textRect.x - 1, textRect.y + metrics.getAscent() - 1);
@Override public void paintIcon( Component c, Graphics g, int x, int y ) { int height = getIconHeight(); orig.paintIcon( c, g, x, y+(height-orig.getIconHeight())/2 ); arrow.paintIcon( c, g, x+GAP+orig.getIconWidth(), y+(height-arrow.getIconHeight())/2 ); if( paintRollOver ) { Color brighter = UIManager.getColor( "controlHighlight" ); //NOI18N Color darker = UIManager.getColor( "controlShadow" ); //NOI18N if( null == brighter || null == darker ) { brighter = c.getBackground().brighter(); darker = c.getBackground().darker(); } if( null != brighter && null != darker ) { g.setColor( brighter ); g.drawLine( x+orig.getIconWidth()+1, y, x+orig.getIconWidth()+1, y+getIconHeight() ); g.setColor( darker ); g.drawLine( x+orig.getIconWidth()+2, y, x+orig.getIconWidth()+2, y+getIconHeight() ); } } }
ORIGINAL.getHeight() + 20); Graphics2D g2 = ALTERED.createGraphics(); g2.setColor(Color.WHITE); g2.fillRect(0, 0, ALTERED.getWidth(), 20); g2.drawImage(ORIGINAL, 0, 20, null); final JFrame frame = new JFrame("Image Manipulation Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setBackground(Color.BLUE.darker()); frame.getContentPane().setLayout(new FlowLayout()); frame.getContentPane().add(new JLabel(new ImageIcon(ORIGINAL)));
private Timer timer; private Queue<Color> clut = new LinkedList<Color>(Arrays.asList( Color.BLUE.darker(), Color.MAGENTA.darker(), Color.BLACK, Color.RED.darker(), Color.PINK, Color.CYAN.darker(), Color.DARK_GRAY, Color.YELLOW.darker(), Color.GREEN.darker())); private Color backgroundColour; private Color foregroundColour; startStopButton.setOpaque(true); startStopButton.setForeground(Color.white); startStopButton.setBackground(Color.green.darker()); startStopButton.addActionListener(new ActionListener() { exitButton.setBorder(BorderFactory.createLineBorder(Color.red.darker(), 4)); buttonPanel.add(exitButton); g.setColor(backgroundColor); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(foregroundColor); g.fillOval(x, y, ballDiameter, ballDiameter);
protected void paintText(Graphics g, AbstractButton b, Rectangle r, String t) { super.paintText(g, b, r, t); g.setColor(SELECT_COLOR); g.drawRect(r.x, r.y, r.width, r.height); Rectangle viewRect, Rectangle textRect, Rectangle iconRect) { super.paintFocus(g, b, viewRect, textRect, iconRect); g.setColor(Color.blue.darker()); g.drawRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height); protected void paintButtonPressed(Graphics g, AbstractButton b) { if (b.isContentAreaFilled()) { g.setColor(SELECT_COLOR); g.fillRect(0, 0, b.getWidth(), b.getHeight());
ArrayList<Shape> regions = separateShapeIntoRegions(imageShapeArea); g.setStroke(new BasicStroke(1)); g.setColor(pieceColors[side]); Color baseColor = pieceColors[side]; if (gradient) { g.setPaint(gp); } else { g.setColor(baseColor); g.setColor(outlineColor); g.fill(shapeArea); g.dispose(); BevelBorder.LOWERED, Color.GRAY.brighter(), Color.GRAY, Color.GRAY.darker(), Color.GRAY));
@Override public void paintIcon(final Component c, final Graphics g, final int x, final int y) { g.setColor(UIManager.getColor("Tree.background")); g.fillRect(x, y, SIZE - 1, SIZE - 1); g.setColor(UIManager.getColor("Tree.hash").darker()); g.drawRect(x, y, SIZE - 1, SIZE - 1); if (type == EMPTY) return; g.setColor(UIManager.getColor("Tree.foreground")); g.drawLine(x + 2, y + SIZE / 2, x + SIZE - 3, y + SIZE / 2); if (type == PLUS) { g.drawLine(x + SIZE / 2, y + 2, x + SIZE / 2, y + SIZE - 3); } }
private void drawCrits(Image im, int crits) { int w = im.getWidth(null); int h = im.getHeight(null); Graphics g = im.getGraphics(); g.setColor(Color.black); g.fillRect(0, 0, w, h); for (int i = 0; i < crits; i++) { g.setColor(Color.red.darker()); g.fillRect(i * (squareSize + 1), 0, squareSize, squareSize); } }
private void drawCrits(Image im, int crits) { int w = im.getWidth(null); int h = im.getHeight(null); Graphics g = im.getGraphics(); g.setColor(Color.black); g.fillRect(0, 0, w, h); for (int i = 0; i < crits; i++) { g.setColor(Color.red.darker()); g.fillRect(i * (squareSize + 1), 0, squareSize, squareSize); } }