4 import java.awt.EventQueue;
6 import java.awt.GridLayout;
7 import java.awt.event.ActionEvent;
8 import java.awt.event.ActionListener;
9 import java.awt.event.WindowAdapter;
10 import java.awt.event.WindowEvent;
11 import java.util.Locale;
12 import java.util.ResourceBundle;
13 import java.util.Vector;
16 * @author Software Engineering teachers
18 import javax.swing.ButtonGroup;
19 import javax.swing.JButton;
20 import javax.swing.JFrame;
21 import javax.swing.JLabel;
22 import javax.swing.JPanel;
23 import javax.swing.JRadioButton;
24 import javax.swing.SwingConstants;
26 import businessLogic.BLFacade;
27 import businessLogic.BLFacadeImplementation;
29 import java.awt.GridBagLayout;
30 import java.awt.GridBagConstraints;
31 import java.awt.Insets;
33 public class MainAdminGUI extends JFrame {
35 private static final long serialVersionUID = 1L;
37 private JPanel jContentPane = null;
38 private JButton jButtonCreateQuery = null;
39 private JButton jButtonCreateEvent = null;
41 private static BLFacade appFacadeInterface = LoginGUI.getBusinessLogic();
44 protected JLabel jLabelSelectOption;
45 private JRadioButton rdbtnNewRadioButton;
46 private JRadioButton rdbtnNewRadioButton_1;
47 private JRadioButton rdbtnNewRadioButton_2;
49 private final ButtonGroup buttonGroup = new ButtonGroup();
50 private JButton jButtonCreateForecast;
53 * This is the default constructor
55 public MainAdminGUI() {
58 addWindowListener(new WindowAdapter() {
60 public void windowClosing(WindowEvent e) {
62 // if (ConfigXML.getInstance().isBusinessLogicLocal()) facade.close();
63 } catch (Exception e1) {
64 // TODO Auto-generated catch block
66 "Error: " + e1.toString() + " , probably problems with Business Logic or Database");
73 // this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
77 * This method initializes this
81 private void initialize() {
82 // this.setSize(271, 295);
83 this.setSize(550, 363);
84 this.setContentPane(getJContentPane());
85 this.setTitle(ResourceBundle.getBundle("Etiquetas").getString("MainTitle"));
89 * This method initializes jContentPane
91 * @return javax.swing.JPanel
93 private JPanel getJContentPane() {
94 if (jContentPane == null) {
95 jContentPane = new JPanel();
96 jContentPane.setLayout(null);
97 jContentPane.add(getLblNewLabel());
98 jContentPane.add(getBoton3());
99 jContentPane.add(getBoton2());
100 jContentPane.add(getJButtonCreateForecast());
101 jContentPane.add(getPanel());
103 JButton jButtonQueryQueries = new JButton();
104 jButtonQueryQueries.addActionListener(new ActionListener() {
105 public void actionPerformed(ActionEvent e) {
106 JFrame a = new FindQuestionsGUI();
107 a.setAlwaysOnTop(true);
111 jButtonQueryQueries.setText(ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.jButtonQueryQuestions.text")); //$NON-NLS-1$ //$NON-NLS-2$
112 jButtonQueryQueries.setBounds(128, 183, 267, 38);
113 jContentPane.add(jButtonQueryQueries);
119 * This method initializes boton1
121 * @return javax.swing.JButton
123 private JButton getBoton2() {
124 if (jButtonCreateQuery == null) {
125 jButtonCreateQuery = new JButton();
126 jButtonCreateQuery.setBounds(128, 100, 267, 38);
127 jButtonCreateQuery.setText(ResourceBundle.getBundle("Etiquetas").getString("CreateQuery"));
128 jButtonCreateQuery.addActionListener(new java.awt.event.ActionListener() {
129 public void actionPerformed(java.awt.event.ActionEvent e) {
130 JFrame a = new CreateQuestionGUI(new Vector<Event>());
131 a.setAlwaysOnTop(true);
137 return jButtonCreateQuery;
141 * This method initializes boton2
143 * @return javax.swing.JButton
145 private JButton getBoton3() {
146 if (jButtonCreateEvent == null) {
147 jButtonCreateEvent = new JButton();
148 jButtonCreateEvent.setBounds(128, 59, 267, 38);
149 jButtonCreateEvent.setText(ResourceBundle.getBundle("Etiquetas").getString("CreateEvent"));
150 jButtonCreateEvent.addActionListener(new java.awt.event.ActionListener() {
151 public void actionPerformed(java.awt.event.ActionEvent e) {
152 JFrame a = new CreateEventGUI();
153 a.setAlwaysOnTop(true);
160 return jButtonCreateEvent;
163 private JLabel getLblNewLabel() {
164 if (jLabelSelectOption == null) {
165 jLabelSelectOption = new JLabel(ResourceBundle.getBundle("Etiquetas").getString("SelectOption"));
166 jLabelSelectOption.setBounds(133, 0, 262, 76);
167 jLabelSelectOption.setFont(new Font("Tahoma", Font.BOLD, 13));
168 jLabelSelectOption.setForeground(Color.BLACK);
169 jLabelSelectOption.setHorizontalAlignment(SwingConstants.CENTER);
172 return jLabelSelectOption;
175 private JRadioButton getRdbtnNewRadioButton() {
176 if (rdbtnNewRadioButton == null) {
177 rdbtnNewRadioButton = new JRadioButton("English");
178 rdbtnNewRadioButton.addActionListener(new ActionListener() {
179 public void actionPerformed(ActionEvent e) {
180 Locale.setDefault(new Locale("en"));
181 System.out.println("Locale: " + Locale.getDefault());
185 buttonGroup.add(rdbtnNewRadioButton);
187 return rdbtnNewRadioButton;
190 private JRadioButton getRdbtnNewRadioButton_1() {
191 if (rdbtnNewRadioButton_1 == null) {
192 rdbtnNewRadioButton_1 = new JRadioButton("Euskara");
193 rdbtnNewRadioButton_1.addActionListener(new ActionListener() {
194 public void actionPerformed(ActionEvent arg0) {
195 Locale.setDefault(new Locale("eus"));
196 System.out.println("Locale: " + Locale.getDefault());
200 buttonGroup.add(rdbtnNewRadioButton_1);
202 return rdbtnNewRadioButton_1;
205 private JRadioButton getRdbtnNewRadioButton_2() {
206 if (rdbtnNewRadioButton_2 == null) {
207 rdbtnNewRadioButton_2 = new JRadioButton("Castellano");
208 rdbtnNewRadioButton_2.addActionListener(new ActionListener() {
209 public void actionPerformed(ActionEvent e) {
210 Locale.setDefault(new Locale("es"));
211 System.out.println("Locale: " + Locale.getDefault());
215 buttonGroup.add(rdbtnNewRadioButton_2);
217 return rdbtnNewRadioButton_2;
220 private JPanel getPanel() {
222 panel = new JPanel();
223 panel.setBounds(128, 232, 262, 81);
224 panel.add(getRdbtnNewRadioButton_1());
225 panel.add(getRdbtnNewRadioButton_2());
226 panel.add(getRdbtnNewRadioButton());
232 private void redibujar() {
233 jLabelSelectOption.setText(ResourceBundle.getBundle("Etiquetas").getString("SelectOption"));
234 jButtonCreateEvent.setText(ResourceBundle.getBundle("Etiquetas").getString("QueryQueries"));
235 jButtonCreateQuery.setText(ResourceBundle.getBundle("Etiquetas").getString("CreateQuery"));
236 this.setTitle(ResourceBundle.getBundle("Etiquetas").getString("MainTitle"));
239 public void close() {
240 this.setVisible(false);
242 private JButton getJButtonCreateForecast() {
243 if (jButtonCreateForecast == null) {
244 jButtonCreateForecast = new JButton();
245 jButtonCreateForecast.addActionListener(new ActionListener() {
246 public void actionPerformed(ActionEvent e) {
247 JFrame a = new CreateForecastGUI();
248 a.setAlwaysOnTop(true);
253 jButtonCreateForecast.setBounds(128, 142, 267, 38);
254 jButtonCreateForecast.setText(ResourceBundle.getBundle("Etiquetas").getString("MainAdminGUI.jButtonCreateForecast.text")); //$NON-NLS-1$ //$NON-NLS-2$
256 return jButtonCreateForecast;
258 } // @jve:decl-index=0:visual-constraint="0,0"