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;
- private JButton łatwy;
- private JButton średni;
- private JButton trudny;
- int w = 1024;
- int h = 768;
- int time = 1;
- public Menu(int w_okno, int h_okno){
- setLayout(new GridLayout(3, 1,200, 200));
- int WIDTH = 200;
- int HEIGHT = 130;
- instrukcja = new JButton("Instrukcja");
- start = new JButton("Start");
- wyjscie = new JButton("Wyjście");
- instrukcja.addActionListener(this);
- start.addActionListener(this);
- wyjscie.addActionListener(this);
- setPreferredSize(new Dimension(WIDTH, HEIGHT));
- add(instrukcja);
- add(start);
- add(wyjscie);
- }
- public void poziomy(String poziom){
- }
- 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) {
- public static void poziomy(){
- setLayout(new GridLayout(3, 1, 200, 200));
- łatwy = new JButton("łatwy");
- średni = new JButton("średni");
- trudny = new JButton("trudny");
- łatwy.addActionListener(this);
- średni.addActionListener(this);
- trudny.addActionListener(this);
- setPreferredSize(new Dimension(WIDTH, HEIGHT));
- add(łatwy);
- add(średni);
- add(trudny);
- if (time != 0) {
- add(new etap_1(w, h));
- long czas = System.currentTimeMillis();
- int i = 5;
- while (i >= 0) {
- if (System.currentTimeMillis() - czas > 1000) {
- System.out.println(i--);
- czas = System.currentTimeMillis();
- }
- }
- System.out.println("Bam");
- }
- }
- }
- else if(source == wyjscie){
- //frame.dispose();
- System.exit(0); //DZIAŁA, NAJS
- }
- }
- //setVisible(true);
- }
Advertisement
Add Comment
Please, Sign In to add comment