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

public class Awindow3 {

    public static void main(String[] args)
    {
        JFrame win = new JFrame("My Third Java JFrame window");

        Container pane = win.getContentPane();      //either get ref to the contentPane

//      JPanel pane = new JPanel();                 //or create a JPanel
//      win.setContentPane(pane);                   //and assign it to the contentPane

        FlowLayout flow = new FlowLayout();         //create a FlowLayout manager 
        pane.setLayout(flow);                       //use it to layout the panel
                                                    //JFrame defaults to BorderLayout
                                                    //JPanel defaults to FlowLayout

        JLabel         nameLabel  = new JLabel("Username: ");   //define all fields
        JTextField     username   = new JTextField(15);         //to be displayed
        JLabel         pswdLabel  = new JLabel("Password: ");
        JPasswordField password   = new JPasswordField(15);

        pane.add(nameLabel);                    //add the components
        pane.add(username);
        pane.add(pswdLabel);
        pane.add(password);

        Color c = new Color(200,255,255);       //create an RGB color object
        pane.setBackground(c);                  //set the background color
    
        win.setSize(300, 150);                              //set window size 
        win.setDefaultCloseOperation(win.EXIT_ON_CLOSE);    //action when you press X
        win.setVisible(true);                               //make window visible
        win.setResizable(false);                            //do not allow resizing
    }
}