cnu.eslab.fileTest.NewJFrame.java Source code

Java tutorial

Introduction

Here is the source code for cnu.eslab.fileTest.NewJFrame.java

Source

package cnu.eslab.fileTest;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.labels.ItemLabelAnchor;
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.StandardCategoryItemLabelGenerator;
import org.jfree.chart.labels.StandardPieSectionLabelGenerator;
import org.jfree.chart.labels.StandardXYToolTipGenerator;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PiePlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.LookupPaintScale;
import org.jfree.chart.renderer.category.BarRenderer;
import org.jfree.chart.renderer.xy.XYBlockRenderer;
import org.jfree.chart.renderer.xy.XYStepAreaRenderer;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.statistics.DefaultStatisticalCategoryDataset;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.RectangleInsets;
import org.jfree.ui.TextAnchor;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class NewJFrame extends javax.swing.JFrame implements ActionListener, ListSelectionListener {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    public static final int POWER_BUTTON_OFF = 0;
    public static final int POWER_BUTTON_ON = 1;

    public static final int TOTAL_POWER = 0;
    public static final int BATTERY_CAPACITY = 1;
    public static final int CPU_POWER = 2;
    public static final int WIFI_POWER = 3;
    public static final int GPS_POWER = 4;
    public static final int AUDIO_POWER = 5;
    public static final int LED_POWER = 6;
    public static final int THREEG_POWER = 10;

    public static final int TOTAL_LED_POWER = 7;
    public static final int TOTAL_CPU_POWER = 8;
    public static final int TOTAL_WIFI_POWER = 9;
    public static final int TOTAL_THREEG_POWER = 11;
    private JButton mTotalCompareBtn;
    private JButton mCompareAppPowerBtn;
    private JLabel jLabel7;
    private JLabel jLabel6;
    private JButton mDeleteUidMoveBtn;
    private JButton mDeleteOneBtn;
    private JButton mDeleteAllBtn;
    private JList mDeleteList;
    private JScrollPane jScrollPane2;
    private JButton mComponentPieBtn;

    public static boolean FLAG_GPS_STATE = false;
    public static boolean FLAG_AUDIO_STATE = false;

    private JFileChooser mJFileChooser;
    private File mFileName;

    private ArrayList<String> mUidArrayList;
    private ArrayList<Integer> mTotalPowerArrayList;
    private ArrayList<String> mTimeArrayList;
    private ArrayList<Integer> mBatteryCapacityArrayList;
    private ArrayList<Integer> mCpuPowerArrayList;
    private JButton mAppTotalPowerBtn;
    private ArrayList<Integer> mWifiPowerArrayList;
    private ArrayList<Integer> mThreeGPowerArrayList;
    private JButton mPhoneTotalStackPowerBtn;
    private JButton mComponentLEDBtn;
    private JButton mComponentCPUBtn;
    private JButton mComponentWIFIBtn;
    private JButton mComponentThreeGBtn;
    private JLabel jLabel5;
    private JLabel jLabel2;
    private JLabel jLabel1;
    private JPanel jPanel7;
    private JPanel jPanel4;
    private ArrayList<Integer> mGpsPowerArrayList;
    private ArrayList<Integer> mLedPowerArrayList;
    private ArrayList<Integer> mAudioPowerArrayList;
    private ArrayList<Integer> mComponentWifiArrayList;

    private DefaultListModel listModel;
    private DefaultListModel listModelUidDelte;

    //  ?.
    private int mFirstRange;
    private int mSecondRange;

    // ?  ??  ?  .
    private FileStream mCFileStream;

    //  UI  .
    private String mSearchUid;
    private String mSerarchUidOld;

    private JPanel jPanel1;
    private JButton mParsingBtn;
    private JButton mFileBtn;
    private JButton m3GBtn;
    private JCheckBox mGPSCheckBox;
    private JCheckBox mAudioCheckBox;
    private JButton mDevicesPowerButton;
    private JButton mAppStackedPower;
    private JTextField mChartMeanUnitTextField;
    private JButton m3DBarChartMean;
    private JLabel jLabel4;
    private JPanel jPanel6;
    private JTextField mSecondRangeText;
    private JLabel jLabel3;
    private JButton mUidPieDiagramBtn;
    private JTextField mFirstRangeText;
    private JLabel Range;
    private JPanel jPanel5;
    private JTextField mLogScaleTextFiled;
    private JLabel LOGTimeLabel;
    private JScrollPane jScrollPane1;
    private JButton mAudioBtn;
    private JButton mGpsBtn;
    private JList mUidList;
    private JLabel dd;
    private JPanel jPanel3;
    private JTextField mFilePathTextField;
    private JLabel mFilePathLabel;
    private JPanel jPanel2;
    private JButton mLedBtn;
    private JButton mWifiBtn;
    private JButton mCpuBtn;
    private JButton mBatteryCapacityBtn;
    private JButton mTotalPowerBtn;

    /**
     * Auto-generated main method to display this JFrame
     */
    public File getFileName() {
        return mFileName;
    }

    public static void main(String[] args) {
        @SuppressWarnings("unused")
        NewJFrame aa = new NewJFrame();

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                NewJFrame inst = new NewJFrame();
                inst.setLocationRelativeTo(null);
                inst.setVisible(true);
            }
        });

    }

    public NewJFrame() {
        super();
        initGUI();
        Myinit();
    }

    private void Myinit() {
        // ArrayList ?.
        mUidArrayList = new ArrayList<String>();
        // ?   ? ? .
        mCFileStream = new FileStream();

        mJFileChooser = new JFileChooser(); // ? ? ? .
        mFileBtn.addActionListener(this); //  ? .
        mParsingBtn.addActionListener(this);
        mTotalPowerBtn.addActionListener(this);
        mBatteryCapacityBtn.addActionListener(this);
        mCpuBtn.addActionListener(this);
        mWifiBtn.addActionListener(this);
        mLedBtn.addActionListener(this);
        mGpsBtn.addActionListener(this);
        mAudioBtn.addActionListener(this);
        mUidPieDiagramBtn.addActionListener(this);
        m3DBarChartMean.addActionListener(this);
        mDevicesPowerButton.addActionListener(this);

        mAppTotalPowerBtn.addActionListener(this);
        mAppStackedPower.addActionListener(this);
        mUidList.addListSelectionListener(this);

        mGPSCheckBox.addActionListener(this);
        mAudioCheckBox.addActionListener(this);
        m3GBtn.addActionListener(this);

        //component ?  ?  .
        mComponentLEDBtn.addActionListener(this);
        mComponentCPUBtn.addActionListener(this);
        mComponentWIFIBtn.addActionListener(this);
        mComponentThreeGBtn.addActionListener(this);
        mPhoneTotalStackPowerBtn.addActionListener(this);
        mComponentPieBtn.addActionListener(this);
        mDeleteUidMoveBtn.addActionListener(this); // ? ?  
        mDeleteOneBtn.addActionListener(this); //  ? ? UID 
        mDeleteAllBtn.addActionListener(this); //  ?  UID 
        mCompareAppPowerBtn.addActionListener(this);
        mTotalCompareBtn.addActionListener(this); // ?   ?? ? ?   ?.

        // ?   ?  ? OFF .
        ComponetStateChanger(POWER_BUTTON_OFF);
    }

    private void initGUI() {
        try {
            setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
            getContentPane().setLayout(null);
            {
                jPanel1 = new JPanel();
                FlowLayout jPanel1Layout = new FlowLayout();
                jPanel1.setLayout(jPanel1Layout);
                getContentPane().add(jPanel1, "North");
                jPanel1.setBounds(12, 434, 590, 66);
                jPanel1.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                {
                    mParsingBtn = new JButton();
                    jPanel1.add(mParsingBtn);
                    mParsingBtn.setText("Parsing");
                    mParsingBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mTotalPowerBtn = new JButton();
                    jPanel1.add(mTotalPowerBtn);
                    mTotalPowerBtn.setText("Phone Total Power");
                    mTotalPowerBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mBatteryCapacityBtn = new JButton();
                    jPanel1.add(mBatteryCapacityBtn);
                    mBatteryCapacityBtn.setText("Battery Capacity");
                    mBatteryCapacityBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mTotalCompareBtn = new JButton();
                    jPanel1.add(mTotalCompareBtn);
                    mTotalCompareBtn.setText("Total Compare");
                    mTotalCompareBtn.setPreferredSize(new java.awt.Dimension(124, 24));
                }
                {
                    mPhoneTotalStackPowerBtn = new JButton();
                    jPanel1.add(mPhoneTotalStackPowerBtn);
                    mPhoneTotalStackPowerBtn.setText("Phone Total Stack Power");
                }
                {
                    mDevicesPowerButton = new JButton();
                    jPanel1.add(mDevicesPowerButton);
                    mDevicesPowerButton.setText("Hardware Component Max Power");
                    mDevicesPowerButton.setPreferredSize(new java.awt.Dimension(280, 24));
                }
                {
                    mCompareAppPowerBtn = new JButton();
                    jPanel1.add(mCompareAppPowerBtn);
                    mCompareAppPowerBtn.setText("Compare");
                }
            }
            {
                jPanel2 = new JPanel();
                getContentPane().add(jPanel2, "West");
                jPanel2.setBounds(12, 25, 589, 67);
                jPanel2.setLayout(null);
                jPanel2.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                {
                    mFilePathLabel = new JLabel();
                    jPanel2.add(mFilePathLabel);
                    mFilePathLabel.setText("File Path");
                    mFilePathLabel.setPreferredSize(new java.awt.Dimension(48, 17));
                    mFilePathLabel.setBounds(8, 8, 48, 17);
                }
                {
                    mFilePathTextField = new JTextField();
                    jPanel2.add(mFilePathTextField);
                    mFilePathTextField.setText("None");
                    mFilePathTextField.setEditable(false);
                    mFilePathTextField.setBounds(68, 4, 430, 24);
                }
                {
                    mFileBtn = new JButton();
                    jPanel2.add(mFileBtn);
                    mFileBtn.setText("OPEN");
                    mFileBtn.setBounds(503, 6, 81, 24);
                }
                {
                    LOGTimeLabel = new JLabel();
                    jPanel2.add(LOGTimeLabel);
                    LOGTimeLabel.setText("LOG Time");
                    LOGTimeLabel.setBounds(8, 37, 60, 17);
                }
                {
                    mLogScaleTextFiled = new JTextField();
                    jPanel2.add(mLogScaleTextFiled);
                    mLogScaleTextFiled.setText("None");
                    mLogScaleTextFiled.setEditable(false);
                    mLogScaleTextFiled.setBounds(68, 34, 430, 24);
                }
            }
            {
                jScrollPane1 = new JScrollPane();
                getContentPane().add(jScrollPane1);
                jScrollPane1.setBounds(13, 122, 424, 228);
                {
                    listModel = new DefaultListModel();// List? ??  ??.
                    mUidList = new JList(listModel);
                    mUidList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // 
                    // ?
                    // ?
                    // .
                    jScrollPane1.setViewportView(mUidList);
                    jScrollPane1.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

                    mUidList.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                    //mUidList.setPreferredSize(new java.awt.Dimension(586, 222));   /?  ?.
                }
            }
            {
                jPanel3 = new JPanel();
                getContentPane().add(jPanel3);
                jPanel3.setBounds(12, 0, 579, 31);
                {
                    dd = new JLabel();
                    jPanel3.add(dd);
                    dd.setText("Power Tutor Trace");
                    dd.setPreferredSize(new java.awt.Dimension(106, 17));
                }
            }
            {
                jPanel5 = new JPanel();
                getContentPane().add(jPanel5, "West");
                jPanel5.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                jPanel5.setBounds(12, 356, 304, 58);
                jPanel5.setLayout(null);
                {
                    Range = new JLabel();
                    jPanel5.add(Range);
                    Range.setText("Range");
                    Range.setBounds(14, 10, 46, 17);
                }
                {
                    mFirstRangeText = new JTextField();
                    jPanel5.add(mFirstRangeText);
                    mFirstRangeText.setBounds(59, 7, 63, 24);
                }
                {
                    mUidPieDiagramBtn = new JButton();
                    jPanel5.add(mUidPieDiagramBtn);
                    mUidPieDiagramBtn.setText("UID Pie");
                    mUidPieDiagramBtn.setBounds(207, 7, 90, 24);
                }
                {
                    jLabel3 = new JLabel();
                    jPanel5.add(jLabel3);
                    jLabel3.setText("-");
                    jLabel3.setBounds(128, 10, 10, 17);
                }
                {
                    mSecondRangeText = new JTextField();
                    jPanel5.add(mSecondRangeText);
                    mSecondRangeText.setBounds(138, 7, 63, 24);
                }
                {
                    mComponentPieBtn = new JButton();
                    jPanel5.add(mComponentPieBtn);
                    mComponentPieBtn.setText("PHONE Pie");
                    mComponentPieBtn.setBounds(59, 36, 238, 16);
                }
            }
            {
                jPanel6 = new JPanel();
                getContentPane().add(jPanel6, "West");
                jPanel6.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                jPanel6.setBounds(322, 356, 275, 66);
                jPanel6.setLayout(null);
                {
                    jLabel4 = new JLabel();
                    jPanel6.add(jLabel4);
                    jLabel4.setText("TotalPM");
                    jLabel4.setBounds(16, 10, 56, 26);
                }
                {
                    mChartMeanUnitTextField = new JTextField();
                    jPanel6.add(mChartMeanUnitTextField);
                    mChartMeanUnitTextField.setBounds(77, 7, 135, 29);
                }
                {
                    m3DBarChartMean = new JButton();
                    jPanel6.add(m3DBarChartMean);
                    m3DBarChartMean.setText("ok");
                    m3DBarChartMean.setBounds(218, 7, 49, 24);
                }
                {
                    mAudioCheckBox = new JCheckBox();
                    jPanel6.add(mAudioCheckBox);
                    mAudioCheckBox.setText("AUDIO");
                    mAudioCheckBox.setBounds(79, 40, 65, 21);
                }
                {
                    mGPSCheckBox = new JCheckBox();
                    jPanel6.add(mGPSCheckBox);
                    mGPSCheckBox.setText("GPS");
                    mGPSCheckBox.setBounds(151, 40, 56, 21);
                }
            }
            {
                jPanel4 = new JPanel();
                getContentPane().add(jPanel4, "North");
                FlowLayout jPanel4Layout = new FlowLayout();
                jPanel4.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                jPanel4.setLayout(jPanel4Layout);
                jPanel4.setBounds(12, 523, 590, 66);
                {
                    mAppTotalPowerBtn = new JButton();
                    jPanel4.add(mAppTotalPowerBtn);
                    mAppTotalPowerBtn.setText("UID Line Total Power");
                    mAppTotalPowerBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mAppStackedPower = new JButton();
                    jPanel4.add(mAppStackedPower);
                    mAppStackedPower.setText("UID Stack Total Power");
                    mAppStackedPower.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mLedBtn = new JButton();
                    jPanel4.add(mLedBtn);
                    mLedBtn.setText("UID LED Power");
                    mLedBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mCpuBtn = new JButton();
                    jPanel4.add(mCpuBtn);
                    mCpuBtn.setText("UID CPU Power");
                    mCpuBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mWifiBtn = new JButton();
                    jPanel4.add(mWifiBtn);
                    mWifiBtn.setText("UID WIFI Power");
                    mWifiBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    m3GBtn = new JButton();
                    jPanel4.add(m3GBtn);
                    m3GBtn.setText("UID ThreeG Power");
                    m3GBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
            }
            {
                jPanel7 = new JPanel();
                getContentPane().add(jPanel7, "North");
                FlowLayout jPanel7Layout = new FlowLayout();
                jPanel7.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
                jPanel7.setLayout(jPanel7Layout);
                jPanel7.setBounds(12, 618, 590, 63);
                {
                    mComponentLEDBtn = new JButton();
                    jPanel7.add(mComponentLEDBtn);
                    mComponentLEDBtn.setText("LED Power");
                    mComponentLEDBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mComponentWIFIBtn = new JButton();
                    jPanel7.add(mComponentWIFIBtn);
                    mComponentWIFIBtn.setText("WIFI Power");
                    mComponentWIFIBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mGpsBtn = new JButton();
                    jPanel7.add(mGpsBtn);
                    mGpsBtn.setText("GPS Power");
                    mGpsBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mComponentCPUBtn = new JButton();
                    jPanel7.add(mComponentCPUBtn);
                    mComponentCPUBtn.setText("CPU Power");
                    mComponentCPUBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mComponentThreeGBtn = new JButton();
                    jPanel7.add(mComponentThreeGBtn);
                    mComponentThreeGBtn.setText("ThreeG Power");
                    mComponentThreeGBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
                {
                    mAudioBtn = new JButton();
                    jPanel7.add(mAudioBtn);
                    mAudioBtn.setText("AUDIO Power");
                    mAudioBtn.setPreferredSize(new java.awt.Dimension(140, 24));
                }
            }
            {
                jLabel1 = new JLabel();
                getContentPane().add(jLabel1);
                jLabel1.setText("Individual App component Power");
                jLabel1.setBounds(12, 506, 202, 17);
            }
            {
                jLabel2 = new JLabel();
                getContentPane().add(jLabel2);
                jLabel2.setText("Function Button");
                jLabel2.setBounds(12, 411, 181, 17);
            }
            {
                jLabel5 = new JLabel();
                getContentPane().add(jLabel5);
                jLabel5.setText("Individual H/W Component Power");
                jLabel5.setBounds(12, 601, 223, 17);
            }
            {
                jScrollPane2 = new JScrollPane();
                getContentPane().add(jScrollPane2);
                jScrollPane2.setBounds(493, 122, 108, 194);
                {
                    listModelUidDelte = new DefaultListModel();// List? ??  ??.
                    mDeleteList = new JList(listModelUidDelte);
                    jScrollPane2.setViewportView(mDeleteList);
                }
            }
            {
                mDeleteAllBtn = new JButton();
                getContentPane().add(mDeleteAllBtn);
                mDeleteAllBtn.setText("A");
                mDeleteAllBtn.setBounds(493, 321, 51, 24);
            }
            {
                mDeleteOneBtn = new JButton();
                getContentPane().add(mDeleteOneBtn);
                mDeleteOneBtn.setText("O");
                mDeleteOneBtn.setBounds(549, 321, 48, 24);
            }
            {
                mDeleteUidMoveBtn = new JButton();
                getContentPane().add(mDeleteUidMoveBtn);
                mDeleteUidMoveBtn.setText(">");
                mDeleteUidMoveBtn.setBounds(443, 169, 45, 95);
            }
            {
                jLabel6 = new JLabel();
                getContentPane().add(jLabel6);
                jLabel6.setText("Package Name List");
                jLabel6.setBounds(13, 99, 139, 17);
            }
            {
                jLabel7 = new JLabel();
                getContentPane().add(jLabel7);
                jLabel7.setText("Remove Uid");
                jLabel7.setBounds(493, 100, 139, 17);
            }
            pack();
            this.setSize(623, 725);
            // setVisible(true);
        } catch (Exception e) {
            // add your error handling code here
            e.printStackTrace();
        }
    }

    //  ? ?   ?.
    @Override
    public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub
        if (e.getSource() == mFileBtn) {
            if (mJFileChooser != null) {
                //  ? ??    ?.
                if (mFileName != null) {
                    String dir = mFileName.getAbsolutePath(); //  ?? 
                    //   .
                    mJFileChooser = new JFileChooser(dir);
                }
                int returnVal = mJFileChooser.showOpenDialog(this);

                if (returnVal != JFileChooser.APPROVE_OPTION)
                    return; //     .

                mFileName = mJFileChooser.getSelectedFile();
                mFilePathTextField.setText(mFileName.getAbsolutePath());

            }
        } else if (e.getSource() == mGPSCheckBox) {
            FLAG_GPS_STATE = mGPSCheckBox.isSelected();
        } else if (e.getSource() == mAudioCheckBox) {
            FLAG_AUDIO_STATE = mAudioCheckBox.isSelected();
        } else if (e.getSource() == mParsingBtn) {
            // List  .
            listModel.clear();
            //   ? ?? ?  .
            mCFileStream.setFileName(mFileName.getAbsolutePath());
            // UID  ? . ?   .
            try {
                mUidArrayList = mCFileStream.ParsingUID();
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

            for (int i = 0; i < mUidArrayList.size(); i++) {
                listModel.addElement(mUidArrayList.get(i));
            }
        } else if (e.getSource() == mTotalPowerBtn) {
            try {
                int LastUnit = 50; //  ?   ?.
                double totalSum = 0.0, mean = 0.0;
                // ? ?  .
                mTotalPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_POWER);
                // ? .
                mTimeArrayList = mCFileStream.ParsingTime();
                //?  
                PrintWriter out = new PrintWriter(new FileWriter("TotalPower.txt"));
                for (int i = 0; i < mTotalPowerArrayList.size(); i++) {
                    out.printf("%s %d\n", mTimeArrayList.get(i), mTotalPowerArrayList.get(i));
                    out.flush();
                }
                out.close();

                /*
                // 50  ??  .
                for (int i = 0; i < mTotalPowerArrayList.size(); i += 50) {
                   totalSum = 0.0; //  .
                   mean = 0.0;
                   for (int j = 0; j < 50; j++) {
                      if ((j + i) >= mTotalPowerArrayList.size()) {
                 LastUnit = j;
                 break; // ???   .
                      }
                      totalSum += mTotalPowerArrayList.get(j + i);
                   }
                   mean = totalSum / LastUnit;
                   System.out.printf("%f\n", mean);
                }*/

                LineGraphGenerate(mTotalPowerArrayList, "Line Graph", "Total Power Consumption",
                        "Total Power Value");
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
        //?  stack   ? 
        else if (e.getSource() == mPhoneTotalStackPowerBtn) {
            try {

                // ? 
                if (listModelUidDelte.getSize() == 0) {
                    //? H/W component  Stack Grap? . ? Grap? Line? ? ? ?.
                    StackedXYAreaRenderer(mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_CPU_POWER),
                            mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_WIFI_POWER),
                            mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_LED_POWER),
                            mCFileStream.ParsingPowerConsumption(mSearchUid, GPS_POWER),
                            mCFileStream.ParsingPowerConsumption(mSearchUid, AUDIO_POWER),
                            mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_THREEG_POWER));
                } else {
                    //? ?  arraylist?  .
                    mCpuPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_CPU_POWER);
                    mWifiPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_WIFI_POWER);
                    mLedPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_LED_POWER);
                    mThreeGPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_THREEG_POWER);
                    mGpsPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, GPS_POWER);
                    mAudioPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, AUDIO_POWER);

                    // ?  UID? Power? ? ?   ArrayList  .
                    processUidDeletePower();
                    //CPU,WIFI,LED,GPS,AUDIO,3G  .
                    StackedXYAreaRenderer(mCpuPowerArrayList, mWifiPowerArrayList, mLedPowerArrayList,
                            mGpsPowerArrayList, mAudioPowerArrayList, mThreeGPowerArrayList);
                }
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        } else if (e.getSource() == mBatteryCapacityBtn) {
            try {
                mBatteryCapacityArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, BATTERY_CAPACITY);
                LineGraphGenerate(mBatteryCapacityArrayList, "Line Graph", "Battery Capacity",
                        "Battery Capacity (%)");
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

        } else if (e.getSource() == mCpuBtn) {
            try {
                mCpuPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, CPU_POWER);
                LineGraphGenerate(mCpuPowerArrayList, "Line Graph", "CPU Power Consumption", "CPU Power Value");
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        } else if (e.getSource() == mWifiBtn) {
            try {
                mWifiPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, WIFI_POWER);
                LineGraphGenerate(mWifiPowerArrayList, "Line Graph", "WIFI Power Consumption", "WIFI Power Value");
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        } else if (e.getSource() == m3GBtn) {
            try {
                mThreeGPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, THREEG_POWER);
                LineGraphGenerate(mThreeGPowerArrayList, "Line Graph", "ThreeG Power Consumption",
                        "ThreeG Power Value");
            } catch (FileNotFoundException e1) {
                e1.printStackTrace();
            }

        } else if (e.getSource() == mLedBtn) {
            try {
                mLedPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, LED_POWER);
                LineGraphGenerate(mLedPowerArrayList, "Line Graph", "LED Power Consumption", "LED Power Value");
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        } else if (e.getSource() == mGpsBtn) {
            try {
                mGpsPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, GPS_POWER);
                LineGraphGenerate(mGpsPowerArrayList, "Line Graph", "GPS Power Consumption", "GPS Power Value");
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        } else if (e.getSource() == mAudioBtn) {
            try {
                mAudioPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, AUDIO_POWER);
                LineGraphGenerate(mAudioPowerArrayList, "Line Graph", "AUDIO Power Consumption",
                        "Audio Power Value");
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
        //?  ?  . (UID ? .)
        else if (e.getSource() == mComponentWIFIBtn) {
            try {
                mComponentWifiArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_WIFI_POWER);
                LineGraphGenerate(mComponentWifiArrayList, "Line Graph", "ComponentWifi Power Consumption",
                        "ComponentWifi Power Value");
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
        }
        // ? ?    ?.
        else if (e.getSource() == mDevicesPowerButton) {

            int maxCPU = 0;
            int maxWIFI = 0;
            int maxThree = 0;
            int maxLED = 0;
            int maxGPS = 0;
            int maxAUDIO = 0;

            try {
                maxCPU = maxEvaluation(mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_CPU_POWER));
                maxWIFI = maxEvaluation(mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_WIFI_POWER));
                maxThree = maxEvaluation(mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_THREEG_POWER));
                maxLED = maxEvaluation(mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_LED_POWER));
                maxGPS = maxEvaluation(mCFileStream.ParsingPowerConsumption(mSearchUid, GPS_POWER));
                maxAUDIO = maxEvaluation(mCFileStream.ParsingPowerConsumption(mSearchUid, AUDIO_POWER));

                System.out.println("CPU " + maxCPU);
                System.out.println("WIFI " + maxWIFI);
                System.out.println("3G " + maxThree);
                System.out.println("LED " + maxLED);
                System.out.println("GPS " + maxGPS);
                System.out.println("AUDIO " + maxAUDIO);
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

        }
        //Component Pipe Diagram make function.
        else if (e.getSource() == mComponentPieBtn) {
            double[] value = new double[6];
            String[] group = new String[6];
            group[0] = "CPU Power";
            group[1] = "WIFI Power";
            group[2] = "LED Power";
            group[3] = "GPS Power";
            group[4] = "AUDIO Power";
            group[5] = "3G Power";
            value[0] = 0.0;
            value[1] = 0.0;
            value[2] = 0.0;
            value[3] = 0.0;
            value[4] = 0.0;
            value[5] = 0.0;

            int totalPowerValue = 0;
            if (mFirstRangeText.getText() != "") {
                //   .
                mFirstRange = Integer.parseInt(mFirstRangeText.getText());
                mSecondRange = Integer.parseInt(mSecondRangeText.getText());

                // ?  ?.
                try {
                    mCpuPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_CPU_POWER);
                    mWifiPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_WIFI_POWER);
                    mLedPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_LED_POWER);
                    mGpsPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, GPS_POWER);
                    mAudioPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, AUDIO_POWER);
                    mThreeGPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_THREEG_POWER);

                    processUidDeletePower(); //  ? ? .

                    for (int i = mFirstRange; i <= mSecondRange; i++) {
                        //  ? ?  .
                        value[0] += (double) mCpuPowerArrayList.get(i);
                        value[1] += (double) mWifiPowerArrayList.get(i);
                        value[2] += (double) mLedPowerArrayList.get(i);
                        value[5] += (double) mThreeGPowerArrayList.get(i);
                        if (FLAG_GPS_STATE == true && FLAG_AUDIO_STATE == true) {
                            value[3] += (double) mGpsPowerArrayList.get(i);
                            value[4] += (double) mAudioPowerArrayList.get(i);
                        } else if (FLAG_GPS_STATE == true && FLAG_AUDIO_STATE == false) {
                            value[3] += (double) mGpsPowerArrayList.get(i);
                            value[4] = 0.0;
                        } else if (FLAG_GPS_STATE == false && FLAG_AUDIO_STATE == true) {
                            value[3] = 0.0;
                            value[4] += (double) mAudioPowerArrayList.get(i);
                        }
                    }

                } catch (FileNotFoundException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }

                PieGraphGenerate(group, value, "", "");
            }
        }
        // Pipe ?? ? ??  
        else if (e.getSource() == mUidPieDiagramBtn) {
            double[] value = new double[6];
            String[] group = new String[6];
            group[0] = "CPU Power";
            group[1] = "WIFI Power";
            group[2] = "LED Power";
            group[3] = "GPS Power";
            group[4] = "AUDIO Power";
            group[5] = "3G Power";
            value[0] = 0.0;
            value[1] = 0.0;
            value[2] = 0.0;
            value[3] = 0.0;
            value[4] = 0.0;
            value[5] = 0.0;

            int totalPowerValue = 0;
            if (mFirstRangeText.getText() != "") {
                //   .
                mFirstRange = Integer.parseInt(mFirstRangeText.getText());
                mSecondRange = Integer.parseInt(mSecondRangeText.getText());

                // ?  ?.
                try {
                    mCpuPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, CPU_POWER);
                    mWifiPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, WIFI_POWER);
                    mLedPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, LED_POWER);
                    mGpsPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, GPS_POWER);
                    mAudioPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, AUDIO_POWER);
                    mThreeGPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, THREEG_POWER);

                    //  ? ??    ?.
                    mTotalPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_POWER);

                    for (int i = mFirstRange; i <= mSecondRange; i++) {
                        //  ? ?  .
                        value[0] += (double) mCpuPowerArrayList.get(i);
                        value[1] += (double) mWifiPowerArrayList.get(i);
                        value[2] += (double) mLedPowerArrayList.get(i);
                        value[5] += (double) mThreeGPowerArrayList.get(i);
                        if (FLAG_GPS_STATE == true && FLAG_AUDIO_STATE == true) {
                            value[3] += (double) mGpsPowerArrayList.get(i);
                            value[4] += (double) mAudioPowerArrayList.get(i);
                        } else if (FLAG_GPS_STATE == true && FLAG_AUDIO_STATE == false) {
                            value[3] += (double) mGpsPowerArrayList.get(i);
                            value[4] = 0.0;
                        } else if (FLAG_GPS_STATE == false && FLAG_AUDIO_STATE == true) {
                            value[3] = 0.0;
                            value[4] += (double) mAudioPowerArrayList.get(i);
                        }
                        totalPowerValue += mTotalPowerArrayList.get(i);
                    }
                    System.out.println(totalPowerValue);
                } catch (FileNotFoundException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }

                PieGraphGenerate(group, value, "", "");
            }
        }
        //Component  .
        else if (e.getSource() == mComponentLEDBtn) {

        }
        // 3D bar chart Range? ??  .
        else if (e.getSource() == m3DBarChartMean) {
            int unit = 0;
            int sumCPU = 0;
            int sumWIFI = 0;
            int sumLED = 0;
            int sumGPS = 0;
            int sumAUDIO = 0;
            int sumThree = 0;
            int totalsum = 0;
            int powtotalsum = 0;
            int LastUnit = 0;
            double mean;
            double totalmean;
            double Powe2mean;
            boolean flagGPS = false;
            boolean flagAUDIO = false;

            // ? ? ? .
            flagGPS = mGPSCheckBox.isSelected();
            flagAUDIO = mAudioCheckBox.isSelected();

            ArrayList<Double> mTotalArrayList = new ArrayList<Double>();
            ArrayList<Double> mUnitCPUArrayList = new ArrayList<Double>();
            ArrayList<Double> mUnitWIFIPowerArrayList = new ArrayList<Double>();
            ArrayList<Double> mUnitThreePowerArrayList = new ArrayList<Double>();
            ArrayList<Double> mUnitLEDPowerArrayList = new ArrayList<Double>();
            ArrayList<Double> mUnitGPSPowerArrayList = new ArrayList<Double>();
            ArrayList<Double> mUnitAUDIOPowerArrayList = new ArrayList<Double>();

            if (mChartMeanUnitTextField.getText() != "") {
                unit = Integer.parseInt(mChartMeanUnitTextField.getText());
                //  ??  ?   ?? ? ?. (e.g 1 ?? ?? 40
                // ? ? ? ?.
                // ? ??  ?      ?   .
                LastUnit = Integer.parseInt(mChartMeanUnitTextField.getText());
            }
            // ? Power ? .
            try {

                mCpuPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_CPU_POWER);
                mWifiPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_WIFI_POWER);
                mThreeGPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_THREEG_POWER);
                mLedPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, TOTAL_LED_POWER);
                mGpsPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, GPS_POWER);
                mAudioPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, AUDIO_POWER);

            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

            // list   .
            processUidDeletePower();

            // unit ? ??  .
            for (int i = 0; i < mCpuPowerArrayList.size(); i += unit) {
                sumCPU = 0;
                sumWIFI = 0;
                sumThree = 0;
                sumLED = 0;
                sumGPS = 0;
                sumAUDIO = 0;

                totalsum = 0;
                powtotalsum = 0;

                for (int j = 0; j < unit; j++) {
                    if ((j + i) >= mCpuPowerArrayList.size()) {
                        // ?   . ?  ??  ?.
                        LastUnit = j; // ?  ?  .
                        break;
                    }
                    sumCPU += mCpuPowerArrayList.get(j + i);
                    sumWIFI += mWifiPowerArrayList.get(j + i);
                    sumThree += mThreeGPowerArrayList.get(j + i);
                    sumLED += mLedPowerArrayList.get(j + i);

                    // ? ? ? .
                    if (flagGPS == true && flagAUDIO == true) {
                        sumGPS += mGpsPowerArrayList.get(j + i);
                        sumAUDIO += mAudioPowerArrayList.get(j + i);

                        totalsum = mCpuPowerArrayList.get(j + i) + mWifiPowerArrayList.get(j + i)
                                + mThreeGPowerArrayList.get(j + i) + mLedPowerArrayList.get(j + i)
                                + mGpsPowerArrayList.get(j + i) + mAudioPowerArrayList.get(j + i);

                    } else if (flagGPS == true && flagAUDIO == false) {
                        sumGPS += mGpsPowerArrayList.get(j + i);

                        totalsum = mCpuPowerArrayList.get(j + i) + mWifiPowerArrayList.get(j + i)
                                + mThreeGPowerArrayList.get(j + i) + mLedPowerArrayList.get(j + i)
                                + mGpsPowerArrayList.get(j + i);
                    } else if (flagGPS == false && flagAUDIO == true) {
                        sumAUDIO += mAudioPowerArrayList.get(j + i);

                        totalsum = mCpuPowerArrayList.get(j + i) + mWifiPowerArrayList.get(j + i)
                                + mThreeGPowerArrayList.get(j + i) + mLedPowerArrayList.get(j + i)
                                + mAudioPowerArrayList.get(j + i);
                    } else {
                        totalsum = mCpuPowerArrayList.get(j + i) + mWifiPowerArrayList.get(j + i)
                                + mThreeGPowerArrayList.get(j + i) + mLedPowerArrayList.get(j + i);
                    }
                    powtotalsum += (int) Math.pow(totalsum, 2);
                    totalsum = 0;

                }

                /*
                 * LastUnit? break?   ? ?    ? . ? ??
                 * ? ? ? ?  ? .
                 */
                mean = sumCPU / LastUnit;
                mUnitCPUArrayList.add(mean);
                mean = sumWIFI / LastUnit;
                mUnitWIFIPowerArrayList.add(mean);
                mean = sumThree / LastUnit;
                mUnitThreePowerArrayList.add(mean);
                mean = sumLED / LastUnit;
                mUnitLEDPowerArrayList.add(mean);

                if ((flagGPS == true) && (flagAUDIO == true)) {
                    mean = sumGPS / LastUnit;
                    mUnitGPSPowerArrayList.add(mean);
                    mean = sumAUDIO / LastUnit;
                    mUnitAUDIOPowerArrayList.add(mean);

                    totalmean = (sumCPU + sumWIFI + sumThree + sumLED + sumGPS + sumAUDIO) / LastUnit;
                    //  .
                    Powe2mean = Math.sqrt((powtotalsum / LastUnit)
                            - Math.pow(((sumCPU + sumWIFI + sumThree + sumLED + sumGPS + sumAUDIO) / LastUnit), 2));
                    // ?   .
                    /*               System.out.println((i / 60) + ": ?: " + totalmean
                                         + " : " + Powe2mean);*/
                    System.out.println("" + totalmean);
                } else if ((flagGPS == true) && (flagAUDIO == false)) {
                    mean = sumGPS / LastUnit;
                    mUnitGPSPowerArrayList.add(mean);
                    mUnitAUDIOPowerArrayList.add(0.0);

                    totalmean = (sumCPU + sumWIFI + sumLED + sumGPS) / LastUnit;
                    //  .
                    Powe2mean = Math.sqrt((powtotalsum / LastUnit)
                            - Math.pow(((sumCPU + sumWIFI + sumThree + sumLED + sumGPS) / LastUnit), 2));
                    /*System.out.println((i / 60) + ": ?: " + totalmean
                          + " : " + Powe2mean);*/
                    System.out.println("" + totalmean);
                } else if (flagGPS == false && flagAUDIO == true) {
                    mUnitGPSPowerArrayList.add(0.0);
                    mean = sumAUDIO / LastUnit;
                    mUnitAUDIOPowerArrayList.add(mean);

                    totalmean = (sumCPU + sumWIFI + sumLED + sumAUDIO) / LastUnit;
                    //  .
                    Powe2mean = Math.sqrt((powtotalsum / LastUnit)
                            - Math.pow(((sumCPU + sumWIFI + sumThree + sumLED + sumAUDIO) / LastUnit), 2));
                    /*System.out.println((i / 60) + ": ?: " + totalmean
                          + " : " + Powe2mean);*/
                    System.out.println("" + totalmean);
                } else {
                    mUnitGPSPowerArrayList.add(0.0);
                    mUnitAUDIOPowerArrayList.add(0.0);

                    totalmean = (sumCPU + sumWIFI + sumLED) / LastUnit;
                    //  .
                    Powe2mean = Math.sqrt((powtotalsum / LastUnit)
                            - Math.pow(((sumCPU + sumWIFI + sumThree + sumLED) / LastUnit), 2));
                    /*System.out.println((i / 60) + ": ?: " + totalmean
                          + " : " + Powe2mean);*/
                    System.out.println("" + totalmean);
                }

            }

            for (int i = 0; i < mUnitCPUArrayList.size(); i++) {
                double sum = mUnitCPUArrayList.get(i) + mUnitWIFIPowerArrayList.get(i)
                        + mUnitThreePowerArrayList.get(i) + mUnitLEDPowerArrayList.get(i)
                        + mUnitGPSPowerArrayList.get(i) + mUnitAUDIOPowerArrayList.get(i);
                System.out.println("" + sum);
            }
            // 3D bar chart ? .
            StackedBarChart3D(mUnitCPUArrayList, mUnitWIFIPowerArrayList, mUnitThreePowerArrayList,
                    mUnitLEDPowerArrayList, mUnitGPSPowerArrayList, mUnitAUDIOPowerArrayList);

        }
        // ? App Line  ?.
        else if (e.getSource() == mAppTotalPowerBtn) {
            int totalPower;
            ArrayList<Integer> mUidTotalPowerArrayList = new ArrayList<Integer>();
            try {

                mCpuPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, CPU_POWER);
                mWifiPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, WIFI_POWER);
                mLedPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, LED_POWER);
                mGpsPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, GPS_POWER);
                mAudioPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, AUDIO_POWER);

                /* log ?  */
                mLogScaleTextFiled.setText(String.format("%d", mCpuPowerArrayList.size() - 1));

            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            // uid  ? Line Grahp .
            for (int i = 0; i < mCpuPowerArrayList.size(); i++) {
                totalPower = mCpuPowerArrayList.get(i) + mWifiPowerArrayList.get(i) + mLedPowerArrayList.get(i);
                if (FLAG_GPS_STATE == true && FLAG_AUDIO_STATE == true) {
                    totalPower += mGpsPowerArrayList.get(i) + mAudioPowerArrayList.get(i);
                } else if (FLAG_GPS_STATE == true && FLAG_AUDIO_STATE == false) {
                    totalPower += mGpsPowerArrayList.get(i);
                } else if (FLAG_GPS_STATE == false && FLAG_AUDIO_STATE == true) {
                    totalPower += mAudioPowerArrayList.get(i);
                }
                mUidTotalPowerArrayList.add(totalPower);
            }
            LineGraphGenerate(mUidTotalPowerArrayList, "Line Graph", "App Total Power", "Power Value");
        }
        // ? App XY Area ?.
        else if (e.getSource() == mAppStackedPower) {
            try {
                mCpuPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, CPU_POWER);
                mWifiPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, WIFI_POWER);
                mLedPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, LED_POWER);
                mGpsPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, GPS_POWER);
                mAudioPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, AUDIO_POWER);
                mThreeGPowerArrayList = mCFileStream.ParsingPowerConsumption(mSearchUid, THREEG_POWER);
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            StackedXYAreaRenderer(mCpuPowerArrayList, mWifiPowerArrayList, mLedPowerArrayList, mGpsPowerArrayList,
                    mAudioPowerArrayList, mThreeGPowerArrayList);
        }
        // List? ???  
        else if (e.getSource() == mDeleteUidMoveBtn) {
            listModelUidDelte.addElement(mSearchUid); //? UID  UID List ?? .
        }
        // List?  UID 
        else if (e.getSource() == mDeleteAllBtn) {
            listModelUidDelte.clear();
        }
        // List? ? UID 
        else if (e.getSource() == mDeleteOneBtn) {
            listModelUidDelte.remove(mDeleteList.getSelectedIndex());

        }
        //?   ?  ?.
        else if (e.getSource() == mTotalCompareBtn) {
            DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
            DefaultStatisticalCategoryDataset defaultstatisticalcategorydataset = new DefaultStatisticalCategoryDataset();

            //? (?) sd 157.97
            defaultcategorydataset.addValue(167, "CPU Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(400, "WIFI Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(0, "LED Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "MYPEOPLE-Voice");
            //?(??) sd 144.44
            defaultcategorydataset.addValue(197, "CPU Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(404, "WIFI Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(399, "LED Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "MYPEOPLE-Video");
            // sd : 246.80
            defaultcategorydataset.addValue(91, "CPU Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(110, "WIFI Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(454, "LED Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "KAKAo-Talk");
            // sd : 188.30
            defaultcategorydataset.addValue(134, "CPU Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(66, "WIFI Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(528, "LED Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(103, "AUDIO Power(mW)", "Angry-Birds");
            // sd : 233.50
            defaultcategorydataset.addValue(40, "CPU Power(mW)", "Youtube");
            defaultcategorydataset.addValue(131, "WIFI Power(mW)", "Youtube");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "Youtube");
            defaultcategorydataset.addValue(474, "LED Power(mW)", "Youtube");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "Youtube");
            defaultcategorydataset.addValue(91, "AUDIO Power(mW)", "Youtube");
            //?  sd : 301.80
            defaultcategorydataset.addValue(382, "CPU Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(0, "WIFI Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(823, "3G Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(570, "LED Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "Web-Browser");

            defaultcategorydataset.addValue(60, "CPU Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(0, "WIFI Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(750, "3G Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(538, "LED Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(244, "GPS Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "Google-Map");

            JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("", "Application Name", "Power(mW)",
                    defaultcategorydataset, PlotOrientation.HORIZONTAL, true, true, false);

            CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
            categoryplot.setBackgroundPaint(new Color(255, 255, 255));// 
            // ?  ?.
            // IntervalMarker intervalmarker = new IntervalMarker(5D, 10D,
            // Color.gray, new BasicStroke(0.5F), Color.blue, new BasicStroke(0.5F),
            // 0.5F);
            // categoryplot.addRangeMarker(intervalmarker);

            BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
            barrenderer.setDrawBarOutline(false);
            barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
            barrenderer.setBaseItemLabelsVisible(true);
            barrenderer.setBasePositiveItemLabelPosition(
                    new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER));
            barrenderer.setBaseNegativeItemLabelPosition(
                    new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER));

            // JFrame?  ?.
            ChartPanel chartPanel = new ChartPanel(jfreechart);
            JFrame f = new JFrame("");
            f.setSize(600, 600);
            f.getContentPane().add(chartPanel);

            // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setVisible(true);

        }
        // ? ? ?   . 
        else if (e.getSource() == mCompareAppPowerBtn) {
            DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();
            DefaultStatisticalCategoryDataset defaultstatisticalcategorydataset = new DefaultStatisticalCategoryDataset();

            //? (?) sd 38.6
            defaultcategorydataset.addValue(313, "CPU Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(404, "WIFI Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(0, "LED Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "MYPEOPLE-Voice");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "MYPEOPLE-Voice");
            //?(??) sd 144.44
            defaultcategorydataset.addValue(277, "CPU Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(396, "WIFI Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(411, "LED Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "MYPEOPLE-Video");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "MYPEOPLE-Video");

            defaultcategorydataset.addValue(93, "CPU Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(166, "WIFI Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(465, "LED Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "KAKAo-Talk");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "KAKAo-Talk");

            defaultcategorydataset.addValue(149, "CPU Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(88, "WIFI Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(534, "LED Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "Angry-Birds");
            defaultcategorydataset.addValue(106, "AUDIO Power(mW)", "Angry-Birds");

            defaultcategorydataset.addValue(32, "CPU Power(mW)", "Youtube");
            defaultcategorydataset.addValue(136, "WIFI Power(mW)", "Youtube");
            defaultcategorydataset.addValue(0, "3G Power(mW)", "Youtube");
            defaultcategorydataset.addValue(520, "LED Power(mW)", "Youtube");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "Youtube");
            defaultcategorydataset.addValue(103, "AUDIO Power(mW)", "Youtube");

            defaultcategorydataset.addValue(411, "CPU Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(0, "WIFI Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(883, "3G Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(626, "LED Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(0, "GPS Power(mW)", "Web-Browser");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "Web-Browser");

            defaultcategorydataset.addValue(94, "CPU Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(0, "WIFI Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(902, "3G Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(581, "LED Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(268, "GPS Power(mW)", "Google-Map");
            defaultcategorydataset.addValue(0, "AUDIO Power(mW)", "Google-Map");

            JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("", "Application Name", "Power(mW)",
                    defaultcategorydataset, PlotOrientation.HORIZONTAL, true, true, false);

            CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
            categoryplot.setBackgroundPaint(new Color(255, 255, 255));// 
            // ?  ?.
            // IntervalMarker intervalmarker = new IntervalMarker(5D, 10D,
            // Color.gray, new BasicStroke(0.5F), Color.blue, new BasicStroke(0.5F),
            // 0.5F);
            // categoryplot.addRangeMarker(intervalmarker);

            BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
            barrenderer.setDrawBarOutline(false);
            barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
            barrenderer.setBaseItemLabelsVisible(true);
            barrenderer.setBasePositiveItemLabelPosition(
                    new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER));
            barrenderer.setBaseNegativeItemLabelPosition(
                    new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER));

            // JFrame?  ?.
            ChartPanel chartPanel = new ChartPanel(jfreechart);
            JFrame f = new JFrame("");
            f.setSize(600, 600);
            f.getContentPane().add(chartPanel);

            // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setVisible(true);

        }
    }

    public int maxEvaluation(ArrayList<Integer> arArrayList) {
        int max = 0;
        for (int i = 0; i < arArrayList.size(); i++) {
            if (max < arArrayList.get(i)) {
                max = arArrayList.get(i);
            }
        }
        return max;
    }

    //list ??  ? 
    @Override
    public void valueChanged(ListSelectionEvent e) {
        // TODO Auto-generated method stub
        if (e.getSource() == mUidList) {
            // package name ? UID  index     .
            int indexEnd = -1;
            if (e.getValueIsAdjusting() == false) {

                if (mUidList.getSelectedIndex() == -1) {
                    // ?? ?   ? ?   .
                    ComponetStateChanger(POWER_BUTTON_OFF);
                } else {
                    // ?? ?  ?  .
                    ComponetStateChanger(POWER_BUTTON_ON);
                    mSearchUid = mUidList.getSelectedValue().toString();

                    indexEnd = mSearchUid.indexOf(" ");
                    mSearchUid = mSearchUid.substring(0, indexEnd);
                    mFilePathTextField.setText(mSearchUid);
                }
            }
        } else if (e.getSource() == mDeleteList) {

        }
    }

    //?  UID Power ?  
    public void processUidDeletePower() {

        ArrayList<Integer> tempListCpu = new ArrayList<Integer>();
        ArrayList<Integer> tempListLed = new ArrayList<Integer>();
        ArrayList<Integer> tempListWiFi = new ArrayList<Integer>();
        ArrayList<Integer> tempList3G = new ArrayList<Integer>();

        //Power  ? ? ?    ?? ? .
        for (int i = 0; i < listModelUidDelte.getSize(); i++) {
            try {
                // UID CPU power    
                tempListCpu = mCFileStream.ParsingPowerConsumption(listModelUidDelte.get(i).toString(), CPU_POWER);
                tempListLed = mCFileStream.ParsingPowerConsumption(listModelUidDelte.get(i).toString(), LED_POWER);
                tempListWiFi = mCFileStream.ParsingPowerConsumption(listModelUidDelte.get(i).toString(),
                        WIFI_POWER);
                tempList3G = mCFileStream.ParsingPowerConsumption(listModelUidDelte.get(i).toString(),
                        THREEG_POWER);
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            for (int j = 0; j < mCpuPowerArrayList.size(); j++) {
                mCpuPowerArrayList.set(j, mCpuPowerArrayList.get(j) - tempListCpu.get(j) < 0 ? 0
                        : mCpuPowerArrayList.get(j) - tempListCpu.get(j)); //? ? list  .
                mLedPowerArrayList.set(j, mLedPowerArrayList.get(j) - tempListLed.get(j) < 0 ? 0
                        : mLedPowerArrayList.get(j) - tempListLed.get(j)); //? ? list  
                mWifiPowerArrayList.set(j, mWifiPowerArrayList.get(j) - tempListWiFi.get(j) < 0 ? 0
                        : mWifiPowerArrayList.get(j) - tempListWiFi.get(j)); //? ? list  
                mThreeGPowerArrayList.set(j, mThreeGPowerArrayList.get(j) - tempList3G.get(j) < 0 ? 0
                        : mThreeGPowerArrayList.get(j) - tempList3G.get(j)); //? ? list  
            }
        }
    }

    // Device      ?.
    // 3? ?  .
    public void StackedBarChart3D(ArrayList<Double> arCpuArrayList, ArrayList<Double> arWifiArrayList,
            ArrayList<Double> arThreeArrayList, ArrayList<Double> arLedArrayList, ArrayList<Double> arGpsArrayList,
            ArrayList<Double> arAudioArrayList) {

        DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset();

        for (int i = 0; i < arCpuArrayList.size(); i++) {
            defaultcategorydataset.addValue(arCpuArrayList.get(i), "CPU Power(mW)", i + "");
            defaultcategorydataset.addValue(arWifiArrayList.get(i), "WIFI Power(mW)", i + "");
            defaultcategorydataset.addValue(arThreeArrayList.get(i), "3G Power(mW)", i + "");
            defaultcategorydataset.addValue(arLedArrayList.get(i), "LED Power(mW)", i + "");
            defaultcategorydataset.addValue(arGpsArrayList.get(i), "GPS Power(mW)", i + "");
            defaultcategorydataset.addValue(arAudioArrayList.get(i), "AUDIO Power(mW)", i + "");
        }

        JFreeChart jfreechart = ChartFactory.createStackedBarChart3D("Stacked Bar Chart", "Time", "Power(mW)",
                defaultcategorydataset, PlotOrientation.VERTICAL, true, true, false);

        CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
        // ?  ?.
        // IntervalMarker intervalmarker = new IntervalMarker(5D, 10D,
        // Color.gray, new BasicStroke(0.5F), Color.blue, new BasicStroke(0.5F),
        // 0.5F);
        // categoryplot.addRangeMarker(intervalmarker);

        BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
        barrenderer.setDrawBarOutline(false);
        barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        barrenderer.setBaseItemLabelsVisible(true);
        barrenderer
                .setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER));
        barrenderer
                .setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER));

        // JFrame?  ?.
        ChartPanel chartPanel = new ChartPanel(jfreechart);
        JFrame f = new JFrame("StackedXYAreaRenderer");
        f.setSize(600, 600);
        f.getContentPane().add(chartPanel);

        // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
    }

    // ? ? ?.
    public void StackedXYAreaRenderer(ArrayList<Integer> arCpuArrayList, ArrayList<Integer> arWifiArrayList,
            ArrayList<Integer> arLedArrayList, ArrayList<Integer> arGpsArrayList,
            ArrayList<Integer> arAudioArrayList, ArrayList<Integer> arThreeGArrayList) {

        boolean flagGPS, flagAUDIO;
        flagGPS = mGPSCheckBox.isSelected();
        flagAUDIO = mAudioCheckBox.isSelected();

        XYSeries xyseriesCPU = new XYSeries("CPU");
        XYSeries xyseriesWIFI = new XYSeries("WIFI");
        XYSeries xyseriesThreeG = new XYSeries("3G");
        XYSeries xyseriesLED = new XYSeries("LED");
        XYSeries xyseriesGPS = new XYSeries("GPS");
        XYSeries xyseriesAUDIO = new XYSeries("AUDIO");

        for (int i = 0; i < arCpuArrayList.size(); i++) {
            //Power Tutor Bug 
            if (arCpuArrayList.get(i) > 450) {
                arCpuArrayList.set(i, 450);
            }
            /*
             * stack ? (Top -> bottom)
             * AUDIO / GPS / LED / ThreeG / WIFI / CPU
             */
            xyseriesCPU.add(i, arCpuArrayList.get(i));
            xyseriesWIFI.add(i, arWifiArrayList.get(i) + arCpuArrayList.get(i));
            xyseriesThreeG.add(i, arThreeGArrayList.get(i) + arWifiArrayList.get(i) + arCpuArrayList.get(i));
            xyseriesLED.add(i, arLedArrayList.get(i) + arThreeGArrayList.get(i) + arWifiArrayList.get(i)
                    + arCpuArrayList.get(i));

            if (flagGPS == true && flagAUDIO == true) {
                xyseriesGPS.add(i, arGpsArrayList.get(i) + arLedArrayList.get(i) + arThreeGArrayList.get(i)
                        + arWifiArrayList.get(i) + arCpuArrayList.get(i));

                xyseriesAUDIO.add(i, arAudioArrayList.get(i) + arGpsArrayList.get(i) + arLedArrayList.get(i)
                        + arThreeGArrayList.get(i) + arWifiArrayList.get(i) + arCpuArrayList.get(i));

            } else if (flagGPS == true && flagAUDIO == false) {
                xyseriesGPS.add(i, arGpsArrayList.get(i) + arLedArrayList.get(i) + arThreeGArrayList.get(i)
                        + arWifiArrayList.get(i) + arCpuArrayList.get(i));

                xyseriesAUDIO.add(i, 0); // AUDIO ?  .
            } else if (flagGPS == false && flagAUDIO == true) {
                xyseriesGPS.add(i, 0); //GPS ?  .
                xyseriesAUDIO.add(i, arAudioArrayList.get(i) + arLedArrayList.get(i) + arThreeGArrayList.get(i)
                        + arWifiArrayList.get(i) + arCpuArrayList.get(i));
            } else {
                xyseriesGPS.add(i, 0); //GPS ?  .
                xyseriesAUDIO.add(i, 0); // AUDIO ?  .
            }
        }

        XYSeriesCollection xyseriescollection = new XYSeriesCollection();
        xyseriescollection.addSeries(xyseriesCPU);
        xyseriescollection.addSeries(xyseriesWIFI);
        xyseriescollection.addSeries(xyseriesThreeG);
        xyseriescollection.addSeries(xyseriesLED);
        xyseriescollection.addSeries(xyseriesGPS);
        xyseriescollection.addSeries(xyseriesAUDIO);

        JFreeChart jfreechart = ChartFactory.createXYLineChart("", "Time(sec)", "Power(mW)", xyseriescollection,
                PlotOrientation.VERTICAL, true, true, false);
        XYPlot xyplot = (XYPlot) jfreechart.getPlot();
        xyplot.setDomainPannable(true);
        xyplot.setBackgroundPaint(new Color(255, 255, 255));//?  . 

        XYStepAreaRenderer xysteparearenderer = new XYStepAreaRenderer(2);
        //?? ? . ?? 
        /*xysteparearenderer.setSeriesPaint(0, new Color(0,0,0));
        xysteparearenderer.setSeriesPaint(1, new Color(30,30,30));
        xysteparearenderer.setSeriesPaint(2, new Color(60,60,60));
        xysteparearenderer.setSeriesPaint(3, new Color(90,90,90));
        xysteparearenderer.setSeriesPaint(4, new Color(120,120,120));
        xysteparearenderer.setSeriesPaint(5, new Color(150,150,150));*/

        xysteparearenderer.setDataBoundsIncludesVisibleSeriesOnly(false);
        xysteparearenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
        xysteparearenderer.setDefaultEntityRadius(6);
        xyplot.setRenderer(xysteparearenderer);

        ChartPanel chartPanel = new ChartPanel(jfreechart);

        JFrame f = new JFrame("StackedXYAreaRenderer");
        f.setSize(600, 600);
        f.getContentPane().add(chartPanel);

        // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
    }

    // ?    ?.
    public void PieGraphGenerate(String[] arGrop, double[] arValue, String arTitle, String arSubTitle) {
        // ??   ?.
        DefaultPieDataset data = new DefaultPieDataset();
        data.setValue(arGrop[0], arValue[0]); //CPU
        data.setValue(arGrop[1], arValue[1]); //WIFI
        data.setValue(arGrop[5], arValue[5]); //3G
        data.setValue(arGrop[2], arValue[2]); //LED
        data.setValue(arGrop[3], arValue[3]); //GPS
        data.setValue(arGrop[4], arValue[4]); //AUDIO

        //offset data .
        RectangleInsets pieOffset = new RectangleInsets(50.0, 50.0, 50.0, 50.0);

        //  ?  ?.
        JFreeChart chart = ChartFactory.createPieChart(arTitle, data, true, true, false);
        TextTitle subTitle = new TextTitle(arSubTitle);
        chart.setBackgroundPaint(Color.WHITE);
        chart.addSubtitle(subTitle);
        PiePlot pieplot = (PiePlot) chart.getPlot();
        pieplot.setNoDataMessage("No data available");
        pieplot.setExplodePercent("LED", 0.20000000000000001D);
        pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1} mW) ({2} percent)"));
        pieplot.setLabelBackgroundPaint(new Color(220, 220, 220));
        pieplot.setLegendLabelToolTipGenerator(new StandardPieSectionLabelGenerator("Tooltip for legend item {0}"));
        //? 
        /*pieplot.setSectionPaint(arGrop[0], new Color(0,0,0));
        pieplot.setSectionPaint(arGrop[1], new Color(60,60,60));
        pieplot.setSectionPaint(arGrop[2], new Color(120,120,120));
        pieplot.setSectionPaint(arGrop[4], new Color(180,180,180));*/

        //pieplot.setSimpleLabels(true);
        //pieplot.setSimpleLabelOffset(pieOffset);   //?? offset? .

        pieplot.setInteriorGap(0.0D);

        // ??   ?.
        ChartPanel chartPanel = new ChartPanel(chart);
        JFrame f = new JFrame("");
        f.setSize(600, 600);
        f.getContentPane().add(chartPanel);

        // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
    }

    //  ? ??   ?.
    public void LineGraphGenerate(ArrayList<Integer> arList, String arTitle, String arSubTitle, String arLineName) {

        // ??? ?? .
        XYSeries series = new XYSeries(arLineName);
        for (int i = 0; i < arList.size(); i++) {
            //  ? ?  .
            series.add(i, arList.get(i));
        }
        //   ?  .
        XYDataset dataset = new XYSeriesCollection(series);

        //   ? ?.
        JFreeChart chart = ChartFactory.createXYLineChart(arTitle, "Time(sec)", "Power(mW)", dataset,
                org.jfree.chart.plot.PlotOrientation.VERTICAL, true, true, false);

        TextTitle subTitle = new TextTitle(arSubTitle);

        chart.setBackgroundPaint(Color.WHITE);
        chart.addSubtitle(subTitle);

        ChartPanel chartPanel = new ChartPanel(chart);

        JFrame f = new JFrame("Power consumption chart");
        f.setSize(600, 600);
        f.getContentPane().add(chartPanel);
        // ? ?  ? close ? .
        // f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
    }

    // ?? ?    ?.
    public void ComponetStateChanger(int mode) {
        if (mode == POWER_BUTTON_OFF) {
            mTotalPowerBtn.setEnabled(false);
            mBatteryCapacityBtn.setEnabled(false);
            mCpuBtn.setEnabled(false);
            mWifiBtn.setEnabled(false);
            mLedBtn.setEnabled(false);
            mGpsBtn.setEnabled(false);
            mAudioBtn.setEnabled(false);
            mAppTotalPowerBtn.setEnabled(false);

            mDevicesPowerButton.setEnabled(false);
            mAppStackedPower.setEnabled(false);
            m3GBtn.setEnabled(false);
            mComponentLEDBtn.setEnabled(false);
            mComponentWIFIBtn.setEnabled(false);
            mComponentThreeGBtn.setEnabled(false);
            mComponentCPUBtn.setEnabled(false);

        } else if (mode == POWER_BUTTON_ON) {
            mTotalPowerBtn.setEnabled(true);
            mBatteryCapacityBtn.setEnabled(true);
            mCpuBtn.setEnabled(true);
            mWifiBtn.setEnabled(true);
            mLedBtn.setEnabled(true);
            mGpsBtn.setEnabled(true);
            mAudioBtn.setEnabled(true);
            mAppTotalPowerBtn.setEnabled(true);

            mDevicesPowerButton.setEnabled(true);
            mAppStackedPower.setEnabled(true);
            m3GBtn.setEnabled(true);
            mComponentLEDBtn.setEnabled(true);
            mComponentWIFIBtn.setEnabled(true);
            mComponentThreeGBtn.setEnabled(true);
            mComponentCPUBtn.setEnabled(true);
        }
    }

}