Example usage for java.awt BasicStroke BasicStroke

List of usage examples for java.awt BasicStroke BasicStroke

Introduction

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

Prototype

public BasicStroke(float width) 

Source Link

Document

Constructs a solid BasicStroke with the specified line width and with default values for the cap and join styles.

Usage

From source file:Main.java

public Main(String name) {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createStrokeBorder(new BasicStroke(0), Color.red));

    add(labelTwo);// ww  w . jav a 2  s  .c o  m

}

From source file:org.jfree.chart.demo.XYStepRendererDemo1.java

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createXYLineChart("XYStepRenderer Demo 1", "X", "Y", xydataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    XYStepRenderer xysteprenderer = new XYStepRenderer();
    xysteprenderer.setBaseShapesVisible(true);
    xysteprenderer.setSeriesStroke(0, new BasicStroke(2.0F));
    xysteprenderer.setSeriesStroke(1, new BasicStroke(2.0F));
    xysteprenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    xysteprenderer.setDefaultEntityRadius(6);
    xyplot.setRenderer(xysteprenderer);/*from  w ww. j a  va 2  s .co  m*/
    return jfreechart;
}

From source file:BasicStrokeDemo.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setStroke(new BasicStroke(3.0f));
    g2.setPaint(Color.blue);/* www .j a  v  a2s. c om*/

    Rectangle r = new Rectangle(5, 5, 200, 200);

    g2.draw(r);
}

From source file:ThickStrokeDemo.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setStroke(new BasicStroke(8.0f));
    g2.setPaint(Color.blue);//from www. j av a2 s.  c o m

    Rectangle r = new Rectangle(5, 5, 200, 200);

    g2.draw(r);
}

From source file:org.jfree.chart.demo.XYStepRendererDemo2.java

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createXYLineChart("XYStepRenderer Demo 2", "X", "Y", xydataset,
            PlotOrientation.VERTICAL, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    ValueAxis valueaxis = xyplot.getRangeAxis();
    valueaxis.setUpperMargin(0.14999999999999999D);
    XYStepRenderer xysteprenderer = new XYStepRenderer();
    xysteprenderer.setSeriesStroke(0, new BasicStroke(2.0F));
    xysteprenderer.setSeriesStroke(1, new BasicStroke(2.0F));
    xysteprenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    xysteprenderer.setDefaultEntityRadius(6);
    xysteprenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    xysteprenderer.setBaseItemLabelsVisible(true);
    xysteprenderer.setBaseItemLabelFont(new Font("Dialog", 1, 14));
    xyplot.setRenderer(xysteprenderer);//from   ww  w .  j a  v  a2s .  c o  m
    return jfreechart;
}

From source file:BasicDraw.java

public void paint(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    float strokeThickness = 5.0f;

    BasicStroke stroke = new BasicStroke(strokeThickness);
    g2d.setStroke(stroke);/*from   w w w  . j ava 2 s  . co  m*/

    g2d.draw(new Rectangle(20, 20, 200, 200));

}

From source file:Overlap.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    double x = 15, y = 50, w = 70, h = 70;
    Ellipse2D e = new Ellipse2D.Double(x, y, w, h);
    g2.setStroke(new BasicStroke(8));

    Color smokeyColor = new Color(128, 128, 128, 128);
    g2.setPaint(smokeyColor);/*from  ww  w  . j  ava  2 s . c o  m*/
    g2.fill(e);
    g2.draw(e);

    e.setFrame(x + 100, y, w, h);
    g2.setPaint(Color.black);
    g2.draw(e);
    g2.setPaint(Color.gray);
    g2.fill(e);

    e.setFrame(x + 200, y, w, h);
    g2.setPaint(Color.gray);
    g2.fill(e);
    g2.setPaint(Color.black);
    g2.draw(e);
}

From source file:MainClass.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    g2.setPaint(Color.black);/*from w  w w.j a  v  a2s .  c o m*/
    g2.setStroke(new BasicStroke(8));
    g2.draw(new Ellipse2D.Double(20, 20, 50, 50));

}

From source file:inet.CalculationNetworkEditor.Transformers.VertexStrokeTransformer.java

@Override
public Stroke transform(V i) {
    //return new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash, 0.0f);
    return new BasicStroke(3.0f);
}

From source file:PaintingAndStroking.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    double x = 15, y = 50, w = 70, h = 70;
    Ellipse2D e = new Ellipse2D.Double(x, y, w, h);
    GradientPaint gp = new GradientPaint(75, 75, Color.white, 95, 95, Color.gray, true);
    // Fill with a gradient.
    g2.setPaint(gp);/*from w  w  w.ja va2 s  . c  o  m*/
    g2.fill(e);
    // Stroke with a solid color.
    e.setFrame(x + 100, y, w, h);
    g2.setPaint(Color.black);
    g2.setStroke(new BasicStroke(8));
    g2.draw(e);
    // Stroke with a gradient.
    e.setFrame(x + 200, y, w, h);
    g2.setPaint(gp);
    g2.draw(e);
}