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:ca.mudar.parkcatcher.ui.fragments.DetailsFragment.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    final Resources res = getResources();

    if (item.getItemId() == R.id.menu_favorites_toggle) {
        onCheckedChanged(mIsStarred);//w w  w .ja v a2 s  . co  m

        mIsStarred = (mIsStarred ? false : true); // Toggle value
        getSherlockActivity().invalidateOptionsMenu();
        return true;
    } else if (item.getItemId() == R.id.menu_map) {
        final Intent intent = new Intent(getActivity(), MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        intent.putExtra(Const.INTENT_EXTRA_GEO_LAT, mGeoLat);
        intent.putExtra(Const.INTENT_EXTRA_GEO_LNG, mGeoLng);
        intent.putExtra(Const.INTENT_EXTRA_POST_ID, mIdPost);

        startActivity(intent);

        return true;
    } else if (item.getItemId() == R.id.menu_reminder) {
        parkingApp.showToastText(R.string.toast_todo_reminder, Toast.LENGTH_LONG);

        return true;
    } else if (item.getItemId() == R.id.menu_directions) {

        if ((Double.compare(mGeoLat, Double.MIN_VALUE) != 0)
                && (Double.compare(mGeoLng, Double.MIN_VALUE) != 0)) {
            /**
             * Get directions using Intents.
             */

            try {
                final Uri uriNavigation = Uri
                        .parse(String.format(Const.URI_INTENT_NAVIGATION, mGeoLat, mGeoLng));
                final Intent intent = new Intent(Intent.ACTION_VIEW, uriNavigation);
                startActivity(intent);

            } catch (Exception e) {
                e.printStackTrace();

                String sAddr = "";
                Location userLocation = parkingApp.getLocation();
                if (userLocation != null) {
                    sAddr = Double.toString(userLocation.getLatitude()) + ","
                            + Double.toString(userLocation.getLongitude());
                }

                final String urlGmaps = String.format(Const.URL_GMAPS_DIRECTIONS, sAddr,
                        mGeoLat + "," + mGeoLng);

                final Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlGmaps));
                startActivity(intent);
            }
        }
        return true;
    } else if (item.getItemId() == R.id.menu_streetview) {

        if ((Double.compare(mGeoLat, Double.MIN_VALUE) != 0)
                && (Double.compare(mGeoLng, Double.MIN_VALUE) != 0)) {

            try {
                final Uri uriStreetView = Uri
                        .parse(String.format(Const.URI_INTENT_STREETVIEW, mGeoLat, mGeoLng));
                final Intent intent = new Intent(Intent.ACTION_VIEW, uriStreetView);
                startActivity(intent);
            } catch (NullPointerException e) {
                e.printStackTrace();
                return false;
            } catch (Exception e) {
                parkingApp.showToastText(R.string.toast_streetview_error, Toast.LENGTH_LONG);
                e.printStackTrace();

                final Uri uriInstallStreetView = Uri.parse(Const.URI_INSTALL_STREETVIEW);
                final Intent intent = new Intent(Intent.ACTION_VIEW, uriInstallStreetView);
                startActivity(intent);

                return false;
            }
        }
        return true;
    }

    else if (item.getItemId() == R.id.menu_share) {

        final GregorianCalendar parkingCalendar = parkingApp.getParkingCalendar();

        final int dayOfWeek = (parkingCalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY ? 7
                : parkingCalendar.get(Calendar.DAY_OF_WEEK) - 1);
        final double parkingHour = parkingCalendar.get(Calendar.HOUR_OF_DAY)
                + Math.round(parkingCalendar.get(Calendar.MINUTE) / 0.6) / 100.00d;

        // final int duration = parkingApp.getParkingDuration();

        final String url = String.format(res.getString(R.string.url_share_post_id), mIdPost, dayOfWeek,
                parkingHour, parkingApp.getParkingDuration());
        final String subject = String.format(res.getString(R.string.details_share_title), url);
        final String desc = String.format(res.getString(R.string.details_share_subtitle), mShareDesc);

        final Intent intent = new Intent(Intent.ACTION_SEND);
        intent.setType("text/plain");
        // EXTRA_SUBJECT is not used to allow sharing with SMS instead of
        // MMS
        // intent.putExtra(Intent.EXTRA_SUBJECT, subject);
        intent.putExtra(Intent.EXTRA_TEXT, subject + Const.LINE_SEPARATOR + desc);

        startActivity(intent);
        return true;
    }

    return (activityHelper.onOptionsItemSelected(item) || super.onOptionsItemSelected(item));
}

From source file:edu.utexas.cs.tactex.servercustomers.factoredcustomer.AdaptiveCapacityOriginator.java

private CapacityProfile selectBestProfileInRecommendation(ProfileRecommendation rec) {
    //log.info("selectBestProfileInRecommendation()");
    double bestUtility = Double.MIN_VALUE;
    CapacityProfile bestProfile = null;/* ww w.j a v a  2s .  c o m*/
    for (AbstractMap.Entry<CapacityProfile, Double> entry : rec.getUtilities().entrySet()) {
        if (entry.getValue() > bestUtility) {
            bestUtility = entry.getValue();
            bestProfile = entry.getKey();
        }
    }
    if (bestProfile == null)
        throw new Error("Best profile in recommendation is null!");
    //log.info("selectBestProfileInRecommendation() " + bestProfile.toString());
    return bestProfile;
}

From source file:org.n52.oxf.layer.FeatureLayer.java

public IBoundingBox getBBox() {
    if (this.bBox == null) {

        // TODO check this code with several features in collection
        // create bbox from featureCollection
        Geometry unionOfBoundingBoxes = getFeatureCollection().iterator().next().getGeometry();
        for (OXFFeature feature : this.featureCollection) {
            Geometry geom = feature.getBoundingBox();
            unionOfBoundingBoxes.union(geom);
        }// ww  w  . j a  va  2  s  .c om

        Coordinate[] unionCoords = unionOfBoundingBoxes.getEnvelope().getCoordinates();
        double[] uR = { Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY };
        double[] lL = { Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY };

        for (Coordinate coord : unionCoords) {
            lL[0] = Math.min(lL[0], coord.x);
            lL[1] = Math.min(lL[1], coord.y);
            lL[2] = Math.min(lL[2], coord.z);
            uR[0] = Math.max(uR[0], coord.x);
            uR[1] = Math.max(uR[1], coord.y);
            uR[2] = Math.max(uR[2], coord.z);
        }

        this.bBox = new BoundingBox(getSrs(), lL, uR);

        // handle bounding box with extend of 0 in one direction
        double defaultBoundingBoxHalfSize = 0.5; // TODO put the default bounding box size somwhere else
        if (bBox.getWidth() < Double.MIN_VALUE || bBox.getHeight() < Double.MIN_VALUE) {
            double[] bigLL = { bBox.getLowerCorner()[0] - defaultBoundingBoxHalfSize,
                    bBox.getLowerCorner()[1] - defaultBoundingBoxHalfSize };
            double[] bigUR = { bBox.getUpperCorner()[0] + defaultBoundingBoxHalfSize,
                    bBox.getUpperCorner()[1] + defaultBoundingBoxHalfSize };

            if (bBox.getDimensions() == 3 && bBox.getDepth() < Double.MIN_VALUE) {
                double[] bigLL2 = { bigLL[0], bigLL[1], bBox.getLowerCorner()[2] - defaultBoundingBoxHalfSize };
                bigLL = bigLL2;
                double[] bigUR2 = { bigUR[0], bigUR[1], bBox.getUpperCorner()[2] + defaultBoundingBoxHalfSize };
                bigUR = bigUR2;
            }
            this.bBox = new BoundingBox(bBox.getCRS(), bigLL, bigUR);
        }

    }
    return this.bBox;
}

From source file:org.red5.io.AbstractIOTest.java

@Test
public void testNumberDouble() {
    log.debug("\ntestNumberDouble");
    for (Number n : new Number[] { 1.056d, Double.MIN_VALUE, Double.MAX_VALUE, new Double(899.45678d),
            rnd.nextDouble() }) {/*from w  ww  .  ja  va 2  s .  c o  m*/
        Serializer.serialize(out, n);
        dumpOutput();
        Number rn = Deserializer.deserialize(in, Number.class);
        assertEquals("Deserialized number should be the same", n, rn.doubleValue());
        resetOutput();
    }
}

From source file:org.jfree.data.time.MovingAverage.java

/**
 * Creates a new {@link XYSeries} containing the moving averages of one
 * series in the <code>source</code> dataset.
 *
 * @param source  the source dataset.//from   w  w  w .jav  a  2  s.  c om
 * @param series  the series index (zero based).
 * @param name  the name for the new series.
 * @param period  the averaging period.
 * @param skip  the length of the initial skip period.
 *
 * @return The dataset.
 */
public static XYSeries createMovingAverage(XYDataset source, int series, String name, double period,
        double skip) {

    ParamChecks.nullNotPermitted(source, "source");
    if (period < Double.MIN_VALUE) {
        throw new IllegalArgumentException("period must be positive.");
    }
    if (skip < 0.0) {
        throw new IllegalArgumentException("skip must be >= 0.0.");
    }

    XYSeries result = new XYSeries(name);

    if (source.getItemCount(series) > 0) {

        // if the initial averaging period is to be excluded, then
        // calculate the lowest x-value to have an average calculated...
        double first = source.getXValue(series, 0) + skip;

        for (int i = source.getItemCount(series) - 1; i >= 0; i--) {

            // get the current data item...
            double x = source.getXValue(series, i);

            if (x >= first) {
                // work out the average for the earlier values...
                int n = 0;
                double sum = 0.0;
                double limit = x - period;
                int offset = 0;
                boolean finished = false;

                while (!finished) {
                    if ((i - offset) >= 0) {
                        double xx = source.getXValue(series, i - offset);
                        Number yy = source.getY(series, i - offset);
                        if (xx > limit) {
                            if (yy != null) {
                                sum = sum + yy.doubleValue();
                                n = n + 1;
                            }
                        } else {
                            finished = true;
                        }
                    } else {
                        finished = true;
                    }
                    offset = offset + 1;
                }
                if (n > 0) {
                    result.add(x, sum / n);
                } else {
                    result.add(x, null);
                }
            }

        }
    }

    return result;

}

From source file:edu.cmu.ark.AnalysisUtilities.java

public ParseResult parseSentence(String sentence) {
    String result = "";
    //System.err.println(sentence);
    //see if a parser socket server is available
    int port = new Integer(GlobalProperties.getProperties().getProperty("parserServerPort", "5556"));
    String host = "127.0.0.1";
    Socket client;//from  w  w w. j  av  a  2  s . c  o m
    PrintWriter pw;
    BufferedReader br;
    String line;
    Tree parse = null;
    double parseScore = Double.MIN_VALUE;

    try {
        client = new Socket(host, port);

        pw = new PrintWriter(client.getOutputStream());
        br = new BufferedReader(new InputStreamReader(client.getInputStream()));
        pw.println(sentence);
        pw.flush(); //flush to complete the transmission

        while ((line = br.readLine()) != null) {
            //if(!line.matches(".*\\S.*")){
            //        System.out.println();
            //}
            if (br.ready()) {
                line = line.replaceAll("\n", "");
                line = line.replaceAll("\\s+", " ");
                result += line + " ";
            } else {
                parseScore = new Double(line);
            }
        }

        br.close();
        pw.close();
        client.close();

        if (parse == null) {
            parse = readTreeFromString("(ROOT (. .))");
            parseScore = -99999.0;
        }

        if (GlobalProperties.getDebug())
            System.err.println("result (parse):" + result);
        parse = readTreeFromString(result);
        return new ParseResult(true, parse, parseScore);

    } catch (Exception ex) {
        if (GlobalProperties.getDebug())
            System.err.println("Could not connect to parser server.");
        //ex.printStackTrace();
    }

    System.err.println("parsing:" + sentence);

    //if socket server not available, then use a local parser object
    if (parser == null) {
        try {
            Options op = new Options();
            String serializedInputFileOrUrl = GlobalProperties.getProperties().getProperty("parserGrammarFile",
                    "config" + File.separator + "englishFactored.ser.gz");
            parser = new LexicalizedParser(serializedInputFileOrUrl, op);
            int maxLength = new Integer(GlobalProperties.getProperties().getProperty("parserMaxLength", "40"))
                    .intValue();
            parser.setMaxLength(maxLength);
            parser.setOptionFlags("-outputFormat", "oneline");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    try {
        if (parser.parse(sentence)) {
            parse = parser.getBestParse();

            //remove all the parent annotations (this is a hacky way to do it)
            String ps = parse.toString().replaceAll("\\[[^\\]]+/[^\\]]+\\]", "");
            parse = AnalysisUtilities.getInstance().readTreeFromString(ps);

            parseScore = parser.getPCFGScore();
            return new ParseResult(true, parse, parseScore);
        }
    } catch (Exception e) {
    }

    parse = readTreeFromString("(ROOT (. .))");
    parseScore = -99999.0;
    return new ParseResult(false, parse, parseScore);
}

From source file:uk.ac.leeds.ccg.andyt.projects.moses.process.RegressionReport.java

public static JFreeChart getYEqualsXLineChart(double[][] data, String xAxisLabel_String,
        String yAxisLabel_String) {
    JFreeChart a_XYLineChart = null;/*from  w  w  w. j  av a  2s .c  om*/
    String title = null;
    boolean legend = false;
    boolean tooltips = false;
    boolean urls = false;
    double[][] lineChartData = new double[2][2];
    lineChartData[0][0] = Double.MAX_VALUE;// min_CASObservedData;
    lineChartData[0][1] = Double.MIN_VALUE;// max_CASObservedData;
    lineChartData[1][0] = Double.MAX_VALUE;// min_SARExpectedData;
    lineChartData[1][1] = Double.MIN_VALUE;// max_SARExpectedData;
    for (int j = 0; j < data[0].length; j++) {
        lineChartData[0][0] = Math.min(lineChartData[0][0], data[0][j]);
        lineChartData[0][1] = Math.max(lineChartData[0][1], data[0][j]);
        lineChartData[1][0] = Math.min(lineChartData[1][0], data[1][j]);
        lineChartData[1][1] = Math.max(lineChartData[1][1], data[1][j]);
    }
    lineChartData[1][0] = lineChartData[0][0];
    lineChartData[0][1] = Math.min(lineChartData[1][1], lineChartData[0][1]);
    lineChartData[1][1] = lineChartData[0][1];
    System.out.println("min lineChartData[0][0] " + lineChartData[0][0]);
    System.out.println("max lineChartData[0][1] " + lineChartData[0][1]);
    System.out.println("min lineChartData[1][0] " + lineChartData[1][0]);
    System.out.println("max lineChartData[1][1] " + lineChartData[1][1]);
    DefaultXYDataset a_DefaultXYDataset = new DefaultXYDataset();
    a_DefaultXYDataset.addSeries("y = x", lineChartData);
    a_XYLineChart = ChartFactory.createXYLineChart(title, xAxisLabel_String, yAxisLabel_String,
            a_DefaultXYDataset, PlotOrientation.HORIZONTAL, legend, tooltips, urls);
    return a_XYLineChart;
}

From source file:org.fhcrc.cpl.toolbox.gui.chart.PanelWithScatterPlot.java

/**
 * This method only does anything if there's exactly one series in the dataset.
 *
 * Performs linear regression, and then plots a regression line, from the
 * minimum to the maximum X value of the series.
 *
 * Removes the old series, adds this new one, and then adds the old one again,
 * so the regression line will appear on top. 
 *///from   w ww. j a va  2s . c o m
public double[] addRegressionLine(int seriesIndex, boolean robustRegression) {
    if (dataset == null || dataset.getSeriesCount() < seriesIndex + 1)
        return null;
    XYSeries series = dataset.getSeries(seriesIndex);
    int n = series.getItemCount();
    double[] xValues = new double[n];
    double[] yValues = new double[n];

    double maxX = Double.MIN_VALUE;
    double minX = Double.MAX_VALUE;

    for (int i = 0; i < n; i++) {
        XYDataItem dataItem = series.getDataItem(i);
        xValues[i] = dataItem.getX().doubleValue();
        yValues[i] = dataItem.getY().doubleValue();

        if (xValues[i] > maxX)
            maxX = xValues[i];
        if (xValues[i] < minX)
            minX = xValues[i];
    }

    _log.debug("addRegressionLine, minX = " + minX + ", maxX = " + maxX);

    RegressionUtilities.robustRegression(xValues, yValues);
    double[] regressionCoefficients = null;
    if (robustRegression)
        regressionCoefficients = RegressionUtilities.robustRegression(xValues, yValues);
    else
        regressionCoefficients = MatrixUtil.linearRegression(xValues, yValues);
    _log.debug("addRegressionLine, coeffs = " + regressionCoefficients[0] + ", " + regressionCoefficients[1]);

    addLine(regressionCoefficients[1], regressionCoefficients[0], minX, maxX);

    return regressionCoefficients;
}

From source file:org.betaconceptframework.astroboa.serializer.CmsDefinitionSerializer.java

private <T> void serializeDoublePropertyDefinition(SimpleCmsPropertyDefinition<T> simplePropertyDefinition) {
    DoublePropertyDefinition doubleDefinition = (DoublePropertyDefinition) simplePropertyDefinition;

    if (doubleDefinition.isSetDefaultValue()) {
        serializer.writeAttribute("defaultValue", String.valueOf(doubleDefinition.getDefaultValue()));
    }/*w  w w.  j  ava  2s  .  c  o  m*/

    if (doubleDefinition.getMinValue() != null && doubleDefinition.getMinValue() != Double.MIN_VALUE) {
        serializer.writeAttribute("minValue", String.valueOf(doubleDefinition.getMinValue()));
        serializer.writeAttribute("minValueIsExclusive",
                String.valueOf(((DoublePropertyDefinitionImpl) doubleDefinition).isMinValueExclusive()));
    }

    if (doubleDefinition.getMaxValue() != null && doubleDefinition.getMinValue() != Double.MAX_VALUE) {
        serializer.writeAttribute("maxValue", String.valueOf(doubleDefinition.getMaxValue()));
        serializer.writeAttribute("maxValueIsExclusive",
                String.valueOf(((DoublePropertyDefinitionImpl) doubleDefinition).isMaxValueExclusive()));
    }
}

From source file:br.com.jinsync.view.FrmJInSync.java

/**
 * Initialize the contents of the frame.
 *//*from   w  ww .  j a  va2s .  co  m*/
private void initialize() {

    Language.loadParameters();

    setBounds(100, 100, 1136, 665);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 0, 0 };
    gridBagLayout.rowHeights = new int[] { 600, 53, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 1.0, 0.0, 0.0, Double.MIN_VALUE };
    getContentPane().setLayout(gridBagLayout);

    grpFontes = new JTabbedPane(SwingConstants.TOP);
    GridBagConstraints gbc_grpFontes = new GridBagConstraints();
    gbc_grpFontes.insets = new Insets(0, 0, 5, 0);
    gbc_grpFontes.fill = GridBagConstraints.BOTH;
    gbc_grpFontes.gridx = 0;
    gbc_grpFontes.gridy = 0;
    getContentPane().add(grpFontes, gbc_grpFontes);

    tabCopybook = new JPanel();
    tabCopybook.setBackground(Color.WHITE);
    grpFontes.addTab(Language.tabCopy, null, tabCopybook, null);

    GridBagLayout gbl_tabCopybook = new GridBagLayout();
    gbl_tabCopybook.columnWidths = new int[] { 10, 1, 0, 349, 0, 0, 62, 28, 71, 0, 0, 0 };
    gbl_tabCopybook.rowHeights = new int[] { 1, 0, 0, 0 };
    gbl_tabCopybook.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    gbl_tabCopybook.rowWeights = new double[] { 0.0, 0.0, 1.0, Double.MIN_VALUE };
    tabCopybook.setLayout(gbl_tabCopybook);

    JLabel lblCopybook = new JLabel(Language.txtFilePds);
    GridBagConstraints gbc_lblCopybook = new GridBagConstraints();
    gbc_lblCopybook.anchor = GridBagConstraints.EAST;
    gbc_lblCopybook.insets = new Insets(0, 0, 5, 5);
    gbc_lblCopybook.gridx = 1;
    gbc_lblCopybook.gridy = 1;
    tabCopybook.add(lblCopybook, gbc_lblCopybook);

    txtPath = new JTextField();
    GridBagConstraints gbc_txtPath = new GridBagConstraints();
    gbc_txtPath.gridwidth = 4;
    gbc_txtPath.insets = new Insets(0, 0, 5, 5);
    gbc_txtPath.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtPath.gridx = 2;
    gbc_txtPath.gridy = 1;
    tabCopybook.add(txtPath, gbc_txtPath);
    txtPath.setColumns(10);

    JButton btnDiretorio = new JButton("");
    btnDiretorio.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/folder.png")));
    btnDiretorio.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            openDirectory();
        }
    });
    GridBagConstraints gbc_btnDiretorio = new GridBagConstraints();
    gbc_btnDiretorio.insets = new Insets(0, 0, 5, 5);
    gbc_btnDiretorio.gridx = 6;
    gbc_btnDiretorio.gridy = 1;
    tabCopybook.add(btnDiretorio, gbc_btnDiretorio);

    btnClearCopy = new JButton("");
    btnClearCopy.setEnabled(false);
    btnClearCopy.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            tableCopy = new JTable();
            scrCopy.setViewportView(tableCopy);
            tableString = new JTable();
            scrTableString.setViewportView(tableString);

            btnExcelString.setEnabled(false);
            btnClearString.setEnabled(false);
            textAreaString.setText("");

            console.removeAllElements();
            btnExcel.setEnabled(false);
            btnClearCopy.setEnabled(false);
            grpFontes.setEnabledAt(1, false);

            tableFile = new JTable();
            scrFile.setViewportView(tableFile);
            btnExcelFile.setEnabled(false);
            btnClearFile.setEnabled(false);
            grpFontes.setEnabledAt(2, false);

        }
    });
    btnClearCopy.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png")));
    GridBagConstraints gbc_btnLimpar = new GridBagConstraints();
    gbc_btnLimpar.fill = GridBagConstraints.BOTH;
    gbc_btnLimpar.insets = new Insets(0, 0, 5, 5);
    gbc_btnLimpar.gridx = 9;
    gbc_btnLimpar.gridy = 1;
    tabCopybook.add(btnClearCopy, gbc_btnLimpar);

    JButton btnProcessarBook = new JButton("");
    btnProcessarBook.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            loadData();
            btnClearCopy.setEnabled(true);
            grpFontes.setEnabledAt(1, true);
            grpFontes.setEnabledAt(2, true);
        }
    });
    btnProcessarBook.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png")));
    GridBagConstraints gbc_btnProcessarBook = new GridBagConstraints();
    gbc_btnProcessarBook.fill = GridBagConstraints.VERTICAL;
    gbc_btnProcessarBook.insets = new Insets(0, 0, 5, 5);
    gbc_btnProcessarBook.gridx = 7;
    gbc_btnProcessarBook.gridy = 1;
    tabCopybook.add(btnProcessarBook, gbc_btnProcessarBook);

    btnExcel = new JButton("");
    btnExcel.setEnabled(false);
    btnExcel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            expExcelBook();
            // exportarExcelBook(tableCopy, txtPath.getText(),
            // "Horizontal");
        }
    });
    btnExcel.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png")));
    GridBagConstraints gbc_btnExcel = new GridBagConstraints();
    gbc_btnExcel.insets = new Insets(0, 0, 5, 5);
    gbc_btnExcel.gridx = 8;
    gbc_btnExcel.gridy = 1;
    tabCopybook.add(btnExcel, gbc_btnExcel);

    // JScrollPane scrCopy = new JScrollPane();
    gbc_scrCopy = new GridBagConstraints();
    gbc_scrCopy.gridwidth = 9;
    gbc_scrCopy.insets = new Insets(0, 0, 0, 5);
    gbc_scrCopy.fill = GridBagConstraints.BOTH;
    gbc_scrCopy.gridx = 1;
    gbc_scrCopy.gridy = 2;
    // tabCopybook.add(scrCopy, gbc_scrCopy);

    panelConsole = new Panel();
    GridBagConstraints gbc_panelConsole = new GridBagConstraints();
    gbc_panelConsole.insets = new Insets(0, 0, 5, 0);
    gbc_panelConsole.fill = GridBagConstraints.BOTH;
    gbc_panelConsole.gridx = 0;
    gbc_panelConsole.gridy = 1;
    getContentPane().add(panelConsole, gbc_panelConsole);
    panelConsole.setLayout(new BorderLayout(0, 0));

    listTerminal = new JList<String>();
    listTerminal.setFont(new Font("Courier New", Font.PLAIN, 11));
    listTerminal.setModel(console);

    scrConsole = new JScrollPane(listTerminal);
    panelConsole.add(scrConsole);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu mnNewMenu = new JMenu(Language.menuParam);
    menuBar.add(mnNewMenu);

    JMenuItem mnItemUsuario = new JMenuItem(Language.menuParamUser);
    mnItemUsuario.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FrmUser frmUsuar = new FrmUser();
            frmUsuar.setLocationRelativeTo(null);
            frmUsuar.setVisible(true);
            setUser();
        }
    });
    mnNewMenu.add(mnItemUsuario);

    JMenuItem mnItemFtp = new JMenuItem(Language.menuParamFtp);
    mnItemFtp.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            FrmFtp frmFtp = new FrmFtp();
            frmFtp.setLocationRelativeTo(null);
            frmFtp.setVisible(true);
            setFtp();
        }
    });

    mnNewMenu.add(mnItemFtp);

    JMenu mnAjuda = new JMenu(Language.menuHelp);
    menuBar.add(mnAjuda);

    JMenuItem mntmNewMenuItem = new JMenuItem(Language.menuHelpAbout);
    mntmNewMenuItem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            FrmAbout frmSobre = new FrmAbout();
            frmSobre.setLocationRelativeTo(null);
            frmSobre.setVisible(true);
        }
    });
    mnAjuda.add(mntmNewMenuItem);

    tabCopybook.setFont(new Font("Arial", Font.PLAIN, 12));
    tabCopybook.add(scrCopy, gbc_scrCopy);

    tabString = new JPanel();
    tabString.setFont(new Font("Arial", Font.PLAIN, 12));
    tabString.setBackground(Color.WHITE);
    grpFontes.addTab(Language.tabString, null, tabString, null);
    grpFontes.setEnabledAt(1, false);
    GridBagLayout gbl_tabString = new GridBagLayout();
    gbl_tabString.columnWidths = new int[] { 10, 1, 346, 349, 0, 0, 62, 28, 71, 0, 0, 0 };
    gbl_tabString.rowHeights = new int[] { 1, 0, 0, 17, 22, 0, 259, 0 };
    gbl_tabString.columnWeights = new double[] { 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    gbl_tabString.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE };
    tabString.setLayout(gbl_tabString);

    JLabel lblString = new JLabel("String:");
    GridBagConstraints gbc_lblString = new GridBagConstraints();
    gbc_lblString.anchor = GridBagConstraints.WEST;
    gbc_lblString.insets = new Insets(0, 0, 5, 5);
    gbc_lblString.gridx = 1;
    gbc_lblString.gridy = 1;
    tabString.add(lblString, gbc_lblString);

    textAreaString = new JTextArea();

    JScrollPane scrStringData = new JScrollPane(textAreaString);
    GridBagConstraints gbc_scrString = new GridBagConstraints();
    gbc_scrString.gridheight = 3;
    gbc_scrString.gridwidth = 8;
    gbc_scrString.insets = new Insets(0, 0, 5, 5);
    gbc_scrString.fill = GridBagConstraints.BOTH;
    gbc_scrString.gridx = 1;
    gbc_scrString.gridy = 2;
    tabString.add(scrStringData, gbc_scrString);

    btnClearString = new JButton("");
    btnClearString.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            scrTableString.setViewportView(tableString);
            btnExcelString.setEnabled(false);
            btnClearString.setEnabled(false);
            textAreaString.setText("");
            tableString = new JTable();
            scrTableString.setViewportView(tableString);
        }
    });

    btnExcelString = new JButton("");
    btnExcelString.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            expExcelString();
        }
    });

    JButton btnProcessarArq = new JButton("");
    btnProcessarArq.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            processString();
        }
    });
    btnProcessarArq.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png")));
    GridBagConstraints gbc_btnProcessarArq = new GridBagConstraints();
    gbc_btnProcessarArq.fill = GridBagConstraints.VERTICAL;
    gbc_btnProcessarArq.insets = new Insets(0, 0, 5, 5);
    gbc_btnProcessarArq.gridx = 9;
    gbc_btnProcessarArq.gridy = 2;
    tabString.add(btnProcessarArq, gbc_btnProcessarArq);
    btnExcelString.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png")));
    btnExcelString.setEnabled(false);
    GridBagConstraints gbc_btnExcelString = new GridBagConstraints();
    gbc_btnExcelString.fill = GridBagConstraints.VERTICAL;
    gbc_btnExcelString.insets = new Insets(0, 0, 5, 5);
    gbc_btnExcelString.gridx = 9;
    gbc_btnExcelString.gridy = 3;
    tabString.add(btnExcelString, gbc_btnExcelString);
    btnClearString.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png")));
    btnClearString.setEnabled(false);
    GridBagConstraints gbc_btnClearString = new GridBagConstraints();
    gbc_btnClearString.fill = GridBagConstraints.VERTICAL;
    gbc_btnClearString.insets = new Insets(0, 0, 5, 5);
    gbc_btnClearString.gridx = 9;
    gbc_btnClearString.gridy = 4;
    tabString.add(btnClearString, gbc_btnClearString);

    JLabel lblSaida = new JLabel(Language.txtOutput);
    GridBagConstraints gbc_lblSaida = new GridBagConstraints();
    gbc_lblSaida.insets = new Insets(0, 0, 5, 5);
    gbc_lblSaida.gridx = 1;
    gbc_lblSaida.gridy = 5;
    tabString.add(lblSaida, gbc_lblSaida);

    GridBagConstraints gbc_scrArquivo = new GridBagConstraints();
    gbc_scrArquivo.fill = GridBagConstraints.BOTH;
    gbc_scrArquivo.gridwidth = 9;
    gbc_scrArquivo.insets = new Insets(0, 0, 0, 5);
    gbc_scrArquivo.gridx = 1;
    gbc_scrArquivo.gridy = 6;
    tabString.add(scrTableString, gbc_scrArquivo);

    tabFile = new JPanel();
    tabFile.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
            // TODO Auto-generated method stub
            if (isProcessStarted) {
                int key = e.getKeyCode();
                if (key == KeyEvent.VK_ESCAPE) {
                    int opc = JOptionPane.showConfirmDialog(null, Language.msgCancelProcess, Language.msgInf,
                            JOptionPane.OK_CANCEL_OPTION);
                    if (opc == JOptionPane.OK_OPTION) {
                        escProcessFile();
                    }
                }
            }

        }

        @Override
        public void keyReleased(KeyEvent arg0) {
            // TODO Auto-generated method stub

        }

        @Override
        public void keyTyped(KeyEvent arg0) {
            // TODO Auto-generated method stub

        }

    });

    tabFile.setFont(new Font("Arial", Font.PLAIN, 12));
    tabFile.setBackground(Color.WHITE);
    grpFontes.addTab(Language.tabFile, null, tabFile, null);
    grpFontes.setEnabledAt(2, false);
    GridBagLayout gbl_tabFile = new GridBagLayout();
    gbl_tabFile.columnWidths = new int[] { 10, 1, 49, 459, 0, 0, 62, 28, 0, 71, 0, 0, 0, 0 };
    gbl_tabFile.rowHeights = new int[] { 1, 0, 0, 17, 22, 0, 259, 0, 0 };
    gbl_tabFile.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    gbl_tabFile.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE };
    tabFile.setLayout(gbl_tabFile);

    JLabel lblFile = new JLabel(Language.txtFilePds);
    GridBagConstraints gbc_lblFile = new GridBagConstraints();
    gbc_lblFile.anchor = GridBagConstraints.EAST;
    gbc_lblFile.insets = new Insets(0, 0, 5, 5);
    gbc_lblFile.gridx = 1;
    gbc_lblFile.gridy = 1;
    tabFile.add(lblFile, gbc_lblFile);

    txtFile = new JTextField();
    txtFile.setColumns(10);
    GridBagConstraints gbc_txtFile = new GridBagConstraints();
    gbc_txtFile.gridwidth = 5;
    gbc_txtFile.insets = new Insets(0, 0, 5, 5);
    gbc_txtFile.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtFile.gridx = 2;
    gbc_txtFile.gridy = 1;
    tabFile.add(txtFile, gbc_txtFile);

    btnClearFile = new JButton("");
    btnClearFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {

            tableFile = new JTable();
            scrFile.setViewportView(tableFile);
            btnExcelFile.setEnabled(false);
            btnClearFile.setEnabled(false);
            progressBar.setStringPainted(true);
            progressBar.setValue(0);
            progressBar.setString("");

        }
    });

    btnExcelFile = new JButton("");
    btnExcelFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            expExcelFile();
        }
    });

    btnProcFile = new JButton("");
    btnProcFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            loadFile();
        }
    });

    btnDirFile = new JButton("");
    btnDirFile.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            openDirFile();
        }
    });
    btnDirFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/folder.png")));
    GridBagConstraints gbc_btnDirFile = new GridBagConstraints();
    gbc_btnDirFile.fill = GridBagConstraints.VERTICAL;
    gbc_btnDirFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnDirFile.gridx = 7;
    gbc_btnDirFile.gridy = 1;
    tabFile.add(btnDirFile, gbc_btnDirFile);
    btnProcFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/engine.png")));
    GridBagConstraints gbc_btnProcFile = new GridBagConstraints();
    gbc_btnProcFile.fill = GridBagConstraints.VERTICAL;
    gbc_btnProcFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnProcFile.gridx = 8;
    gbc_btnProcFile.gridy = 1;
    tabFile.add(btnProcFile, gbc_btnProcFile);
    btnExcelFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/excel.png")));
    btnExcelFile.setEnabled(false);
    GridBagConstraints gbc_btnExcelFile = new GridBagConstraints();
    gbc_btnExcelFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnExcelFile.gridx = 9;
    gbc_btnExcelFile.gridy = 1;
    tabFile.add(btnExcelFile, gbc_btnExcelFile);
    btnClearFile.setIcon(new ImageIcon(FrmJInSync.class.getResource("/resources/cancel.png")));
    btnClearFile.setEnabled(false);
    GridBagConstraints gbc_btnLimparFile = new GridBagConstraints();
    gbc_btnLimparFile.fill = GridBagConstraints.VERTICAL;
    gbc_btnLimparFile.insets = new Insets(0, 0, 5, 5);
    gbc_btnLimparFile.gridx = 10;
    gbc_btnLimparFile.gridy = 1;
    tabFile.add(btnClearFile, gbc_btnLimparFile);

    JLabel lblTamanho = new JLabel(Language.txtFileLength);
    GridBagConstraints gbc_lblTamanho = new GridBagConstraints();
    gbc_lblTamanho.anchor = GridBagConstraints.WEST;
    gbc_lblTamanho.insets = new Insets(0, 0, 5, 5);
    gbc_lblTamanho.gridx = 1;
    gbc_lblTamanho.gridy = 2;
    tabFile.add(lblTamanho, gbc_lblTamanho);

    txtLength = new JTextField();
    GridBagConstraints gbc_txtTamanho = new GridBagConstraints();
    gbc_txtTamanho.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtTamanho.insets = new Insets(0, 0, 5, 5);
    gbc_txtTamanho.gridx = 2;
    gbc_txtTamanho.gridy = 2;
    tabFile.add(txtLength, gbc_txtTamanho);
    txtLength.setColumns(10);

    JLabel label_1 = new JLabel(Language.txtOutput);
    GridBagConstraints gbc_label_1 = new GridBagConstraints();
    gbc_label_1.anchor = GridBagConstraints.WEST;
    gbc_label_1.insets = new Insets(0, 0, 5, 5);
    gbc_label_1.gridx = 1;
    gbc_label_1.gridy = 3;
    tabFile.add(label_1, gbc_label_1);

    GridBagConstraints gbc_scrFile = new GridBagConstraints();
    gbc_scrFile.gridheight = 3;
    gbc_scrFile.fill = GridBagConstraints.BOTH;
    gbc_scrFile.gridwidth = 10;
    gbc_scrFile.insets = new Insets(0, 0, 5, 5);
    gbc_scrFile.gridx = 1;
    gbc_scrFile.gridy = 4;
    tabFile.add(scrFile, gbc_scrFile);

    progressBar = new JProgressBar();
    GridBagConstraints gbc_progressBar = new GridBagConstraints();
    gbc_progressBar.fill = GridBagConstraints.HORIZONTAL;
    gbc_progressBar.gridwidth = 10;
    gbc_progressBar.insets = new Insets(0, 0, 0, 5);
    gbc_progressBar.gridx = 1;
    gbc_progressBar.gridy = 7;
    tabFile.add(progressBar, gbc_progressBar);

    JLabel lblNewLabel = new JLabel(Language.txtDeveloped + " Rodrigo Augusto Silva dos Santos - 2016");
    GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
    gbc_lblNewLabel.gridx = 0;
    gbc_lblNewLabel.gridy = 2;
    getContentPane().add(lblNewLabel, gbc_lblNewLabel);

    loadParameters();

}