Package java.awt

Examples of java.awt.BasicStroke$BufferedPath


        setEndCaps(basicStroke.getEndCap());
        setLineJoins(basicStroke.getLineJoin());
    }

    public void resetStroke() {
        BasicStroke oldStroke = basicStroke;
        setMiterLimit(miterLimit);
        basicStroke = new BasicStroke(width, endCaps, lineJoins, miterLimit, dash, dashPhase);
        pcs.firePropertyChange("line", oldStroke, basicStroke);
    }
View Full Code Here


            for (int i = 1; i < width; i++) {
                dash1[i] = 2.0f;
            }

            BasicStroke dashed = new BasicStroke(5.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
            ((Graphics2D) g).setStroke(dashed);
            setGraphicsColor(g, Color.YELLOW);
            draw(g);
        }
View Full Code Here

            for (int i = 1; i < width; i++) {
                dash1[i] = 2.0f;
            }

            BasicStroke dashed = new BasicStroke(5.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
            ((Graphics2D) g).setStroke(dashed);
            setGraphicsColor(g, Color.BLUE);
            draw(g);
        }
View Full Code Here

    private I18n i18n = Environment.getI18n();
   
    protected JButton launchButton;

    public BasicStrokeEditorMenu() {
        this(new BasicStroke(1f));
    }
View Full Code Here

    public BasicStrokeEditorMenu(BasicStroke bs) {
        if (bs != null) {
            basicStroke = bs;
        } else {
            basicStroke = new BasicStroke(1f);
        }
       
        setBasicStroke(basicStroke);
    }
View Full Code Here

        }
        return launchButton;
    }

    public void resetStroke() {
        BasicStroke oldStroke = basicStroke;
        setMiterLimit(miterLimit);
        basicStroke = new BasicStroke(width, endCaps, lineJoins, miterLimit, dash, dashPhase);
        if (launchButton != null) {
            launchButton.setIcon(createIcon(basicStroke, 50, 20, true));
        }
        pcs.firePropertyChange("line", oldStroke, basicStroke);
    }
View Full Code Here

        group = new ButtonGroup();
        ImageIcon ii;
        int i;
        for (i = 1; i < 13; i++) {
            ii = createIcon(new BasicStroke(i), 50, 20, true);
            button = new JRadioButtonMenuItem(" ", ii, (int) width == i);//without the space as a parameter these instances look strange with some Look&Feel
            button.setActionCommand(String.valueOf(i));
            group.add(button);
            button.addActionListener(listener);
            button.setMargin( new java.awt.Insets(0,10,0,10));
            button.setPreferredSize(new java.awt.Dimension(70,20));
            widthMenu.add(button);
        }

        //////// Dash Pattern

        JMenu dashMenu = new JMenu(i18n.get(BasicStrokeEditorMenu.class, "Dash_Pattern", "Dash Pattern"));

        listener = new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                String command = ae.getActionCommand();
                try {
                    setDash(stringToDashArray(command));
                    resetStroke();
                } catch (NumberFormatException e) {
                }
            }
        };

        group = new ButtonGroup();

        String[] patterns = new String[] { NONE, "1.0 3.0", "3.0 3.0", "12.0 10.0",
                "12.0 10.0 6.0 10.0", "20.0 10.0", "20.0 10.0 6.0 10.0", "20.0 10.0 6.0 10.0 6.0 10.0" };

        String currentDash = dashArrayToString(getDash());
        for (i = 0; i < patterns.length; i++) {
            BasicStroke dashStroke = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER, 10.0f, stringToDashArray(patterns[i]), 0.0f);
            ii = createIcon(dashStroke, 90, 10, true);

            button = new JRadioButtonMenuItem(" ", ii, currentDash.equals(patterns[i]));
            button.setActionCommand(patterns[i]);
            group.add(button);
View Full Code Here

      g.fillRect(0, 0, width, height);
     
      g.setPaint(background);
      g.fillRect(0, 0, width, height);
      if (matting != null) {
        BasicStroke mattedStroke=new BasicStroke(((BasicStroke) stroke).getLineWidth() + 2f);
        g.setStroke(mattedStroke);
        g.setPaint(matting);
        g.drawLine(0,height/2,width,height/2);
      }
        g.setPaint(color);
View Full Code Here

            } else if (strokeString.equalsIgnoreCase(LPC_DASH_DOT_DOT)) {
                dash = new float[] { 6f, 6f, 3f, 6f, 3f, 6f };
            }

            if (dash != null) {
                stroke = new BasicStroke(lineWidth, cap, join, miterLimit, dash, dashPhase);
            }
        }

        if (stroke == null) {
            stroke = new BasicStroke(lineWidth);
        }

        renderAttributesCache.put(strokeCode, stroke);

        return stroke;
View Full Code Here

        }
    }

    public Stroke cloneBasicStroke() {
        if (stroke instanceof BasicStroke) {
            BasicStroke bs = (BasicStroke) stroke;
            return new BasicStroke(bs.getLineWidth(), bs.getEndCap(), bs.getLineJoin(), bs.getMiterLimit(), bs.getDashArray(), bs.getDashPhase());
        } else {
            return new BasicStroke(1);
        }
    }
View Full Code Here

TOP

Related Classes of java.awt.BasicStroke$BufferedPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.