-
Notifications
You must be signed in to change notification settings - Fork 0
/
profileGui.java
193 lines (137 loc) · 5.63 KB
/
profileGui.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
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 profileGui extends JFrame {
protected String usernam;
protected String username;
protected String password;
protected String fullname;
protected String address;
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 textuser;
private JLabel labeluser;
//private JTextField textpass;
private JLabel labelpass;
//private JTextField textfn;
private JLabel labelfn;
//private JTextField textad;
private JLabel labelad;
private JLabel labelkey1;
private JLabel labelprice1;
private JLabel labelpark1;
private JLabel labelwifi1;
private JLabel label22;
private ImageIcon icon5;
private JButton buttonc;
private JButton buttonr;
private JLabel cr;
private int choicer = 0;
/**
* <p>
*this is the gui and code for the choice to see his profile in the provider menu made with java swing
*<br>
* @param -
* @return
* @see -
* @author tsig-404
*/
public profileGui(String us,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.username=us;
this.ausers = aausers;
this.rentals = arentals;
this.user = auser;
this.rented = arented;
this.rentalsV2 = arentalsV2;
this.rentcancel = rc;
this.messages = msg;
this.roles = aroles;
//if it doesnt work
setSize(500, 500);
//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//setLocationRelativeTo(null);
//setResizable(false);
setTitle("Profile Tab");
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);
for (Map.Entry<String, User> e : user.entrySet()) {
if (Objects.equals(username, e.getKey())) {
// Provider u2 = new Provider();
// u2.profile(e.getValue());
//e.getValue().showGui();
User u2 = e.getValue();
JPanel panel2 = new JPanel();
String imgName5 = "images/prof1.png";
URL imageURL5 = this.getClass().getResource(imgName5);
ImageIcon icon5 = new ImageIcon(imageURL5);
label22 = new JLabel();
label22 = new JLabel("");
label22.setIcon(icon5);
panel2.add(label22);
labelkey1 = new JLabel("Username:");
labelprice1 = new JLabel("Fullname:");
labelpark1 = new JLabel("Address:");
labelwifi1 = new JLabel("Role:");
//add(button);
//add(label);
//setVisible(true);
labeluser = new JLabel(u2.getUsername());
panel2.add(labelkey1);
panel2.add(labeluser);
//textuser = new JTextField("un");
//panel1.add(textuser);
labelpass = new JLabel(u2.getFullname());
panel2.add(labelprice1);
panel2.add(labelpass);
//textpass = new JTextField("ps");
// panel1.add(textpass);
labelfn = new JLabel(u2.getAddress());
panel2.add(labelpark1);
panel2.add(labelfn);
//textfn = new JTextField("fn");
//panel1.add(textfn);
labelad = new JLabel("Provider");
panel2.add(labelwifi1);
panel2.add(labelad);
FlowLayout aLayout = new FlowLayout();
setLayout(aLayout);
setVisible(true);
add(panel2, BorderLayout.CENTER);
//textad = new JTextField("ad");
//textDose.setEditable(false);
//panel1.add(textad);
}
}
FlowLayout aLayout = new FlowLayout();
setLayout(aLayout);
setVisible(true);
//add(panel1, BorderLayout.CENTER);
JPanel panel2 = new JPanel();
pack();
setVisible(true);
}
}