1

と呼ばれるJDesktopPaneを追加して表示する場所があります。そこから、ボタンをクリックするという別の方法を開きます。開いたときに真ん中に配置する方程式があります。JInternalFrameListarEmpleado.javaListarEmpleado.javaJInternalFrameInformacionEmpleado.javaInformacionEmpleado.javaJDesktopPane

これはボタンイベントです (私は 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