Example usage for java.lang Double MIN_VALUE

List of usage examples for java.lang Double MIN_VALUE

Introduction

In this page you can find the example usage for java.lang Double MIN_VALUE.

Prototype

double MIN_VALUE

To view the source code for java.lang Double MIN_VALUE.

Click Source Link

Document

A constant holding the smallest positive nonzero value of type double , 2-1074.

Usage

From source file:com.opengamma.maths.lowlevelapi.functions.utilities.Max.java

/**
 * Returns the index of the maximum value in data
 * @param data the data to search//from   ww w. j  av a2 s. c  o  m
 * @return idx, the index of the maximum value in the data
 */
public static int index(double... data) {
    Validate.notNull(data);
    double max = Double.MIN_VALUE;
    int idx = -1;
    final int n = data.length;
    for (int i = 0; i < n; i++) {
        if (data[i] > max) {
            max = data[i];
            idx = i;
        }
    }
    return idx;
}

From source file:gsn.reports.scriptlets.StreamScriptlet.java

@SuppressWarnings("unchecked")
public void setStatistics() throws JRScriptletException {

    String max = "NA";
    String min = "NA";
    String average = "NA";
    String stdDeviation = "NA";
    String median = "NA";
    String nb = "0";
    String startTime = "NA";
    String endTime = "NA";
    String samplingAverage = "NA";
    //      String samplingAverageUnit      = "NA";
    String nbOfNull = "0";
    String samplingStdDeviation = "NA";
    //      String samplingStdDeviationUnit   = "NA";

    Collection<Data> datas = (Collection<Data>) this.getFieldValue("datas");
    if (datas.size() > 0) {
        Double max_value = Double.MIN_VALUE;
        Double min_value = Double.MAX_VALUE;
        Double average_value = 0.0;
        Double sum_value = 0.0;/*  ww w .  ja v  a2 s.co m*/
        Long start_time_value = 0L;
        Long end_time_value = 0L;
        Long sampling_average_value = 0L;
        Integer nb_value = 0;
        Integer nb_of_null = 0;
        Iterator<Data> iter = datas.iterator();
        Data nextData;
        Double nextDataValue;
        while (iter.hasNext()) {
            nextData = iter.next();
            if (nextData.getValue() != null) {
                nextDataValue = (Double) nextData.getValue();
                //
                sum_value += nextDataValue;
                //
                if (nextDataValue < min_value)
                    min_value = nextDataValue;
                if (nextDataValue > max_value)
                    max_value = nextDataValue;
                //               
                if (datas.size() == 1 || nb_value == datas.size() / 2)
                    median = nextDataValue.toString();
                //
                if (!iter.hasNext()) {
                    startTime = sdf.format(new Date((Long) nextData.getP2())).toString();
                    start_time_value = (Long) nextData.getP2();
                }
                if (nb_value == 0) {
                    endTime = sdf.format(new Date((Long) nextData.getP2())).toString();
                    end_time_value = (Long) nextData.getP2();
                }
            } else {
                nb_of_null++;
            }
            nb_value++;
        }
        //
        max = max_value == Double.MIN_VALUE ? "NA" : max_value.toString();
        min = min_value == Double.MAX_VALUE ? "NA" : min_value.toString();
        nb = nb_value.toString();
        average_value = (Double) (sum_value / nb_value);
        average = average_value.toString();
        nbOfNull = nb_of_null.toString();
        //
        if (datas.size() > 1) {
            sampling_average_value = (end_time_value - start_time_value) / (nb_value - 1);
            samplingAverage = Helpers.formatTimePeriod(sampling_average_value);
        }
        //
        iter = datas.iterator();
        Double variance_value = 0.0;
        Double sampling_variance_value = 0.0;
        Long lastDataTime = end_time_value;
        int i = 0;
        while (iter.hasNext()) {
            nextData = iter.next();
            if (nextData.getValue() != null) {
                nextDataValue = (Double) nextData.getValue();
                variance_value += Math.pow((average_value - nextDataValue), 2);
                if (i > 0) {
                    sampling_variance_value += Math
                            .pow((sampling_average_value - ((lastDataTime - (Long) nextData.getP2()))), 2);
                    lastDataTime = (Long) nextData.getP2();
                }
                i++;
            }
        }
        stdDeviation = ((Double) Math.sqrt(variance_value)).toString();
        if (datas.size() > 1) {
            Double sampling_std_deviation = (Double) Math.sqrt(sampling_variance_value);
            samplingStdDeviation = Helpers.formatTimePeriod(sampling_std_deviation.longValue());
        }
    }

    this.setVariableValue("max", max); // ok
    this.setVariableValue("min", min); // ok
    this.setVariableValue("average", average); // ok
    this.setVariableValue("stdDeviation", stdDeviation); // ok
    this.setVariableValue("median", median); // ok
    this.setVariableValue("nb", nb); // ok
    this.setVariableValue("startTime", startTime); // ok
    this.setVariableValue("endTime", endTime); // ok
    this.setVariableValue("samplingAverage", samplingAverage); // ok
    this.setVariableValue("nbOfNull", nbOfNull); // ok
    this.setVariableValue("samplingStdDeviation", samplingStdDeviation); // ok
}

From source file:tilt.handler.get.TiltBoundsHandler.java

JSONArray getBBox(JSONArray polygon) {
    double minX = Double.MAX_VALUE;
    double minY = Double.MAX_VALUE;
    double maxX = Double.MIN_VALUE;
    double maxY = Double.MIN_VALUE;
    for (int i = 0; i < polygon.size(); i++) {
        JSONArray pt = (JSONArray) polygon.get(i);
        double x = (double) pt.get(0);
        double y = (double) pt.get(1);
        if (x < minX)
            minX = x;/*from w  ww  . ja  v  a2  s . c o m*/
        if (y < minY)
            minY = y;
        if (x > maxX)
            maxX = x;
        if (y > maxY)
            maxY = y;
    }
    JSONArray corners = new JSONArray();
    corners.add(minX);
    corners.add(minY);
    corners.add(maxX);
    corners.add(maxY);
    return corners;
}

From source file:fr.ens.transcriptome.corsen.gui.qt.ResultGraphs.java

private static final double getMax(final double[] array) {

    double max = Double.MIN_VALUE;

    if (array == null)
        return max;

    for (int i = 0; i < array.length; i++)
        if (array[i] > max)
            max = array[i];// w  w w  .  j a v a 2s.c  o m

    return max;
}

From source file:dk.netarkivet.harvester.harvesting.frontier.FrontierReportCsvExport.java

private static String getDisplayValue(double val) {
    if (Double.MIN_VALUE == val) {
        return FrontierReportLine.EMPTY_VALUE_TOKEN;
    }/*from  w  ww. ja v a2 s  .co  m*/
    return (Math.rint(val) == val ? Integer.toString((int) val) : "" + Double.toString(val));
}

From source file:org.honeybee.coderally.Modelt.java

private void slowForTightCorner(Car mCar) {

    double turn = 0, distance = 0;
    CheckPoint cp = mCar.getCheckpoint();

    Point target = schewy.getMidPoint(cp);

    turn = Math.abs(mCar.calculateHeading(target));
    distance = mCar.getPosition().getDistance(target);
    double ratio = 0;

    double degreesPerSecond = mCar.calculateMaximumTurning(mCar.getAccelerationPercent());
    double maxAngularVelocity = Double.MIN_VALUE;
    for (int i = 0; i < 15; i++) {
        CheckPoint nextCp = getTrack().getNextCheckpoint(cp);
        double angle = Math.toDegrees(schewy.getAngle(cp));
        Point point = schewy.getMidPoint(cp);
        Point nextPoint = schewy.getMidPoint(nextCp);
        Vec2 distance2 = new Vec2((float) nextPoint.getX() - (float) point.getX(),
                (float) nextPoint.getY() - (float) point.getY());
        distance = distance + (double) distance2.length();

        turn = turn + Math.abs(angle);
        double seconds = distance / (mCar.getVelocity().length());

        double tempRatio = turn / (seconds * degreesPerSecond);
        if (tempRatio > ratio)
            ratio = tempRatio;/*w  ww .j ava  2s. c om*/

        double seconds2 = distance2.length() / mCar.getVelocity().length();
        double angularVelocity = angle / seconds2;

        if (angularVelocity > maxAngularVelocity)
            maxAngularVelocity = angularVelocity;
        cp = nextCp;
        if (seconds > 1)
            break;

    }
    System.out.println("Velocity:" + getCar().getVelocity().length());
    System.out.println("MaxAv:" + maxAngularVelocity);

    System.out.println("Ratio:" + ratio + "," + maxRatio);

    if (ratio > maxRatio)
        maxRatio = ratio;

    if (ratio > 15) {
        mCar.setBrakePercent(100);
        mCar.setAccelerationPercent(0);
    } else if (ratio > 12) {
        mCar.setBrakePercent(50);
        mCar.setAccelerationPercent(0);
    } else if (ratio > 12) {
        mCar.setBrakePercent(0);
        mCar.setAccelerationPercent(0);
    } else {
        mCar.setBrakePercent(0);
        mCar.setAccelerationPercent(100);
    }

    if (maxAngularVelocity > 360) {
        System.out.println("MAXAV BRAKING!");
        mCar.setBrakePercent(100);
        mCar.setAccelerationPercent(0);
    }

}

From source file:com.cidre.algorithms.CidreMath.java

public static double max(double[][] a) {
    double max = Double.MIN_VALUE;
    for (int i = 0; i < a.length; i++) {
        for (int j = 0; j < a[i].length; j++) {
            if (a[i][j] > max) {
                max = a[i][j];/*from  www  .  j  a v a  2s .  c  o  m*/
            }
        }
    }
    return max;
}

From source file:org.lakeast.main.TestBatch.java

public void run() throws TestException {
    try {/*from   w ww.  jav a 2  s .  c o m*/
        Calendar calendar = Calendar.getInstance();
        SimpleDateFormat formatter = new SimpleDateFormat();
        log.info("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
        log.info("START!^^^^^^^^^^^^" + formatter.format(calendar.getTime()));
        log.debug("*******************DEBUG**********************");
        int size = container.size();
        int[] successCount = new int[size];
        int[] neededTotalGenerations = new int[size];
        double[] totalElapsedTime = new double[size];
        double[] squareSumOfElapsedTime = new double[size];
        double[] totalBestValues = new double[size];
        double[][] values = new double[size][testCount];
        double[] max = new double[size];
        double[] min = new double[size];
        for (int i = 0; i < size; i++) {
            max[i] = Double.MIN_VALUE;
            min[i] = Double.MAX_VALUE;
        }
        int[][] x = new int[size][numberOfIterations / Testable.PRECISION];// ?
        double[][] y = new double[size][numberOfIterations / Testable.PRECISION];// 
        if (isCounted) {
            for (int i = 0; i < size; i++) {
                y[i] = null;// a must
            }
        }
        for (int i = 0; i < testCount; i++) {
            for (int j = 0; j < size; j++) {
                Testable target = container.get(j);
                target.reset();
                if (log.isDebugEnabled()) {
                    log.debug("The " + (i + 1) + "th run of " + target.getSimpleDescription() + " start.");
                }
                long start = System.currentTimeMillis();
                boolean isSolved = target.iterate(numberOfIterations, exitCondition, y[j]);
                long end = System.currentTimeMillis();
                if (log.isDebugEnabled()) {
                    log.debug("The " + (i + 1) + "th run of " + target.getSimpleDescription() + " complete.");
                }
                if (isSolved) {
                    successCount[j]++;
                    neededTotalGenerations[j] += target.getGeneration();
                    x[j][target.getGeneration() / Testable.PRECISION]++;
                }
                totalElapsedTime[j] += (end - start) / 1000.0;
                squareSumOfElapsedTime[j] += totalElapsedTime[j] * totalElapsedTime[j];
                totalBestValues[j] += target.getBestValue();
                values[j][i] = target.getBestValue();
                if (target.getBestValue() > max[j]) {
                    max[j] = target.getBestValue();
                }
                if (target.getBestValue() < min[j]) {
                    min[j] = target.getBestValue();
                }
            }
        }
        log.debug("*******************DEBUG**********************");
        log.info("*******************INFO***********************");
        log.info("[TestCount: " + testCount + "]\t[NumberOfIterations: " + numberOfIterations + "]");
        for (int i = 0; i < size; i++) {
            Testable target = container.get(i);
            log.info(target + ":");
            log.info("[SuccessRate: " + 100 * successCount[i] / (double) testCount
                    + "%]\t[AverageNeededGenerations: " + neededTotalGenerations[i] / (double) successCount[i]
                    + "]");
            double average = totalElapsedTime[i] / testCount;
            log.info("[AverageElapsedTime: " + average + " seconds]\t[StandardDeviationOfElapsedTime: "
                    + Math.sqrt((squareSumOfElapsedTime[i] - testCount * average * average) / (testCount - 1))
                    + "]");
            log.info("[AverageBestValue: " + totalBestValues[i] / testCount + "]");
            log.info("[LastBestValue: " + target.getBestValue() + "]");
            log.info("[" + ToStringBuffer.list(target.getSolution(), "LastSolution: (", ", ", ") ") + "]");
        }
        log.info("*******************INFO***********************");
        log.info("OVER!^^^^^^^^^^^^^" + formatter.format(new Date()));
        /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
        WritableWorkbook wb = Workbook.createWorkbook(
                new File(Testable.DATAPATH, formatter.format(calendar.getTime()).replace(":", "-") + "-"
                        + calendar.get(Calendar.SECOND) + ".xls"));
        WritableSheet ws = wb.createSheet("TestResult", 0);
        ws.addCell(new Label(0, 1, "Size"));
        ws.addCell(new Label(0, 2, "DimensionsCount"));
        ws.addCell(new Label(0, 3, "TestCount"));
        ws.addCell(new Label(0, 4, "SuccessRate(%)"));
        ws.addCell(new Label(0, 5, "AverageNeededGenerations"));
        ws.addCell(new Label(0, 6, "AverageElapsedTime(s)"));
        ws.addCell(new Label(0, 7, "StandardDeviationOfElapsedTime"));
        ws.addCell(new Label(0, 8, "AverageBestValue"));
        ws.addCell(new Label(0, 9, "Values"));
        ws.addCell(new Label(0, 10, "MaxValue"));
        ws.addCell(new Label(0, 11, "MinValue"));
        ws.addCell(new Label(0, 12, "LastSolution"));
        int offset = 13;
        for (int j = 0; j < numberOfIterations / Testable.PRECISION; j++) {
            ws.addCell(new Number(0, j + offset, (j + 1) * Testable.PRECISION));
        }
        for (int i = 0; i < size; i++) {
            Testable target = container.get(i);
            ws.addCell(new Label(i + 1, 0, target.toString()));
            ws.addCell(new Number(i + 1, 1, target.size()));
            ws.addCell(new Number(i + 1, 2, target.getDimensionsCount()));
            ws.addCell(new Number(i + 1, 3, testCount));
            ws.addCell(new Number(i + 1, 4, 100 * successCount[i] / (double) testCount));
            ws.addCell(new Number(i + 1, 5, neededTotalGenerations[i] / (double) successCount[i]));
            double average = totalElapsedTime[i] / testCount;
            ws.addCell(new Number(i + 1, 6, average));
            ws.addCell(new Number(i + 1, 7,
                    Math.sqrt((squareSumOfElapsedTime[i] - testCount * average * average) / (testCount - 1))));
            ws.addCell(new Number(i + 1, 8, totalBestValues[i] / testCount));
            ws.addCell(new Label(i + 1, 9, ToStringBuffer.list(values[i], "", ",", "").toString()));
            ws.addCell(new Number(i + 1, 10, max[i]));
            ws.addCell(new Number(i + 1, 11, min[i]));
            ws.addCell(new Label(i + 1, 12, ToStringBuffer.list(target.getSolution(), "", ",", "").toString()));
            if (isCounted) {
                for (int j = 0; j < numberOfIterations / Testable.PRECISION; j++) {
                    ws.addCell(new Number(i + 1, j + offset, x[i][j]));
                    if (j < numberOfIterations / Testable.PRECISION - 1) {
                        x[i][j + 1] += x[i][j];
                    }
                }
            } else {
                for (int j = 0; j < numberOfIterations / Testable.PRECISION; j++) {
                    ws.addCell(new Number(i + 1, j + offset, y[i][j] / testCount / optima.get(i)));
                }
            }
        }
        wb.write();
        wb.close();
        /* @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ */
    } catch (Exception ex) {
        throw new TestException(ex);
    }
}

From source file:com.litt.core.security.license.gui.ConfigPanel.java

/**
 * Create the panel./* w  w  w  .j  a v  a 2s.  c  o  m*/
 */
public ConfigPanel(final Gui gui) {
    GridBagLayout gbl_configPanel = new GridBagLayout();
    gbl_configPanel.columnWidths = new int[] { 0, 0, 0, 0 };
    gbl_configPanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    gbl_configPanel.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
    gbl_configPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0,
            Double.MIN_VALUE };
    this.setLayout(gbl_configPanel);

    JLabel label_18 = new JLabel("?");
    GridBagConstraints gbc_label_18 = new GridBagConstraints();
    gbc_label_18.insets = new Insets(0, 0, 5, 5);
    gbc_label_18.anchor = GridBagConstraints.EAST;
    gbc_label_18.gridx = 0;
    gbc_label_18.gridy = 0;
    this.add(label_18, gbc_label_18);

    comboBox_config = new JComboBox();
    comboBox_config.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                try {
                    LicenseConfig licenseConfig = (LicenseConfig) e.getItem();
                    File licenseFile = new File(licenseConfig.getLicenseFilePath());
                    currentLicenseConfig = licenseConfig;
                    loadLicense(licenseFile);
                    gui.setCurrentLicenseConfig(currentLicenseConfig);
                } catch (Exception e1) {
                    JOptionPane.showMessageDialog(self, e1.getMessage());
                }
            }
        }
    });
    GridBagConstraints gbc_comboBox_config = new GridBagConstraints();
    gbc_comboBox_config.insets = new Insets(0, 0, 5, 5);
    gbc_comboBox_config.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboBox_config.gridx = 1;
    gbc_comboBox_config.gridy = 0;
    this.add(comboBox_config, gbc_comboBox_config);

    JButton button_3 = new JButton("?");
    button_3.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {

            try {
                comboBox_config.removeAllItems();

                File configFile = new File(Gui.HOME_PATH + File.separator + "config.xml");

                Document document = XmlUtils.readXml(configFile);
                Element rootE = document.getRootElement();
                List productList = rootE.elements();
                for (int i = 0; i < productList.size(); i++) {
                    Element productE = (Element) productList.get(i);
                    String productCode = productE.attributeValue("code");

                    List customerList = productE.elements();
                    for (int j = 0; j < customerList.size(); j++) {
                        Element customerE = (Element) customerList.get(j);
                        String customerCode = customerE.attributeValue("code");

                        LicenseConfig licenseConfig = new LicenseConfig();
                        licenseConfig.setProductCode(productCode);
                        licenseConfig.setCustomerCode(customerCode);
                        licenseConfig.setLicenseId(customerE.elementText("licenseId"));
                        licenseConfig.setEncryptedLicense(customerE.elementText("encryptedLicense"));
                        licenseConfig.setRootFilePath(Gui.HOME_PATH);
                        licenseConfig.setLicenseFilePath(Gui.HOME_PATH + File.separator + productCode
                                + File.separator + customerCode + File.separator + "license.xml");
                        licenseConfig.setPriKeyFilePath(
                                Gui.HOME_PATH + File.separator + productCode + File.separator + "private.key");
                        licenseConfig.setPubKeyFilePath(
                                Gui.HOME_PATH + File.separator + productCode + File.separator + "license.key");
                        comboBox_config.addItem(licenseConfig);
                        if (i == 0 && j == 0) {
                            File licenseFile = new File(licenseConfig.getLicenseFilePath());
                            currentLicenseConfig = licenseConfig;
                            loadLicense(licenseFile);
                            gui.setCurrentLicenseConfig(currentLicenseConfig);

                            btnDelete.setEnabled(true);
                        }
                    }
                }

            } catch (Exception e1) {
                e1.printStackTrace();
                JOptionPane.showMessageDialog(self, e1.getMessage());
            }

        }
    });

    btnDelete = new JButton();
    btnDelete.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (currentLicenseConfig != null) {
                try {
                    String productCode = currentLicenseConfig.getProductCode();
                    String customerCode = currentLicenseConfig.getCustomerCode();
                    //congfig.xml
                    File configFile = new File(Gui.HOME_PATH + File.separator + "config.xml");
                    Document document = XmlUtils.readXml(configFile);

                    Element customerNode = (Element) document.selectSingleNode(
                            "//product[@code='" + productCode + "']/customer[@code='" + customerCode + "']");
                    if (customerNode != null) {
                        customerNode.detach();
                        XmlUtils.writeXml(configFile, document);
                    }
                    //                  
                    File licensePathFile = new File(currentLicenseConfig.getLicenseFilePath());
                    if (licensePathFile.exists()) {
                        FileUtils.deleteDirectory(licensePathFile.getParentFile());
                    }

                    //comboboxitem
                    comboBox_config.removeItemAt(comboBox_config.getSelectedIndex());
                } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                } catch (Exception e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
                }
                if (comboBox_config.getItemCount() <= 0) {
                    btnDelete.setEnabled(false);
                }

            }
        }
    });
    btnDelete.setEnabled(false);
    btnDelete.setIcon(new ImageIcon(ConfigPanel.class.getResource("/images/icon_delete.png")));
    GridBagConstraints gbc_btnDelete = new GridBagConstraints();
    gbc_btnDelete.insets = new Insets(0, 0, 5, 0);
    gbc_btnDelete.gridx = 2;
    gbc_btnDelete.gridy = 0;
    add(btnDelete, gbc_btnDelete);
    GridBagConstraints gbc_button_3 = new GridBagConstraints();
    gbc_button_3.insets = new Insets(0, 0, 5, 5);
    gbc_button_3.gridx = 1;
    gbc_button_3.gridy = 1;
    this.add(button_3, gbc_button_3);

    JLabel lblid = new JLabel("?ID");
    GridBagConstraints gbc_lblid = new GridBagConstraints();
    gbc_lblid.anchor = GridBagConstraints.EAST;
    gbc_lblid.insets = new Insets(0, 0, 5, 5);
    gbc_lblid.gridx = 0;
    gbc_lblid.gridy = 2;
    this.add(lblid, gbc_lblid);

    textField_licenseId = new JTextField();
    GridBagConstraints gbc_textField_licenseId = new GridBagConstraints();
    gbc_textField_licenseId.insets = new Insets(0, 0, 5, 5);
    gbc_textField_licenseId.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_licenseId.gridx = 1;
    gbc_textField_licenseId.gridy = 2;
    this.add(textField_licenseId, gbc_textField_licenseId);
    textField_licenseId.setColumns(10);

    JLabel label = new JLabel("?");
    GridBagConstraints gbc_label = new GridBagConstraints();
    gbc_label.anchor = GridBagConstraints.EAST;
    gbc_label.insets = new Insets(0, 0, 5, 5);
    gbc_label.gridx = 0;
    gbc_label.gridy = 3;
    add(label, gbc_label);

    comboBox_licenseType = new JComboBox(MapComboBoxModel.getLicenseTypeOptions().toArray());
    GridBagConstraints gbc_comboBox_licenseType = new GridBagConstraints();
    gbc_comboBox_licenseType.insets = new Insets(0, 0, 5, 5);
    gbc_comboBox_licenseType.fill = GridBagConstraints.HORIZONTAL;
    gbc_comboBox_licenseType.gridx = 1;
    gbc_comboBox_licenseType.gridy = 3;
    add(comboBox_licenseType, gbc_comboBox_licenseType);

    JLabel label_23 = new JLabel("???");
    GridBagConstraints gbc_label_23 = new GridBagConstraints();
    gbc_label_23.anchor = GridBagConstraints.EAST;
    gbc_label_23.insets = new Insets(0, 0, 5, 5);
    gbc_label_23.gridx = 0;
    gbc_label_23.gridy = 4;
    this.add(label_23, gbc_label_23);

    textField_productName = new JTextField();
    GridBagConstraints gbc_textField_productName = new GridBagConstraints();
    gbc_textField_productName.insets = new Insets(0, 0, 5, 5);
    gbc_textField_productName.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_productName.gridx = 1;
    gbc_textField_productName.gridy = 4;
    this.add(textField_productName, gbc_textField_productName);
    textField_productName.setColumns(10);

    JLabel label_24 = new JLabel("???");
    GridBagConstraints gbc_label_24 = new GridBagConstraints();
    gbc_label_24.anchor = GridBagConstraints.EAST;
    gbc_label_24.insets = new Insets(0, 0, 5, 5);
    gbc_label_24.gridx = 0;
    gbc_label_24.gridy = 5;
    this.add(label_24, gbc_label_24);

    textField_companyName = new JTextField();
    GridBagConstraints gbc_textField_companyName = new GridBagConstraints();
    gbc_textField_companyName.insets = new Insets(0, 0, 5, 5);
    gbc_textField_companyName.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_companyName.gridx = 1;
    gbc_textField_companyName.gridy = 5;
    this.add(textField_companyName, gbc_textField_companyName);
    textField_companyName.setColumns(10);

    JLabel label_25 = new JLabel("??");
    GridBagConstraints gbc_label_25 = new GridBagConstraints();
    gbc_label_25.anchor = GridBagConstraints.EAST;
    gbc_label_25.insets = new Insets(0, 0, 5, 5);
    gbc_label_25.gridx = 0;
    gbc_label_25.gridy = 6;
    this.add(label_25, gbc_label_25);

    textField_customerName = new JTextField();
    GridBagConstraints gbc_textField_customerName = new GridBagConstraints();
    gbc_textField_customerName.insets = new Insets(0, 0, 5, 5);
    gbc_textField_customerName.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_customerName.gridx = 1;
    gbc_textField_customerName.gridy = 6;
    this.add(textField_customerName, gbc_textField_customerName);
    textField_customerName.setColumns(10);

    JLabel label_26 = new JLabel("");
    GridBagConstraints gbc_label_26 = new GridBagConstraints();
    gbc_label_26.anchor = GridBagConstraints.EAST;
    gbc_label_26.insets = new Insets(0, 0, 5, 5);
    gbc_label_26.gridx = 0;
    gbc_label_26.gridy = 7;
    this.add(label_26, gbc_label_26);

    textField_version = new JTextField();
    GridBagConstraints gbc_textField_version = new GridBagConstraints();
    gbc_textField_version.insets = new Insets(0, 0, 5, 5);
    gbc_textField_version.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField_version.gridx = 1;
    gbc_textField_version.gridy = 7;
    this.add(textField_version, gbc_textField_version);
    textField_version.setColumns(10);

    JLabel label_27 = new JLabel("");
    GridBagConstraints gbc_label_27 = new GridBagConstraints();
    gbc_label_27.insets = new Insets(0, 0, 5, 5);
    gbc_label_27.gridx = 0;
    gbc_label_27.gridy = 8;
    this.add(label_27, gbc_label_27);

    datePicker_expiredDate = new DatePicker(new Date(), "yyyy-MM-dd", null, null);
    //datePicker_expiredDate.setTimePanleVisible(false);
    GridBagConstraints gbc_datePicker_expiredDate = new GridBagConstraints();
    gbc_datePicker_expiredDate.anchor = GridBagConstraints.WEST;
    gbc_datePicker_expiredDate.insets = new Insets(0, 0, 5, 5);
    gbc_datePicker_expiredDate.gridx = 1;
    gbc_datePicker_expiredDate.gridy = 8;
    this.add(datePicker_expiredDate, gbc_datePicker_expiredDate);

    JButton button_5 = new JButton("");
    button_5.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {

            if (currentLicenseConfig != null) {
                try {
                    File priKeyFile = new File(currentLicenseConfig.getPriKeyFilePath());
                    File licenseFile = new File(currentLicenseConfig.getLicenseFilePath());

                    //??
                    License license = new License();
                    license.setLicenseId(textField_licenseId.getText());
                    license.setLicenseType(
                            ((MapComboBoxModel) comboBox_licenseType.getSelectedItem()).getValue().toString());
                    license.setProductName(textField_productName.getText());
                    license.setCompanyName(textField_companyName.getText());
                    license.setCustomerName(textField_customerName.getText());
                    license.setVersion(Version.parseVersion(textField_version.getText()));
                    license.setCreateDate(new Date());
                    license.setExpiredDate(Utility.parseDate(datePicker_expiredDate.getText()));

                    //????
                    DigitalSignatureTool utils = new DigitalSignatureTool("DSA");
                    utils.readPriKey(priKeyFile.getAbsolutePath()); //??
                    String signedData = utils.sign(license.toString()); //??????
                    license.setSignature(signedData);

                    LicenseManager.writeLicense(license, licenseFile);
                    //config.xml
                    String licenseContent = XmlUtils.readXml(licenseFile).asXML();
                    //DES
                    ISecurity security = new DESTool(currentLicenseConfig.getLicenseId(), Algorithm.BLOWFISH);
                    licenseContent = security.encrypt(licenseContent);

                    txt_encryptContent.setText(licenseContent);
                    currentLicenseConfig.setEncryptedLicense(licenseContent);
                    System.out.println(licenseContent);
                    File configFile = new File(Gui.HOME_PATH + File.separator + "config.xml");

                    XMLConfiguration config = new XMLConfiguration(configFile);
                    config.setAutoSave(true);

                    config.setProperty("product.customer.encryptedLicense", licenseContent);

                    //??zip?
                    File customerPath = licenseFile.getParentFile();
                    //???license?????
                    File licensePath = new File(customerPath.getParent(), "license");
                    if (!licensePath.exists() && !licensePath.isDirectory()) {
                        licensePath.mkdir();
                    } else {
                        FileUtils.cleanDirectory(licensePath);
                    }

                    //?
                    FileUtils.copyDirectory(customerPath, licensePath);
                    String currentTime = FormatDateTime.formatDateTimeNum(new Date());
                    ZipUtils.zip(licensePath, new File(licensePath.getParentFile(),
                            currentLicenseConfig.getCustomerCode() + "-" + currentTime + ".zip"));

                    //license
                    FileUtils.deleteDirectory(licensePath);

                    JOptionPane.showMessageDialog(self, "??");
                } catch (Exception e1) {
                    e1.printStackTrace();
                    JOptionPane.showMessageDialog(self, e1.getMessage());
                }
            } else {
                JOptionPane.showMessageDialog(self, "???");
            }
        }
    });
    GridBagConstraints gbc_button_5 = new GridBagConstraints();
    gbc_button_5.insets = new Insets(0, 0, 5, 5);
    gbc_button_5.gridx = 1;
    gbc_button_5.gridy = 9;
    this.add(button_5, gbc_button_5);

    JScrollPane scrollPane = new JScrollPane();
    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
    gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
    gbc_scrollPane.fill = GridBagConstraints.BOTH;
    gbc_scrollPane.gridx = 1;
    gbc_scrollPane.gridy = 10;
    this.add(scrollPane, gbc_scrollPane);

    txt_encryptContent = new JTextArea();
    txt_encryptContent.setLineWrap(true);
    scrollPane.setViewportView(txt_encryptContent);

    //      txt_encryptContent = new JTextArea(20, 20);
    //      GridBagConstraints gbc_6 = new GridBagConstraints();
    //      gbc_6.gridx = 1;
    //      gbc_6.gridy = 10;
    //      this.add(txt_encryptContent, gbc_6);

}

From source file:playground.anhorni.surprice.analysis.SupriceBoxPlot.java

public JFreeChart createChart() {
    String title = chartTitle;//from  w  w  w. j  a va2  s .co  m

    final CategoryAxis xAxis = new CategoryAxis(this.xAxisName);
    xAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 10));
    xAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);

    final NumberAxis yAxis = new NumberAxis(this.yAxisName);
    yAxis.setAutoRangeIncludesZero(true);

    if (Math.abs(yrangeLower - yrangeUpper) > Double.MIN_VALUE) {
        yAxis.setRange(yrangeLower, yrangeUpper);
    }

    final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
    renderer.setFillBox(false);
    renderer.setSeriesPaint(0, Color.blue);
    CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);

    this.chart_ = new JFreeChart(title, new Font("SansSerif", Font.BOLD, 14), plot, false);
    return this.chart_;
}