-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHome2.java
More file actions
220 lines (189 loc) · 10.2 KB
/
Copy pathHome2.java
File metadata and controls
220 lines (189 loc) · 10.2 KB
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
import java.awt.Dimension;
public class Home2 extends javax.swing.JFrame {
public Home2() {
initComponents();
this.setLocationRelativeTo(null);
Login login = new Login();
boolean visible = login.role.equals("Administrador");
jMenuUsuarios.setVisible(visible);
jMenuHabitaciones.setVisible(visible);
}
public int calcularX(Dimension desktopSize, Dimension jIFrameSize) {
return (desktopSize.width - jIFrameSize.width) / 2;
}
public int calcularY(Dimension desktopSize, Dimension jIFrameSize) {
return (desktopSize.height - jIFrameSize.height) / 2;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
Escritorio = new javax.swing.JDesktopPane();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
mItemLogOut = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
mItemReservaciones = new javax.swing.JMenuItem();
mItemNewReservacion = new javax.swing.JMenuItem();
jMenuUsuarios = new javax.swing.JMenu();
mItemUsuarios = new javax.swing.JMenuItem();
jMenuHabitaciones = new javax.swing.JMenu();
mItemHabitaciones = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
setTitle("Home");
setMaximumSize(new java.awt.Dimension(1200, 800));
setResizable(false);
jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/home-regular-36 (1).png"))); // NOI18N
jMenu1.setText("Inicio");
mItemLogOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/log-out-regular-36 (1).png"))); // NOI18N
mItemLogOut.setText("Cerrar Sesión");
mItemLogOut.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mItemLogOutActionPerformed(evt);
}
});
jMenu1.add(mItemLogOut);
jMenuBar1.add(jMenu1);
jMenu2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/book-content-regular-36 (1).png"))); // NOI18N
jMenu2.setText("Reservaciones");
mItemReservaciones.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/book-content-regular-36 (1).png"))); // NOI18N
mItemReservaciones.setText("Reservaciones");
mItemReservaciones.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mItemReservacionesActionPerformed(evt);
}
});
jMenu2.add(mItemReservaciones);
mItemNewReservacion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/plus-medical-regular-36.png"))); // NOI18N
mItemNewReservacion.setText("Crear Reservacion");
mItemNewReservacion.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mItemNewReservacionActionPerformed(evt);
}
});
jMenu2.add(mItemNewReservacion);
jMenuBar1.add(jMenu2);
jMenuUsuarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/user-regular-36 (1).png"))); // NOI18N
jMenuUsuarios.setText("Usuarios");
mItemUsuarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/user-regular-36 (1).png"))); // NOI18N
mItemUsuarios.setText("Usuarios");
mItemUsuarios.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mItemUsuariosActionPerformed(evt);
}
});
jMenuUsuarios.add(mItemUsuarios);
jMenuBar1.add(jMenuUsuarios);
jMenuHabitaciones.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/bed-regular-36 (1).png"))); // NOI18N
jMenuHabitaciones.setText("Habitaciones");
mItemHabitaciones.setIcon(new javax.swing.ImageIcon(getClass().getResource("/iconos/bed-regular-36 (1).png"))); // NOI18N
mItemHabitaciones.setText("Habitaciones");
mItemHabitaciones.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
mItemHabitacionesActionPerformed(evt);
}
});
jMenuHabitaciones.add(mItemHabitaciones);
jMenuBar1.add(jMenuHabitaciones);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Escritorio, javax.swing.GroupLayout.DEFAULT_SIZE, 1200, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Escritorio, javax.swing.GroupLayout.DEFAULT_SIZE, 751, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void mItemReservacionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemReservacionesActionPerformed
// TODO add your handling code here:
Reservaciones reservaciones = new Reservaciones();
Dimension desktopSize = Escritorio.getSize();
Dimension IJFReservaciones = reservaciones.getSize();
reservaciones.setLocation(calcularX(desktopSize, IJFReservaciones), calcularY(desktopSize, IJFReservaciones));
Escritorio.add(reservaciones);
reservaciones.show();
}//GEN-LAST:event_mItemReservacionesActionPerformed
private void mItemHabitacionesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemHabitacionesActionPerformed
Habitaciones habitaciones = new Habitaciones();
Dimension desktopSize = Escritorio.getSize();
Dimension IJFrameHabitaciones = habitaciones.getSize();
habitaciones.setLocation(calcularX(desktopSize, IJFrameHabitaciones), calcularY(desktopSize, IJFrameHabitaciones));
Escritorio.add(habitaciones);
habitaciones.show();
}//GEN-LAST:event_mItemHabitacionesActionPerformed
private void mItemLogOutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemLogOutActionPerformed
Login login = new Login();
login.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_mItemLogOutActionPerformed
private void mItemNewReservacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemNewReservacionActionPerformed
NuevaReservacion nReservacion = new NuevaReservacion();
Dimension desktopSize = Escritorio.getSize();
Dimension IJFrameNReservacion = nReservacion.getSize();
nReservacion.setLocation(calcularX(desktopSize, IJFrameNReservacion), calcularY(desktopSize, IJFrameNReservacion));
Escritorio.add(nReservacion);
nReservacion.show();
}//GEN-LAST:event_mItemNewReservacionActionPerformed
private void mItemUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mItemUsuariosActionPerformed
Usuarios usuarios = new Usuarios();
Dimension desktopSize = Escritorio.getSize();
Dimension IJFrameUsuarios = usuarios.getSize();
usuarios.setLocation(calcularX(desktopSize, IJFrameUsuarios), calcularY(desktopSize, IJFrameUsuarios));
Escritorio.add(usuarios);
usuarios.show();
}//GEN-LAST:event_mItemUsuariosActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Home2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Home2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Home2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Home2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Home2().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JDesktopPane Escritorio;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenu jMenuHabitaciones;
private javax.swing.JMenu jMenuUsuarios;
private javax.swing.JMenuItem mItemHabitaciones;
private javax.swing.JMenuItem mItemLogOut;
private javax.swing.JMenuItem mItemNewReservacion;
private javax.swing.JMenuItem mItemReservaciones;
private javax.swing.JMenuItem mItemUsuarios;
// End of variables declaration//GEN-END:variables
}