Problemas con jframe al momento de maximizarlo
Este es el codigo de mi formulario
Pero el problema es cuando ocurre esto this.setExtendedState(MAXIMIZED_BOTH);
se maximiza todo y no me deja ver la barra de tareas y quiero que se maximize normal osea que deje ver la barra de tareas
package evenezer;
import java.awt.Color;
import javax.swing.JPanel;
import javax.swing.JDesktopPane;
import javax.swing.JRootPane;
/**
*
* @author Anonymous
*/
public class contenedor extends javax.swing.JFrame {
/**
* Creates new form contenedor
*/
public contenedor() {
this.setUndecorated(true);//esto es para dejar sin los botones de maximizar, minizar y cerrar
getRootPane().setWindowDecorationStyle(JRootPane.NONE);
initComponents();
maximizar_form();
}
private void maximizar_form(){
this.getContentPane().setBackground(Color.WHITE);
this.setExtendedState(MAXIMIZED_BOTH);
}
@SuppressWarnings("unchecked")
//
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setPreferredSize(new java.awt.Dimension(400, 300));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
pack();
}//
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(contenedor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(contenedor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(contenedor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(contenedor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
contenedor frm_Contenedor = new contenedor();
frm_Contenedor.setVisible(true);
}
});
}
// Variables declaration - do not modify
// End of variables declaration
}
- gaviluis12's blog
- Inicie sesión o regístrese para enviar comentarios