[code]import java.io.File;
import java.io.IOException;
import java.net.URL;
import javax.swing.;
import java.awt.;
public class TelaPrincipal extends javax.swing.JFrame {
/** Creates new form TelaPrincipal */
public TelaPrincipal() {
super("ARF-Cruzeiro: Controle de Emissão de Documentos (CED)");
for (int i = 0; i < 5000; i++)
System.out.println("");
initComponents();
setBounds(10,10,630,500);
setResizable(false);
setLocationRelativeTo(null);
ImageIcon icone = new ImageIcon ("icone.GIF");
setIconImage (icone.getImage());
}
/** 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=" Código Gerado ">//GEN-BEGIN:initComponents
private void initComponents() {
painelCorpo = new javax.swing.JPanel();
bCom = new javax.swing.JButton();
bMem = new javax.swing.JButton();
bInt = new javax.swing.JButton();
bRep = new javax.swing.JButton();
bCob = new javax.swing.JButton();
bOfi = new javax.swing.JButton();
bDis = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
arquivo = new javax.swing.JMenu();
comunicacao = new javax.swing.JMenuItem();
memorando = new javax.swing.JMenuItem();
intimacao = new javax.swing.JMenuItem();
diso = new javax.swing.JMenuItem();
representacao = new javax.swing.JMenuItem();
cobranca = new javax.swing.JMenuItem();
oficio = new javax.swing.JMenuItem();
Cancelamento = new javax.swing.JMenuItem();
ajuda = new javax.swing.JMenu();
guia = new javax.swing.JMenuItem();
getContentPane().setLayout(null);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(255, 255, 255));
setBounds(new java.awt.Rectangle(2, 2, 2, 2));
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
ImageIcon icone = new ImageIcon ("C:\Documents and Settings\INSS\ControleDeEmissaoDeDocumentos\build\classes\icone.GIF");
setIconImage(icone.getImage());
painelCorpo.setBackground(new java.awt.Color(255, 255, 255));
painelCorpo.setAutoscrolls(true);
painelCorpo.setOpaque(false);
bCom.setText("Comunica\u00e7\u00e3o");
bCom.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bComActionPerformed(evt);
}
});
bMem.setText("Memorando");
bMem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bMemActionPerformed(evt);
}
});
bInt.setText("Intima\u00e7\u00e3o");
bInt.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bIntActionPerformed(evt);
}
});
bRep.setText("Representa\u00e7\u00e3o");
bRep.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bRepActionPerformed(evt);
}
});
bCob.setText("Cobran\u00e7a");
bCob.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bCobActionPerformed(evt);
}
});
bOfi.setText("Oficio");
bOfi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bOfiActionPerformed(evt);
}
});
bDis.setText("DISO");
bDis.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bDisActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Arial", 1, 24));
jLabel1.setForeground(new java.awt.Color(0, 51, 102));
jLabel1.setText("CONTROLE DE EMISS\u00c3O DE DOCUMENTOS");
javax.swing.GroupLayout painelCorpoLayout = new javax.swing.GroupLayout(painelCorpo);
painelCorpo.setLayout(painelCorpoLayout);
painelCorpoLayout.setHorizontalGroup(
painelCorpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(painelCorpoLayout.createSequentialGroup()
.addGap(106, 106, 106)
.addGroup(painelCorpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(painelCorpoLayout.createSequentialGroup()
.addGroup(painelCorpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(bMem, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
.addComponent(bInt, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
.addComponent(bCom, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(190, 190, 190)
.addGroup(painelCorpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(bCob, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(bOfi, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(bRep)))
.addGroup(painelCorpoLayout.createSequentialGroup()
.addGap(139, 139, 139)
.addComponent(bDis, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 156, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(134, 134, 134))
.addGroup(painelCorpoLayout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 519, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(61, Short.MAX_VALUE))
);
painelCorpoLayout.setVerticalGroup(
painelCorpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(painelCorpoLayout.createSequentialGroup()
.addGap(33, 33, 33)
.addComponent(jLabel1)
.addGap(25, 25, 25)
.addGroup(painelCorpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(bRep, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bCom, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(53, 53, 53)
.addGroup(painelCorpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(bCob, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bMem, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(49, 49, 49)
.addGroup(painelCorpoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(bInt, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bOfi, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addComponent(bDis, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(78, 78, 78))
);
getContentPane().add(painelCorpo);
painelCorpo.setBounds(0, 0, 630, 440);
jLabel2.setBackground(new java.awt.Color(255, 255, 255));
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("fundoTelaPrincipal.JPG")));
jLabel2.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/controledeemissaodedocumentos/fundoTelaPrincipal.JPG")));
getContentPane().add(jLabel2);
jLabel2.setBounds(-6, 4, 670, 440);
arquivo.setMnemonic('a');
arquivo.setText("Arquivo");
comunicacao.setMnemonic('c');
comunicacao.setText("Comunica\u00e7\u00e3o");
comunicacao.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comunicacaoActionPerformed(evt);
}
});
arquivo.add(comunicacao);
memorando.setMnemonic('m');
memorando.setText("Memorando");
memorando.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
memorandoActionPerformed(evt);
}
});
arquivo.add(memorando);
intimacao.setMnemonic('i');
intimacao.setText("Intima\u00e7\u00e3o");
intimacao.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
intimacaoActionPerformed(evt);
}
});
arquivo.add(intimacao);
diso.setMnemonic('d');
diso.setText("DISO");
diso.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
disoActionPerformed(evt);
}
});
arquivo.add(diso);
representacao.setMnemonic('r');
representacao.setText("Representa\u00e7\u00e3o");
representacao.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
representacaoActionPerformed(evt);
}
});
arquivo.add(representacao);
cobranca.setMnemonic('o');
cobranca.setText("Cobran\u00e7a");
cobranca.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cobrancaActionPerformed(evt);
}
});
arquivo.add(cobranca);
oficio.setMnemonic('f');
oficio.setText("Of\u00edcio");
oficio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
oficioActionPerformed(evt);
}
});
arquivo.add(oficio);
Cancelamento.setMnemonic('e');
Cancelamento.setText("Cancelamento");
Cancelamento.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CancelamentoActionPerformed(evt);
}
});
arquivo.add(Cancelamento);
jMenuBar1.add(arquivo);
ajuda.setMnemonic('j');
ajuda.setText("Ajuda");
guia.setMnemonic('g');
guia.setText("Guia do Usu\u00e1rio");
guia.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
guiaActionPerformed(evt);
}
});
ajuda.add(guia);
jMenuBar1.add(ajuda);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>//GEN-END:initComponents
private void CancelamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelamentoActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()== Cancelamento){Cancelamento cnl = new Cancelamento();}
}//GEN-LAST:event_CancelamentoActionPerformed
private void disoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disoActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==diso){iDISO diso = new iDISO();}
}//GEN-LAST:event_disoActionPerformed
private void oficioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_oficioActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==oficio){iOficio ofi = new iOficio();}
}//GEN-LAST:event_oficioActionPerformed
private void cobrancaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cobrancaActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==cobranca){iCobranca cob = new iCobranca();}
}//GEN-LAST:event_cobrancaActionPerformed
private void representacaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_representacaoActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==representacao){iRepresentacao rep = new iRepresentacao();}
}//GEN-LAST:event_representacaoActionPerformed
private void intimacaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_intimacaoActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==intimacao){Intimacao iInt = new Intimacao();}
}//GEN-LAST:event_intimacaoActionPerformed
private void memorandoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_memorandoActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==memorando){iMemorando mem = new iMemorando();}
}//GEN-LAST:event_memorandoActionPerformed
private void comunicacaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comunicacaoActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==comunicacao){iComunicacao com = new iComunicacao();}
}//GEN-LAST:event_comunicacaoActionPerformed
private void bDisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bDisActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==bDis){iDISO disoX = new iDISO();}
}//GEN-LAST:event_bDisActionPerformed
private void bOfiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bOfiActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==bOfi){iOficio ofi = new iOficio();}
}//GEN-LAST:event_bOfiActionPerformed
private void bCobActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bCobActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==bCob){iCobranca cob = new iCobranca();}
}//GEN-LAST:event_bCobActionPerformed
private void bRepActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bRepActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==bRep){iRepresentacao rep = new iRepresentacao();}
}//GEN-LAST:event_bRepActionPerformed
private void bIntActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bIntActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==bInt){Intimacao iInt = new Intimacao();}
}//GEN-LAST:event_bIntActionPerformed
private void bMemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bMemActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource()==bMem){iMemorando memX = new iMemorando();}
}//GEN-LAST:event_bMemActionPerformed
private void bComActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bComActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource() == bCom){iComunicacao com = new iComunicacao();}
}//GEN-LAST:event_bComActionPerformed
private void guiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guiaActionPerformed
// TODO adicione seu código de manipulação aqui:
if (evt.getSource() == guia){
try{
//String caminho=“C:\Documents and Settings\INSS\ControleDeEmissaoDeDocumentos\build\classes\CartaCobranca.doc”;
Desktop.getDesktop().open(new File("\C:\CED\dist\Docs\Documentacao.doc"));
}
catch(Exception e){
System.out.print(e);
}}
}//GEN-LAST:event_guiaActionPerformed
//método Splash
public void initApplication() {
Splash.getInstance().finish();
}
// Declaração de variáveis - não modifique//GEN-BEGIN:variables
private javax.swing.JMenuItem Cancelamento;
private javax.swing.JMenu ajuda;
private javax.swing.JMenu arquivo;
private javax.swing.JButton bCob;
private javax.swing.JButton bCom;
private javax.swing.JButton bDis;
private javax.swing.JButton bInt;
private javax.swing.JButton bMem;
private javax.swing.JButton bOfi;
private javax.swing.JButton bRep;
private javax.swing.JMenuItem cobranca;
private javax.swing.JMenuItem comunicacao;
private javax.swing.JMenuItem diso;
private javax.swing.JMenuItem guia;
private javax.swing.JMenuItem intimacao;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem memorando;
private javax.swing.JMenuItem oficio;
private javax.swing.JPanel painelCorpo;
private javax.swing.JMenuItem representacao;
// Fim da declaração de variáveis//GEN-END:variables
}
[/code]
Especificamente esta linha:
try{
Desktop.getDesktop().open(new File("\C:\CED\dist\Docs\Documentacao.doc"));
}