import cadastros.cad_clientes;
import javax.swing.*;
public final class TelaPrincipal extends javax.swing.JFrame {
String seta_look = "javax.swing.plaf.metal.MetalLookAndFeel";
data mostra_data;
/**
* Creates new form TelaPrincipal
*/
public TelaPrincipal() {
initComponents();
mostra_data = new data();
mostra_data.le_data();
label_data.setText("Data:"+mostra_data.dia+"/"+mostra_data.mes+"/"+mostra_data.ano);
timer1.start();
lookandfeel();
}
/**
* 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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
timer1 = new org.netbeans.examples.lib.timerbean.Timer();
jPanel1 = new javax.swing.JPanel();
jButton_Clientes = new javax.swing.JButton();
jButton_produtos = new javax.swing.JButton();
jButton_fornecedor = new javax.swing.JButton();
jButton_sair = new javax.swing.JButton();
label_data = new javax.swing.JLabel();
label_hora = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
Menu_cadastro = new javax.swing.JMenu();
MenuItem_Clientes = new javax.swing.JMenuItem();
MenuItem_Produtos = new javax.swing.JMenuItem();
MenuItem_Fornecedores = new javax.swing.JMenuItem();
Menu_consultas = new javax.swing.JMenu();
Menu_relatorio = new javax.swing.JMenu();
jMenu4_utilitarios = new javax.swing.JMenu();
jMenuItem1_temawindows = new javax.swing.JMenuItem();
jMenuItem1_temametal = new javax.swing.JMenuItem();
jMenuItem1_temamotif = new javax.swing.JMenuItem();
jMenuItem1_temanimbus = new javax.swing.JMenuItem();
jMenu5 = new javax.swing.JMenu();
timer1.addTimerListener(new org.netbeans.examples.lib.timerbean.TimerListener() {
public void onTime(java.awt.event.ActionEvent evt) {
timer1OnTime(evt);
}
});
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Sistema de Pedidos");
jPanel1.setBackground(new java.awt.Color(204, 204, 204));
jButton_Clientes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/icon_clientes.gif"))); // NOI18N
jButton_Clientes.setText("Clientes");
jButton_Clientes.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_ClientesActionPerformed(evt);
}
});
jButton_produtos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/icon_produto.gif"))); // NOI18N
jButton_produtos.setText("Produtos");
jButton_produtos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_produtosActionPerformed(evt);
}
});
jButton_fornecedor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/icon_fornecedores.png"))); // NOI18N
jButton_fornecedor.setText("Fornecedor");
jButton_fornecedor.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_fornecedorActionPerformed(evt);
}
});
jButton_sair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/sair.png"))); // NOI18N
jButton_sair.setText("Sair");
jButton_sair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton_sairActionPerformed(evt);
}
});
label_data.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
label_data.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/data.png"))); // NOI18N
label_data.setText("Data: ");
label_hora.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
label_hora.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/hora.png"))); // NOI18N
label_hora.setText("Hora: ");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jButton_Clientes, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(29, 29, 29)
.addComponent(jButton_produtos, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(26, 26, 26)
.addComponent(jButton_fornecedor, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(37, 37, 37)
.addComponent(jButton_sair, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(185, 185, 185)
.addComponent(label_data, javax.swing.GroupLayout.PREFERRED_SIZE, 238, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(27, 27, 27)
.addComponent(label_hora)
.addContainerGap(275, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton_produtos, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_Clientes, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_fornecedor, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton_sair, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(label_data)
.addComponent(label_hora))
.addContainerGap(693, Short.MAX_VALUE))
);
Menu_cadastro.setMnemonic('c');
Menu_cadastro.setText("Cadastro");
MenuItem_Clientes.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
MenuItem_Clientes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/icon_clientes.gif"))); // NOI18N
MenuItem_Clientes.setText("Clientes");
MenuItem_Clientes.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
MenuItem_ClientesActionPerformed(evt);
}
});
Menu_cadastro.add(MenuItem_Clientes);
MenuItem_Produtos.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
MenuItem_Produtos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/icon_produto.gif"))); // NOI18N
MenuItem_Produtos.setText("Produtos");
Menu_cadastro.add(MenuItem_Produtos);
MenuItem_Fornecedores.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK));
MenuItem_Fornecedores.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/icon_fornecedores.png"))); // NOI18N
MenuItem_Fornecedores.setText("Fornecedores");
Menu_cadastro.add(MenuItem_Fornecedores);
jMenuBar1.add(Menu_cadastro);
Menu_consultas.setMnemonic('n');
Menu_consultas.setText("Consultas");
jMenuBar1.add(Menu_consultas);
Menu_relatorio.setMnemonic('r');
Menu_relatorio.setText("Relatórios");
jMenuBar1.add(Menu_relatorio);
jMenu4_utilitarios.setMnemonic('u');
jMenu4_utilitarios.setText("Utilitarios");
jMenuItem1_temawindows.setText("Tema Windows");
jMenuItem1_temawindows.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1_temawindowsActionPerformed(evt);
}
});
jMenu4_utilitarios.add(jMenuItem1_temawindows);
jMenuItem1_temametal.setText("Tema Metal");
jMenuItem1_temametal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1_temametalActionPerformed(evt);
}
});
jMenu4_utilitarios.add(jMenuItem1_temametal);
jMenuItem1_temamotif.setText("Tema Motif");
jMenuItem1_temamotif.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1_temamotifActionPerformed(evt);
}
});
jMenu4_utilitarios.add(jMenuItem1_temamotif);
jMenuItem1_temanimbus.setText("Tema Nimbus");
jMenuItem1_temanimbus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1_temanimbusActionPerformed(evt);
}
});
jMenu4_utilitarios.add(jMenuItem1_temanimbus);
jMenuBar1.add(jMenu4_utilitarios);
jMenu5.setMnemonic('s');
jMenu5.setText("Sair");
jMenu5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jMenu5MouseClicked(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
jMenu5MouseExited(evt);
}
});
jMenuBar1.add(jMenu5);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 71, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>
private void jButton_ClientesActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jButton_produtosActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jButton_fornecedorActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jButton_sairActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
}
private void jMenu5MouseExited(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}
private void jMenu5MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
System.exit(0);
}
private void jMenuItem1_temawindowsActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
seta_look="com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
lookandfeel();
}
private void jMenuItem1_temametalActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
seta_look="javax.swing.plaf.metal.MetalLookAndFeel";
lookandfeel();
}
private void jMenuItem1_temamotifActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
seta_look="com.sun.java.swing.plaf.motif.MotifLookAndFeel";
lookandfeel();
}
private void jMenuItem1_temanimbusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
seta_look="com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";
lookandfeel();
}
private void timer1OnTime(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
mostra_data.le_hora();
label_hora.setText("Hora: "+mostra_data.hora);
}
private void MenuItem_ClientesActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
cad_clientes tela = new cad_clientes();
tela.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(() -> {
new TelaPrincipal().setVisible(true);
});
}
// Variables declaration - do not modify
private javax.swing.JMenuItem MenuItem_Clientes;
private javax.swing.JMenuItem MenuItem_Fornecedores;
private javax.swing.JMenuItem MenuItem_Produtos;
private javax.swing.JMenu Menu_cadastro;
private javax.swing.JMenu Menu_consultas;
private javax.swing.JMenu Menu_relatorio;
private javax.swing.JButton jButton_Clientes;
private javax.swing.JButton jButton_fornecedor;
private javax.swing.JButton jButton_produtos;
private javax.swing.JButton jButton_sair;
private javax.swing.JMenu jMenu4_utilitarios;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1_temametal;
private javax.swing.JMenuItem jMenuItem1_temamotif;
private javax.swing.JMenuItem jMenuItem1_temanimbus;
private javax.swing.JMenuItem jMenuItem1_temawindows;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel label_data;
private javax.swing.JLabel label_hora;
private org.netbeans.examples.lib.timerbean.Timer timer1;
// End of variables declaration
/**
*
*/
public void lookandfeel(){
try
{
UIManager.setLookAndFeel(seta_look);
SwingUtilities.updateComponentTreeUI(this);
}
catch(ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException erro)
{
JOptionPane.showMessageDialog(null, erro);
}
}
}