Advertisement
Guest User

Untitled

a guest
Jun 28th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import java.awt.*;
  2.  
  3. import java.awt.event.*;
  4.  
  5. import javax.swing.*;
  6.  
  7.  
  8. class Windowabc extends JFrame
  9. {private JLabel l;
  10.  
  11. private JTextField tf;
  12.  
  13. private JButton b;
  14.  
  15. public Windowabc(){
  16.  
  17. setTitle("Sorting files program");
  18.  
  19. setLayout(null);
  20.  
  21. setSize(400,300);
  22.  
  23. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  24.  
  25.  
  26. l = new JLabel("Enter the path of Directory:");
  27.  
  28. l.setSize(200,30);
  29.  
  30. l.setLocation(20,20);
  31.  
  32. add(l);
  33.  
  34.  
  35. tf = new JTextField(30);
  36.  
  37. tf.setSize(100,40);
  38.  
  39. tf.setLocation(140,80);
  40.  
  41. tf.setToolTipText("Enter the path in textfield:");
  42.  
  43. add(tf);
  44.  
  45. b = new JButton("OK");
  46.  
  47. b.setSize(100,20);
  48.  
  49. b.setLocation(240,260);
  50.  
  51. b.setToolTipText("OK Button");
  52.  
  53. b.addActionListener(new ActionListener(){
  54.  
  55. public void actionPerformed(ActionEvent e)
  56.  
  57. {Toolkit.getDefaultToolkit().beep();//Function for beep sound
  58.  
  59. }});
  60.  
  61. add(b);
  62.  
  63. setVisible(true);
  64. }
  65. }
  66.  
  67. public class Directory
  68. {
  69. public static void main(String args[])
  70. {
  71. Windowabc w = new Windowabc();
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement