Estou postando a classe prncipal
[code]package br.com.llw.ag.painel;
import java.awt.Event;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import br.com.llw.ag.calendario.CalendData;
import br.com.llw.ag.comprimissos.CalendComp;
import br.com.llw.ag.fluxo.PainelFluxo;
import br.com.llw.ag.funcoesgerais.CarregaProperties;
import br.com.llw.ag.funcoesgerais.FuncoesGerais;
import br.com.llw.ag.funcoesgerais.PainelExecSql;
import br.com.llw.ag.recados.PainelRecados;
import br.com.llw.ag.telefonica.FuncoesTel;
import br.com.llw.ag.telefonica.PainelTel;
public class PainelAG extends JFrame {
private PainelTel pt = null;
private CalendComp ccomp = null;
private CalendData calend = null;
private PainelRecados pr = null;
private PainelFluxo pf = null;
private boolean depura = false;
private CarregaProperties prop = new CarregaProperties();
private final String sobre = "Projeto independe.\nCriador:\nFerramentas utilizadas:\n Eclipse SDK, Java, Swing, H2Database, MySql, Inkscape";
/**
*
*/
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JMenuBar jJMenuBar = null;
private JMenu fileMenu = null;
private JMenu editMenu = null;
private JMenu helpMenu = null;
private JMenuItem exitMenuItem = null;
private JMenuItem aboutMenuItem = null;
private JMenuItem execSQLMenuItem = null;
private JMenuItem configMenuItem = null;
private JMenuItem atualizaMenuItem = null;
private JButton btn_agTel = null;
private JButton btn_agComp = null;
private JButton btn_calend = null;
private JButton btn_finan = null;
private JButton btn_correio = null;
private JButton btn_amigos = null;
private JMenuItem exportarMenuItem = null;
private JMenuItem loginaMenuItem = null;
FuncoesPainel fp = new FuncoesPainel();
/**
* This method initializes btn_agTel
*
* @return javax.swing.JButton
*/
private JButton getBtn_agTel() {
if (btn_agTel == null) {
btn_agTel = new JButton();
btn_agTel.setIcon(new ImageIcon(getClass().getResource("/br/com/llw/ag/img/mini_tel.png")));
btn_agTel.setToolTipText("Sua agenda de telefones.");
btn_agTel.setBackground(java.awt.Color.white);
btn_agTel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// abreTelefone();
if (pt == null) {
pt = new PainelTel();
// pt.setLocation(new java.awt.Point(prop.PainelX,
// prop.PainelY));
}
pt.setVisible(true);
}
});
}
return btn_agTel;
}
/**
* This method initializes btn_AgComp
*
* @return javax.swing.JButton
*/
private JButton getBtn_agComp() {
if (btn_agComp == null) {
btn_agComp = new JButton();
btn_agComp.setIcon(new ImageIcon(getClass().getResource("/br/com/llw/ag/img/mini_agenda.png")));
btn_agComp.setToolTipText("Sua agenda de compromissos.");
btn_agComp.setBackground(java.awt.Color.white);
btn_agComp.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
if(ccomp == null){
ccomp = new CalendComp();
ccomp.addDias();
}
ccomp.setVisible(true);
}
});
}
return btn_agComp;
}
/**
* This method initializes btn_calend
*
* @return javax.swing.JButton
*/
private JButton getBtn_calend() {
if (btn_calend == null) {
btn_calend = new JButton();
btn_calend.setIcon(new ImageIcon(getClass().getResource("/br/com/llw/ag/img/mini_calend.png")));
btn_calend.setToolTipText("Calendário");
btn_calend.setBackground(java.awt.Color.white);
btn_calend.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//abreCalendario();
if (calend == null){
calend = new CalendData();
calend.addDias();
}
calend.setVisible(true);
}
});
}
return btn_calend;
}
/**
* This method initializes btn_finan
*
* @return javax.swing.JButton
*/
private JButton getBtn_finan() {
if (btn_finan == null) {
btn_finan = new JButton();
btn_finan.setIcon(new ImageIcon(getClass().getResource("/br/com/llw/ag/img/mini_finan.png")));
btn_finan.setToolTipText("Controle financeiro.");
btn_finan.setBackground(java.awt.Color.white);
btn_finan.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
// System.out.println("actionPerformed()"); // TODO
// Auto-generated Event stub actionPerformed()
if (pf == null)
pf = new PainelFluxo();
pf.setVisible(true);
}
});
}
return btn_finan;
}
/**
* This method initializes btn_correio
*
* @return javax.swing.JButton
*/
private JButton getBtn_correio() {
if (btn_correio == null) {
btn_correio = new JButton();
btn_correio.setIcon(new ImageIcon(getClass().getResource("/br/com/llw/ag/img/mini_notas.png")));
btn_correio.setToolTipText("Caixa de entrada, recados e anotações.");
btn_correio.setBackground(java.awt.Color.white);
btn_correio.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
if(pr == null)
pr = new PainelRecados();
pr.setVisible(true);
}
});
}
return btn_correio;
}
/**
* This method initializes btn_amigos
*
* @return javax.swing.JButton
*/
private JButton getBtn_amigos() {
if (btn_amigos == null) {
btn_amigos = new JButton();
btn_amigos.setIcon(new ImageIcon(getClass().getResource("/br/com/llw/ag/img/mini_p03.png")));
btn_amigos.setToolTipText("Compartilhe compromissos com seus contatos.");
btn_amigos.setEnabled(false);
btn_amigos.setBackground(java.awt.Color.white);
}
return btn_amigos;
}
/**
* This method initializes exportarMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExportarMenuItem() {
if (exportarMenuItem == null) {
exportarMenuItem = new JMenuItem();
exportarMenuItem.setText("Exportar");
exportarMenuItem.setToolTipText("Exportar dados em formato CSV.");
exportarMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
FuncoesTel funcTel = new FuncoesTel();
String txt = "A funcionalidade exportar será aprimorada nas próximas versões.\nSerá criado um arquivo \"dadosAgTel.csv\" na mesma pasta da aplicação.";
fp.mostraMensagem(txt,'a');
funcTel.exportaCSV();
funcTel = null;
}
});
}
return exportarMenuItem;
}
/**
* This method initializes loginaMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getLoginaMenuItem() {
if (loginaMenuItem == null) {
loginaMenuItem = new JMenuItem();
loginaMenuItem.setText("Login.");
loginaMenuItem.setEnabled(false);
loginaMenuItem.setToolTipText("Efetuar login.");
}
return loginaMenuItem;
}
/**
* @param args
*/
public static void main(String[] args) {
boolean dep = false;
if(args.length > 0){
if(args[0].equals("MarcusBecker"))
dep = true;
}
PainelAG inicia = new PainelAG(dep);
inicia.setVisible(true);
}
/**
* This is the default constructor
*/
public PainelAG() {
super();
initialize();
}
public PainelAG(boolean dep) {
super();
depura = dep;
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
this.setLocation(new java.awt.Point(prop.PainelX,prop.PainelY));
this.setJMenuBar(getJJMenuBar());
this.setSize(prop.PainelW, prop.PainelH);
this.setContentPane(getJContentPane());
this.setTitle("A G - 2 0 0 7");
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
fechaAG();
}
});
}
private void fechaAG(){
prop.salvaPainel(this.getX(),this.getY(),this.getWidth(),this.getHeight());
System.out.println("PainelHeight: " + this.getHeight());
System.out.println("PainelWidth: " + this.getWidth());
System.out.println("PainelX: " + this.getX());
System.out.println("PainelY: " + this.getY());
System.exit(0);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
GridLayout gridLayout = new GridLayout();
gridLayout.setColumns(6);
gridLayout.setRows(1);
jContentPane = new JPanel();
jContentPane.setLayout(gridLayout);
jContentPane.add(getBtn_agTel(), null);
jContentPane.add(getBtn_agComp(), null);
jContentPane.add(getBtn_calend(), null);
jContentPane.add(getBtn_finan(), null);
jContentPane.add(getBtn_correio(), null);
jContentPane.add(getBtn_amigos(), null);
}
return jContentPane;
}
/**
* This method initializes jJMenuBar
*
* @return javax.swing.JMenuBar
*/
private JMenuBar getJJMenuBar() {
if (jJMenuBar == null) {
jJMenuBar = new JMenuBar();
jJMenuBar.add(getFileMenu());
jJMenuBar.add(getEditMenu());
jJMenuBar.add(getHelpMenu());
}
return jJMenuBar;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getFileMenu() {
if (fileMenu == null) {
fileMenu = new JMenu();
fileMenu.setText("Sistema");
fileMenu.add(getLoginaMenuItem());
fileMenu.add(getAtualizaMenuItem());
fileMenu.add(getExportarMenuItem());
fileMenu.addSeparator();
fileMenu.add(getExitMenuItem());
}
return fileMenu;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getEditMenu() {
if (editMenu == null) {
editMenu = new JMenu();
editMenu.setText("Config");
if(depura)
editMenu.add(getExecSQLMenuItem());
editMenu.add(getConfigMenuItem());
}
return editMenu;
}
/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getHelpMenu() {
if (helpMenu == null) {
helpMenu = new JMenu();
helpMenu.setText("Sobre");
helpMenu.add(getAboutMenuItem());
}
return helpMenu;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExitMenuItem() {
if (exitMenuItem == null) {
exitMenuItem = new JMenuItem();
exitMenuItem.setText("Fechar");
exitMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
fechaAG();
}
});
}
return exitMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getAboutMenuItem() {
if (aboutMenuItem == null) {
aboutMenuItem = new JMenuItem();
aboutMenuItem.setText("Info.");
aboutMenuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
//new JDialog(PainelAG.this, "","", true).setVisible(true);
JOptionPane.showMessageDialog(PainelAG.this, sobre,
"A G 2 0 0 7", JOptionPane.INFORMATION_MESSAGE);
}
});
}
return aboutMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getExecSQLMenuItem() {
if (execSQLMenuItem == null) {
execSQLMenuItem = new JMenuItem();
execSQLMenuItem.setText("SQL Prompt.");
execSQLMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
Event.CTRL_MASK, true));
execSQLMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed()
FuncoesGerais fg = new FuncoesGerais();
PainelExecSql exec = new PainelExecSql(fg.criaConInt());
exec.setVisible(true);
}
});
}
return execSQLMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getConfigMenuItem() {
if (configMenuItem == null) {
configMenuItem = new JMenuItem();
configMenuItem.setText("Cofigurações");
configMenuItem.setEnabled(false);
configMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
Event.CTRL_MASK, true));
}
return configMenuItem;
}
/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getAtualizaMenuItem() {
if (atualizaMenuItem == null) {
atualizaMenuItem = new JMenuItem();
atualizaMenuItem.setText("Atualizar");
atualizaMenuItem.setToolTipText("Procurar por atualizações.");
atualizaMenuItem.setEnabled(false);
atualizaMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,
Event.CTRL_MASK, true));
}
return atualizaMenuItem;
}
/*
private void abreTelefone() {
if (pt == null) {
pt = new PainelTel();
//pt.setLocation(new java.awt.Point(prop.PainelX, prop.PainelY));
}
pt.setVisible(true);
}
private void abreCalendario() {
if (calend == null){
calend = new CalendData();
calend.addDias();
}
calend.setVisible(true);
}
*/
} // @jve:decl-index=0:visual-constraint=“10,10”
[/code]