Java Graphics Draw paintFilthyPanel(Graphics g, int width, int height)

Here you can find the source of paintFilthyPanel(Graphics g, int width, int height)

Description

Paint a filthy panel.

License

Apache License

Parameter

Parameter Description
g The graphics.
width The width of the panel.
height The height of the panel.

Declaration

public static void paintFilthyPanel(Graphics g, int width, int height) 

Method Source Code


//package com.java2s;
/*/*from www .  ja  v a2s  . c om*/
 * Copyright JTheque (Baptiste Wicht)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.awt.AlphaComposite;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Graphics;
import java.awt.Graphics2D;

import java.awt.Stroke;
import java.awt.geom.RoundRectangle2D;

public class Main {
    /**
     * Paint a filthy panel.
     *
     * @param g      The graphics.
     * @param width  The width of the panel. 
     * @param height The height of the panel.
     */
    public static void paintFilthyPanel(Graphics g, int width, int height) {
        Graphics2D g2 = (Graphics2D) g;

        Composite composite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f));

        g2.setColor(Color.white);

        RoundRectangle2D background;
        background = new RoundRectangle2D.Double(3.0, 3.0, (double) width - 10.0 - 3.0, (double) height - 6.0, 12,
                12);

        g2.fill(background);

        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f));
        Stroke stroke = g2.getStroke();
        g2.setStroke(new BasicStroke(3.0f));
        g2.draw(background);
        g2.setStroke(stroke);

        g2.setComposite(composite);
    }
}

Related

  1. paint3DRoundRectEffect(Graphics g, int x, int y, int width, int height, int radius)
  2. paintBall(Graphics2D g2, Color c)
  3. paintColorImageFromAlphaImage(Image alphaImage, Image out, Color color)
  4. paintComponent(Graphics g, Component c, Container p, Rectangle r)
  5. paintCross(Graphics g, Color color, int centerX, int centerY, int size, int width)
  6. paintFocus(Graphics g, int x, int y, int width, int height, int r1, int r2, float grosor, Color color)
  7. paintKnurl3(java.awt.Graphics g2, float x, float y, float width, float height)
  8. paintLine(Graphics2D g2, Point2D.Double from, Point2D.Double to)
  9. paintOval(int x, int y, Color c, int size, Graphics g)