newm4n

Untitled

Jan 21st, 2015
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.01 KB | None | 0 0
  1.  
  2. public class DialogD extends JDialog {
  3.     private JButton pbHideMe = new JButton("Hello DIALOG !!, Close ME");
  4.    
  5.     public DialogD() {
  6.         this.setTitle("Dialog D Here");
  7.         this.setModal(true);
  8.         this.getContentPane().add(pbHideMe);
  9.         pbHideMe.addActionListener(new ActionListener() {
  10.             public void actionPerformed(ActionEvent e) {
  11.                 DialogD.this.setVisible(false);
  12.             }
  13.         })
  14.         pbHitMe.setPreferredSize(new Dimension(100,100));
  15.         this.pack();
  16.     }
  17. }
  18.  
  19.  
  20. public class FormA extends JFrame {
  21.     private JButton pbHitMe = new JButton("Hello FORM !!, Hit Me");
  22.     public FormA() {
  23.         this.setTitle("Form A Here");
  24.         this.getContentPane().add(pbHitMe);
  25.         pbHitMe.addActionListener(new ActionListener() {
  26.             public void actionPerformed(ActionEvent e) {
  27.                 DialogD dd = new DialogD();
  28.                 dd.setVisible(true);
  29.             }
  30.         });
  31.         pbHitMe.setPreferredSize(new Dimension(100,100));
  32.         this.pack();
  33.     }
  34. }
  35.  
  36.  
  37. public class RunMe {
  38.     public static void main(String[] args) {
  39.         FormA fa = new FormA();
  40.         fa.setVisible(true);
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment