Crea sito

Java Swing:"Creare una finestra con label e button"

import javax.swing.*;
import java.awt.*;

class FinestraSwing
{
public static void main (String args[])
{
JFrame FrameObj=new JFrame();
JPanel PanelObj=new JPanel();
JLabel LabelObj=new JLabel("Etichetta");
JButton ButtonObj=new JButton("Bottone");
Container ContainerObj=FrameObj.getContentPane();
ContainerObj.add(PanelObj);
PanelObj.add(LabelObj);
PanelObj.add(ButtonObj);
FrameObj.setSize(300,200);
FrameObj.setVisible(true);
}
}

<-Ritorna