と呼ばれる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
最大化すると元のサイズに戻ります(最大化されたままではありません)。なぜこれが起こり、どうすれば修正できますか?
どうもありがとう!