Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package eti.radio.pr_inz;
- import javax.imageio.ImageIO;
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.image.BufferedImage;
- import java.io.File;
- import java.io.IOException;
- public class Mapa extends JPanel implements ActionListener {
- private JLabel tytul3;
- private JButton dalej;
- private JButton wyjscie;
- private ButtonGroup bgRozmiar;
- private JRadioButton InH, UMa, UMa_O2I, UMi, UMi_O2I, RMa, RMa_O2I;
- public BufferedImage tlo_wybor;
- static int s;
- public int d3D_max=100;
- Dane nowe_dane;
- public Mapa(Dane nowe_dane) {
- setLayout(null);
- this.nowe_dane = nowe_dane;
- File zdj_menu = new File("zdjecia/strona_wybor.png");
- try{ tlo_wybor = ImageIO.read(zdj_menu); }
- catch(IOException e){ System.err.println("Blad odczytu obrazków"); }
- tytul3 = new JLabel( "\n Wybór modelu środowiska propagacyjnego", JLabel.CENTER);
- tytul3.setSize(1000, 100);
- tytul3.setLocation(5, 50);
- tytul3.setFont(new Font("Sitka Text", Font.BOLD, 30));
- bgRozmiar = new ButtonGroup();
- InH = new JRadioButton("model Indoor Hotspot (InH)", true);
- InH.setBounds(600, 200, 200, 50);
- InH.setFont(new Font("Sitka Text", Font.PLAIN, 13));
- bgRozmiar.add(InH);
- InH.addActionListener(this);
- InH.setBackground(Color.WHITE);
- UMa = new JRadioButton("model Urban Macro (UMa)", false);
- UMa.setBounds(600, 250, 200, 50);
- UMa.setFont(new Font("Sitka Text", Font.PLAIN, 13));
- bgRozmiar.add(UMa);
- UMa.addActionListener(this);
- UMa.setBackground(Color.WHITE);
- UMa_O2I = new JRadioButton("model Urban Macro (UMa) dla scenariusza O2I", false);
- UMa_O2I.setBounds(600, 300, 320, 50);
- UMa_O2I.setFont(new Font("Sitka Text", Font.PLAIN, 13));
- bgRozmiar.add(UMa_O2I);
- UMa_O2I.addActionListener(this);
- UMa_O2I.setBackground(Color.WHITE);
- UMi = new JRadioButton("model Urban Micro (UMi)", false);
- UMi.setBounds(600, 350, 200, 50);
- UMi.setFont(new Font("Sitka Text", Font.PLAIN, 13));
- bgRozmiar.add(UMi);
- UMi.addActionListener(this);
- UMi.setBackground(Color.WHITE);
- UMi_O2I = new JRadioButton("model Urban Micro (UMi) dla scenariusza O2I", false);
- UMi_O2I.setBounds(600, 400, 320, 50);
- UMi_O2I.setFont(new Font("Sitka Text", Font.PLAIN, 13));
- bgRozmiar.add(UMi_O2I);
- UMi_O2I.addActionListener(this);
- UMi_O2I.setBackground(Color.WHITE);
- RMa = new JRadioButton("model Rural Macro (RMa)", false);
- RMa.setBounds(600, 450, 200, 50);
- RMa.setFont(new Font("Sitka Text", Font.PLAIN, 13));
- bgRozmiar.add(RMa);
- RMa.addActionListener(this);
- RMa.setBackground(Color.WHITE);
- RMa_O2I = new JRadioButton("model Rural Macro (RMa) dla scenariusza O2I", false);
- RMa_O2I.setBounds(600, 500, 320, 50);
- RMa_O2I.setFont(new Font("Sitka Text", Font.PLAIN, 13));
- bgRozmiar.add(RMa_O2I);
- RMa_O2I.addActionListener(this);
- RMa_O2I.setBackground(Color.WHITE);
- dalej = new JButton("Dalej");
- wyjscie = new JButton("Wyjście");
- dalej.addActionListener(this);
- wyjscie.addActionListener(this);
- wyjscie.setBounds(100, 620, 200, 60);
- wyjscie.setFont(new Font("Sitka Text", Font.BOLD, 25));
- wyjscie.setBackground(Color.white);
- dalej.setBounds(724, 620, 200, 60);
- dalej.setFont(new Font("Sitka Text", Font.BOLD, 25));
- dalej.setBackground(Color.white);
- add(tytul3);
- add(InH); add(UMa); add(UMa_O2I); add(UMi); add(UMi_O2I); add(RMa); add(RMa_O2I);
- add(dalej);
- add(wyjscie);
- }
- public void actionPerformed(ActionEvent e){
- Object source = e.getSource();
- if(source == InH){
- s = 1;
- d3D_max = 150; // metrów
- System.out.println("Wybrano s rowne: " + s);
- }
- else if(source == UMa){
- s = 2;
- d3D_max = 5000; // metrów
- System.out.println("Wybrano s rowne: " + s);
- }
- else if(source == UMa_O2I){
- s = 3;
- d3D_max = 5000; // metrów
- System.out.println("Wybrano s rowne: " + s);
- }
- else if(source == UMi){
- s = 4;
- d3D_max = 5000; // metrów
- System.out.println("Wybrano s rowne: " + s);
- }
- else if(source == UMi_O2I){
- s = 5;
- d3D_max = 5000; // metrów
- System.out.println("Wybrano s rowne: " + s);
- }
- else if(source == RMa){
- s = 6;
- d3D_max = 21000; // metrów
- System.out.println("Wybrano s rowne: " + s);
- }
- else if(source == RMa_O2I){
- s = 7;
- d3D_max = 21000; // metrów
- System.out.println("Wybrano s rowne: " + s);
- }
- else if(source == dalej) {
- CardLayout CL =(CardLayout)(Main.noweOkno.karty.getLayout());
- if(s == 3 || s == 5 || s == 7){
- CL.show(Main.noweOkno.karty, "o2i_licz");
- }
- else{
- CL.show(Main.noweOkno.karty, "wpisz_dane");
- }
- }
- else if(source == wyjscie){
- System.exit(0);
- }
- nowe_dane.changeSlider(d3D_max); //, 250, 180, 500, 50, false);
- }
- public void paintComponent(Graphics graphic) {
- Graphics2D g2d = (Graphics2D) graphic;
- g2d.drawImage(tlo_wybor, 0, 0, this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement