
TextField.setBackground no funciona
Publicado por Sergio (3 intervenciones) el 18/03/2016 20:39:52
Hola,me ha surgido el siguiente problema, tengo que cambiar el color de fondo de un Textfield y para ello implemento el método .setBackground(Color.red). La función donde esta implementado se ejecuta correctamente. He comprobado que la linea entra con un System.out.println, he revisado los imports y todo parece correcto. De hecho esto ha estado funcionando hasta hace poco. He hecho una prueba con un TextArea en el mismo proyecto y si me funciona, pero en los TextFields no.
¿Podéis orientarme sobre cual puede ser el motivo por el que no cambie de color?.
Os paso detalle del codigo donde lo utilizo:
¿Podéis orientarme sobre cual puede ser el motivo por el que no cambie de color?.
Os paso detalle del codigo donde lo utilizo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
public static boolean enter_ID() {
int position;
boolean check = false;
if (F_Create_Admin.TF_ID_Card.getText().isEmpty()) {
F_Create_Admin.L_Confirm_ID_Card.setIcon(Singleton.noncomplying);
F_Create_Admin.TF_ID_Card.setBackground(Color.red);
F_Create_Admin.TF_ID_Card.requestFocus();
check = false;
F_Create_Admin.L_Info.setText(SLanguages.lang.getProperty("TF_no_empty"));
F_Create_Admin.L_Info.setBackground(Color.red);
} else if (Validate.v_ID_Card(F_Create_Admin.TF_ID_Card.getText()) == false) {
F_Create_Admin.L_Confirm_ID_Card.setIcon(Singleton.noncomplying);
F_Create_Admin.TF_ID_Card.setBackground(Color.red);
F_Create_Admin.TF_ID_Card.requestFocus();
check = false;
F_Create_Admin.L_Info.setText(SLanguages.lang.getProperty("id_incorrect"));
} else {
Admin admin = new Admin(F_Create_Admin.TF_ID_Card.getText());
position = BLL_Admins.search_admins(admin);
if (position >= 0) {
F_Create_Admin.L_Confirm_ID_Card.setIcon(Singleton.noncomplying);
F_Create_Admin.TF_ID_Card.setBackground(Color.red);
F_Create_Admin.TF_ID_Card.requestFocus();
check = false;
F_Create_Admin.L_Info.setText(SLanguages.lang.getProperty("Id_exist"));
} else {
F_Create_Admin.L_Confirm_ID_Card.setIcon(Singleton.complying);
F_Create_Admin.TF_ID_Card.setBackground(Color.green);
F_Create_Admin.TF_Name.requestFocus();
if (F_Create_Admin.TF_Name.getText().equals("NAME")) {
F_Create_Admin.TF_Name.setText("");
}
F_Create_Admin.L_Info.setText("");
check = true;
}
}
return check;
}//End of enter ID Function
Valora esta pregunta


0