Advertisement
hamaXD

Lab 7 SwingCounter

Mar 28th, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1.  
  2. import java.awt.*;
  3.  
  4. import javax.swing.*;
  5.  
  6. public class SwingCounter extends JFrame{
  7.     public SwingCounter(String title){
  8.         setTitle(title);
  9.         setLayout(new FlowLayout(FlowLayout.LEFT,10,20));
  10.         add(new JLabel("Counter"));
  11.         add(new JTextField(10));
  12.         JButton btnOK = new JButton("Count");
  13.         add(btnOK);
  14.        
  15.  
  16.  
  17.     }
  18.  
  19.     public static void main(String s[]) {
  20.         SwingCounter frame = new SwingCounter("Swing Counter");
  21.         frame.setSize(300, 100);
  22.         frame.setLocationRelativeTo(null);
  23.         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  24.         frame.setVisible(true);
  25.  
  26.     }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement