Galera estou com problemas com o set Modal, simplesmente não funciona, segue abaixo:
Aqui nessa parte eu faço a chamada no meu menu
jMenuItemFuncionario.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JanelaFuncionario func = new JanelaFuncionario(f);
func.setModal(true);
func.setVisible(true);
}
});
[b]e essa parte do código é a minha tela de funcionário[b]
package views;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.text.ParseException;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.text.MaskFormatter;
import Beans.funcionario_locadora;
@SuppressWarnings("serial")
public class JanelaFuncionario extends JDialog {
JLabel rotulo1, rotulo2, rotulo3, rotulo4, rotulo5, rotulo6, rotulo7, rotulo8, rotulo9;
JLabel rotulo10, rotulo11, rotulo12, rotulo13, rotulo14, rotulo15, rotulo16;
JButton cadastrar, fechar, alterar, excluir, consultar, limpar;
JTextField cod_func, nome_func, log, sexo, rg;
JTextField end, cidade, uf, bairro;
JPasswordField senha, conf_senha;
JFormattedTextField dat_nasc, celular, telefone, cpf, cep;
private static EntityManagerFactory f = null;
public JanelaFuncionario(EntityManagerFactory f1) {
//super("Cadastro de Funcionário");
getContentPane().setForeground(new Color(30, 144, 255));
getContentPane().setLayout(null);
Container tela = getContentPane();
setLayout(null);
f = f1;
tela.setBackground(new Color(181, 181, 181));
rotulo1 = new JLabel("Código:");
rotulo2 = new JLabel("Nome:");
rotulo3 = new JLabel("Login:");
rotulo4 = new JLabel("Senha:");
rotulo5 = new JLabel("Confirmar senha:");
rotulo6 = new JLabel("Sexo:");
rotulo7 = new JLabel("RG:");
rotulo8 = new JLabel("CPF:");
rotulo9 = new JLabel("Celular:");
rotulo10 = new JLabel("Telefone:");
rotulo11 = new JLabel("Data de nascimento:");
rotulo12 = new JLabel("Endereço:");
rotulo13 = new JLabel("Cidade:");
rotulo14 = new JLabel("Estado:");
rotulo15 = new JLabel("Bairro:");
rotulo16 = new JLabel("CEP:");
cod_func = new JTextField(5);
nome_func = new JTextField(5);
log = new JTextField(5);
senha = new JPasswordField(5);
sexo = new JTextField(5);
conf_senha = new JPasswordField(5);
rg = new JTextField(5);
cpf = new JFormattedTextField(getFormatadorCPF());
celular = new JFormattedTextField(getFormatadorTelefone());
telefone = new JFormattedTextField(getFormatadorTelefone());
dat_nasc = new JFormattedTextField(getFormatadorData());
end = new JTextField(5);
cidade = new JTextField(5);
uf = new JTextField(5);
bairro = new JTextField(5);
cep = new JFormattedTextField(getFormatadorCep());
cadastrar = new JButton("Cadastrar");
fechar = new JButton("Fechar");
alterar = new JButton("Alterar");
excluir = new JButton("Excluir");
consultar = new JButton("Consultar");
limpar = new JButton("Limpar");
rotulo1.setBounds(30, 50, 150, 30);
rotulo2.setBounds(30, 80, 150, 30);
rotulo3.setBounds(30, 140, 100, 30);
rotulo4.setBounds(310, 140, 100, 30);
rotulo5.setBounds(550, 140, 100, 30);
rotulo6.setBounds(30, 110, 150, 30);
rotulo7.setBounds(310, 110, 150, 30);
rotulo8.setBounds(550, 110, 150, 30);
rotulo9.setBounds(30, 235, 100, 30);
rotulo10.setBounds(300, 235, 100, 30);
rotulo11.setBounds(550, 80, 150, 30);
rotulo12.setBounds(30, 170, 100, 30);
rotulo13.setBounds(310, 205, 100, 30);
rotulo14.setBounds(620, 205, 100, 30);
rotulo15.setBounds(30, 205, 100, 30);
rotulo16.setBounds(640, 235, 100, 30);
cod_func.setBounds(100, 55, 100, 25);
nome_func.setBounds(100, 85, 400, 25);
log.setBounds(100, 145, 150, 25);
senha.setBounds(360, 145, 100, 25);
conf_senha.setBounds(670, 145, 100, 25);
sexo.setBounds(100, 115, 150, 25);
rg.setBounds(360, 115, 150, 25);
cpf.setBounds(670, 115, 100, 25);
celular.setBounds(100, 235, 100, 25);
telefone.setBounds(360, 235, 100, 25);
dat_nasc.setBounds(670, 85, 100, 25);
end.setBounds(100, 175, 400, 25);
cidade.setBounds(360, 205, 150, 25);
uf.setBounds(670, 205, 100, 25);
bairro.setBounds(100, 205, 150, 25);
cep.setBounds(670, 235, 100, 25);
cadastrar.setBounds(20, 300, 100, 30);
fechar.setBounds(570, 300, 100, 30);
alterar.setBounds(130, 300, 100, 30);
excluir.setBounds(240, 300, 100, 30);
limpar.setBounds(350, 300, 100, 30);
tela.add(rotulo1);
tela.add(rotulo2);
tela.add(rotulo3);
tela.add(rotulo4);
tela.add(rotulo5);
tela.add(rotulo6);
tela.add(rotulo7);
tela.add(rotulo8);
tela.add(rotulo9);
tela.add(rotulo10);
tela.add(rotulo11);
tela.add(rotulo12);
tela.add(rotulo13);
tela.add(rotulo14);
tela.add(rotulo15);
tela.add(rotulo16);
tela.add(cod_func);
tela.add(nome_func);
tela.add(log);
tela.add(senha);
tela.add(conf_senha);
tela.add(sexo);
tela.add(rg);
tela.add(cpf);
tela.add(celular);
tela.add(telefone);
tela.add(dat_nasc);
tela.add(end);
tela.add(cidade);
tela.add(uf);
tela.add(bairro);
tela.add(cep);
tela.add(cadastrar);
tela.add(fechar);
tela.add(alterar);
tela.add(consultar);
tela.add(excluir);
tela.add(limpar);
// DESABILITAM-SE ALGUNS BOTÕES
cadastrar.setEnabled(true);
alterar.setEnabled(false);
excluir.setEnabled(false);
consultar.setEnabled(true);
setSize(800, 400);
setVisible(true);
setLocationRelativeTo(null);// CENTRALIZA A JANELA