-
Notifications
You must be signed in to change notification settings - Fork 0
/
pmOp4Pop.java
222 lines (146 loc) · 6.14 KB
/
pmOp4Pop.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
package com.company;
import javax.swing.*;
import javax.swing.border.TitledBorder;
import java.awt.*;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class pmOp4Pop extends JFrame {
protected String username;
protected String key;
protected int price;
protected boolean parking;
protected boolean wifi;
protected int size;
protected HashMap<String, String> ausers = new HashMap<String, String>();
protected HashMap<String, String> roles = new HashMap<String, String>();
protected HashMap<String, User> user = new HashMap<String, User>();
protected HashMap<String, String> rentals = new HashMap<String, String>();
protected HashMap<String, Rentable> rentalsV2 = new HashMap<String, Rentable>();
protected HashMap<String, String> rented = new HashMap<String, String>();
protected HashMap<String, String> rentcancel = new HashMap<String, String>();
protected HashMap<String, String> messages = new HashMap<String, String>();
//gui register values
private JTextField textkey;
private JLabel labelkey;
private JTextField textprice;
private JLabel labelprice;
private JTextField textpark;
private JLabel labelpark;
private JTextField textwifi;
private JLabel labelwifi;
private JTextField textsize;
private JLabel labelsize;
private JLabel labelkey1;
private JLabel labelprice1;
private JLabel labelpark1;
private JLabel labelwifi1;
private JLabel labelsize1;
private JLabel label22;
private ImageIcon icon5;
private JLabel label3;
private JButton buttonqq;
private JButton buttonrr;
private JLabel cr;
private int choicer = 0;
/**
* <p>
*this is the gui and code for the choice to see his rentals in the provider menu made with java swing
*<br>
* @param -
* @return
* @see -
* @author tsig-404
*/
public pmOp4Pop(String name, HashMap<String, String> aausers, HashMap<String, String> arentals,
HashMap<String, User> auser, HashMap<String, String> arented,
HashMap<String, Rentable> arentalsV2, HashMap<String, String> rc,
HashMap<String, String> msg, HashMap<String, String> aroles) {
//maybe get rid of them later nooo it works dont delete it
this.ausers = aausers;
this.rentals = arentals;
this.user = auser;
this.rented = arented;
this.rentalsV2 = arentalsV2;
this.rentcancel = rc;
this.messages = msg;
this.roles = aroles;
this.username = name;
//if it doesnt work
setSize(500, 500);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//setLocationRelativeTo(null);
//setResizable(false);
setTitle("Rentals");
setLocationRelativeTo(null);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setResizable(true);
JPanel panel1 = new JPanel();
TitledBorder border = BorderFactory.createTitledBorder(" ");
//panel1.setVerticalTextPosition(JPanel.BOTTOM);
panel1.setBorder(border);
GridLayout layout = new GridLayout(10, 10, 10, 10);
//panel1.setLayout(layout);
Rentable ph=new Rentable();
for (Map.Entry<String, String> e : rentals.entrySet()) {
for (Map.Entry<String, Rentable> j : rentalsV2.entrySet()) {
ph=j.getValue();
if (Objects.equals(e.getValue(), username)&& Objects.equals(e.getKey(), j.getKey())) {
//Rentable u3= new getValue();
String imgName5 = "images/home2.png";
URL imageURL5 = this.getClass().getResource(imgName5);
ImageIcon icon5 = new ImageIcon(imageURL5);
label22 = new JLabel();
label22 = new JLabel("");
label22.setIcon(icon5);
labelkey=new JLabel(ph.getKey());
labelprice=new JLabel(String.valueOf(ph.getPrice()));
labelpark=new JLabel(ph.getPark());
labelwifi=new JLabel(ph.getWifi());
labelsize=new JLabel(String.valueOf(ph.getSize1()));
JPanel panel2 = new JPanel();
//GridLayout alayout = new GridLayout(10, 10, 10, 10);
//TitledBorder border = BorderFactory.createTitledBorder(" ");
labelkey1=new JLabel("key:");
labelprice1=new JLabel("price:");
labelpark1=new JLabel("parking:");
labelwifi1=new JLabel("wifi:");
labelsize1=new JLabel("size:");
panel2.add(label22);
panel2.add(labelkey1);
panel2.add(labelkey);
panel2.add(labelprice1);
panel2.add(labelprice);
panel2.add(labelpark1);
panel2.add(labelpark);
panel2.add(labelwifi1);
panel2.add(labelwifi);
panel2.add(labelsize1);
panel2.add(labelsize);
//panel2.add(label3);
FlowLayout aLayout = new FlowLayout();
setLayout(aLayout);
setVisible(true);
add(panel2, BorderLayout.CENTER);
//u3.display(j.getValue());
}
}
}
/*
panel1.add(labelkey);
panel1.add(labelprice);
panel1.add(labelpark);
panel1.add(labelwifi);
panel1.add(labelsize);
*/
FlowLayout aLayout = new FlowLayout();
setLayout(aLayout);
setVisible(true);
//add(panel1, BorderLayout.CENTER);
JPanel panel2 = new JPanel();
pack();
setVisible(true);
}
}