Example usage for java.awt Font Font

List of usage examples for java.awt Font Font

Introduction

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

Prototype

private Font(String name, int style, float sizePts) 

Source Link

Usage

From source file:SwingTypeTester9.java

private void initComponents() {
    parent = this;
    handler = new CharacterEventHandler();
    producer = new RandomCharacterGenerator();
    producer.setDone(true);//from  w  w  w  .j a va2s  . c om
    producer.start();
    displayCanvas = new AnimatedCharacterDisplayCanvas(producer);
    feedbackCanvas = new CharacterDisplayCanvas(this);
    quitButton = new JButton();
    startButton = new JButton();
    stopButton = new JButton();
    score = new ScoreLabel(producer, this);

    Container pane = getContentPane();
    JPanel p1 = new JPanel();
    p1.setLayout(new BoxLayout(p1, BoxLayout.PAGE_AXIS));
    p1.add(displayCanvas);
    p1.add(feedbackCanvas);

    JPanel p2 = new JPanel();
    score.setText("      ");
    score.setFont(new Font("MONOSPACED", Font.BOLD, 30));
    p2.add(score);
    startButton.setText("Start");
    p2.add(startButton);
    stopButton.setText("Stop");
    stopButton.setEnabled(false);
    p2.add(stopButton);
    quitButton.setText("Quit");
    p2.add(quitButton);
    p1.add(p2);
    pane.add(p1, BorderLayout.NORTH);
    pack();

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent evt) {
            quit();
        }
    });
    feedbackCanvas.addKeyListener(new KeyAdapter() {
        public void keyPressed(KeyEvent ke) {
            char c = ke.getKeyChar();
            if (c != KeyEvent.CHAR_UNDEFINED)
                newCharacter((int) c);
        }
    });
    startButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            new FeedbackFrame(parent).show();
        }
    });
    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            startButton.setEnabled(true);
            stopButton.setEnabled(false);
            producer.setDone(true);
            displayCanvas.setDone(true);
            feedbackCanvas.setEnabled(false);
        }
    });
    quitButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            quit();
        }
    });
}

From source file:de.hs.mannheim.modUro.diagram.JCellcycletimeDiagram.java

protected JFreeChart createChart(XYDataset dataset, List<String> celltypes) {
    String title = "Cell cycle times";

    JFreeChart xyLineChart = ChartFactory.createXYLineChart(title, // title
            "t", // x-axis label
            "T", // y-axis label
            dataset);/*from w ww .  ja  v  a2 s  .  c o  m*/

    String fontName = "Palatino";
    xyLineChart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));

    XYPlot plot = (XYPlot) xyLineChart.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.getDomainAxis().setLowerMargin(0.0);
    plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    plot.getRangeAxis().setLowerMargin(0.0);
    // plot.getRangeAxis().setRange(0.0, 1.01);
    plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    xyLineChart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
    xyLineChart.getLegend().setFrame(BlockBorder.NONE);
    xyLineChart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
    XYItemRenderer r = plot.getRenderer();

    // set the default stroke for all series
    int i = 0;
    for (String celltype : celltypes) {
        r.setSeriesPaint(i, CellTypeColor.getColor(celltype));
        i++;
    }
    return xyLineChart;
}

From source file:it.marcoberri.mbmeteo.action.chart.GetLastUPie.java

/**
 * Processes requests for both HTTP/*from   ww  w.  j  a  v  a2s  .co m*/
 * <code>GET</code> and
 * <code>POST</code> methods.
 *
 * @param request servlet request
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    log.debug("start : " + this.getClass().getName());

    final HashMap<String, String> params = getParams(request.getParameterMap());
    final Integer dimy = Default.toInteger(params.get("dimy"), 600);
    final Integer dimx = Default.toInteger(params.get("dimx"), 800);

    Meteolog meteolog = ds.find(Meteolog.class).order("-time").limit(1).get();

    final DefaultPieDataset dataset = new DefaultPieDataset();

    dataset.setValue(ChartEnumMinMaxHelper.outdoorHumidityMin.getUm(), meteolog.getOutdoorHumidity());
    dataset.setValue("", 100 - meteolog.getOutdoorHumidity());

    JFreeChart chart = ChartFactory.createPieChart("Humidity %", // chart title
            dataset, // data
            true, // include legend
            true, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    plot.setNoDataMessage("No data available");
    plot.setCircular(false);
    plot.setLabelGap(0.02);

    final File f = File.createTempFile("mbmeteo", ".jpg");
    ChartUtilities.saveChartAsJPEG(f, chart, dimx, dimy);

    response.setContentType("image/jpeg");
    response.setHeader("Content-Length", "" + f.length());
    response.setHeader("Content-Disposition", "inline; filename=\"" + f.getName() + "\"");
    final OutputStream out = response.getOutputStream();
    final FileInputStream in = new FileInputStream(f.toString());
    final int size = in.available();
    final byte[] content = new byte[size];
    in.read(content);
    out.write(content);
    in.close();
    out.close();

}

From source file:MessageDigestTest.java

public MessageDigestFrame() {
    setTitle("MessageDigestTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    JPanel panel = new JPanel();
    ButtonGroup group = new ButtonGroup();
    addRadioButton(panel, "SHA-1", group);
    addRadioButton(panel, "MD5", group);

    add(panel, BorderLayout.NORTH);
    add(new JScrollPane(message), BorderLayout.CENTER);
    add(digest, BorderLayout.SOUTH);
    digest.setFont(new Font("Monospaced", Font.PLAIN, 12));

    setAlgorithm("SHA-1");

    JMenuBar menuBar = new JMenuBar();
    JMenu menu = new JMenu("File");
    JMenuItem fileDigestItem = new JMenuItem("File digest");
    fileDigestItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            loadFile();/*from w  w  w. j  av a2s  .  com*/
        }
    });
    menu.add(fileDigestItem);
    JMenuItem textDigestItem = new JMenuItem("Text area digest");
    textDigestItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            String m = message.getText();
            computeDigest(m.getBytes());
        }
    });
    menu.add(textDigestItem);
    menuBar.add(menu);
    setJMenuBar(menuBar);
}

From source file:it.eng.spagobi.engines.kpi.bo.charttypes.dialcharts.Meter.java

/**
 * Creates the MeterChart .//from w  w w. ja v  a2s .  c  om
 * 
 * @return A MeterChart .
 */
public JFreeChart createChart() {
    logger.debug("IN");
    if (dataset == null) {
        logger.debug("The dataset to be represented is null");
        return null;
    }
    MeterPlot plot = new MeterPlot((ValueDataset) dataset);
    logger.debug("Created new plot");
    plot.setRange(new Range(lower, upper));
    logger.debug("Setted plot range");

    for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
        KpiInterval interval = (KpiInterval) iterator.next();
        plot.addInterval(new MeterInterval(interval.getLabel(), new Range(interval.getMin(), interval.getMax()),
                Color.lightGray, new BasicStroke(2.0f), interval.getColor()));
        logger.debug("Added new interval to the plot");
    }

    plot.setNeedlePaint(Color.darkGray);
    plot.setDialBackgroundPaint(Color.white);
    plot.setDialOutlinePaint(Color.gray);
    plot.setDialShape(DialShape.CHORD);
    plot.setMeterAngle(260);
    plot.setTickLabelsVisible(true);
    Font f = new Font("Arial", Font.PLAIN, 11);
    plot.setTickLabelFont(f);
    plot.setTickLabelPaint(Color.darkGray);
    plot.setTickSize(5.0);
    plot.setTickPaint(Color.lightGray);
    plot.setValuePaint(Color.black);
    plot.setValueFont(new Font("Arial", Font.PLAIN, 14));
    logger.debug("Setted all properties of the plot");

    JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    logger.debug("Created the chart");
    chart.setBackgroundPaint(color);
    logger.debug("Setted background color of the chart");

    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);
    logger.debug("Setted the title of the chart");
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
        logger.debug("Setted the subtitle of the chart");
    }
    logger.debug("OUT");
    return chart;
}

From source file:org.jfree.graphics2d.demo.SVGPieChartDemo1.java

/**
 * Creates a chart.// w  ww. j a v  a2s .c  o m
 *
 * @param dataset  the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset) {

    JFreeChart chart = ChartFactory.createPieChart("Smart Phones Manufactured / Q3 2011", // chart title
            dataset);
    chart.removeLegend();

    // set a custom background for the chart
    chart.setBackgroundPainter(new GradientPainter(new Color(20, 20, 20), RectangleAnchor.TOP_LEFT,
            Color.DARK_GRAY, RectangleAnchor.BOTTOM_RIGHT));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPainter(null);
    plot.setInteriorGap(0.04);
    plot.setBorderPainter(null);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("Others", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("Samsung", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("Apple", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("Nokia", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);
    // add a subtitle giving the data source
    TextTitle source = new TextTitle("Source: http://www.bbc.co.uk/news/business-15489523",
            new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:com.game.ui.views.MapEditor.java

public void generateGUI() throws IOException {
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    //        setResizable(false);
    JMenuBar menubar = new JMenuBar();
    ImageIcon icon = null;/*from   w  w  w.  j a  va  2s  .  co m*/
    try {
        icon = GameUtils.shrinkImage("save.png", 20, 20);
    } catch (IOException e) {
        System.out.println("Dialog : showDialogForMap(): Exception occured :" + e);
        e.printStackTrace();
    }
    JMenu file = new JMenu("File");
    JMenuItem save = new JMenuItem("Save", icon);
    save.setToolTipText("Save Map Information");
    save.setActionCommand("Save Map");
    save.addActionListener(this);
    file.add(save);
    menubar.add(file);
    setJMenuBar(menubar);
    JPanel topPanel = new JPanel();
    topPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    topPanel.setLayout(new GridBagLayout());
    JLabel headerLbl = new JLabel("Legend : ");
    headerLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    JLabel lbl1 = new JLabel();
    lbl1.setPreferredSize(new Dimension(50, 20));
    lbl1.setBackground(Configuration.pathColor);
    lbl1.setOpaque(true);
    JLabel lbl2 = new JLabel("- Represents the path.");
    JLabel lbl3 = new JLabel();
    lbl3.setPreferredSize(new Dimension(50, 20));
    lbl3.setBackground(Configuration.enemyColor);
    lbl3.setOpaque(true);
    JLabel lbl4 = new JLabel("- Represents the path with monsters");
    JLabel lbl5 = new JLabel();
    lbl5.setPreferredSize(new Dimension(50, 20));
    lbl5.setBackground(Configuration.startPointColor);
    lbl5.setOpaque(true);
    JLabel lbl6 = new JLabel("- Represents the starting point in the path");
    JLabel lbl7 = new JLabel();
    lbl7.setBackground(Configuration.endPointColor);
    lbl7.setOpaque(true);
    lbl7.setPreferredSize(new Dimension(50, 20));
    JLabel lbl8 = new JLabel("- Ending point in the path");
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.insets = new Insets(5, 5, 5, 5);
    c.gridwidth = 2;
    topPanel.add(headerLbl, c);
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.ipadx = 5;
    c.ipady = 5;
    topPanel.add(lbl1, c);
    c.gridx = 1;
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    topPanel.add(lbl2, c);
    c.gridx = 0;
    c.gridy = 2;
    topPanel.add(lbl3, c);
    c.gridx = 1;
    topPanel.add(lbl4, c);
    c.gridx = 0;
    c.gridy = 3;
    topPanel.add(lbl5, c);
    c.gridx = 1;
    topPanel.add(lbl6, c);
    c.gridx = 0;
    c.gridy = 4;
    topPanel.add(lbl7, c);
    c.gridx = 1;
    topPanel.add(lbl8, c);
    add(topPanel, BorderLayout.NORTH);
    bottomPanel = new JPanel();
    add(bottomPanel, BorderLayout.CENTER);
    bottomPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    //        bottomPanel.add(new JButton("kaushik"));
    pack();
    setExtendedState(JFrame.MAXIMIZED_BOTH);
    GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
    setMaximizedBounds(env.getMaximumWindowBounds());
    setVisible(true);
    callDialogForUsersInput();
}

From source file:integratedprogressdemo.WeatherData.java

private WeatherData(boolean displayProgress) {
    setBackground(Color.WHITE);// ww w.  j  a va2 s.  co m
    setLayout(new BorderLayout());
    JLabel lbl = new JLabel("World-Wide Weather Data");
    lbl.setFont(new Font("Serif", Font.PLAIN, 18));

    add(lbl, BorderLayout.PAGE_START);
    lbl = new JLabel("Weather information from over 50 cities");
    add(lbl, BorderLayout.LINE_START);

    if (displayProgress) {
        progressPanel = new JPanel();
        progressPanel.setBackground(Color.WHITE);
        progressPanel.setLayout(new BorderLayout(20, 20));

        String lblText = "<html>Stuck in the mud? Make progress with...<br /><font color=red><em>JDK Documentation</em></font><br/></html>";
        lbl = new JLabel(lblText);
        progressPanel.add(lbl, BorderLayout.NORTH);

        progressBar = new JProgressBar(0, 100);
        progressBar.setValue(0);
        progressBar.setStringPainted(true);
        progressPanel.add(progressBar, BorderLayout.SOUTH);

        add(progressPanel, BorderLayout.LINE_END);
    }

    String[] columnNames = { "City", "Temperature" };
    JTable table = new JTable(getData(), columnNames);

    table.setPreferredScrollableViewportSize(new Dimension(500, 70));
    table.setFillsViewportHeight(true);

    //Create the scroll pane and add the table to it.
    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setBackground(Color.WHITE);

    //Add the scroll pane to this panel.
    add(scrollPane, BorderLayout.PAGE_END);
}

From source file:components.ScrollDemo.java

public ScrollDemo() {
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));

    //Get the image to use.
    ImageIcon bee = createImageIcon("images/flyingBee.jpg");

    //Create the row and column headers.
    columnView = new Rule(Rule.HORIZONTAL, true);
    rowView = new Rule(Rule.VERTICAL, true);

    if (bee != null) {
        columnView.setPreferredWidth(bee.getIconWidth());
        rowView.setPreferredHeight(bee.getIconHeight());
    } else {/*from  ww w.j  a va2s  .  c  o m*/
        columnView.setPreferredWidth(320);
        rowView.setPreferredHeight(480);
    }

    //Create the corners.
    JPanel buttonCorner = new JPanel(); //use FlowLayout
    isMetric = new JToggleButton("cm", true);
    isMetric.setFont(new Font("SansSerif", Font.PLAIN, 11));
    isMetric.setMargin(new Insets(2, 2, 2, 2));
    isMetric.addItemListener(this);
    buttonCorner.add(isMetric);

    //Set up the scroll pane.
    picture = new ScrollablePicture(bee, columnView.getIncrement());
    JScrollPane pictureScrollPane = new JScrollPane(picture);
    pictureScrollPane.setPreferredSize(new Dimension(300, 250));
    pictureScrollPane.setViewportBorder(BorderFactory.createLineBorder(Color.black));

    pictureScrollPane.setColumnHeaderView(columnView);
    pictureScrollPane.setRowHeaderView(rowView);

    //Set the corners.
    //In theory, to support internationalization you would change
    //UPPER_LEFT_CORNER to UPPER_LEADING_CORNER,
    //LOWER_LEFT_CORNER to LOWER_LEADING_CORNER, and
    //UPPER_RIGHT_CORNER to UPPER_TRAILING_CORNER.  In practice,
    //bug #4467063 makes that impossible (in 1.4, at least).
    pictureScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, buttonCorner);
    pictureScrollPane.setCorner(JScrollPane.LOWER_LEFT_CORNER, new Corner());
    pictureScrollPane.setCorner(JScrollPane.UPPER_RIGHT_CORNER, new Corner());

    //Put it in this panel.
    add(pictureScrollPane);
    setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
}

From source file:DashboardInterface.CableOutSpeedDial.java

public CableOutSpeedDial(JPanel parentIn) {
    super(new BorderLayout());
    parent = parentIn;//  ww w  .  ja  v  a 2  s  .  c  om
    dataset1 = new DefaultValueDataset(0D);
    dataset2 = new DefaultValueDataset(0D);
    pipe = MessagePipeline.getInstance();
    pipe.attach(this);
    DialPlot dialplot = new DialPlot();
    dialplot.setView(0.0D, 0.0D, 1.0D, 1.0D);
    dialplot.setDataset(0, dataset1);
    dialplot.setDataset(1, dataset2);
    setBackground(Color.WHITE);
    StandardDialFrame standarddialframe = new StandardDialFrame();
    standarddialframe.setBackgroundPaint(Color.lightGray);
    standarddialframe.setForegroundPaint(Color.darkGray);

    dialplot.setDialFrame(standarddialframe);

    DialBackground dialbackground = new DialBackground(Color.LIGHT_GRAY);

    dialbackground.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    dialplot.setBackground(dialbackground);

    DialTextAnnotation dialtextannotation = new DialTextAnnotation("Cable Out (ft)");
    dialtextannotation.setFont(new Font("Dialog", 1, 12));
    dialtextannotation.setPaint(new Color(36, 130, 9));
    dialtextannotation.setRadius(0.47999999999999996D);
    dialplot.addLayer(dialtextannotation);

    DialTextAnnotation dialtextannotation2 = new DialTextAnnotation("Speed (kts)");
    dialtextannotation2.setFont(new Font("Dialog", 1, 12));
    dialtextannotation2.setPaint(Color.BLUE);
    dialtextannotation2.setRadius(0.78999999999999996D);
    dialplot.addLayer(dialtextannotation2);

    /*DialValueIndicator dialvalueindicator = new DialValueIndicator(0);
    dialvalueindicator.setFont(new Font("Dialog", 0, 10));
    dialvalueindicator.setOutlinePaint(Color.BLACK);
    dialvalueindicator.setRadius(0.84999999999999998D);
    dialvalueindicator.setAngle(-90D);
    dialplot.addLayer(dialvalueindicator);
            
    DialValueIndicator dialvalueindicator1 = new DialValueIndicator(1);
    dialvalueindicator1.setFont(new Font("Dialog", 0, 10));
    dialvalueindicator1.setOutlinePaint(Color.BLACK);
    dialvalueindicator1.setRadius(0.60999999999999998D);
    dialvalueindicator1.setAngle(-90D);
    dialplot.addLayer(dialvalueindicator1);*/

    StandardDialScale standarddialscale = new StandardDialScale(0D, 90D, -110D, -320D, 10D, 4);
    standarddialscale.setTickRadius(0.88D);
    standarddialscale.setTickLabelOffset(0.14999999999999999D);
    standarddialscale.setTickLabelFont(new Font("Dialog", 0, 14));
    standarddialscale.setMajorTickPaint(Color.BLUE);
    standarddialscale.setMinorTickPaint(Color.BLUE);
    dialplot.addScale(0, standarddialscale);

    StandardDialScale standarddialscale1 = new StandardDialScale(0.0D, 6000D, -110D, -320D, 750D, 4);
    standarddialscale1.setTickRadius(0.5D);
    standarddialscale1.setTickLabelOffset(0.14999999999999999D);
    standarddialscale1.setTickLabelFont(new Font("Dialog", 0, 10));
    standarddialscale1.setTickLabelPaint(new Color(36, 130, 9));
    standarddialscale1.setMajorTickPaint(new Color(36, 130, 9));
    standarddialscale1.setMinorTickPaint(new Color(36, 130, 9));
    dialplot.addScale(1, standarddialscale1);

    dialplot.mapDatasetToScale(1, 1);

    org.jfree.chart.plot.dial.DialPointer.Pointer pointer = new org.jfree.chart.plot.dial.DialPointer.Pointer(
            0);
    pointer.setFillPaint(Color.BLUE);
    dialplot.addPointer(pointer);

    org.jfree.chart.plot.dial.DialPointer.Pointer pin = new org.jfree.chart.plot.dial.DialPointer.Pointer(1);
    pin.setRadius(0.55000000000000004D);
    pin.setFillPaint(new Color(36, 130, 9));
    dialplot.addPointer(pin);

    DialCap dialcap = new DialCap();
    dialcap.setRadius(0.10000000000000001D);
    dialplot.setCap(dialcap);

    Dimension size = parent.getBounds().getSize();
    int width = parent.getWidth();
    int height = parent.getHeight();

    width = 200;

    JFreeChart jfreechart = new JFreeChart(dialplot);
    jfreechart.setBackgroundPaint(Color.WHITE);
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    chartpanel.setPreferredSize(new Dimension(width, width));

    add(chartpanel);
}