public class FormOS extends JInternalFrame {
private javax.swing.JPanel jContentPane = null;
private javax.swing.JPanel jPanel = null;
private javax.swing.JLabel jLabel = null;
private javax.swing.JLabel jLabel1 = null;
private javax.swing.JLabel jLabel3 = null;
private javax.swing.JLabel jLabel4 = null;
private javax.swing.JTextField jTextField = null;
private javax.swing.JComboBox jComboBox = null;
private javax.swing.JComboBox jComboBox1 = null;
private javax.swing.JScrollPane jScrollPane = null;
private javax.swing.JTextArea jTextArea = null;
GerenteBD gb=new GerenteBD();
InfoSistema is=new InfoSistema();
Conexao connect;
Statement stmt;
private javax.swing.JLabel jLabel2 = null;
private javax.swing.JTextField jTextField1 = null;
private javax.swing.JComboBox jComboBox2 = null;
private javax.swing.JCheckBox jCheckBox = null;
private javax.swing.JLabel jLabel6 = null;
private javax.swing.JComboBox jComboBox3 = null;
private javax.swing.JButton jButton = null;
private javax.swing.JLabel jLabel5 = null;
/**
* This is the default constructor
*/
public FormOS() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(450, 348);
this.setClosable(true);
this.setContentPane(getJContentPane());
this.setTitle("MSITecnologia - Registro de OS");
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private javax.swing.JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new javax.swing.JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJPanel(), null);
jContentPane.setBackground(java.awt.Color.white);
}
return jContentPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private javax.swing.JPanel getJPanel() {
if(jPanel == null) {
jPanel = new javax.swing.JPanel();
jPanel.setLayout(null);
jPanel.add(getJLabel(), null);
jPanel.add(getJLabel1(), null);
jPanel.add(getJLabel4(), null);
jPanel.add(getJTextField(), null);
jPanel.add(getJComboBox(), null);
jPanel.add(getJComboBox1(), null);
jPanel.add(getJLabel3(), null);
jPanel.add(getJScrollPane(), null);
jPanel.add(getJLabel2(), null);
jPanel.add(getJTextField1(), null);
jPanel.add(getJComboBox2(), null);
jPanel.add(getJCheckBox(), null);
jPanel.add(getJLabel6(), null);
jPanel.add(getJComboBox3(), null);
jPanel.add(getJButton(), null);
jPanel.add(getJLabel5(), null);
jPanel.setBounds(7, 10, 429, 298);
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED), "Abrir OS", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(0,153,51)));
jPanel.setBackground(new java.awt.Color(204,255,204));
}
return jPanel;
}
/**
* This method initializes jLabel
*
* @return javax.swing.JLabel
*/
private javax.swing.JLabel getJLabel() {
if(jLabel == null) {
jLabel = new javax.swing.JLabel();
jLabel.setSize(80, 20);
jLabel.setText("Data:");
jLabel.setLocation(12, 24);
}
return jLabel;
}
/**
* This method initializes jLabel1
*
* @return javax.swing.JLabel
*/
private javax.swing.JLabel getJLabel1() {
if(jLabel1 == null) {
jLabel1 = new javax.swing.JLabel();
jLabel1.setSize(80, 20);
jLabel1.setText("Cliente:");
jLabel1.setLocation(12, 50);
}
return jLabel1;
}
/**
* This method initializes jLabel2
*
* @return javax.swing.JLabel
*/
/**
* This method initializes jLabel3
*
* @return javax.swing.JLabel
*/
private javax.swing.JLabel getJLabel3() {
if(jLabel3 == null) {
jLabel3 = new javax.swing.JLabel();
jLabel3.setBounds(12, 134, 80, 20);
jLabel3.setText("Descricao:");
}
return jLabel3;
}
/**
* This method initializes jLabel4
*
* @return javax.swing.JLabel
*/
private javax.swing.JLabel getJLabel4() {
if(jLabel4 == null) {
jLabel4 = new javax.swing.JLabel();
jLabel4.setSize(80, 20);
jLabel4.setText("Equipamento:");
jLabel4.setLocation(12, 77);
}
return jLabel4;
}
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
private javax.swing.JTextField getJTextField() {
if(jTextField == null) {
jTextField = new javax.swing.JTextField(is.data());
jTextField.setSize(72, 20);
jTextField.setLocation(97, 24);
}
return jTextField;
}
/**
* This method initializes jComboBox
*
* @return javax.swing.JComboBox
*/
private javax.swing.JComboBox getJComboBox() {
if(jComboBox == null) {
jComboBox = new javax.swing.JComboBox();
jComboBox.setSize(138, 20);
jComboBox.setLocation(97, 51);
jComboBox.setMaximumRowCount(120);
jComboBox.setEditable(true);
jComboBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
PreencheCombo();
}
});
}return jComboBox;
}
/**
* This method initializes jComboBox1
*
* @return javax.swing.JComboBox
*/
private javax.swing.JComboBox getJComboBox1() {
if(jComboBox1 == null) {
String[] equip={"CPU","Monitor","Teclado","Mouse","HD","Drive Disquete","Drive CD-Rom","Impressora","Scanner","Placa Interna","Fonte","Computador","Rede","Internet","Software"};
jComboBox1 = new JComboBox(equip);
jComboBox1.setSize(138, 18);
jComboBox1.setLocation(97, 78);
jComboBox1.setMaximumRowCount(15);
}
return jComboBox1;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private javax.swing.JScrollPane getJScrollPane() {
if(jScrollPane == null) {
jScrollPane = new javax.swing.JScrollPane();
jScrollPane.setViewportView(getJTextArea());
jScrollPane.setBounds(13, 156, 363, 64);
}
return jScrollPane;
}
/**
* This method initializes jTextArea
*
* @return javax.swing.JTextArea
*/
private javax.swing.JTextArea getJTextArea() {
if(jTextArea == null) {
jTextArea = new javax.swing.JTextArea();
}
return jTextArea;
}
/**
* This method initializes jLabel2
*
* @return javax.swing.JLabel
*/
private javax.swing.JLabel getJLabel2() {
if(jLabel2 == null) {
jLabel2 = new javax.swing.JLabel();
jLabel2.setSize(80, 20);
jLabel2.setText("Solicitante:");
jLabel2.setLocation(13, 109);
}
return jLabel2;
}
/**
* This method initializes jTextField1
*
* @return javax.swing.JTextField
*/
private javax.swing.JTextField getJTextField1() {
if(jTextField1 == null) {
jTextField1 = new javax.swing.JTextField();
jTextField1.setSize(153, 20);
jTextField1.setLocation(97, 110);
}
return jTextField1;
}
/**
* This method initializes jLabel5
*
* @return javax.swing.JLabel
*/
/**
* This method initializes jComboBox2
*
* @return javax.swing.JComboBox
*/
private javax.swing.JComboBox getJComboBox2() {
if(jComboBox2 == null) {
String [] tipo={"interno","externo"};
jComboBox2 = new javax.swing.JComboBox(tipo);
jComboBox2.setSize(90, 18);
jComboBox2.setLocation(141, 226);
jComboBox2.setMaximumRowCount(10);
}
return jComboBox2;
}
/**
* This method initializes jCheckBox
*
* @return javax.swing.JCheckBox
*/
private javax.swing.JCheckBox getJCheckBox() {
if(jCheckBox == null) {
jCheckBox = new javax.swing.JCheckBox();
jCheckBox.setBounds(278, 226, 97, 21);
jCheckBox.setText("Garantia");
jCheckBox.setBackground(new java.awt.Color(204,255,204));
}
return jCheckBox;
}
/**
* This method initializes jLabel6
*
* @return javax.swing.JLabel
*/
private javax.swing.JLabel getJLabel6() {
if(jLabel6 == null) {
jLabel6 = new javax.swing.JLabel();
jLabel6.setSize(153, 20);
jLabel6.setText("Direcionar chamado para:");
jLabel6.setLocation(264, 22);
}
return jLabel6;
}
/**
* This method initializes jComboBox3
*
* @return javax.swing.JComboBox
*/
private javax.swing.JComboBox getJComboBox3() {
if(jComboBox3 == null) {
jComboBox3 = new javax.swing.JComboBox(gb.listaUSER());
jComboBox3.setSize(153, 18);
jComboBox3.setLocation(264, 44);
jComboBox3.setMaximumRowCount(10);
}
return jComboBox3;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private javax.swing.JButton getJButton() {
if(jButton == null) {
jButton = new javax.swing.JButton();
jButton.setSize(90, 25);
jButton.setLocation(175, 257);
jButton.setText("ABRIR");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
AbrirOS();
}
});
}
return jButton;
}
/**
* This method initializes jLabel5
*
* @return javax.swing.JLabel
*/
private javax.swing.JLabel getJLabel5() {
if(jLabel5 == null) {
jLabel5 = new javax.swing.JLabel();
jLabel5.setSize(120, 20);
jLabel5.setText("Tipo de Atendimento:");
jLabel5.setLocation(15, 226);
}
return jLabel5;
}
public void AbrirOS(){
int garantia=-1;
if(jCheckBox.isSelected()){
garantia=1;
}else{
garantia=0;
}
boolean fechado=false;
String equipamento=(String)jComboBox.getSelectedItem();
String tipo=(String)jComboBox2.getSelectedItem();
gb.cadOS(jComboBox.getSelectedIndex(),equipamento,jTextField1.getText(),jTextArea.getText(),jComboBox3.getSelectedIndex(),tipo,garantia,fechado);
}
public void PreencheCombo(){
String cliente=(String)jComboBox.getSelectedItem();
try{
stmt=connect.getStatement();
ResultSet rs=
stmt.executeQuery("select nm_cliente from sis_cad_clientes where nm_cliente like '"+cliente+"%"+"'");
int i=0;
while(rs.next()){
String nome=rs.getString("nm_cliente");
jComboBox.addItem(nome);
System.out.println(nome);
}
}catch(SQLException ex){
System.out.println("aqui"+ex);
}
}
} // @jve:visual-info decl-index=0 visual-constraint="10,10"