carolina.pegaLatLong.Teste.java Source code

Java tutorial

Introduction

Here is the source code for carolina.pegaLatLong.Teste.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package carolina.pegaLatLong;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import jdk.nashorn.internal.parser.JSONParser;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.ParseException;
import sun.net.www.http.HttpClient;
import sun.nio.cs.StandardCharsets;

/**
 *
 * @author c01015
 */
public class Teste {

    public static void main(String[] args) throws MalformedURLException, IOException, ParseException {
        List<InformacoesTxt> listaInfo = new ArrayList<InformacoesTxt>();
        //        String json = "";
        //        InputStream in = null;
        //      
        //
        //        URL ul;
        //        
        //            ul = new URL("https://maps.googleapis.com/maps/api/geocode/json?address=10115,germany");
        //            HttpURLConnection conn = (HttpURLConnection) ul.openConnection();
        //           // conn.setRequestMethod("GET");
        //            //conn.setRequestProperty("Accept", "application/json");
        //            BufferedReader bf = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        //            String pega = "";
        //            String result = "";
        //            while((pega = bf.readLine()) != null){
        //                result+=pega;
        //            }
        //            System.err.println(result);
        //            
        //            org.json.simple.parser.JSONParser parser = new org.json.simple.parser.JSONParser();
        //            Object obj = parser.parse(result);
        //            
        //            JSONObject tudo = (JSONObject) obj; 
        //            
        //            JSONArray jsonObject1 = (JSONArray) tudo.get("results");
        //            JSONObject jsonObject2 = (JSONObject)jsonObject1.get(0);
        //            JSONObject jsonObject3 = (JSONObject)jsonObject2.get("geometry");
        //            JSONObject location = (JSONObject) jsonObject3.get("location");
        //
        //            System.out.println( "Lat = "+location.get("lat"));
        //            System.out.println( "Lng = "+location.get("lng"));
        //
        //        String caminho = "externfiles\\emitente3.txt";
        //        FileInputStream file = new FileInputStream(caminho);
        //        InputStreamReader input = new InputStreamReader(file, java.nio.charset.StandardCharsets.ISO_8859_1);
        //        BufferedReader br = new BufferedReader(input);
        //        String pega = "";
        //        String mostra = "";
        //        System.err.println(mostra);
        //        int cont = 0;
        //        // Nome do Emitente,CNPJ,IE,Endereo,Bairro,CEP,Cidade,UF,Pais,
        //        while ((pega = br.readLine()) != null) {
        //            if (cont > 0) {
        //                String neew = LatLong.removerAcentos(pega.toLowerCase());
        //                String vet[] = neew.split(";");
        //                InformacoesTxt info = new InformacoesTxt();
        //                info.setEndereco(vet[0]);
        //                info.setCep(vet[2]);
        //                info.setBairro(vet[1]);
        //                info.setCidade(vet[3]);
        //                info.setUf(vet[4]);
        //                info.setPais(vet[5]);
        //                listaInfo.add(info);
        //            }
        //            cont++;
        //        }
        //
        //        //System.err.println("Tudo: " + cont);
        //        for (InformacoesTxt informacoes : listaInfo) {
        //
        //            System.out.println("Endereo: " + informacoes.getEndereco());
        //            System.out.println("Bairro: " + informacoes.getBairro());
        //            System.out.println("CEP: " + informacoes.getCep());
        //            System.out.println("Cidade: " + informacoes.getCidade());
        //            System.out.println("UF: " + informacoes.getUf());
        //            System.out.println("Pais: " + informacoes.getPais() + "\n");
        //
        //        }

        //        JPanel painel = new JPanel();
        //        JRadioButton btnEncontrados = new JRadioButton("Encontrados");
        //        JRadioButton btnNaoEncontrados = new JRadioButton("No encontrados");
        //        JRadioButton btnEncontradosMais = new JRadioButton("Mais de um encontrados");
        //        JRadioButton btnTudo = new JRadioButton("Tudo");
        //        ButtonGroup btnGroup = new ButtonGroup();
        //        btnGroup.add(btnTudo);
        //        btnGroup.add(btnEncontrados);
        //        btnGroup.add(btnNaoEncontrados);
        //        btnGroup.add(btnEncontradosMais);
        //
        //        painel.add(btnTudo);
        //        painel.add(btnEncontrados);
        //        painel.add(btnNaoEncontrados);
        //        painel.add(btnEncontradosMais);
        //        JOptionPane.showMessageDialog(null, painel);

        int a = 2;
        int b = 3;
        String teste = (a > b) ? "A maior que b" : "B maior que A";
        JOptionPane.showMessageDialog(null, teste);
    }

}