Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.95 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package paternivezbanje;
  7. import javax.swing.*;
  8. /**
  9.  *
  10.  * @author maja
  11.  */
  12. public class Form extends JFrame{
  13.    
  14.     public Form(){
  15.    
  16.         initComponents();
  17.        
  18.     }
  19.    
  20.     private JButton btnSum;
  21.     private JButton btnSub;
  22.     private JTextField txtA;
  23.     private JTextField txtB;
  24.     private JTextField txtResult;
  25.     private JLabel lblA;
  26.     private JLabel lblB;
  27.     private JLabel lblresult;
  28.  
  29.     private void initComponents() {
  30.        
  31.      
  32.        btnSub = new JButton();
  33.        btnSum = new JButton();
  34.        txtA = new JTextField();
  35.        txtB = new JTextField();
  36.        txtResult = new JTextField();
  37.        lblA = new JLabel();
  38.        lblB = new JLabel();
  39.        lblresult = new JLabel();
  40.        txtResult.setEditable(false);
  41.        
  42.        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  43.        getContentPane().setLayout(null);
  44.        
  45.        
  46.        
  47.        btnSub.setText("Sub");
  48.        getContentPane().add(btnSub);
  49.        btnSub.setBounds(20, 220, 72, 29);
  50.        
  51.        btnSum.setText("Sum");
  52.        getContentPane().add(btnSum);
  53.        btnSum.setBounds(130, 220, 72, 29);
  54.  
  55.        getContentPane().add(txtA);
  56.        txtA.setBounds(100, 30, 86, 27);
  57.  
  58.        getContentPane().add(txtB);
  59.        txtB.setBounds(100, 90, 86, 27);
  60.        
  61.        getContentPane().add(txtResult);
  62.        txtResult.setBounds(100, 150, 86, 27);
  63.  
  64.        lblA.setText("A:");
  65.        getContentPane().add(lblA);
  66.        lblA.setBounds(10, 30, 49, 17);
  67.  
  68.        lblB.setText("B:");
  69.        getContentPane().add(lblB);
  70.        lblB.setBounds(10, 90, 49, 17);
  71.        
  72.        lblresult.setText("Result:");
  73.        getContentPane().add(lblresult);
  74.        lblresult.setBounds(10, 150, 49, 17);
  75.  
  76.        pack();
  77.     }
  78.    
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement