1

我有一个JDesktopPane添加并显示一个JInternalFrame被调用的位置ListarEmpleado.java。从那ListarEmpleado.java我打开另一个JInternalFrame叫做InformacionEmpleado.java点击按钮。我有一个等式位于它打开时InformacionEmpleado.java的中间。JDesktopPane

这是按钮事件(我在 Netbeans 中编码):

private void masInformacionActionPerformed(java.awt.event.ActionEvent evt) {                                               
    InformacionEmpleado verDetalle = new InformacionEmpleado(this.cedulaSeleccionada);
    escritorio = getDesktopPane();
    escritorio.add(verDetalle);

    int width = verDetalle.getParent().getWidth();
    int width1 = verDetalle.getWidth();
    int height = verDetalle.getParent().getHeight();
    int height1 = verDetalle.getHeight();

    verDetalle.setLocation(width / 2 - width1 / 2, height / 2 -  height1/ 2 - 10);
    verDetalle.setVisible(true);
}

问题是当行verDetalle.setVisible(true);执行时,InformacionEmpleado.java它完美地位于中间并且我没有问题,但是如果我已经ListarEmpleado.java最大化,它会返回到它的初始大小(不会保持最大化)。为什么会发生这种情况,我该如何解决?

非常感谢!

4

0 回答 0