Já pesquisei bastante e nunca obtive exito em colocar, se puderem me ajudar… segue o código:
package telas;
import javax.swing.*;
public class CalculadoraImposto extends JFrame{
//Declarando os componentes
public JLabel lblTituloPrograma;
public JLabel lblValorTotalNota;
public JLabel lblIrrf;
public JLabel lblPis;
public JLabel lblCofins;
public JLabel lblCsll;
public JLabel lbltotal;
public JButton btnCalcular;
public JTextField txtValorTotalNota;
public JTextField txtIrff;
public JTextField txtPis;
public JTextField txtCofins;
public JTextField txtCsll;
//construtor
public CalculadoraImposto(){
this.setResizable(false);
this.setTitle(“Calculadora”);
this.setBounds(50,50,300,400);
this.getContentPane().setLayout(null);
//label - Titulo do Programa
lblTituloPrograma = new JLabel();
lblTituloPrograma.setText("Calculadora de Impostos");
lblTituloPrograma.setBounds(80,2,150,50);
this.add(lblTituloPrograma);
//label - valor total da nota
lblValorTotalNota = new JLabel();
lblValorTotalNota.setText("Valor total da Nota:");
lblValorTotalNota.setBounds(10,40,108,50);
this.add(lblValorTotalNota);
//textfield - valor total nota
txtValorTotalNota = new JTextField();
txtValorTotalNota.setBounds(130,57,70,20);
this.add(txtValorTotalNota);
//label - lblIrrf
lblIrrf = new JLabel();
lblIrrf.setText("IRRF:");
lblIrrf.setBounds(10,95,108,50);
this.add(lblIrrf);
//textfield - irff
txtIrff = new JTextField();
txtIrff.setBounds(50,110,70,20);
this.add(txtIrff);
//label - lblPis
lblPis = new JLabel();
lblPis.setText("PIS:");
lblPis.setBounds(10,120,108,50);
this.add(lblPis);
//textfield - pis
txtPis = new JTextField();
txtPis.setBounds(50,140,70,20);
this.add(txtPis);
//label - lblCofins
lblCofins = new JLabel();
lblCofins.setText("COFINS:");
lblCofins.setBounds(12,150,108,50);
this.add(lblCofins);
//textfield - cofins
txtCofins = new JTextField();
txtCofins.setBounds(65,165,70,20);
this.add(txtCofins);
//label - lblCsll
lblCsll = new JLabel();
lblCsll.setText("CSLL:");
lblCsll.setBounds(12,180,108,50);
this.add(lblCsll);
//textfield - csll
txtCsll = new JTextField();
txtCsll.setBounds(65,195,70,20);
this.add(txtCsll);
//botao calcular
btnCalcular = new JButton();
btnCalcular.setText("Calcular");
btnCalcular.setBounds(100, 250, 90, 25);
this.add(btnCalcular);
}
public static void main(String[] args) {
CalculadoraImposto exemplo = new CalculadoraImposto();
exemplo.setVisible(true);
}
}