Skip to content

Instantly share code, notes, and snippets.

@kurotori
Created July 14, 2025 13:41
Show Gist options
  • Save kurotori/3b85b0af145298f2570d462a40d1d9ac to your computer and use it in GitHub Desktop.
Save kurotori/3b85b0af145298f2570d462a40d1d9ac to your computer and use it in GitHub Desktop.
Java: Ventana básica con Swing
import interfaz.Inicio;
public class App {
public static void main(String[] args) throws Exception {
Inicio v1 = new Inicio();
}
}
//Esta clase debe estar ubicado en un paquete llamado "interfaz" para que este código funcione corréctamente
package interfaz;
import javax.swing.JFrame;
public class Inicio extends JFrame {
public Inicio(){
configurar();
}
private void configurar(){
setLayout(null);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(800,600);
setVisible(true);
}
}

Java: Ejemplo de Ventana básico usando Swing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment