I want to organize the forms of my system, create a enum where I add all the data of each form (title, Querys, Name of the table, etc). It worked great until you try to put the JInternalFrame to which it belongs. What I want to do is have a procedure in my Menu which only sends the enum and from there I can interact with the JInternalFrame. The problem is that when I search the enum I get the following error:
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
at PckMain.clsFrm $ ENMFRM. (clsFrm.java:124)
It should be noted that the enum is in a class apart from the menu where I want to maejarlo, as well as the declaration of the JInternalFrame.
The code is as follows:
public static final frmControlInterno FrmControlInterno=new frmControlInterno();
public static enum ENMFRM{
FRMV_CNTINT(FrmControlInterno ,"Control Interno","SELECT a.NroDocCCI, a.CodEmp, a.FecEmiCCI, a.ImpTotCCI, "
+ "CASE WHEN AlEmp.AliEmp = '' THEN CASE WHEN AlEmp.NomCmcEmp = '' THEN AlEmp.RazSocEmp ELSE AlEmp.NomCmcEmp END ELSE AlEmp.AliEmp END AS NomEmp, "
+ "CASE WHEN AlEnt.AliEnt = '' THEN CASE WHEN AlEnt.NomCmcEnt = '' THEN AlEnt.RazSocEnt ELSE AlEnt.NomCmcEnt END ELSE AlEnt.AliEnt END AS NomEnt "
+ "FROM tb_cincab as a "
+ "LEFT JOIN tb_ent as AlEnt ON a.CodEnt = AlEnt.CodEnt "
+ "LEFT JOIN tb_emp as AlEmp ON a.CodEmp = AlEmp.CodEmp "
+ "WHERE EXTRACT(YEAR FROM FecEmiCCI)='" + ANOACT + "' AND EXTRACT(MONTH FROM FecEmiCCI)='" + MESACT + "' "," ORDER BY a.FecEmiCCI DESC, a.NroDocCCI DESC ","","")
private final JInternalFrame loIFrm;
private final String lsTitFrm;
private final String lsQryLst1;
private final String lsQryLst2;
private final String lsQryDet1;
private final String lsQryDet2;
private ENMFRM(JInternalFrame toIFrm, String tsTitFrm, String tsQryLst1, String tsQryLst2, String tsQryDet1, String tsQryDet2) {
loIFrm = toIFrm;
lsTitFrm = tsTitFrm;
lsQryLst1 = tsQryLst1;
lsQryLst2 = tsQryLst2;
lsQryDet1 = tsQryDet1;
lsQryDet2 = tsQryDet2;
}
public JInternalFrame getIFrm() {
return loIFrm;
}
public JDialog getDFrm() {
return loDFrm;
}
public String getTitulo() {
return lsTitFrm;
}
public String getQryLst1() {
return lsQryLst1;
}
public String getQryLst2() {
return lsQryLst2;
}
public String getQryDet1() {
return lsQryDet1;
}
public String getQryDet2() {
return lsQryDet2;
}
}
And my procedure for maejarlo is:
private void ppCargaFrm(ENMFRM toEnmFrm){
Dimension loSizeDtk = dtkPanelPrincipal.getSize();
Dimension FrameSize = toEnmFrm.getIFrm().getSize();
toEnmFrm.getIFrm().setLocation((loSizeDtk.width - FrameSize.width)/2, (loSizeDtk.height- FrameSize.height)/2);
dtkPanelPrincipal.add(toEnmFrm.getIFrm());
toEnmFrm.getIFrm().setTitle(toEnmFrm.getTitulo());
toEnmFrm.getIFrm().setClosable(true);
toEnmFrm.getIFrm().setFrameIcon(loIcono);
toEnmFrm.getIFrm().show();
}
I hope you can help me, thanks in advance.