Creating controls on forms

2

I'm starting Java, I'm using IntelliJ IDEA, creating a desktop app, I'm creating a form and adding controls, like Label , TextBox , Button and I see that everything is done by code:

public class frmLogin extends JFrame {

    //Objetos del formulario
    private JLabel lblUsuario;
    private JLabel lblClave;
    private JLabel lblImagen;
    private JTextField txtUsuario;
    private JPasswordField txtClave;
    private JButton btnAceptar;
    private JButton btnCancelar;

    public frmLogin(){
        setTitle("Ingreso al Sistema");
        setResizable(false);
        setSize(390, 180);
        setLayout(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        //Creamos objetos del formulario
        lblUsuario = new JLabel("Usuario:");
        txtUsuario = new JTextField(10);
        lblClave = new JLabel("Clave:");
        txtClave = new JPasswordField(10);
        btnAceptar = new JButton("Aceptar");
        btnCancelar = new JButton("Cancelar");

        //Adicionar objetos al formulario
        add(lblUsuario);
        add(txtUsuario);
        add(lblClave);
        add(txtClave);
        add(btnAceptar);
        add(btnCancelar);

        //Ubicamos objetos en el formulario
        lblUsuario.reshape  (20, 20, 100, 20);
        txtUsuario.reshape  (120, 20, 160, 20);

        lblClave.reshape  (20, 45, 100, 20);
        txtClave.reshape  (120, 45, 100, 20);

        btnAceptar.reshape  (20, 75, 90, 60);
        btnCancelar.reshape  (120, 75, 90, 60);
    }
}

Is there any way to add a ToolBox by means of a plugin that contains the controls and forms?

Is it that everything is done in Java code?

    
asked by Pedro Ávila 24.11.2016 в 16:50
source

1 answer

5

Use Swing

In the "Project" tab, right click on "src" and then on the "New" - > "GUI Form".

    
answered by 24.11.2016 / 17:09
source