Passar Objeto para inner class

0 respostas
R

possuo uma classe:

public class TelaPedidos extends JDialog {
private JCheckBox checkBox = new JCheckBox();

public TelaPedidos(){
.......................
}

}

possuo um checkBox:

Action action = new AbstractAction("Não Enviar Agora") {
public void actionPerformed(ActionEvent evt) {
if (txtstatus.getText().equals("")){
}else{
JCheckBox cb = (JCheckBox)evt.getSource();
boolean isSel = cb.isSelected();
if (isSel) {
// Selecionou
} else {}
}
}
};
    
JCheckBox checkBox = new JCheckBox(action);
checkBox.setBorder(null);
this.getContentPane().add(checkBox);

Possuo uma inner class para procurar o pedido:

//Botão procura Pedido
Icon iconped = new ImageIcon("/images/find.jpg");
Action actionped = new AbstractAction("", iconped) {
public void actionPerformed(ActionEvent evt) {
//Clique no Botão lupa
JDialog gridped = new GridPed();
if (gridped.getTitle().substring(0, 6).equals("Pedido")) {
}
else {
txtnroped.setText(gridped.getTitle().substring(0, 10));
[b]checkBox.setSelected(true);[/b]
}
}
};
JButton lupaped = new JButton(actionped);
lupaped.setBorder(null);
this.getContentPane().add(lupaped);

o comando : checkBox.setSelected(true);
não é executado, acredito que ele não esteja enxergando o JCheckBox

como fazer ele funcionar?

obrigado

Criado 9 de junho de 2005
Respostas 0
Participantes 1