I have a ABM People screen (JinternalFrame). One of the fields on the screen is "City". In the same one when pressing F3 I call a generic search screen ( Jframe
) in the following way:
if(e.getKeyCode()==KeyEvent.VK_F3) {
Buscador.Buscar_tabla("CIUDAD", "DESCIUDAD", "CODCIUDAD", "NROCIUDAD", "Buscar Ciudad", "", "", "", "", "", "", "", "", "", "", "", "");
if (Buscador.campo_clave_tablas != "0") {
txtCiudad.setText(Buscador.campo_numero_tablas);
lblDesCiudad.setText(Buscador.campo_descripcion_tablas);
}
}
As you can see the method Buscar_tabla
is a static method of the Finder class, as follows:
public static void Buscar_tabla(String nombre_tabla, String nombre_campo_descripcion, String nombre_campo_codigo,
String nombre_campo_numcodigo, String titulo_pantalla, String where, String group_by, String having,
String opCampo1, String opCampo1Text, String opCampo2, String opCampo2Text, String opCampo3,
String opCampo3Text,String opCampo4, String opCampo4Text, String primerasPalabras) {
frmBuscar ventana = new frmBuscar();
campo_clave_tablas = "0";
campo_numero_tablas = "0";
campo_descripcion_tablas = "0";
campo1_clave = "0";
campo2_clave = "0";
campo3_clave = "0";
campo4_clave = "0";
ventana.CodigoBus = nombre_campo_codigo;
ventana.NumCodigoBus = nombre_campo_numcodigo;
ventana.DescripcionBus = nombre_campo_descripcion;
ventana.NombretablaBus = nombre_tabla;
ventana.titulo_Buscador = titulo_pantalla;
ventana.sentencia_where = where;
ventana.group_by = group_by;
ventana.having = having;
ventana.opCampo1 = opCampo1;
ventana.opCampo2 = opCampo2;
ventana.opCampo3 = opCampo3;
ventana.opCampo4 = opCampo4;
ventana.opCampo1Text = opCampo1Text;
ventana.opCampo2Text = opCampo2Text;
ventana.opCampo3Text = opCampo3Text;
ventana.opCampo4Text = opCampo4Text;
ventana.primerasPalabras = primerasPalabras;
ventana.setVisible(true);
if (Main.SeleccionBusquedaOK == true) {
campo_clave_tablas = Integer.toString(Main.CodigoBusQuedaResultado);
campo_numero_tablas = Main.NroCodigoBusquedaResultado;
campo_descripcion_tablas = Main.DescripcionBusquedaResultado;
Main.SeleccionBusquedaOK = false;
}
As you can see, the method instantiates a class Jframe
by passing the parameters to it.
Once the screen is displayed, I proceed to choose the desired record of Jtable
of it and store them in global variables. ( codigo
, nrocodigo
and descripcion
).
The problem is that when the execution line is located in ventana.setVisible(true);
, it shows the screen but continues with the next line ..
Well, what I need is that just once the search screen is closed (when selecting a record of it), continue with the block of:
if (Main.SeleccionBusquedaOK == true) {
campo_clave_tablas = Integer.toString(Main.CodigoBusQuedaResultado);
campo_numero_tablas = Main.NroCodigoBusquedaResultado;
campo_descripcion_tablas = Main.DescripcionBusquedaResultado;
Main.SeleccionBusquedaOK = false;
}
In this way, set the selected search to the txtCiudad
and lblDescripcionCiudad
of my People screen.
How could I do it?