ISBets21MAUBRY
3cf4057e97448d401b49261033b8ab566105944e
ISBets21MAUBRY / eclipse-workspace / ISBets21MAUBRY / src / main / java / gui / MainAdminGUI.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 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
package gui; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Locale; import java.util.Vector; /** * @author Software Engineering teachers */ import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.SwingConstants; import businessLogic.BLFacade; import domain.AdminUser; import domain.Event; public class MainAdminGUI extends JFrame { private static final long serialVersionUID = 1L; private JPanel jContentPane = null; private JButton jButtonCreateQuestion = null; private JButton jButtonCreateEvent = null; private static BLFacade appFacadeInterface = LoginGUI.getBusinessLogic(); protected JLabel jLabelSelectOption; private JRadioButton rdbtnNewRadioButton; private JRadioButton rdbtnNewRadioButton_1; private JRadioButton rdbtnNewRadioButton_2; private JPanel panel; private final ButtonGroup buttonGroup = new ButtonGroup(); private JButton jButtonCreateForecast; private JButton buttonAdmin; private AdminUser userlog = null; private JButton buttonCloseEvent; private JButton jButtonQueryQueries; private JLabel lblFotoCrearEvento; private JLabel lblFotoCrearQuestion; private JLabel lblFotoCrearForecast; private JLabel lblFotoSeeQuestions; private JLabel lblFotoAdministration; private JLabel lblFotoCloseEvent; /** * This is the default constructor */ public MainAdminGUI(AdminUser au) { super(); userlog = au; addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { try { // if (ConfigXML.getInstance().isBusinessLogicLocal()) facade.close(); } catch (Exception e1) { // TODO Auto-generated catch block System.out.println( "Error: " + e1.toString() + " , probably problems with Business Logic or Database"); } // System.exit(1); } }); initialize(); // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } /** * This method initializes this * * @return void */ private void initialize() { // this.setSize(271, 295); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setSize(630, 421); this.setContentPane(getJContentPane()); // this.setTitle(ResourceBundle.getBundle("Etiquetas").getString("MainTitle")); this.setTitle("MainTitle"); } /** * This method initializes jContentPane * * @return javax.swing.JPanel */ private JPanel getJContentPane() { if (jContentPane == null) { jContentPane = new JPanel(); jContentPane.setBackground(Color.WHITE); jContentPane.setLayout(null); jContentPane.add(getLblNewLabel()); jContentPane.add(getBoton3()); jContentPane.add(getBoton2()); jContentPane.add(getJButtonCreateForecast()); jContentPane.add(getPanel()); jContentPane.add(getJButtonAdministration()); jContentPane.add(getbuttonCloseEvent()); jButtonQueryQueries = new JButton(); jButtonQueryQueries.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { lblFotoSeeQuestions.setVisible(true); } @Override public void mouseExited(MouseEvent e) { lblFotoSeeQuestions.setVisible(false); } }); jButtonQueryQueries.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFrame a = new FindQuestionsGUI(userlog); a.setAlwaysOnTop(true); a.setVisible(true); dispose(); } }); // jButtonQueryQueries.setText( // ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.jButtonQueryQuestions.text")); //$NON-NLS-1$ //$NON-NLS-2$ jButtonQueryQueries.setText("QueryQuestions"); //$NON-NLS-1$ //$NON-NLS-2$ jButtonQueryQueries.setBounds(34, 191, 267, 38); jContentPane.add(jButtonQueryQueries); ImageIcon icon = new ImageIcon("imagenes/fotoCrearEvento.png"); lblFotoCrearEvento = new JLabel(icon); lblFotoCrearEvento.setBounds(320, 108, 265, 192); lblFotoCrearEvento.setVisible(false); jContentPane.add(lblFotoCrearEvento); ImageIcon icon2 = new ImageIcon("imagenes/fotoCrearQuestion.png"); lblFotoCrearQuestion = new JLabel(icon2); lblFotoCrearQuestion.setBounds(320, 108, 265, 192); lblFotoCrearQuestion.setVisible(false); jContentPane.add(lblFotoCrearQuestion); ImageIcon icon3 = new ImageIcon("imagenes/fotoCrearForecast.png"); lblFotoCrearForecast = new JLabel(icon3); lblFotoCrearForecast.setBounds(320, 108, 265, 192); lblFotoCrearForecast.setVisible(false); jContentPane.add(lblFotoCrearForecast); ImageIcon icon4 = new ImageIcon("imagenes/fotoSeeQuestions.png"); lblFotoSeeQuestions = new JLabel(icon4); lblFotoSeeQuestions.setBounds(320, 108, 265, 192); lblFotoSeeQuestions.setVisible(false); jContentPane.add(lblFotoSeeQuestions); ImageIcon icon5 = new ImageIcon("imagenes/fotoAdministration.png"); lblFotoAdministration = new JLabel(icon5); lblFotoAdministration.setBounds(320, 108, 265, 192); lblFotoAdministration.setVisible(false); jContentPane.add(lblFotoAdministration); ImageIcon icon6 = new ImageIcon("imagenes/fotoCloseEvent.png"); lblFotoCloseEvent = new JLabel(icon6); lblFotoCloseEvent.setBounds(320, 108, 265, 192); lblFotoCloseEvent.setVisible(false); jContentPane.add(lblFotoCloseEvent); } return jContentPane; } /** * This method initializes boton1 * * @return javax.swing.JButton */ private JButton getBoton2() { if (jButtonCreateQuestion == null) { jButtonCreateQuestion = new JButton(); jButtonCreateQuestion.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { lblFotoCrearQuestion.setVisible(true); } @Override public void mouseExited(MouseEvent e) { lblFotoCrearQuestion.setVisible(false); } }); jButtonCreateQuestion.setBounds(34, 108, 267, 38); // jButtonCreateQuestion.setText(ResourceBundle.getBundle("Etiquetas").getString("CreateQuestion")); jButtonCreateQuestion.setText("CreateQuestion"); jButtonCreateQuestion.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { JFrame a = new CreateQuestionGUI(new Vector<Event>(), userlog); a.setAlwaysOnTop(true); a.setVisible(true); close(); } }); } return jButtonCreateQuestion; } /** * This method initializes boton2 * * @return javax.swing.JButton */ private JButton getBoton3() { if (jButtonCreateEvent == null) { jButtonCreateEvent = new JButton(); jButtonCreateEvent.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent arg0) { lblFotoCrearEvento.setVisible(true); } @Override public void mouseExited(MouseEvent e) { lblFotoCrearEvento.setVisible(false); } }); jButtonCreateEvent.setBounds(34, 67, 267, 38); // jButtonCreateEvent.setText(ResourceBundle.getBundle("Etiquetas").getString("CreateEvent")); jButtonCreateEvent.setText("CreateEvent"); jButtonCreateEvent.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { JFrame a = new CreateEventGUI(userlog); a.setAlwaysOnTop(true); a.setVisible(true); a.setVisible(true); dispose(); } }); } return jButtonCreateEvent; } private JLabel getLblNewLabel() { if (jLabelSelectOption == null) { // jLabelSelectOption = new JLabel(ResourceBundle.getBundle("Etiquetas").getString("SelectOption")); jLabelSelectOption = new JLabel("SelectOption"); jLabelSelectOption.setBounds(39, 8, 262, 76); jLabelSelectOption.setFont(new Font("Tahoma", Font.BOLD, 13)); jLabelSelectOption.setForeground(Color.BLACK); jLabelSelectOption.setHorizontalAlignment(SwingConstants.CENTER); } return jLabelSelectOption; } private JRadioButton getRdbtnNewRadioButton() { if (rdbtnNewRadioButton == null) { rdbtnNewRadioButton = new JRadioButton("English"); rdbtnNewRadioButton.setBackground(Color.WHITE); rdbtnNewRadioButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Locale.setDefault(new Locale("en")); System.out.println("Locale: " + Locale.getDefault()); redibujar(); } }); buttonGroup.add(rdbtnNewRadioButton); } return rdbtnNewRadioButton; } private JRadioButton getRdbtnNewRadioButton_1() { if (rdbtnNewRadioButton_1 == null) { rdbtnNewRadioButton_1 = new JRadioButton("Euskara"); rdbtnNewRadioButton_1.setBackground(Color.WHITE); rdbtnNewRadioButton_1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Locale.setDefault(new Locale("eus")); System.out.println("Locale: " + Locale.getDefault()); redibujar(); } }); buttonGroup.add(rdbtnNewRadioButton_1); } return rdbtnNewRadioButton_1; } private JRadioButton getRdbtnNewRadioButton_2() { if (rdbtnNewRadioButton_2 == null) { rdbtnNewRadioButton_2 = new JRadioButton("Castellano"); rdbtnNewRadioButton_2.setBackground(Color.WHITE); rdbtnNewRadioButton_2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Locale.setDefault(new Locale("es")); System.out.println("Locale: " + Locale.getDefault()); redibujar(); } }); buttonGroup.add(rdbtnNewRadioButton_2); } return rdbtnNewRadioButton_2; } private JPanel getPanel() { if (panel == null) { panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setBounds(38, 318, 262, 38); panel.add(getRdbtnNewRadioButton_1()); panel.add(getRdbtnNewRadioButton_2()); panel.add(getRdbtnNewRadioButton()); } return panel; } private void redibujar() { // jLabelSelectOption.setText(ResourceBundle.getBundle("Etiquetas").getString("SelectOption")); // jButtonCreateEvent.setText(ResourceBundle.getBundle("Etiquetas").getString("CreateEvent")); // jButtonCreateQuestion.setText(ResourceBundle.getBundle("Etiquetas").getString("CreateQuestion")); // jButtonCreateForecast // .setText(ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.jButtonCreateForecast.text")); // jButtonQueryQueries // .setText(ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.jButtonQueryQuestions.text")); // buttonAdmin.setText(ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.buttonAdmin.text")); // buttonCloseEvent.setText(ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.buttonCloseEvent.text")); // // this.setTitle(ResourceBundle.getBundle("Etiquetas").getString("MainTitle")); jLabelSelectOption.setText("SelectOption"); jButtonCreateEvent.setText("CreateEvent"); jButtonCreateQuestion.setText("CreateQuestion"); jButtonCreateForecast.setText("CreateForecast"); jButtonQueryQueries.setText("QueryQuestions"); buttonAdmin.setText("SeeStoredData"); buttonCloseEvent.setText("CloseEvent"); this.setTitle("MainTitle"); } public void close() { this.setVisible(false); } private JButton getJButtonCreateForecast() { if (jButtonCreateForecast == null) { jButtonCreateForecast = new JButton(); jButtonCreateForecast.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { lblFotoCrearForecast.setVisible(true); } @Override public void mouseExited(MouseEvent e) { lblFotoCrearForecast.setVisible(false); } }); jButtonCreateForecast.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFrame a = new CreateForecastGUI(userlog); a.setAlwaysOnTop(true); a.setVisible(true); close(); } }); jButtonCreateForecast.setBounds(34, 150, 267, 38); // jButtonCreateForecast.setText( // ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.jButtonCreateForecast.text")); //$NON-NLS-1$ //$NON-NLS-2$ jButtonCreateForecast.setText("CreateForecast"); //$NON-NLS-1$ //$NON-NLS-2$ } return jButtonCreateForecast; } private JButton getJButtonAdministration() { if (buttonAdmin == null) { buttonAdmin = new JButton(); buttonAdmin.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { lblFotoAdministration.setVisible(true); } @Override public void mouseExited(MouseEvent e) { lblFotoAdministration.setVisible(false); } }); buttonAdmin.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFrame a = new AdministrationGUI(userlog); a.setAlwaysOnTop(true); a.setVisible(true); close(); } }); buttonAdmin.setBounds(34, 232, 267, 38); // buttonAdmin.setText(ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.buttonAdmin.text")); //$NON-NLS-1$ //$NON-NLS-2$ buttonAdmin.setText("buttonAdmin"); //$NON-NLS-1$ //$NON-NLS-2$ } return buttonAdmin; } private JButton getbuttonCloseEvent() { if (buttonCloseEvent == null) { buttonCloseEvent = new JButton(); buttonCloseEvent.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { lblFotoCloseEvent.setVisible(true); } @Override public void mouseExited(MouseEvent e) { lblFotoCloseEvent.setVisible(false); } }); buttonCloseEvent.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFrame a = new CloseEventGUI(userlog); a.setAlwaysOnTop(true); a.setVisible(true); dispose(); } }); buttonCloseEvent.setBounds(34, 273, 267, 38); // buttonCloseEvent // .setText(ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.buttonCloseEvent.text")); //$NON-NLS-1$ //$NON-NLS-2$ buttonCloseEvent.setText("CloseEvent"); //$NON-NLS-1$ //$NON-NLS-2$ jContentPane.add(buttonCloseEvent); } return buttonCloseEvent; } } // @jve:decl-index=0:visual-constraint="0,0" |
Commits for ISBets21MAUBRYeclipse-workspace/ISBets21MAUBRY/src/main/java/gui/MainAdminGUI.java
Revision | Author | Commited | Message |
---|---|---|---|
3cf405 ... | porkipig | Sun 16 May, 2021 19:27:29 +0000 | IteraciĆ³n 3(VersiĆ³n sin idiomas) |