Package guiPilotoArduino.cmp

Source Code of guiPilotoArduino.cmp.Compass

package guiPilotoArduino.cmp;

import javax.swing.JPanel;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GradientPaint;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;

import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CompassFormat;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.axis.NumberTickUnit;
import org.jfree.chart.axis.TickUnits;
import org.jfree.chart.plot.CompassPlot;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.general.DefaultValueDataset;
import org.jfree.ui.Spinner;

import javax.swing.BoxLayout;
import javax.swing.JLabel;


public class Compass extends JPanel {
  /** Dataset 1. */
    private DefaultValueDataset compassData = new DefaultValueDataset(new Double(0));
      /** The compass plot. */
    private CompassPlot compassPlot = new CompassPlot(compassData);
    /** The chart. */
    private JFreeChart compassChart = new JFreeChart("Brujula",
                                                     JFreeChart.DEFAULT_TITLE_FONT,
                                                     this.compassPlot, true);
   
   
    /** The chart panel. */
    private ChartPanel panelCompass = new ChartPanel(this.compassChart);

    public Compass(){
      setLayout(new BorderLayout(0, 0));
      add(panelCompass, BorderLayout.CENTER);
     
      compassPlot.setLabelType(CompassPlot.VALUE_LABELS);
      compassPlot.setLabelFont(new Font("Serif", Font.PLAIN, 130));
     
         compassPlot.setSeriesNeedle(5);
         compassPlot.setSeriesPaint(0, Color.white);
         compassPlot.setSeriesOutlinePaint(0, Color.white);
         compassPlot.setRosePaint(Color.green);
         compassPlot.setRosePaint(new GradientPaint(1.0f, 2.0f, Color.blue,3.0f, 4.0f, Color.yellow));
         compassPlot.setRoseHighlightPaint(Color.gray);
         compassPlot.setRoseCenterPaint(Color.black);
         compassPlot.setDrawBorder(true);

     
    }
   
    public DefaultValueDataset getCompassData(){
      return compassData;
    }

 
 
}
TOP

Related Classes of guiPilotoArduino.cmp.Compass

TOP
Copyright © 2018 www.massapi.com. 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.