[quote=marcosharbs]onde vc seta os valores?
onde vc atribui valor para editora?[/quote]
na janelaEditora
[code] private BorderLayout borderLayout1;
private JPanel jPanel1;
private JPanel jPanel2;
private JButton bConfirmar;
private JButton bCancelar;
private JTextField textEditora;
private JTextField textLocalidade;
private Editora ed;
/* public void setEditora(Editora ac)
{
ed=ac;
}
*/
public janelaEditora()
{
this(null, “”, false);
}
public janelaEditora(Frame parent, String title, boolean modal)
{
super(parent, title, modal);
try
{
jbInit();
}
catch (Exception e)
{
e.printStackTrace();
}
}
private void jbInit()
throws Exception
{
borderLayout1 =
(BorderLayout) Beans.instantiate(getClass().getClassLoader(),
BorderLayout.class.getName());
jPanel1 =
(JPanel) Beans.instantiate(getClass().getClassLoader(),
JPanel.class.getName());
jPanel2 =
(JPanel) Beans.instantiate(getClass().getClassLoader(),
JPanel.class.getName());
bConfirmar =
(JButton) Beans.instantiate(getClass().getClassLoader(),
JButton.class.getName());
bCancelar =
(JButton) Beans.instantiate(getClass().getClassLoader(),
JButton.class.getName());
textEditora =
(JTextField) Beans.instantiate(getClass().getClassLoader(),
JTextField.class.getName());
textLocalidade =
(JTextField) Beans.instantiate(getClass().getClassLoader(),
JTextField.class.getName());
this.setSize(new Dimension(400, 200));
this.getContentPane().setLayout(borderLayout1);
this.setTitle(“Nova Editora”);
jPanel1.setLayout(null);
jPanel2.setPreferredSize(new Dimension(10, 50));
jPanel2.setLayout(null);
bConfirmar.setText(“Confirmar”);
bConfirmar.setBounds(new Rectangle(80, 5, 105, 35));
bConfirmar.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
bConfirmar_actionPerformed(e);
}
});
bCancelar.setText(“Cancelar”);
bCancelar.setBounds(new Rectangle(245, 5, 100, 35));
bCancelar.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
bCancelar_actionPerformed(e);
}
});
textEditora.setBounds(new Rectangle(25, 20, 165, 50));
textEditora.setBorder(BorderFactory.createTitledBorder(“Editora:”));
textLocalidade.setBounds(new Rectangle(215, 20, 170, 50));
textLocalidade.setBorder(BorderFactory.createTitledBorder(“Localidade:”));
jPanel1.add(textLocalidade, null);
jPanel1.add(textEditora, null);
this.getContentPane().add(jPanel1, BorderLayout.CENTER);
jPanel2.add(bCancelar, null);
jPanel2.add(bConfirmar, null);
this.getContentPane().add(jPanel2, BorderLayout.SOUTH);
}
private void bConfirmar_actionPerformed(ActionEvent e)
{
UIManager.put(“OptionPane.yesButtonText”, “Sim”);
UIManager.put(“OptionPane.noButtonText”, “Não”);
if (JOptionPane.showConfirmDialog(null,“Armazenar nome da Editora?”,“NOVO NOME”,
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
ed = new Editora(textEditora.getText(),textLocalidade.getText());
textEditora.setText("");
textLocalidade.setText("");
//System.out.println(ed.getNome());
// System.out.println(ed.getLocal());
}
private void bCancelar_actionPerformed(ActionEvent e)
{
dispose();
}
[/code]