Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.awt.*;
- import java.util.ArrayList;
- public class UserInterface implements Runnable{
- private JFrame frame;
- public UserInterface(){}
- private ArrayList<Bathroom> baritiuD = new ArrayList<Bathroom>();
- private Bathroom etaj1D = new Bathroom("Etajul 1");
- private Bathroom etaj2D = new Bathroom("Etajul 2");
- private Bathroom etaj3D = new Bathroom("Etajul 3");
- private Building baritiuCorpD = new Building("Corpul D, strada Baritiu", baritiuD);
- private ArrayList<Bathroom> baritiuH = new ArrayList<Bathroom>();
- private Bathroom etaj1H = new Bathroom("Etajul 1");
- private Bathroom etaj2H = new Bathroom("Etajul 2");
- private Bathroom etaj3H = new Bathroom("Etajul 3");
- private Bathroom etaj4H = new Bathroom("Etajul 4");
- private Building baritiuCorpH = new Building("Corpul H, strada Baritiu", baritiuH);
- private ArrayList<Bathroom> baritiuBarlog = new ArrayList<Bathroom>();
- private Bathroom baiaDinBarlog = new Bathroom("langa barlogul lui Septimiu");
- private Building barlog = new Building("Barlogul lui Septimiu", baritiuBarlog);
- private ArrayList<Bathroom> ursusObservator = new ArrayList<Bathroom>();
- private Bathroom ursusP = new Bathroom("Parter");
- private Bathroom ursus1 = new Bathroom("Etajul 1");
- private Bathroom ursus2 = new Bathroom("Etajul 2");
- private Bathroom ursus3 = new Bathroom("Etajul 3");
- private Building cladireaUrsus = new Building("Cladirea Ursus, Strada Observatorului", ursusObservator);
- @Override
- public void run(){
- frame = new JFrame();
- frame.setPreferredSize(new Dimension(300,400));
- frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
- createComponents(frame.getContentPane());
- frame.pack();
- frame.setVisible(true);
- }
- public JFrame getFrame() {
- return frame;
- }
- private void createComponents(Container container){
- baritiuD.add(etaj1D);
- baritiuD.add(etaj2D);
- baritiuD.add(etaj3D);
- baritiuH.add(etaj1H);
- baritiuH.add(etaj2H);
- baritiuH.add(etaj3H);
- baritiuH.add(etaj4H);
- ursusObservator.add(ursusP);
- ursusObservator.add(ursus1);
- ursusObservator.add(ursus2);
- ursusObservator.add(ursus3);
- baritiuBarlog.add(baiaDinBarlog);
- BoxLayout layout = new BoxLayout(container, BoxLayout.Y_AXIS);
- container.setLayout(layout);
- JLabel text_inceput = new JLabel("Alege Cladirea");
- text_inceput.setAlignmentX(Component.CENTER_ALIGNMENT);
- container.add(text_inceput);
- JButton button1 = new JButton(baritiuCorpD.name);
- button1.setAlignmentX(Component.CENTER_ALIGNMENT);
- container.add(button1);
- JButton button2 = new JButton(baritiuCorpH.name);
- container.add(button2);
- button2.setAlignmentX(Component.CENTER_ALIGNMENT);
- JButton button3 = new JButton(barlog.name);
- button3.setAlignmentX(Component.CENTER_ALIGNMENT);
- container.add(button3);
- JButton button4 = new JButton(cladireaUrsus.name);
- button4.setAlignmentX(Component.CENTER_ALIGNMENT);
- container.add(button4);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment