Advertisement
Guest User

Untitled

a guest
Feb 1st, 2014
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.49 KB | None | 0 0
  1. package test;
  2.  
  3.  
  4. import java.awt.BorderLayout;
  5. import java.awt.Dimension;
  6. import java.awt.Font;
  7. import java.awt.Rectangle;
  8. import java.awt.event.ActionEvent;
  9. import java.awt.event.ActionListener;
  10.  
  11. import javax.swing.JButton;
  12. import javax.swing.JDialog;
  13. import javax.swing.JFrame;
  14. import javax.swing.JLabel;
  15.  
  16. public class SoftwarePackage extends javax.swing.JFrame implements ActionListener
  17. {
  18.    
  19.     private JButton bDalej, bWyjście;
  20.    
  21.    
  22.     public Test() {
  23.         setSize(800,800);
  24.         setTitle("test");
  25.         setLayout(null);
  26.         setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  27.        
  28.         bDalej = new JButton("Dalej");
  29.         bDalej.setBounds(550, 700, 100, 20);
  30.         add(bDalej);
  31.         bDalej.addActionListener(this);
  32.                
  33.         bWyjście = new JButton("Wyjście");
  34.         bWyjście.setBounds(650, 700, 100, 20);
  35.         add(bWyjście);
  36.         bWyjście.addActionListener(this);
  37.        
  38.        
  39.     }
  40.    
  41.     public void openDialog() {
  42.         setVisible(false);
  43.         Programy p;
  44.         p  = new Programy(this);
  45.         p.setVisible(true);
  46.            
  47.        
  48.     }
  49.    
  50.     /**
  51.      * @param args
  52.      */
  53.     public static void main(String[] args) {
  54.         Test okienko = new Test();
  55.         okienko.setVisible(true);
  56.     }
  57.    
  58.     @Override
  59.     public void actionPerformed(ActionEvent e) {
  60.         Object z = e.getSource();
  61.        
  62.         if (z == bDalej)
  63.         {
  64.         openDialog();
  65.         i++;
  66.         }
  67.         else if (z == bWyjście) dispose();
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement