Pessoal,alguem pode me dizer onde está meu erro, não to conseguindo achar:
to tentando criar uma lista com jComboBox mas não consigo criar o jcbagentes.addItem(xxx)…“iniciante é roça!!!rsrsrsrsrsrs”
[code]
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
/*
- BuscaEventos.java
- Created on 02/09/2009, 13:16:47
*/
package br.com.Work.Audit;
import br.com.Work.Audit.Operadores.OperadoresBean;
import br.com.Work.Audit.Operadores.OperadoresControl;
import java.util.List;
import javax.swing.JComboBox;
/**
*
-
@author leonardo
*/
public class BuscaEventos extends javax.swing.JFrame {OperadoresBean doperdores = new OperadoresBean();
List<OperadoresBean> listaOp;/** Creates new form BuscaEventos */
public BuscaEventos() {
initComponents();
listarOperadores();}
/** 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() {javax.swing.JFormattedTextField jFormattedTextField1 = new javax.swing.JFormattedTextField();
javax.swing.JLabel jLabel1 = new javax.swing.JLabel();
javax.swing.JLabel jLabel2 = new javax.swing.JLabel();
javax.swing.JFormattedTextField ftfDataInicial = new javax.swing.JFormattedTextField();
javax.swing.JFormattedTextField ftfDataFinal = new javax.swing.JFormattedTextField();
javax.swing.JLabel jLabel3 = new javax.swing.JLabel();
javax.swing.JLabel jLabel4 = new javax.swing.JLabel();
javax.swing.JTextField tfCampanha = new javax.swing.JTextField();
javax.swing.JButton jButton1 = new javax.swing.JButton();
javax.swing.JLabel jLabel5 = new javax.swing.JLabel();
javax.swing.JComboBox jcbagentes = new javax.swing.JComboBox();jFormattedTextField1.setText(“jFormattedTextField1”);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText(“Data Inicial”);
jLabel2.setText(“Data Final”);
ftfDataInicial.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ftfDataInicialActionPerformed(evt);
}
});jLabel3.setText(“Operador”);
jLabel4.setText(“Campanha”);
jButton1.setText(“Buscar Eventos”);
jLabel5.setText(“Busca Eventos de Operadores”);
jcbagentes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { “Item 1”, “Item 2”, “Item 3”, “Item 4” }));
jcbagentes.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jcbagentesActionPerformed(evt);
}
});javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jLabel5))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(2, 2, 2)
.addComponent(ftfDataInicial, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jcbagentes, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(ftfDataFinal, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tfCampanha, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton1)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5)
.addGap(28, 28, 28)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jcbagentes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(tfCampanha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ftfDataInicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ftfDataFinal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);pack();
}// </editor-fold>
private void listarOperadores(){
OperadoresControl op = new OperadoresControl();
listaOp = op.buscaOperadores("%%");
}
public void mostraragentes(List<OperadoresBean> opBean){}
public void montaLista(){
String[] operadores = new String[]{};
for(int i=0;i<listaOp.size();i++){}
}
private void ftfDataInicialActionPerformed(java.awt.event.ActionEvent evt) { -
}
private void jcbagentesActionPerformed(java.awt.event.ActionEvent evt) {
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new BuscaEventos().setVisible(true);
}
});
}
// Variables declaration - do not modify
// End of variables declaration
}
[/code]>