Yo lo haria de esta forma ... para mantener un mejor orden.
O sino de esta otra manera:
Código [Seleccionar]
import javax.swing.*;
public class Ventana{
public static void main(String[] args)
{
NuevoFrame1 ventana1=new NuevoFrame1();
NuevoFrame2 ventana2=new NuevoFrame2();
}
}
class NuevoFrame1 extends JFrame{
public NuevoFrame1()
{
this.setSize(400,500);
this.setTitle("Primera Aplicacion Swing");
this.setVisible(true);
}
}
class NuevoFrame2 extends JFrame{
public NuevoFrame2()
{
this.setSize(400,500);
this.setTitle("Segunda Aplicacion Swing");
this.setVisible(true);
}
}
O sino de esta otra manera:
Código [Seleccionar]
import javax.swing.*;
public class Ventana{
private static JFrame NuevoFrame2=new JFrame();
public static void main(String[] args)
{
NuevoFrame1 ventana1=new NuevoFrame1();
NuevoFrame2.setSize(400,500);
NuevoFrame2.setTitle("Segunda Aplicacion Swing");
NuevoFrame2.setVisible(true);
}
}
class NuevoFrame1 extends JFrame{
public NuevoFrame1()
{
this.setSize(400,500);
this.setTitle("Primera Aplicacion Swing");
this.setVisible(true);
}
}