Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import javax.swing.JButton;
- import javax.swing.JPanel;
- public class Menu extends JPanel implements ActionListener{
- private JButton instrukcja;
- private JButton start;
- private JButton wyjscie;
- public Object poziom;
- int w_okno = 1024;
- int h_okno = 768;
- public int time = 1;
- public Menu(){
- //setLayout(new GridLayout(3, 1,10, 200));
- setLayout(null);
- int WIDTH = 20;
- int HEIGHT = 13;
- instrukcja = new JButton("Instrukcja");
- start = new JButton("Start");
- wyjscie = new JButton("Wyjście");
- instrukcja.addActionListener(this);
- start.addActionListener(this);
- wyjscie.addActionListener(this);
- instrukcja.setBounds(320, 100, 300, 80 );
- start.setBounds(320, 300, 300, 80);
- wyjscie.setBounds(320, 500, 300, 80);
- //setPreferredSize(new Dimension(WIDTH, HEIGHT));
- add(instrukcja);
- add(start);
- add(wyjscie);
- }
- public void actionPerformed(ActionEvent e){
- Object source = e.getSource();
- if(source == instrukcja) {
- JOptionPane.showMessageDialog(null, "Tutaj będzie cała instrukcja do grania"); //DZIAŁA, NAJS
- }
- else if(source == start) {
- /*setLayout(new GridLayout(1,1));
- System.out.println("tutaj!");
- Etap_1 e_1 = new Etap_1();
- //add(e_1);
- //add(new Etap_1());
- System.out.println("tutaj też jestem!");
- (new Okno(1024, 768)).add(e_1);*/
- Okno noweOkno = new Okno(1024,768);
- CardLayout CL =(CardLayout)(noweOkno.karty.getLayout());
- CL.show(noweOkno.karty, "poziomy");
- }
- else if(source == wyjscie){
- System.exit(0); //DZIAŁA, NAJS
- }
- }
- //setVisible(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment