Example usage for java.awt Graphics fill3DRect

List of usage examples for java.awt Graphics fill3DRect

Introduction

In this page you can find the example usage for java.awt Graphics fill3DRect.

Prototype

public void fill3DRect(int x, int y, int width, int height, boolean raised) 

Source Link

Document

Paints a 3-D highlighted rectangle filled with the current color.

Usage

From source file:org.processmining.analysis.performance.dottedchart.ui.DottedChartPanel.java

/**
 * convenience method for internal use. paints a log item handle
 * visualization./*from w  ww . j a v  a 2  s  . c om*/
 * 
 * @param x
 *            horizontal anchor coordinate of the handle
 * @param y
 *            vertical anchor coordinate of the handle
 * @param g
 *            the Graphics object used for painting
 */
protected void paintItem_buffer(int x, int y, Graphics g, String shape) {
    if (shape.equals(STR_NONE)) {
        return;
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_DOT)) {
        g.fillOval(x - 2, y - 2, 7, 7);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_BOX)) {
        g.fill3DRect(x - 3, y - 3, 6, 6, false);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_CIRCLE)) {
        g.fillOval(x - 2, y - 2, 7, 7);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_RHOMBUS)) {
        int rhombX[] = { x, x - 3, x, x + 3 };
        int rhombY[] = { y - 3, y, y + 3, y };
        g.fillPolygon(rhombX, rhombY, 4);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_TRIANGLE)) {
        int triX[] = { x, x - 3, x + 3 };
        int triY[] = { y + 3, y - 3, y - 3 };
        g.fillPolygon(triX, triY, 3);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_ROUND_BOX)) {
        g.fillRoundRect(x - 3, y - 3, 6, 6, 2, 2);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_DRAW_BOX)) {
        g.drawRect(x - 3, y - 3, 6, 6);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_DRAW_CIRCLE)) {
        g.drawOval(x - 2, y - 2, 7, 7);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_DRAW_RHOMBUS)) {
        int rhombX[] = { x, x - 3, x, x + 3 };
        int rhombY[] = { y - 3, y, y + 3, y };
        g.drawPolygon(rhombX, rhombY, 4);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_DRAW_TRIANGLE)) {
        int triX[] = { x, x - 3, x + 3 };
        int triY[] = { y + 3, y - 3, y - 3 };
        g.drawPolygon(triX, triY, 3);
    } else if (shape.equals(DottedChartPanel.ITEM_HANDLE_DRAW_ROUND_BOX)) {
        g.drawRoundRect(x - 3, y - 3, 6, 6, 2, 2);
    }
}

From source file:org.trianacode.gui.main.imp.TrianaTask.java

protected void paintProcessProgress(Graphics g) {
    if (processled) {
        Color col = ColorManager.getColor(PROGRESS_ELEMENT, getTaskInterface());

        if (col.getAlpha() > 0) {
            Dimension size = getSize();

            int width = (int) (size.width * PROCESS_LED_WIDTH_FACTOR);
            int height = (int) (size.height * PROCESS_LED_HEIGHT_FACTOR);
            int left = (size.width / 2) - (width / 2);
            int top = 0;

            if (getTaskInterface() instanceof TaskGraph) {
                int processCount = (getStartProcessCount() % 3);
                left = (size.width / 2) - (width / 2 * 3) + (processCount * width);
            }/*from  w  w  w  .ja v a 2 s  . c  om*/

            g.setColor(col);
            g.fill3DRect(left, top, width, height, true);

            left += width + 1;
            int offset = height / 2;

            for (int count = 0; (count < getStartProcessCount() - getStopProcessCount() - 1)
                    && (left + height < size.width); count++) {
                g.drawLine(left, top + offset, left + height, top + offset);
                g.drawLine(left + offset, top, left + offset, top + height);

                left += height + 1;
            }
        }
    }
}