grafix.telas.secundarias.FormPapeisYahoo.java Source code

Java tutorial

Introduction

Here is the source code for grafix.telas.secundarias.FormPapeisYahoo.java

Source

/*
  Copyright (C) 2001-2012, Joao Medeiros, Paulo Vilela (grafix2.com)
      
  Este arquivo  parte do programa Grafix2.com
      
  Grafix2.com  um software livre; voc pode redistribui-lo e/ou 
  modifica-lo dentro dos termos da Licena Pblica Geral GNU como 
  publicada pela Fundao do Software Livre (FSF); na verso 2 da 
  Licena.
    
  Este programa  distribuido na esperana que possa ser til, 
  mas SEM NENHUMA GARANTIA; sem uma garantia implicita de ADEQUAO a qualquer
  MERCADO ou APLICAO EM PARTICULAR. Veja a
  Licena Pblica Geral GNU para maiores detalhes.
    
  Voc deve ter recebido uma cpia da Licena Pblica Geral GNU
  junto com este programa, se no, veja uma cpia em
  <http://www.gnu.org/licenses/>
      
 */

/*
 * FormPapeisYahoo.java
 *
 * Created on 27 de Maio de 2008, 21:40
 */

package grafix.telas.secundarias;

import grafix.auxiliar.Utils;
import java.io.FileReader;
import java.io.FileWriter;
import org.jfree.chart.title.Title;

/**
 *
 * @author  joao
 */
public class FormPapeisYahoo extends javax.swing.JDialog {
    private boolean salvou = false;

    /** Creates new form FormPapeisYahoo */
    public FormPapeisYahoo(java.awt.Frame parent, String Title, boolean modal) {
        super(parent, modal);
        initComponents();
        iniciarCampos();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Cdigo Gerado ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jScrollPane1 = new javax.swing.JScrollPane();
        taLista = new javax.swing.JTextArea();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        taLista.setColumns(20);
        taLista.setRows(5);
        jScrollPane1.setViewportView(taLista);

        jLabel1.setText("Lista de pap\u00e9is para atualiza\u00e7\u00e3o via Yahoo!");

        jLabel2.setText("Cada linha \u00e9 composta pelo c\u00f3digo Grafix seguido do c\u00f3digo Yahoo!");

        jButton1.setText("Salva");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setText("Cancela");

        jButton3.setText("Fecha");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout
                .createSequentialGroup().add(27, 27, 27)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel2).add(jLabel1)
                        .add(layout.createSequentialGroup()
                                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 247,
                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(33, 33, 33)
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                        .add(jButton3).add(jButton2).add(jButton1))))
                .addContainerGap(95, Short.MAX_VALUE)));
        layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout
                .createSequentialGroup().add(38, 38, 38).add(jLabel1).add(26, 26, 26).add(jLabel2)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(layout.createSequentialGroup().addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 434,
                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(layout.createSequentialGroup().add(59, 59, 59).add(jButton1).add(21, 21, 21)
                                .add(jButton2).add(18, 18, 18).add(jButton3)))
                .addContainerGap(42, Short.MAX_VALUE)));
        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        String nomeLista = "internacionais.txt";
        try {
            taLista.write(new FileWriter(nomeLista));

        } catch (Exception ex) {
            Utils.exibeMsgErro(
                    "No conseguiu gravar o arquivo com a lista de papis da base de dados: " + nomeLista);
            ex.printStackTrace();
        }
        // dispose();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void iniciarCampos() {
        //tfDiretori.setText(Controle.getConfiguracoesGrafix().getPathBaseDados());
        String nomeLista = "internacionais.txt";
        try {
            taLista.read(new FileReader(nomeLista), null);

        } catch (Exception ex) {
            Utils.exibeMsgErro(
                    "No conseguiu ler o arquivo com a lista de papis da base de dados: " + nomeLista);
            ex.printStackTrace();
        }

    }

    // Declarao de variveis - no modifique//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea taLista;
    // Fim da declarao de variveis//GEN-END:variables

}