(F1) JFrame.setDefaultLookAndFeelDecorated

Plucho

Lanero Regular
17 Feb 2005
31
Hola


Estuve en la pagina De SUN y en contre un codigo, con esta Opcion JFrame.setDefaultLookAndFeelDecorated(true) cre uno por mi cuenta pero cuando lo abro me Ejecuta minizado.

¿como le puedo dar un tamaño A esto y centrarlo?
este es codigo si Alguien me puede ayudar muchas gracias


import javax.swing.*;

public class Decorado extends JFrame
{
public static void Aplicacion()
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame Hu=new JFrame("Hola");
Hu.pack();
Hu.setVisible(true);
}
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
Aplicacion();
}
});
}
}
 
Ensaya este codigo:

import javax.swing.*;

public class Decorado extends JFrame
{
public static void Aplicacion()
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame Hu=new JFrame("Hola");
Hu.show();
Hu.setExtendedState(JFrame.MAXIMIZED_BOTH);
Hu.show();
Hu.setVisible(true);
}
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
Aplicacion();
}
});
}
}
 
La razón es que como no tienes componentes en ese frame, al ejecutar el Hu.pack(); ese método reduce todo a su más pequeña expresión, en este caso si acaso un poquito de la barra de título.
 

Los últimos temas