Example #1
0
  private void buildFields() {
    JLabel lbFaculty = new JLabel("Факультет:");
    lbFaculty.setHorizontalAlignment(SwingConstants.RIGHT);
    lbFaculty.setBounds(new Rectangle(PAD, 0 * H_B + PAD, W_L, H_B));
    add(lbFaculty);
    txtFaculty.setBounds(new Rectangle(W_L + 2 * PAD, 0 * H_B + PAD, W_T, H_B));
    txtFaculty.setBorder(BorderFactory.createEtchedBorder());
    add(txtFaculty);

    JLabel lbNOG = new JLabel("Группа:");
    lbNOG.setHorizontalAlignment(SwingConstants.RIGHT);
    lbNOG.setBounds(new Rectangle(PAD, 1 * H_B + PAD, W_L, H_B));
    add(lbNOG);
    txtNOG.setBounds(new Rectangle(W_L + 2 * PAD, 1 * H_B + PAD, W_T, H_B));
    txtNOG.setBorder(BorderFactory.createEtchedBorder());
    add(txtNOG);

    JLabel lbName = new JLabel("Имя:");
    lbName.setHorizontalAlignment(SwingConstants.RIGHT);
    lbName.setBounds(new Rectangle(PAD, 2 * H_B + PAD, W_L, H_B));
    add(lbName);
    txtName.setBounds(new Rectangle(W_L + 2 * PAD, 2 * H_B + PAD, W_T, H_B));
    txtName.setBorder(BorderFactory.createEtchedBorder());
    add(txtName);

    JLabel lbDOE = new JLabel("Дата зачисления:");
    lbDOE.setHorizontalAlignment(SwingConstants.RIGHT);
    lbDOE.setBounds(new Rectangle(PAD, 3 * H_B + PAD, W_L, H_B));
    add(lbDOE);
    txtDOE.setBounds(new Rectangle(W_L + 2 * PAD, 3 * H_B + PAD, W_T, H_B));
    txtDOE.setBorder(BorderFactory.createEtchedBorder());
    add(txtDOE);
  }
Example #2
0
  /** Método que construye la ventana "acerca de". */
  public acercaDe() {
    setResizable(false);
    setType(Type.UTILITY);
    setTitle("ACERCA DE");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(300, 100, 533, 572);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JButton atras = new JButton("ATR\u00C1S");
    atras.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try {
              pantallaAnterior.setVisible(true);
              frame.dispose();
            } catch (Exception e1) {
            }
          }
        });
    atras.setToolTipText("ATR\u00C1S");
    atras.setBounds(224, 514, 89, 23);
    contentPane.add(atras);

    JTextPane textPane = new JTextPane();
    textPane.setBounds(75, 210, -4, 14);
    contentPane.add(textPane);

    JTextPane txtpnVersionSoftware = new JTextPane();
    txtpnVersionSoftware.setFont(new Font("Trebuchet MS", Font.PLAIN, 11));
    txtpnVersionSoftware.setEditable(false);
    txtpnVersionSoftware.setText(
        "PictoDroid Lite es un aplicaci\u00F3n que permite a los usuarios comunicarse a trav\u00E9s del uso de pictogramas o pictos (signos que representan esquem\u00E1ticamente un s\u00EDmbolo, objeto real o figura). Esta versi\u00F3n Lite \u00FAnicamente permite expresar acciones muy concretas, sin la posibilidad de crear oraciones complejas.\r\n\r\nEn la actualidad se pueden realizar oraciones iniciadas por:\r\n- vamos a...\r\n- quiero jugar...\r\n- quiero ir al ba\u00F1o...\r\n- quiero beber...\r\n- quiero comer...\r\n- estoy...\r\n\r\nAl completar la selecci\u00F3n de pictos el sistema proceder\u00E1 a la lectura de la frase formada.\r\n\r\nTodos los pictos pueden ser modificados o eliminados y es posible a\u00F1adir tantos como sea necesario.\r\nEl proceso se encuentra explicado en el manual de aplicaci\u00F3n disponible en http://www.accegal.org.\r\nSi tiene alguna duda o dificultad en la configuraci\u00F3n de PictoDroid Lite puede ponerse en contacto con nosotros en el email \"[email protected]\" y trataremos de ayudarle.\r\n\r\nLa aplicaci\u00F3n utiliza los pictos de ARASAAC (http://arasaac.org), creado por Sergio Palao y \r\ndistribuidos con licencia Creative Commons (BY-NC-SA), aunque es posible configurarla para utilizar otros pictos e incluso im\u00E1genes reales.");
    txtpnVersionSoftware.setBounds(10, 121, 507, 382);
    contentPane.add(txtpnVersionSoftware);

    JLabel lblNewLabel = new JLabel("");
    lblNewLabel.setIcon(new ImageIcon(getClass().getResource(".\\imagenes\\accegal_peque.jpg")));
    lblNewLabel.setBounds(10, 11, 166, 78);
    contentPane.add(lblNewLabel);

    JLabel lblNewLabel_1 = new JLabel("");
    lblNewLabel_1.setIcon(new ImageIcon(getClass().getResource(".\\imagenes\\florida_peque.png")));
    lblNewLabel_1.setBounds(186, 11, 166, 78);
    contentPane.add(lblNewLabel_1);

    JLabel lblNewLabel_2 = new JLabel("");
    lblNewLabel_2.setIcon(new ImageIcon(getClass().getResource(".\\imagenes\\Picto_peque.jpg")));
    lblNewLabel_2.setBounds(372, 11, 127, 99);
    contentPane.add(lblNewLabel_2);
  }
Example #3
0
  private void initPanel() {
    masterPanel.add(initPanel, SELECTSARTYPE);

    initPanel.setBorder(new EmptyBorder(5, 5, 5, 5));

    initPanel.setLayout(null);

    JPanel panel = new JPanel();
    panel.setBorder(
        new TitledBorder(
            null,
            "Inititate New SAR Operation",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            null));
    panel.setBounds(10, 11, 523, 340);
    initPanel.add(panel);
    panel.setLayout(null);

    typeSelectionComboBox = new JComboBox<String>();
    typeSelectionComboBox.setBounds(126, 21, 102, 20);
    panel.add(typeSelectionComboBox);
    typeSelectionComboBox.setModel(
        new DefaultComboBoxModel<String>(
            new String[] {
              "Simple SAR", "Rapid Response", "Datum Point", "Datum Line", "Back Track"
            }));

    typeSelectionComboBox.addActionListener(this);

    JLabel lblSelectSarType = new JLabel("Select SAR Type");
    lblSelectSarType.setBounds(10, 24, 140, 14);
    panel.add(lblSelectSarType);

    descriptiveText = new JTextPane();

    descriptiveText.setBounds(10, 52, 503, 112);
    panel.add(descriptiveText);
    // descriptiveText.setBackground(UIManager.getColor("Button.background"));
    descriptiveText.setOpaque(false);
    descriptiveText.setEditable(false);
    descriptiveText.setText(rapidresponseTxt);

    descriptiveImage = new JLabel(" ");
    descriptiveImage.setHorizontalAlignment(SwingConstants.CENTER);
    descriptiveImage.setBounds(20, 131, 493, 200);
    panel.add(descriptiveImage);
    descriptiveImage.setIcon(simpleSarIcon);

    lblOrImportSar = new JLabel("Or import SAR from external file:");
    lblOrImportSar.setBounds(238, 24, 176, 14);
    panel.add(lblOrImportSar);

    btnImport = new JButton("Import");
    btnImport.setBounds(408, 20, 89, 23);
    panel.add(btnImport);

    btnImport.addActionListener(this);
  }
 private JTextPane getErrorMessage() {
   if (errorMessage == null) {
     errorMessage = new JTextPane();
     errorMessage.setFont(new Font("Calibri", Font.PLAIN, 18));
     errorMessage.setBackground(new Color(227, 228, 250));
     errorMessage.setBounds(601, 454, 243, 88);
   }
   return errorMessage;
 }
 /**
  * This method initializes jTextPane1
  *
  * @return javax.swing.JTextPane
  */
 private JTextPane getJTextPane1() {
   if (jTextPane1 == null) {
     jTextPane1 = new JTextPane();
     jTextPane1.setEditable(false);
     jTextPane1.setBounds(new Rectangle(591, 302, 253, 167));
     jTextPane1.setFont(new Font("Calibri Light", Font.PLAIN, 24));
     jTextPane1.setBackground(new Color(227, 228, 250));
     jTextPane1.setText(
         "Approach one of our friendly staff with your IC or passport to change your password.");
   }
   return jTextPane1;
 }
 /** Create the dialog. */
 public HelpDialog() {
   setBounds(100, 100, 506, 410);
   getContentPane().setLayout(new BorderLayout());
   contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
   getContentPane().add(contentPanel, BorderLayout.CENTER);
   contentPanel.setLayout(null);
   {
     JPanel panel = new JPanel();
     panel.setLayout(null);
     panel.setBorder(new EmptyBorder(5, 5, 5, 5));
     panel.setBounds(10, 41, 469, 297);
     contentPanel.add(panel);
     {
       JTextPane textPane = new JTextPane();
       textPane.setBackground(SystemColor.control);
       textPane.setEditable(false);
       textPane.setText(
           "\u03A4\u03BF \u03C0\u03B1\u03C1\u03CE\u03BD \u03C0\u03C1\u03BF\u03B9\u03CC\u03BD \u03B1\u03C0\u03BF\u03C4\u03B5\u03BB\u03B5\u03B9 \u03BC\u03B9\u03B1 \u03C5\u03C0\u03B7\u03C1\u03B5\u03C3\u03B9\u03B1 \u03BC\u03B5 \u03C3\u03BA\u03BF\u03C0\u03BF \u03C4\u03B7\u03BD \u03BA\u03B1\u03BB\u03C5\u03C8\u03B7 \u03B1\u03BD\u03B1\u03B3\u03BA\u03C9\u03BD \u03C0\u03BF\u03C5 \u03B1\u03C6\u03BF\u03C1\u03BF\u03C5\u03BD \r\n\u03C4\u03B7\u03BD \u03B4\u03B9\u03B1\u03C7\u03B5\u03B9\u03C1\u03B7\u03C3\u03B7 \u03C4\u03BF\u03C5 \u03B1\u03BD\u03B8\u03C1\u03C9\u03C0\u03B9\u03BD\u03BF\u03C5 \u03B4\u03C5\u03BD\u03B1\u03BC\u03B9\u03BA\u03BF\u03C5 \u03BC\u03B5\u03C3\u03B1 \u03C3\u03B5 \u03BC\u03B9\u03B1 \u03B5\u03C4\u03B1\u03B9\u03C1\u03B9\u03B1.\r\n\r\n\u03A0\u03C1\u03BF\u03C3\u03C6\u03B5\u03C1\u03B5\u03C4\u03B1\u03B9 \u03B5\u03BD\u03B1 \u03C0\u03BB\u03B7\u03B8\u03BF\u03C2 \u03B4\u03C5\u03BD\u03B1\u03C4\u03BF\u03C4\u03B7\u03C4\u03C9\u03BD (\u03B1\u03BD\u03B1\u03BB\u03BF\u03B3\u03C9\u03C2 \u03C4\u03B7\u03C2 \u03B8\u03B5\u03C3\u03B7\u03C2 \u03C4\u03BF\u03C5 \u03BA\u03B1\u03B8\u03B5 \u03C5\u03C0\u03B1\u03BB\u03BB\u03B7\u03BB\u03BF\u03C5) \u03BF\u03C0\u03BF\u03C5 \u03C3\u03C5\u03BC\u03C0\u03B5\u03C1\u03B9\u03BB\u03B1\u03BC\u03B2\u03B1\u03BD\u03B5\u03B9 :\r\n\r\n\t\u03A0\u03C1\u03BF\u03C3\u03B8\u03B7\u03BA\u03B7 \u03BD\u03B5\u03BF\u03C5 \u03C5\u03C0\u03B1\u03BB\u03BB\u03B7\u03BB\u03BF\u03C5 \u03C3\u03C4\u03B7\u03BD \u03B5\u03C4\u03B1\u03B9\u03C1\u03B9\u03B1\r\n\t\u0395\u03C0\u03B5\u03BE\u03B5\u03C1\u03B3\u03B1\u03C3\u03B9\u03B1 \u03C3\u03C4\u03BF\u03B9\u03C7\u03B5\u03B9\u03C9\u03BD \u03C5\u03C0\u03B1\u03BB\u03BB\u03B7\u03BB\u03BF\u03C5\r\n\t\u03A0\u03C1\u03BF\u03C3\u03B8\u03B7\u03BA\u03B7 \u03BD\u03B5\u03BF\u03C5 \u03C4\u03BC\u03B7\u03BC\u03B1\u03C4\u03BF\u03C2 \u03C3\u03C4\u03B7\u03BD \u03B5\u03C4\u03B1\u03B9\u03C1\u03B9\u03B1\r\n\t\u03A3\u03C5\u03C3\u03C4\u03B7\u03BC\u03B1 \u03B1\u03BE\u03B9\u03BF\u03BB\u03CC\u03B3\u03B7\u03C3\u03B7\u03C2 \u03C5\u03C0\u03B1\u03BB\u03BB\u03AE\u03BB\u03C9\u03BD\r\n\t\u03BA\u03BB\u03C0.\r\n\r\n\u0393\u03B9\u03B1 \u03C0\u03B5\u03C1\u03B9\u03C3\u03C3\u03CC\u03C4\u03B5\u03C1\u03B5\u03C2 \u03C0\u03BB\u03B7\u03C1\u03BF\u03C6\u03BF\u03C1\u03B9\u03B5\u03C2 \u03C3\u03C7\u03B5\u03C4\u03B9\u03BA\u03B1 \u03BC\u03B5 \u03C4\u03B9\u03C2 \u03B4\u03C5\u03BD\u03B1\u03C4\u03BF\u03C4\u03B7\u03C4\u03B5\u03C2 \u03C4\u03BF\u03C5 \u03C0\u03C1\u03BF\u03B3\u03C1\u03B1\u03BC\u03BC\u03B1\u03C4\u03BF\u03C2 \u03B4\u03B9\u03B1\u03C7\u03B5\u03B9\u03C1\u03B7\u03C3\u03B7\u03C2 \u03C0\u03C1\u03BF\u03C3\u03C9\u03C0\u03B9\u03BA\u03BF\u03C5 \u03BF\u03C0\u03C9\u03C2 \u03B5\u03C0\u03B9\u03C3\u03B7\u03C2 \u03BA\u03B1\u03B9 \u03B3\u03B9\u03B1 \u03B1\u03BD\u03B1\u03BB\u03C5\u03C4\u03B9\u03BA\u03B5\u03C2 \u03BF\u03B4\u03B7\u03B3\u03B9\u03B5\u03C2 \u03C3\u03C7\u03B5\u03C4\u03B9\u03BA\u03B1 \u03BC\u03B5 \u03C4\u03B7\u03BD \u03C7\u03C1\u03B7\u03C3\u03B7 \u03C4\u03BF\u03C5 , \u03B1\u03C0\u03B5\u03C5\u03B8\u03C5\u03BD\u03B8\u03B5\u03B9\u03C4\u03B5 \u03C3\u03C4\u03B7\u03BD \u03BA\u03B1\u03C1\u03C4\u03B5\u03BB\u03B1 \"\u039F\u03B4\u03B7\u03B3\u03AF\u03B5\u03C2 \u03A7\u03C1\u03AE\u03C3\u03B7\u03C2\".");
       textPane.setBounds(0, 21, 459, 290);
       panel.add(textPane);
     }
   }
   {
     JLabel label =
         new JLabel(
             "\u03A0\u0395\u03A1\u0399\u0395\u03A7\u039F\u039C\u0395\u039D\u0391 \u0392\u039F\u0397\u0398\u0395\u0399\u0391\u03A3");
     label.setBounds(10, 11, 469, 32);
     contentPanel.add(label);
     label.setHorizontalAlignment(SwingConstants.CENTER);
     label.setFont(new Font("Tahoma", Font.PLAIN, 16));
   }
   {
     JPanel buttonPane = new JPanel();
     buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
     getContentPane().add(buttonPane, BorderLayout.SOUTH);
     {
       JButton cancelButton = new JButton("\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF");
       cancelButton.setIcon(
           new ImageIcon(HelpDialog.class.getResource("/Pictures/error_button.png")));
       cancelButton.addActionListener(
           new ActionListener() {
             public void actionPerformed(ActionEvent e) {
               setVisible(false);
             }
           });
       cancelButton.setActionCommand("Cancel");
       buttonPane.add(cancelButton);
     }
   }
 }
  /** Create the dialog. */
  public ModalMethodDescription(JFrame frame, String mensaje) {

    super(frame, true);

    setTitle("Descripci\u00F3n del m\u00E9todo");
    setIconImage(
        Toolkit.getDefaultToolkit()
            .getImage(
                ModalMethodDescription.class.getResource(
                    "/icons/imagen de respuessta transitoria.jpg")));
    setResizable(false);
    setBounds(100, 100, 600, 500);
    setMinimumSize(new Dimension(600, 500));
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(null);

    JLabel label = new JLabel();
    label.setIcon(
        new ImageIcon(
            ModalMethodDescription.class.getResource(
                "/javax/swing/plaf/metal/icons/ocean/info.png")));
    label.setBounds(10, 10, 32, 43);
    contentPanel.add(label);

    JTextPane textPane = new JTextPane();
    textPane.setText(mensaje);
    JScrollPane scrollPane = new JScrollPane(textPane);
    textPane.setBounds(40, 18, 550, 400);
    scrollPane.setBounds(40, 18, 530, 400);
    textPane.setEditable(false);
    textPane.setFont(new Font("Tahoma", Font.PLAIN, 13));
    textPane.setBackground(SystemColor.control);
    // textPane.setSize(textPane.getPreferredSize());
    contentPanel.add(scrollPane);
    textPane.setCaretPosition(0);

    JButton btnAceptar = new JButton("Aceptar");
    btnAceptar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });
    btnAceptar.setBounds(250, 420, 100, 40);
    contentPanel.add(btnAceptar);
  }
  /** set all component */
  public void initComponent() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    font = new Font("Monaco", Font.BOLD, 20); // $NON-NLS-1$

    setBounds(100, 100, 450, 478);

    contentPane = new JPanel();

    contentPane.setBackground(Color.WHITE);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
    setButton();

    txtpnVotetype.setEditable(false);
    txtpnVotetype.setFont(new Font("Tahoma", Font.PLAIN, 36)); // $NON-NLS-1$
    txtpnVotetype.setText(Messages.getString("Detail.text.votetype")); // $NON-NLS-1$
    txtpnVotetype.setBounds(10, 11, 176, 50);
    contentPane.add(txtpnVotetype);

    lblSelectTheType.setBounds(20, 72, 185, 14);
    contentPane.add(lblSelectTheType);

    selectType = new JLabel();
    selectType.setText(Messages.getString("Detail.label.none")); // $NON-NLS-1$
    selectType.setBounds(86, lastPos + 50, 199, 14);
    contentPane.add(selectType);

    btnGoToVote = new JButton(new ActionSubmit());
    btnGoToVote.setText(Messages.getString("Detail.butt.resultpage")); // $NON-NLS-1$
    btnGoToVote.setBounds(232, lastPos + 50, 169, 23);
    contentPane.add(btnGoToVote);

    select.setBounds(30, lastPos + 50, 46, 14);
    contentPane.add(select);
    setSize(430, lastPos + 100);
  }
Example #9
0
  /** Create the frame. */
  public void inicialitzarComponents() {
    setResizable(false);
    setTitle("Importar/Exportar Dades\r\n");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 650, 500);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JTextPane txtpnImportar = new JTextPane();
    txtpnImportar.setBackground(UIManager.getColor("Button.background"));
    txtpnImportar.setEditable(false);
    txtpnImportar.setText("Importar:");
    txtpnImportar.setBounds(110, 173, 63, 21);
    contentPane.add(txtpnImportar);

    JTextPane txtpnE = new JTextPane();
    txtpnE.setBackground(UIManager.getColor("Button.background"));
    txtpnE.setEditable(false);
    txtpnE.setText("Exportar:");
    txtpnE.setBounds(110, 221, 63, 21);
    contentPane.add(txtpnE);

    textField = new JTextField();
    textField.setBounds(199, 173, 199, 19);
    contentPane.add(textField);
    textField.setColumns(10);

    textField_1 = new JTextField();
    textField_1.setBounds(199, 221, 199, 19);
    contentPane.add(textField_1);
    textField_1.setColumns(10);

    JButton button = new JButton();
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // vistaMenuPrincipal pancat = new vistaMenuPrincipal();
            // pancat.setVisible(true);
            // dispose();
            cp.mostraPrincipal();
          }
        });
    button.setIcon(new ImageIcon(vistaModificarNomCat.class.getResource("/prop/icons/flecha.png")));
    button.setBounds(10, 416, 65, 35);
    contentPane.add(button);

    JButton button_1 = new JButton("");
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cp.importar(textField.getText());
          }
        });
    button_1.setIcon(new ImageIcon(vistaModificarNomCat.class.getResource("/prop/icons/tick.png")));
    button_1.setBounds(559, 416, 65, 35);
    contentPane.add(button_1);

    JButton btnImportar = new JButton("");
    btnImportar.setIcon(
        new ImageIcon(vistaImportarExportar.class.getResource("/prop/icons/Flaticon_32527.png")));
    btnImportar.addActionListener(
        new ActionListener() { // boto importar
          public void actionPerformed(ActionEvent arg0) {
            JFileChooser jfile = new JFileChooser();
            jfile.setFileSelectionMode(JFileChooser.FILES_ONLY);
            int value = jfile.showOpenDialog(null);
            if (value == JFileChooser.APPROVE_OPTION) {
              File file = jfile.getSelectedFile();
              textField.setText(file.getAbsolutePath().toString());
            }
          }
        });
    btnImportar.setBounds(412, 170, 95, 25);
    contentPane.add(btnImportar);

    JButton btnExportar = new JButton("");
    btnExportar.setIcon(
        new ImageIcon(vistaImportarExportar.class.getResource("/prop/icons/Flaticon_32527.png")));
    btnExportar.addActionListener(
        new ActionListener() { // boto exportar
          public void actionPerformed(ActionEvent e) {
            JFileChooser jfile2 = new JFileChooser();
            jfile2.setAcceptAllFileFilterUsed(false);
            jfile2.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            int value = jfile2.showOpenDialog(null);
            if (value == JFileChooser.APPROVE_OPTION) {
              File file2 = jfile2.getSelectedFile();
              textField_1.setText(file2.getAbsolutePath().toString());
            }
          }
        });
    btnExportar.setBounds(412, 217, 95, 25);
    contentPane.add(btnExportar);
  }
  /**
   * Cria uma instância da janela de cadastro de funcionário do sistema BVB
   *
   * @param janelaPai <code>Window</code> com a janela pai da caixa de diálogo <code>
   *     IgCadFuncionario</code>
   * @param funcionario <code>Funcionario</code> referênte ao objeto onde os dados serão salvos
   * @see Window
   * @see Funcionario
   */
  public IgCadFuncionario(Window janelaPai, Funcionario funcionario) {
    setModal(true);
    Color nephritis = new Color(39, 174, 96);

    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setResizable(false);
    setTitle("BVB - Cadastro de Funcion\u00E1rio");
    setBounds(100, 100, 523, (int) (506 * 0.85));
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JSeparator separatorBtn = new JSeparator();
    separatorBtn.setBounds(0, 348, 517, 2);
    contentPane.add(separatorBtn);

    JSeparator separatorTitulo = new JSeparator();
    separatorTitulo.setBounds(0, 69, 517, 2);
    contentPane.add(separatorTitulo);

    JTextPane txtpnSubTitulo = new JTextPane();
    txtpnSubTitulo.setEditable(false);
    txtpnSubTitulo.setForeground(Color.WHITE);
    txtpnSubTitulo.setBackground(nephritis);
    txtpnSubTitulo.setText("Insira o login e a senha do novo funcion\u00E1rio.");
    txtpnSubTitulo.setFont(new Font("Tahoma", Font.PLAIN, 12));
    txtpnSubTitulo.setBounds(20, 36, 290, 22);
    contentPane.add(txtpnSubTitulo);

    JTextPane txtpnTitulo = new JTextPane();
    txtpnTitulo.setEditable(false);
    txtpnTitulo.setForeground(Color.WHITE);
    txtpnTitulo.setBackground(nephritis);
    txtpnTitulo.setText("Cadastro de Funcion\u00E1rio");
    txtpnTitulo.setFont(new Font("Tahoma", Font.BOLD, 13));
    txtpnTitulo.setBounds(10, 11, 210, 22);
    contentPane.add(txtpnTitulo);

    JLabel lblImg = new JLabel("Label Img");
    lblImg.setBorder(new LineBorder(Color.WHITE, 1, true));
    lblImg.setIcon(
        new ImageIcon(
            IgCadFuncionario.class.getResource("/tsi/too/bvb/recursos/imagens/User-48.png")));
    lblImg.setBounds(459, 11, 48, 48);
    contentPane.add(lblImg);

    JEditorPane dtrpnCampoTitulo = new JEditorPane();
    dtrpnCampoTitulo.setBackground(nephritis);
    dtrpnCampoTitulo.setEditable(false);
    dtrpnCampoTitulo.setBounds(0, 0, 517, 70);
    contentPane.add(dtrpnCampoTitulo);

    JPanel Btnpanel = new JPanel();
    Btnpanel.setBounds(0, 359, 517, 43);
    contentPane.add(Btnpanel);
    Btnpanel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    btnFinalizar = new JButton("Finalizar");
    btnFinalizar.addActionListener(new TEActionCadastrarFuncionario(this, funcionario));
    btnFinalizar.setMnemonic(KeyEvent.VK_F);
    Btnpanel.add(btnFinalizar);

    btnLimpar = new JButton("Limpar");
    btnLimpar.addActionListener(new TEActionCadastrarFuncionario(this, funcionario));
    btnLimpar.setMnemonic(KeyEvent.VK_L);
    Btnpanel.add(btnLimpar);

    btnCancelar = new JButton("Cancelar");
    btnCancelar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            IgCadFuncionario.this.dispose();
          }
        });
    btnCancelar.setMnemonic(KeyEvent.VK_C);
    Btnpanel.add(btnCancelar);

    verificacaoPanel = new JPanel();
    verificacaoPanel.setLayout(null);
    verificacaoPanel.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "N\u00E3o Verificado",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(0, 0, 255)));
    verificacaoPanel.setBounds(100, 95, 407, 58);
    contentPane.add(verificacaoPanel);

    loginTextField = new JTextField();
    loginTextField.setToolTipText(
        "este campo \u00E9 de preenchimento obrigat\u00F3rio, deve conter no m\u00EDnimo 6 e no m\u00E1ximo 20 caracteres (letras, d\u00EDgitos e os s\u00EDmbolos underscore (_) ou ponto (.)) e deve ser \u00FAnico");
    loginTextField.setColumns(10);
    loginTextField.setBounds(10, 20, 288, 20);
    verificacaoPanel.add(loginTextField);

    passwordField = new JPasswordField();
    passwordField.setToolTipText(
        "este campo \u00E9 de preenchimento obrigat\u00F3rio e deve conter no m\u00EDnimo 6 e no m\u00E1ximo 10 caracteres");
    passwordField.setBounds(100, 172, 308, 20);
    contentPane.add(passwordField);

    JPanel tipoUsuarioPanel = new JPanel();
    tipoUsuarioPanel.setLayout(null);
    tipoUsuarioPanel.setBorder(
        new TitledBorder(
            UIManager.getBorder("TitledBorder.border"),
            "Tipo do Usu\u00E1rio",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(51, 153, 255)));
    tipoUsuarioPanel.setBounds(10, 235, 497, 58);
    contentPane.add(tipoUsuarioPanel);

    rdbtnAdministrador = new JRadioButton("Administrador");
    rdbtnAdministrador.setToolTipText("selecione se o funcion\u00E1rio for um administrador");
    buttonGroup.add(rdbtnAdministrador);
    rdbtnAdministrador.setSelected(true);
    rdbtnAdministrador.setMnemonic(KeyEvent.VK_A);
    rdbtnAdministrador.setBounds(10, 20, 108, 23);
    tipoUsuarioPanel.add(rdbtnAdministrador);

    rdbtnCaixa = new JRadioButton("Caixa");
    rdbtnCaixa.setToolTipText("selecione se o funcion\u00E1rio for um caixa");
    buttonGroup.add(rdbtnCaixa);
    rdbtnCaixa.setMnemonic(KeyEvent.VK_I);
    rdbtnCaixa.setBounds(120, 20, 58, 23);
    tipoUsuarioPanel.add(rdbtnCaixa);

    rdbtnGerente = new JRadioButton("Gerente");
    rdbtnGerente.setToolTipText("selecione se o funcion\u00E1rio for um gerente");
    buttonGroup.add(rdbtnGerente);
    rdbtnGerente.setMnemonic(KeyEvent.VK_G);
    rdbtnGerente.setBounds(220, 20, 72, 23);
    tipoUsuarioPanel.add(rdbtnGerente);

    JLabel lblLogin = new JLabel("Login:"******"Verificar");
    btnVerificar.addActionListener(new TEActionCadastrarFuncionario(this, funcionario));
    btnVerificar.setMnemonic(KeyEvent.VK_V);
    btnVerificar.setBounds(308, 19, 89, 23);
    verificacaoPanel.add(btnVerificar);
    lblLogin.setDisplayedMnemonic(KeyEvent.VK_O);
    lblLogin.setBounds(10, 115, 60, 14);
    contentPane.add(lblLogin);

    JLabel lblSenha = new JLabel("Senha:");
    lblSenha.setLabelFor(passwordField);
    lblSenha.setDisplayedMnemonic(KeyEvent.VK_S);
    lblSenha.setBounds(10, 175, 60, 14);
    contentPane.add(lblSenha);

    lblCamposErrados =
        new JLabel("* Os campos destacados de vermelho n\u00E3o foram preenchidos corretamente!");
    lblCamposErrados.setVisible(false);
    lblCamposErrados.setForeground(Color.RED);
    lblCamposErrados.setBounds(10, 323, 497, 14);
    contentPane.add(lblCamposErrados);

    JLabel lblRepetirSenha = new JLabel("Repita a Senha:");
    lblRepetirSenha.setDisplayedMnemonic(KeyEvent.VK_R);
    lblRepetirSenha.setBounds(10, 205, 90, 14);
    contentPane.add(lblRepetirSenha);

    rPasswordField = new JPasswordField();
    lblRepetirSenha.setLabelFor(rPasswordField);
    rPasswordField.setToolTipText(
        "este campo \u00E9 de preenchimento obrigat\u00F3rio e as senhas devem conferir");
    rPasswordField.setBounds(100, 204, 308, 20);
    contentPane.add(rPasswordField);

    setLocationRelativeTo(janelaPai);
    setVisible(true);
  }
  /** Create the frame. */
  public UserInfoForm() {
    setBounds(100, 100, 436, 318);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    super.lbTitle.setText("用户资料");

    panel = new JPanel();
    panel.setBackground(c);
    getContentPane().add(panel, BorderLayout.CENTER);
    super.btnExit.setLocation(this.getWidth() - 27, 0);
    super.btnMini.setLocation(this.getWidth() - 50, 0);
    panel.setBorder(new EmptyBorder(5, 5, 5, 5));
    panel.setLayout(null);
    this.setLocationRelativeTo(null);

    lblHead = new JLabel("head");
    lblHead.setBounds(22, 10, 40, 39);
    panel.add(lblHead);

    nickNameTf = new JTextField();
    nickNameTf.setBounds(72, 28, 152, 21);
    panel.add(nickNameTf);
    nickNameTf.setColumns(10);

    JLabel label = new JLabel("\u6635\u79F0\uFF1A");
    label.setBounds(72, 10, 72, 15);
    panel.add(label);

    JLabel label_1 = new JLabel("\u4E3B\u663E\u8D26\u53F7\uFF1A");
    label_1.setBounds(254, 10, 72, 15);
    panel.add(label_1);

    JLabel label_2 = new JLabel("\u4E2A\u6027\u7B7E\u540D\uFF1A");
    label_2.setBounds(72, 59, 72, 15);
    panel.add(label_2);

    textPane = new JTextPane();
    textPane.setBounds(72, 76, 334, 51);
    panel.add(textPane);

    uIDTf = new JLabel("New label");
    uIDTf.setBounds(254, 34, 152, 15);
    panel.add(uIDTf);

    JSeparator separator = new JSeparator();
    separator.setBounds(72, 137, 334, 2);
    panel.add(separator);

    JLabel label_4 = new JLabel("\u6027\u522B\uFF1A");
    label_4.setBounds(72, 149, 53, 15);
    panel.add(label_4);

    JLabel label_5 = new JLabel("\u5E74\u9F84\uFF1A");
    label_5.setBounds(145, 149, 53, 15);
    panel.add(label_5);

    JLabel label_6 = new JLabel("\u7535\u8BDD\uFF1A");
    label_6.setBounds(205, 149, 53, 15);
    panel.add(label_6);

    JLabel lblEmail = new JLabel("E-mail\uFF1A");
    lblEmail.setBounds(285, 149, 64, 15);
    panel.add(lblEmail);

    JLabel label_8 = new JLabel("\u56FD\u5BB6/\u5730\u533A:");
    label_8.setBounds(72, 205, 84, 15);
    panel.add(label_8);

    countryTf = new JTextField();
    countryTf.setBounds(72, 230, 126, 21);
    panel.add(countryTf);
    countryTf.setColumns(10);

    JLabel label_9 = new JLabel("\u7701\u4EFD\uFF1A");
    label_9.setBounds(205, 205, 64, 15);
    panel.add(label_9);

    JLabel label_10 = new JLabel("\u57CE\u5E02\uFF1A");
    label_10.setBounds(320, 205, 64, 15);
    panel.add(label_10);

    provinceTf = new JTextField();
    provinceTf.setBounds(205, 230, 101, 21);
    panel.add(provinceTf);
    provinceTf.setColumns(10);

    cityTf = new JTextField();
    cityTf.setColumns(10);
    cityTf.setBounds(320, 230, 86, 21);
    panel.add(cityTf);

    sexTf = new JTextField();
    sexTf.setBounds(72, 174, 64, 21);
    panel.add(sexTf);
    sexTf.setColumns(10);

    ageTf = new JTextField();
    ageTf.setColumns(10);
    ageTf.setBounds(139, 174, 64, 21);
    panel.add(ageTf);

    mailTf = new JTextField();
    mailTf.setColumns(10);
    mailTf.setBounds(285, 174, 121, 21);
    panel.add(mailTf);

    telTf = new JTextField();
    telTf.setColumns(10);
    telTf.setBounds(204, 174, 78, 21);
    panel.add(telTf);

    JButton sureBtn = new JButton("\u786E\u5B9A");
    sureBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });
    sureBtn.setBounds(215, 257, 93, 23);
    panel.add(sureBtn);

    JButton cancelBtn = new JButton("\u53D6\u6D88");
    cancelBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            dispose();
          }
        });
    cancelBtn.setBounds(313, 257, 93, 23);
    panel.add(cancelBtn);
  }
Example #12
0
  /** Create the frame. */
  public mainframe_test() {
    setTitle("EXAM SYSTEM");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 709, 472);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new CardLayout(0, 0));

    login = new JPanel();
    contentPane.add(login, "login");
    login.setLayout(null);

    JButton button = new JButton("STUDENT");
    button.setFont(new Font("SimSun", Font.PLAIN, 22));
    button.setBounds(425, 133, 146, 45);
    login.add(button);
    button.addActionListener(new PersonAction());

    JButton btnInstructor = new JButton("INSTRUCTOR");
    btnInstructor.setFont(new Font("SimSun", Font.PLAIN, 22));
    btnInstructor.setBounds(425, 233, 146, 45);
    login.add(btnInstructor);
    btnInstructor.addActionListener(new teacherAction());

    JLabel lblUcid = new JLabel("UCID");
    lblUcid.setFont(new Font("SimSun", Font.PLAIN, 30));
    lblUcid.setBounds(39, 101, 146, 32);
    login.add(lblUcid);

    textField = new JTextField();
    textField.setFont(new Font("SimSun", Font.PLAIN, 30));
    textField.setColumns(10);
    textField.setBounds(39, 146, 206, 32);
    login.add(textField);

    JLabel label_1 = new JLabel("OR");
    label_1.setFont(new Font("SimSun", Font.PLAIN, 34));
    label_1.setBounds(486, 191, 81, 32);
    login.add(label_1);

    JLabel label_2 = new JLabel("Password");
    label_2.setFont(new Font("SimSun", Font.PLAIN, 30));
    label_2.setBounds(39, 191, 146, 32);
    login.add(label_2);

    button_2 = new JButton("EXIT SYSTEM");
    button_2.setFont(new Font("SimSun", Font.PLAIN, 30));
    button_2.addActionListener(new button2());
    button_2.setBounds(224, 329, 213, 45);
    login.add(button_2);

    JLabel label_3 = new JLabel("     Welcome to online exam system");
    label_3.setFont(new Font("Arial", Font.BOLD, 38));
    label_3.setBounds(0, 13, 677, 68);
    login.add(label_3);

    passwordField = new JPasswordField();
    passwordField.setFont(new Font("SimSun", Font.PLAIN, 30));
    passwordField.setBounds(39, 246, 206, 32);
    login.add(passwordField);

    student = new JPanel();
    contentPane.add(student, "student");
    student.setLayout(null);

    JDesktopPane desktopPane = new JDesktopPane();
    desktopPane.setBackground(Color.WHITE);
    desktopPane.setBounds(0, 0, 681, 417);
    student.add(desktopPane);

    JLabel lblStudentId = new JLabel("UCID:");
    lblStudentId.setHorizontalAlignment(SwingConstants.CENTER);
    lblStudentId.setFont(new Font("SimSun", Font.PLAIN, 24));
    lblStudentId.setBounds(14, 0, 153, 40);
    desktopPane.add(lblStudentId);

    JPanel tree = new JPanel();
    tree.setBackground(Color.WHITE);
    tree.setBounds(0, 36, 131, 381);
    desktopPane.add(tree);
    tree.setLayout(null);

    tree_1 = new JTree();
    tree_1.setModel(
        new DefaultTreeModel(
            new DefaultMutableTreeNode("Index") {
              {
                DefaultMutableTreeNode node_1;
                node_1 = new DefaultMutableTreeNode("Questions");
                node_1.add(new DefaultMutableTreeNode("1"));
                node_1.add(new DefaultMutableTreeNode("2"));
                node_1.add(new DefaultMutableTreeNode("3"));
                node_1.add(new DefaultMutableTreeNode("4"));
                node_1.add(new DefaultMutableTreeNode("5"));
                node_1.add(new DefaultMutableTreeNode("6"));
                node_1.add(new DefaultMutableTreeNode("7"));
                node_1.add(new DefaultMutableTreeNode("8"));
                node_1.add(new DefaultMutableTreeNode("9"));
                node_1.add(new DefaultMutableTreeNode("10"));
                getContentPane().add(node_1);
                getContentPane().add(new DefaultMutableTreeNode("Submit"));
              }
            }));
    tree_1.setBounds(14, 13, 103, 322);
    tree_1.addTreeSelectionListener(
        new javax.swing.event.TreeSelectionListener() {
          public void valueChanged(javax.swing.event.TreeSelectionEvent evt) {
            treeValueChanged(evt);
          }
        });
    tree.add(tree_1);

    content = new JPanel();
    content.setBounds(134, 36, 547, 381);
    desktopPane.add(content);
    content.setLayout(new CardLayout(0, 0));

    ready = new JPanel();
    content.add(ready, "ready");
    ready.setLayout(null);

    JLabel lblTheExamsTotal = new JLabel("The exam's total time is 3 H.");
    lblTheExamsTotal.setHorizontalAlignment(SwingConstants.CENTER);
    lblTheExamsTotal.setFont(new Font("SimSun", Font.BOLD, 30));
    lblTheExamsTotal.setBounds(25, 24, 508, 67);
    ready.add(lblTheExamsTotal);

    JLabel lblWishYouAll = new JLabel("Wish you all the best.");
    lblWishYouAll.setFont(new Font("SimSun", Font.BOLD, 30));
    lblWishYouAll.setHorizontalAlignment(SwingConstants.CENTER);
    lblWishYouAll.setBounds(25, 106, 508, 67);
    ready.add(lblWishYouAll);

    JLabel lblReady = new JLabel("Ready?");
    lblReady.setHorizontalAlignment(SwingConstants.CENTER);
    lblReady.setFont(new Font("SimSun", Font.BOLD, 30));
    lblReady.setBounds(112, 186, 313, 67);
    ready.add(lblReady);

    JButton btnNewButton = new JButton("Go");
    btnNewButton.setFont(new Font("SimSun", Font.PLAIN, 20));
    btnNewButton.setBounds(197, 266, 130, 42);
    btnNewButton.addActionListener(new Go());
    ready.add(btnNewButton);

    Question_T = new JPanel();
    content.add(Question_T, "Question_T");
    Question_T.setLayout(null);

    textPane = new JTextPane();
    textPane.setBounds(33, 13, 489, 225);
    Question_T.add(textPane);

    True = new JRadioButton("True");
    True.setBounds(48, 278, 157, 27);
    True.addItemListener(new TFRadio());
    Question_T.add(True);

    False = new JRadioButton("False");
    False.setBounds(319, 278, 157, 27);
    False.addItemListener(new TFRadio());
    Question_T.add(False);
    BG1 = new ButtonGroup();
    BG1.add(True);
    BG1.add(False);

    BG2 = new ButtonGroup();

    Question_M = new JPanel();
    content.add(Question_M, "Question_M");
    Question_M.setLayout(null);

    textPane_1 = new JTextPane();
    textPane_1.setBounds(27, 13, 489, 225);
    Question_M.add(textPane_1);

    rdbtnNewRadioButton = new JRadioButton("A");
    rdbtnNewRadioButton.setHorizontalAlignment(SwingConstants.CENTER);
    rdbtnNewRadioButton.setBounds(26, 257, 81, 27);
    rdbtnNewRadioButton.addItemListener(new TFRadio());
    Question_M.add(rdbtnNewRadioButton);

    rdbtnB = new JRadioButton("B");
    rdbtnB.setHorizontalAlignment(SwingConstants.CENTER);
    rdbtnB.setBounds(275, 257, 81, 27);
    rdbtnB.addItemListener(new TFRadio());
    Question_M.add(rdbtnB);

    rdbtnC = new JRadioButton("C");
    rdbtnC.setHorizontalAlignment(SwingConstants.CENTER);
    rdbtnC.setBounds(27, 289, 81, 27);
    rdbtnC.addItemListener(new TFRadio());
    Question_M.add(rdbtnC);

    rdbtnD = new JRadioButton("D");
    rdbtnD.setHorizontalAlignment(SwingConstants.CENTER);
    rdbtnD.setBounds(275, 289, 81, 27);
    rdbtnD.addItemListener(new TFRadio());
    Question_M.add(rdbtnD);

    BG2.add(rdbtnNewRadioButton);
    BG2.add(rdbtnB);
    BG2.add(rdbtnC);
    BG2.add(rdbtnD);

    Submit = new JPanel();
    content.add(Submit, "Submit");
    Submit.setLayout(null);

    JLabel lblHaveYouFinished = new JLabel("Have you finished all the questions?");
    lblHaveYouFinished.setHorizontalAlignment(SwingConstants.CENTER);
    lblHaveYouFinished.setFont(new Font("SimSun", Font.BOLD, 22));
    lblHaveYouFinished.setBounds(14, 42, 508, 59);
    Submit.add(lblHaveYouFinished);

    JLabel lblOnceYouSubmitno = new JLabel("Once you submit,");
    lblOnceYouSubmitno.setHorizontalAlignment(SwingConstants.CENTER);
    lblOnceYouSubmitno.setFont(new Font("SimSun", Font.BOLD, 22));
    lblOnceYouSubmitno.setBounds(24, 111, 508, 59);
    Submit.add(lblOnceYouSubmitno);

    JLabel lblYouCantChange = new JLabel("there's no chance to change your answers.");
    lblYouCantChange.setHorizontalAlignment(SwingConstants.CENTER);
    lblYouCantChange.setFont(new Font("SimSun", Font.BOLD, 22));
    lblYouCantChange.setBounds(0, 183, 532, 59);
    Submit.add(lblYouCantChange);

    JButton btnSubmit = new JButton("Submit");
    btnSubmit.setFont(new Font("SimSun", Font.PLAIN, 24));
    btnSubmit.setBounds(222, 291, 124, 42);
    btnSubmit.addActionListener(new Submit());
    Submit.add(btnSubmit);

    Score = new JPanel();
    content.add(Score, "Score");
    Score.setLayout(null);

    JLabel lblNewLabel = new JLabel("Your final score is :");
    lblNewLabel.setFont(new Font("SimSun", Font.BOLD, 30));
    lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
    lblNewLabel.setBounds(14, 106, 357, 69);
    Score.add(lblNewLabel);

    lblNewLabel_1 = new JLabel(" ");
    lblNewLabel_1.setFont(new Font("SimSun", Font.BOLD, 30));
    lblNewLabel_1.setBounds(392, 106, 103, 69);

    Score.add(lblNewLabel_1);

    label = new JLabel(" ");
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setFont(new Font("SimSun", Font.PLAIN, 24));
    label.setText(" ");
    label.setBounds(164, 4, 83, 33);
    desktopPane.add(label);

    instructor = new JPanel();
    contentPane.add(instructor, "instructor");
    instructor.setLayout(null);

    JDesktopPane desktopPane_1 = new JDesktopPane();
    desktopPane_1.setBounds(0, 0, 681, 417);
    instructor.add(desktopPane_1);
    desktopPane_1.setBackground(Color.WHITE);

    teacher = new JPanel();
    teacher.setBounds(0, 80, 681, 337);
    desktopPane_1.add(teacher);
    teacher.setLayout(new CardLayout(0, 0));

    Index = new JPanel();
    teacher.add(Index, "Index");
    Index.setLayout(null);

    lblNewLabel_2 = new JLabel("If you want to add a question,please click add button.");
    lblNewLabel_2.setFont(new Font("SimSun", Font.PLAIN, 21));
    lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER);
    lblNewLabel_2.setBounds(0, 23, 681, 83);
    Index.add(lblNewLabel_2);

    lblIfYouWant = new JLabel("If you want to select a question,please click select button.");
    lblIfYouWant.setHorizontalAlignment(SwingConstants.CENTER);
    lblIfYouWant.setFont(new Font("SimSun", Font.PLAIN, 21));
    lblIfYouWant.setBounds(0, 102, 681, 83);
    Index.add(lblIfYouWant);

    Add = new JPanel();
    teacher.add(Add, "Add");
    Add.setLayout(null);

    qField = new JTextField();
    qField.setBounds(186, 13, 481, 178);
    Add.add(qField);
    qField.setColumns(10);

    lblQuestion = new JLabel("Question:");
    lblQuestion.setFont(new Font("SimSun", Font.PLAIN, 25));
    lblQuestion.setHorizontalAlignment(SwingConstants.CENTER);
    lblQuestion.setBounds(14, 13, 158, 51);
    Add.add(lblQuestion);

    aField = new JTextField();
    aField.setBounds(186, 207, 197, 72);
    Add.add(aField);
    aField.setColumns(10);

    lblAnswer = new JLabel("Answer:");
    lblAnswer.setHorizontalAlignment(SwingConstants.CENTER);
    lblAnswer.setFont(new Font("SimSun", Font.PLAIN, 25));
    lblAnswer.setBounds(14, 207, 158, 51);
    Add.add(lblAnswer);

    Insert = new JButton("Insert");
    Insert.setBounds(484, 223, 143, 40);
    Insert.addActionListener(new QuestionAction());
    Add.add(Insert);

    Select = new JPanel();
    teacher.add(Select, "Select");
    Select.setLayout(null);

    label_4 = new JLabel("UCID:");
    label_4.setHorizontalAlignment(SwingConstants.CENTER);
    label_4.setFont(new Font("SimSun", Font.PLAIN, 24));
    label_4.setBounds(0, 0, 153, 40);
    desktopPane_1.add(label_4);

    label_5 = new JLabel(" ");
    label_5.setHorizontalAlignment(SwingConstants.CENTER);
    label_5.setFont(new Font("SimSun", Font.PLAIN, 24));
    label_5.setText(" ");
    label_5.setBounds(167, 0, 100, 40);
    desktopPane_1.add(label_5);

    addquestion = new JButton("Add question");
    addquestion.setBounds(342, 4, 143, 40);
    addquestion.addActionListener(new Add());
    desktopPane_1.add(addquestion);

    selquestion = new JButton("Select question");
    selquestion.setBounds(499, 4, 168, 40);
    selquestion.addActionListener(new Select());
    desktopPane_1.add(selquestion);
  }
Example #13
0
  /**
   * Creates new form UTalkingUI
   *
   * @param userName
   */
  public UTalkingUI(String userName, UIManager p) {
    initComponents();
    this.userName = userName;
    pm = p;
    setTitle("Talk to " + userName);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    int ww = (int) (screenSize.width * 0.9);
    int wh = (int) (screenSize.height * 0.9);
    setBounds((int) (ww * 0.2), (int) (wh * 0.2), (int) (ww * 0.6), (int) (wh * 0.6));

    jTextPane1 = new JTextPane();
    jTextArea1 = new JTextArea();
    jButton1 = new JButton();
    jButton2 = new JButton();

    jTextPane1.setBounds(0, 0, getWidth(), getHeight() * 7 / 11 - 10);
    jTextPane1.setEditable(false);
    jTextPane1.setToolTipText("消息");

    jTextArea1.setBounds(0, getHeight() * 7 / 11, getWidth(), getHeight() * 2 / 11 - 3);
    jTextArea1.setToolTipText("发送");

    jButton1.setBounds(getWidth() - 220, getHeight() * 9 / 11 + 10, 100, 30);
    jButton1.setText("发送");
    jButton1.addMouseListener(
        new MouseListener() {

          @Override
          public void mouseClicked(MouseEvent me) {
            if (jTextArea1.getText().length() > 0) {
              pm.getManager()
                  .getInterchange()
                  .sendMsgToUser(userName, jTextArea1.getText()); // /////发送消息
              jTextPane1.setText(
                  jTextPane1.getText()
                      + "\n"
                      + pm.getManager().getData().getUserName()
                      + " :\n"
                      + jTextArea1.getText());
              jTextArea1.setText("");
            }
          }

          @Override
          public void mousePressed(MouseEvent me) {}

          @Override
          public void mouseReleased(MouseEvent me) {}

          @Override
          public void mouseEntered(MouseEvent me) {}

          @Override
          public void mouseExited(MouseEvent me) {}
        });
    jButton2.setBounds(getWidth() - 110, getHeight() * 9 / 11 + 10, 100, 30);
    jButton2.setText("退出");
    jButton2.addMouseListener(
        new MouseListener() {

          @Override
          public void mouseClicked(MouseEvent me) {
            dispose();
          }

          @Override
          public void mousePressed(MouseEvent me) {}

          @Override
          public void mouseReleased(MouseEvent me) {}

          @Override
          public void mouseEntered(MouseEvent me) {}

          @Override
          public void mouseExited(MouseEvent me) {}
        });
    jTextArea1.addKeyListener(
        new KeyListener() {

          @Override
          public void keyTyped(KeyEvent ke) {
            if (ke.getKeyChar() == 10) // 发送
            System.out.println("hehe");
          }

          @Override
          public void keyPressed(KeyEvent ke) {}

          @Override
          public void keyReleased(KeyEvent ke) {}
        });
    add(jTextArea1);
    add(jTextPane1);
    add(jButton1);
    add(jButton2);
    setVisible(true);
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frmCarMpgComparison = new JFrame();
    frmCarMpgComparison.setTitle("Car MPG Comparison");
    frmCarMpgComparison.setBounds(100, 100, 325, 340);
    frmCarMpgComparison.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frmCarMpgComparison.getContentPane().setLayout(new CardLayout(0, 0));

    // Panel Initial Set-Up
    final JPanel CarMenu = new JPanel();
    frmCarMpgComparison.getContentPane().add(CarMenu, "name_2311361691594");
    CarMenu.setLayout(null);
    CarMenu.setVisible(true);

    final JPanel Statistics = new JPanel();
    frmCarMpgComparison.getContentPane().add(Statistics, "name_2315729688832");
    Statistics.setLayout(null);
    Statistics.setVisible(false);

    final JLabel lblCAR = new JLabel("");
    lblCAR.setHorizontalAlignment(SwingConstants.CENTER);
    lblCAR.setBounds(99, 11, 125, 14);
    Statistics.add(lblCAR);

    // Create a Map for storage
    final Map<String, List<String>> map = new HashMap<String, List<String>>();

    // Car 'ArrayList' for Each of the Six Cars Pre-populated in 'ComboBox'
    final List<String> carOne = new ArrayList<String>(); // Chevy
    final List<String> carTwo = new ArrayList<String>(); // Ford
    final List<String> carThree = new ArrayList<String>(); // Honda
    final List<String> carFour = new ArrayList<String>(); // Hyundai
    final List<String> carFive = new ArrayList<String>(); // Mazda
    final List<String> carSix = new ArrayList<String>(); // Toyota

    // Map out Cars (key) with their respective MPGs and dates (values)
    map.put("Chevrolet Cruze", carOne);
    map.put("Ford Focus", carTwo);
    map.put("Honda Civic", carThree);
    map.put("Hyundai Elantra", carFour);
    map.put("Mazda 3", carFive);
    map.put("Toyota Corolla", carSix);

    // Round to 2 Decimal Values
    final DecimalFormat df = new DecimalFormat(".##");
    // Date Format
    final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy");

    final JComboBox comboBox = new JComboBox();
    comboBox.setModel(
        new DefaultComboBoxModel(
            new String[] {
              "Chevrolet Cruze",
              "Ford Focus",
              "Honda Civic",
              "Hyundai Elantra",
              "Mazda 3",
              "Toyota Corolla"
            }));
    comboBox.setBounds(30, 60, 242, 20);
    CarMenu.add(comboBox);

    // ----------------------Car Main Menu Panel---------------------------------

    JSeparator separator = new JSeparator();
    separator.setBounds(30, 124, 242, 2);
    CarMenu.add(separator);

    // Statistics BUTTON
    JButton btnStatistics = new JButton("Statistics");
    btnStatistics.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            // Initialize 'MPG statistical data' class
            final MPG_Data data = new MPG_Data();

            // Key is assigned to Selected 'Car' ComboBox selection
            String key = comboBox.getSelectedItem().toString();
            // Obtain List of MPG and Date Values from the specific 'Car' key
            List<String> values = map.get(key);

            lblCAR.setText(comboBox.getSelectedItem().toString());

            // Get the MPG Data Figures
            data.Total_MPG(values);

            // Round to 2 decimal places for "AvgMPG' textbox
            String AvgMpg = df.format(data.Avg_MPG());

            // Initially the Average MPG will be 'NaN' because there is no MPG data (user has to add
            // via 'Add Fuel' button)
            if (comboBox.getSelectedItem().equals("Chevrolet Cruze")) {
              txtTankSize.setText("14");
              txtPrice.setText("$18,118 - $25,174");
              txtClaimMPG.setText("25 City / 35 Hwy");
              txtAvgMPG.setText(AvgMpg);
            } else if (comboBox.getSelectedItem().equals("Ford Focus")) {
              txtTankSize.setText("13.2");
              txtPrice.setText("$17,125 - $23,972");
              txtClaimMPG.setText("26 City / 36 Hwy");
              txtAvgMPG.setText(AvgMpg);
            } else if (comboBox.getSelectedItem().equals("Honda Civic")) {
              txtTankSize.setText("14");
              txtPrice.setText("$18,014 - $28,530");
              txtClaimMPG.setText("30 City / 39 Hwy");
              txtAvgMPG.setText(AvgMpg);
            } else if (comboBox.getSelectedItem().equals("Hyundai Elantra")) {
              txtTankSize.setText("13.2");
              txtPrice.setText("$17,556 - $22,008");
              txtClaimMPG.setText("27 City / 37 Hwy");
              txtAvgMPG.setText(AvgMpg);
            } else if (comboBox.getSelectedItem().equals("Mazda 3")) {
              txtTankSize.setText("14");
              txtPrice.setText("$17,265 - $26,426");
              txtClaimMPG.setText("30 City / 41 Hwy");
              txtAvgMPG.setText(AvgMpg);
            } else if (comboBox.getSelectedItem().equals("Toyota Corolla")) {
              txtTankSize.setText("13.2");
              txtPrice.setText("$16,960 - $21,234");
              txtClaimMPG.setText("27 City / 36 Hwy");
              txtAvgMPG.setText(AvgMpg);
            }

            // Switch to Statistics Panel upon clicking on 'Statistics' button
            Statistics.setVisible(true);
            CarMenu.setVisible(false);
          }
        });
    btnStatistics.setBounds(66, 202, 166, 23);
    CarMenu.add(btnStatistics);

    JLabel lblCompactSedanManufacturer = new JLabel("Compact Sedan Manufacturer/ Model");
    lblCompactSedanManufacturer.setBounds(30, 27, 213, 39);
    CarMenu.add(lblCompactSedanManufacturer);

    // ----------------------Car Statistics Panel------------------------------
    JLabel lblTankSizegallons = new JLabel("Tank Size (Gallons)");
    lblTankSizegallons.setBounds(20, 39, 192, 14);
    Statistics.add(lblTankSizegallons);

    txtTankSize = new JTextField();
    txtTankSize.setEditable(false);
    txtTankSize.setColumns(10);
    txtTankSize.setBounds(20, 59, 189, 20);
    Statistics.add(txtTankSize);

    JLabel lblPrice = new JLabel("Price ($)");
    lblPrice.setBounds(20, 90, 192, 14);
    Statistics.add(lblPrice);

    txtPrice = new JTextField();
    txtPrice.setEditable(false);
    txtPrice.setColumns(10);
    txtPrice.setBounds(20, 110, 189, 20);
    Statistics.add(txtPrice);

    JLabel lblTheoreticalMpg = new JLabel("Theoretical MPG");
    lblTheoreticalMpg.setBounds(20, 150, 192, 14);
    Statistics.add(lblTheoreticalMpg);

    txtClaimMPG = new JTextField();
    txtClaimMPG.setEditable(false);
    txtClaimMPG.setColumns(10);
    txtClaimMPG.setBounds(20, 170, 189, 20);
    Statistics.add(txtClaimMPG);

    JButton btnOk = new JButton("OK");
    btnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            Statistics.setVisible(false);
            CarMenu.setVisible(true);
          }
        });
    btnOk.setBounds(120, 267, 89, 23);
    Statistics.add(btnOk);

    JLabel lblActualAvgMpg = new JLabel("Tested Actual Avg MPG");
    lblActualAvgMpg.setBounds(20, 205, 192, 14);
    Statistics.add(lblActualAvgMpg);

    txtAvgMPG = new JTextField();
    txtAvgMPG.setEditable(false);
    txtAvgMPG.setColumns(10);
    txtAvgMPG.setBounds(20, 225, 189, 20);
    Statistics.add(txtAvgMPG);

    // ------------------------Actual MPG Figures Panel------------------------
    final JPanel ActualMPG = new JPanel();
    frmCarMpgComparison.getContentPane().add(ActualMPG, "name_13442105327611");
    ActualMPG.setLayout(null);

    JButton btnOk_1 = new JButton("OK");
    btnOk_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            ActualMPG.setVisible(false);
            CarMenu.setVisible(true);
          }
        });
    btnOk_1.setBounds(108, 256, 89, 23);
    ActualMPG.add(btnOk_1);

    final JTextPane txtSumPane = new JTextPane();
    txtSumPane.setEditable(false);
    txtSumPane.setBounds(10, 34, 289, 201);
    ActualMPG.add(txtSumPane);

    final JLabel lblCar = new JLabel("");
    lblCar.setHorizontalAlignment(SwingConstants.CENTER);
    lblCar.setBounds(92, 11, 129, 14);
    ActualMPG.add(lblCar);

    // Actual MPG Figures (All MPG, Last MPG, Last Date)
    JButton btnActualMpgFigures = new JButton("Actual MPG Figures");
    btnActualMpgFigures.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            // Initialize 'MPG statistical data' class
            final MPG_Data data = new MPG_Data();

            String key = comboBox.getSelectedItem().toString();
            List<String> values = map.get(key);

            // lblCar.setText(key);
            data.Total_MPG(values);

            // MPG Summary and Last MPG and Date for each of the six cars in a JTextPane
            if (comboBox.getSelectedItem().equals("Chevrolet Cruze")) {
              lblCar.setText("Chevrolet Cruze");
              txtSumPane.setText(
                  data.AllMPG()
                      + "-----------------------------\n"
                      + "Last MPG: "
                      + Double.toString(data.Last_MPG())
                      + "\n"
                      + "Last Date: "
                      + data.Last_Date());
            } else if (comboBox.getSelectedItem().equals("Ford Focus")) {
              lblCar.setText("Ford Focus");
              txtSumPane.setText(
                  data.AllMPG()
                      + "-----------------------------\n"
                      + "Last MPG: "
                      + Double.toString(data.Last_MPG())
                      + "\n"
                      + "Last Date: "
                      + data.Last_Date());
            } else if (comboBox.getSelectedItem().equals("Honda Civic")) {
              lblCar.setText("Honda Civic");
              txtSumPane.setText(
                  data.AllMPG()
                      + "-----------------------------\n"
                      + "Last MPG: "
                      + Double.toString(data.Last_MPG())
                      + "\n"
                      + "Last Date: "
                      + data.Last_Date());
            } else if (comboBox.getSelectedItem().equals("Hyundai Elantra")) {
              lblCar.setText("Hyundai Elantra");
              txtSumPane.setText(
                  data.AllMPG()
                      + "-----------------------------\n"
                      + "Last MPG: "
                      + Double.toString(data.Last_MPG())
                      + "\n"
                      + "Last Date: "
                      + data.Last_Date());
            } else if (comboBox.getSelectedItem().equals("Mazda 3")) {
              lblCar.setText("Mazda 3");
              txtSumPane.setText(
                  data.AllMPG()
                      + "-----------------------------\n"
                      + "Last MPG: "
                      + Double.toString(data.Last_MPG())
                      + "\n"
                      + "Last Date: "
                      + data.Last_Date());
            } else if (comboBox.getSelectedItem().equals("Toyota Corolla")) {
              lblCar.setText("Toyota Corolla");
              txtSumPane.setText(
                  data.AllMPG()
                      + "-----------------------------\n"
                      + "Last MPG: "
                      + Double.toString(data.Last_MPG())
                      + "\n"
                      + "Last Date: "
                      + data.Last_Date());
            }

            ActualMPG.setVisible(true);
            CarMenu.setVisible(false);
          }
        });
    btnActualMpgFigures.setBounds(66, 251, 166, 23);
    CarMenu.add(btnActualMpgFigures);

    // --------------------Add Fuel Panel------------------------
    final JPanel AddFuel = new JPanel();
    frmCarMpgComparison.getContentPane().add(AddFuel, "name_23672580070031");
    AddFuel.setLayout(null);

    // Add Fuel Button
    JButton btnAddFuel = new JButton("Add Fuel");
    btnAddFuel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {

            // Reset back to stock set values in 'AddFuel' Panel every time user hits 'Add Fuel'
            // Button
            txtMilesDriven.setText("");
            txtDate.setText("01/01/1990");
            txtFill.setText("");

            AddFuel.setVisible(true);
            CarMenu.setVisible(false);
          }
        });
    btnAddFuel.setBounds(66, 155, 166, 23);
    CarMenu.add(btnAddFuel);

    JButton button = new JButton("Cancel");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            AddFuel.setVisible(false);
            CarMenu.setVisible(true);
          }
        });
    button.setBounds(158, 233, 89, 23);
    AddFuel.add(button);

    // OK Button - This is where the user-input data is done
    JButton button_1 = new JButton("OK");
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            final MPG_Data data = new MPG_Data();

            try {
              m_MilesDriven = Double.parseDouble(txtMilesDriven.getText());
              m_GallonsFilled = Double.parseDouble(txtFill.getText());
              m_mpg = m_MilesDriven / m_GallonsFilled;
              m_Date = txtDate.getText();
            } // end of try statement

            // Make Sure User Types in Double Values for 'Miles Driven' and 'Gallons Filled'
            catch (NumberFormatException e) {
              JOptionPane.showMessageDialog(
                  null, "Invalid Values entered!", "Warning", JOptionPane.WARNING_MESSAGE);
              return;
            }

            // Validate Date Format: (MM/dd/yyyy)
            Date_OK = data.isValidDate(m_Date);

            if (Date_OK == false) {
              JOptionPane.showMessageDialog(
                  null,
                  "Must Enter Correct Date Format: MM/dd/yyyy!",
                  "Warning",
                  JOptionPane.WARNING_MESSAGE);
              return;
            }

            // check if the user inputs BLANK miles
            if (txtMilesDriven.getText() == ""
                || txtDate.getText() == ""
                || txtFill.getText() == "") {
              JOptionPane.showMessageDialog(
                  null, "Inputs cannot be blank!", "Warning", JOptionPane.WARNING_MESSAGE);
              return;
            }

            // Make sure user enters positive values for 'Miles Driven' and 'Gallons Filled'
            else if (Float.parseFloat(txtMilesDriven.getText()) <= 0.0
                || Float.parseFloat(txtFill.getText()) <= 0.0) {
              JOptionPane.showMessageDialog(
                  null, "Must enter positive values!", "Warning", JOptionPane.WARNING_MESSAGE);
              return;
            } else {
              String mpg = df.format(m_mpg);

              if (comboBox.getSelectedItem().equals("Chevrolet Cruze")) {
                carOne.add(mpg);
                carOne.add(m_Date);
              } else if (comboBox.getSelectedItem().equals("Ford Focus")) {
                carTwo.add(mpg);
                carTwo.add(m_Date);
              } else if (comboBox.getSelectedItem().equals("Honda Civic")) {
                carThree.add(mpg);
                carThree.add(m_Date);
              } else if (comboBox.getSelectedItem().equals("Hyundai Elantra")) {
                carFour.add(mpg);
                carFour.add(m_Date);
              } else if (comboBox.getSelectedItem().equals("Mazda 3")) {
                carFive.add(mpg);
                carFive.add(m_Date);
              } else if (comboBox.getSelectedItem().equals("Toyota Corolla")) {
                carSix.add(mpg);
                carSix.add(m_Date);
              }

              // Key is assigned to Selected 'Car' ComboBox selection
              String key = comboBox.getSelectedItem().toString();
              // Obtain List of MPG and Date Values from the specific 'Car' key
              List<String> values = map.get(key);
              // Get the MPG Data Figures
              data.Total_MPG(values);

              AddFuel.setVisible(false);
              CarMenu.setVisible(true);
            }
          }
        });
    button_1.setBounds(47, 233, 89, 23);
    AddFuel.add(button_1);

    JLabel label = new JLabel("Gallons Filled Up");
    label.setBounds(47, 157, 200, 50);
    AddFuel.add(label);

    txtFill = new JTextField();
    txtFill.setText("0");
    txtFill.setColumns(10);
    txtFill.setBounds(47, 191, 158, 20);
    AddFuel.add(txtFill);

    txtDate = new JTextField();
    txtDate.setColumns(10);
    txtDate.setBounds(47, 126, 158, 20);
    AddFuel.add(txtDate);

    JLabel lblDate = new JLabel("Date (mm/dd/yyyy)");
    lblDate.setBounds(47, 92, 200, 50);
    AddFuel.add(lblDate);

    txtMilesDriven = new JTextField();
    txtMilesDriven.setText("0");
    txtMilesDriven.setColumns(10);
    txtMilesDriven.setBounds(47, 66, 158, 20);
    AddFuel.add(txtMilesDriven);

    JLabel label_2 = new JLabel("Miles Driven");
    label_2.setBounds(47, 25, 200, 50);
    AddFuel.add(label_2);
  }
  /**
   * Interfaz gráfica de usuaria creada directamente en el constructor.
   *
   * @throws IOException
   */
  public IUCliente() throws IOException {

    socket =
        new Socket(
            "localhost",
            55555); // Lo ponemos en contacto con el servidor, que lo aceptará una vez le llegue
    oos =
        new ObjectOutputStream(
            socket.getOutputStream()); // Abrimos los streamings de escritura y lectura.
    ois = new ObjectInputStream(socket.getInputStream());

    // Parte de la interfaz gráfica que he creado con la paleta del IDE
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 319, 295);
    getContentPane().setLayout(null);

    SimpleAttributeSet attribs = new SimpleAttributeSet();
    StyleConstants.setAlignment(attribs, StyleConstants.ALIGN_RIGHT);

    panel = new JTextPane();
    panel.setText("");
    panel.setFont(new Font("Consolas", Font.PLAIN, 15));
    panel.setEditable(false);
    panel.setBounds(10, 11, 177, 41);
    panel.setParagraphAttributes(attribs, true);

    getContentPane().add(panel);

    JPanel panel_1 = new JPanel();
    panel_1.setBounds(10, 63, 284, 188);
    getContentPane().add(panel_1);
    panel_1.setLayout(null);

    // Todos los eventos de la calculadora por cada botón. Básicamente cada botóne escribe en el
    // panel lo que pone en dicho botón.

    JButton btnNewButton = new JButton("1");
    btnNewButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            panel.setText(panel.getText() + btnNewButton.getText());
          }
        });
    btnNewButton.setBounds(0, 0, 56, 33);
    panel_1.add(btnNewButton);

    JButton button = new JButton("2");
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + button.getText());
          }
        });
    button.setBounds(62, 0, 56, 33);
    panel_1.add(button);

    JButton button_1 = new JButton("3");
    button_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + button_1.getText());
          }
        });
    button_1.setBounds(123, 0, 56, 33);
    panel_1.add(button_1);

    JButton button_2 = new JButton("4");
    button_2.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + button_2.getText());
          }
        });
    button_2.setBounds(0, 44, 56, 33);
    panel_1.add(button_2);

    JButton button_3 = new JButton("5");
    button_3.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + button_3.getText());
          }
        });
    button_3.setBounds(62, 44, 56, 33);
    panel_1.add(button_3);

    JButton button_4 = new JButton("6");
    button_4.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + button_4.getText());
          }
        });
    button_4.setBounds(123, 44, 56, 33);
    panel_1.add(button_4);

    JButton button_5 = new JButton("7");
    button_5.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + button_5.getText());
          }
        });
    button_5.setBounds(0, 88, 56, 33);
    panel_1.add(button_5);

    JButton button_6 = new JButton("8");
    button_6.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + button_6.getText());
          }
        });
    button_6.setBounds(62, 88, 56, 33);
    panel_1.add(button_6);

    JButton button_7 = new JButton("9");
    button_7.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + button_7.getText());
          }
        });
    button_7.setBounds(123, 88, 56, 33);
    panel_1.add(button_7);

    JButton button_8 = new JButton("0");
    button_8.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + button_8.getText());
          }
        });

    button_8.setBounds(62, 132, 56, 33);
    panel_1.add(button_8);

    JButton button_9 = new JButton("/");
    button_9.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + " " + button_9.getText() + " ");
          }
        });
    button_9.setBounds(225, 88, 56, 33);
    panel_1.add(button_9);

    JButton button_10 = new JButton("—");
    button_10.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + " " + button_10.getText() + " ");
          }
        });
    button_10.setBounds(225, 44, 56, 33);
    panel_1.add(button_10);

    JButton button_11 = new JButton("+");
    button_11.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + " " + button_11.getText() + " ");
          }
        });
    button_11.setBounds(225, 0, 56, 33);
    panel_1.add(button_11);

    JButton btnX = new JButton("X");
    btnX.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            panel.setText(panel.getText() + " " + btnX.getText() + " ");
          }
        });
    btnX.setBounds(225, 132, 56, 33);
    panel_1.add(btnX);

    // Este es el único evento que cambia un poco. No tenemos un hilo que envíe y recibe
    // automáticamente, sino que
    // va en función del click del usuario.  LLama a dos métodos que he definido más abajo.
    JButton btnNewButton_1 = new JButton("Calcular");
    btnNewButton_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            try {
              enviar();
              recibir();
            } catch (IOException | ClassNotFoundException e1) {
              e1.printStackTrace();
            }
          }
        });
    btnNewButton_1.setBounds(197, 11, 96, 41);
    getContentPane().add(btnNewButton_1);
  }
Example #16
0
  /** Initialize the contents of the frame. */
  @PostConstruct
  public void initialize() {
    telaInicial = new JFrame();
    telaInicial.setBounds(100, 100, 513, 341);
    telaInicial.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    telaInicial.getContentPane().setLayout(null);

    telaInicial.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent arg0) {
            System.exit(0);
          }
        });

    JButton btUpdateVersao = new JButton("Atualizar versão do sistema");
    btUpdateVersao.setBounds(10, 11, 477, 29);

    telaInicial.getContentPane().add(btUpdateVersao);

    JButton btRollbackVersao = new JButton("Fazer rollback da versão");
    btRollbackVersao.setBounds(10, 51, 477, 29);
    telaInicial.getContentPane().add(btRollbackVersao);

    final JTextPane txtDescription = new JTextPane();
    txtDescription.setFont(new Font("Arial", Font.BOLD, 12));
    txtDescription.setBounds(10, 131, 477, 160);
    telaInicial.getContentPane().add(txtDescription);

    JButton btInstalarJboss = new JButton("Instalar infra (Jboss)");
    btInstalarJboss.setBounds(10, 91, 477, 29);
    telaInicial.getContentPane().add(btInstalarJboss);

    StringBuilder builder = new StringBuilder();
    builder
        .append("Atualização do sistema \n")
        .append("Irá realizar atualização do sistema com as versões diponíveis no diretório ")
        .append(configuracao.getConfigurador().getPastaAtualizacaoVersao().getAbsolutePath())
        .append(". \n")
        .append("Os scripts de atualização do sistema devem estar disponíveis no diretório ")
        .append(configuracao.getConfigurador().getPastaScriptsAtualizacao().getAbsolutePath());
    final String textoUpdate = builder.toString();

    builder.setLength(0);
    builder
        .append("Rollback de sistema \n")
        .append("Irá realizar rollback do sistema com as versões diponíveis no diretório ")
        .append(configuracao.getConfigurador().getPastaBackup().getAbsolutePath())
        .append(" \n")
        .append("Os scripts de rollback do sistema devem estar disponíveis no diretório ")
        .append(configuracao.getConfigurador().getPastaScriptsRollback().getAbsolutePath());
    final String textoRollback = builder.toString();

    builder.setLength(0);
    builder
        .append(
            "Irá instalar o Jboss. Caso se deseje instalar o jboss em algum local diferente do padrão (")
        .append(configuracao.getConfigurador().getPastaRaizInfra())
        .append("), informar o local da instalação diferente durante a instalação. \n")
        .append(
            "Esta operação deve ser realizada somente se estiver executando o configurador como administrador. A infra original está disponível no diretório ")
        .append(configuracao.getConfigurador().getPastaNovasInfra().getAbsolutePath())
        .append("\n");
    final String textoInstalarJboss = builder.toString();

    btRollbackVersao.addMouseListener(
        new BaseMouseListener()
            .setHelp(textoRollback)
            .setObservacoes(txtDescription)
            .setTarefa("EXECUTAR_ROLLBACK_VERSAO")
            .setExecutorTarefas(executorTarefas));

    btUpdateVersao.addMouseListener(
        new BaseMouseListener()
            .setHelp(textoUpdate)
            .setObservacoes(txtDescription)
            .setTarefa("EXECUTAR_UPDATE_VERSAO")
            .setExecutorTarefas(executorTarefas));

    btInstalarJboss.addMouseListener(
        new BaseMouseListener()
            .setHelp(textoInstalarJboss)
            .setObservacoes(txtDescription)
            .setTarefa("EXECUTAR_INSTALACAO_INFRA_JBOSS")
            .setExecutorTarefas(executorTarefas));

    telaInicial.setVisible(true);
  }
Example #17
0
  /**
   * Create the frame.
   *
   * @param account the account
   * @param ap the ap
   * @param idBacheca the id bacheca
   * @param tipo the tipo
   */
  public BachecaClasse(
      final AccountJpa account,
      final ApplicationContext ap,
      final int idBacheca,
      final String tipo) {

    this.ap = ap;
    bachecaDAO = (BachecaDiClasseJpaDAO) ap.getBean("bachecaClasseDAO");
    postDAO = (PostJpaDAO) ap.getBean("postDAO");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 1151, 521);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setTitle("Bacheca Classe");
    setContentPane(contentPane);
    contentPane.setLayout(null);

    JSeparator separator = new JSeparator();
    separator.setBounds(193, 245, 729, -2);
    contentPane.add(separator);

    listaPost = postDAO.getAll();
    removePostNotMatching(idBacheca);

    String bacheca = fillBacheca(listaPost);

    JButton btnScriviSuBacheca = new JButton("Scrivi su bacheca");
    btnScriviSuBacheca.setForeground(Color.BLUE);
    btnScriviSuBacheca.setBounds(954, 449, 171, 23);
    btnScriviSuBacheca.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String post = "(" + account.getUsername() + ")" + textArea.getText();
            Post newPost = new Post();
            newPost.setData(new GregorianCalendar());
            BachecaDiClasseJpa bacheca = bachecaDAO.get(idBacheca);
            newPost.setBachecaClasse(bacheca);
            newPost.setContenuto(post);
            listaPost.add(newPost);
            Set<Post> collectionPost = new HashSet<Post>();
            collectionPost.addAll(listaPost);
            bacheca.setListaPost(collectionPost);
            JdbcTemplate jdbc = new JdbcTemplate(getDataSource());
            String sql =
                "Insert into post("
                    + "data,"
                    + "contenuto,"
                    + "id_bacheca_classe)"
                    + "VALUES (?,?,?)";

            // define query arguments

            Object[] params = new Object[] {newPost.getData(), newPost.getContenuto(), idBacheca};

            // define SQL types of the arguments
            int[] types = new int[] {Types.DATE, Types.VARCHAR, Types.INTEGER};

            jdbc.update(sql, params, types);
            //				bachecaDAO.delete(1);
            //				bachecaDAO.save(bacheca);

            textArea.setText(null);
            textPane.setText(null);
            textPane.setText(fillBacheca(listaPost));
          }
        });
    contentPane.add(btnScriviSuBacheca);

    JButton btnIndietro = new JButton();
    btnIndietro.setForeground(Color.BLUE);
    btnIndietro.setBounds(10, 449, 59, 23);
    btnIndietro.setText("<--");
    btnIndietro.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {

            if (tipo.equals(DOCENTE)) {
              AreaDocente x = new AreaDocente(account, ap);
              x.setVisible(true);
              dispose();
            } else {
              AreaStudente x = new AreaStudente(account, ap);
              x.setVisible(true);
              dispose();
            }
          }
        });
    contentPane.add(btnIndietro);
    textArea = new JTextArea();
    textArea.setBounds(10, 254, 1115, 184);
    contentPane.add(textArea);
    textPane = new JTextPane();
    textPane.setBounds(10, 33, 1115, 184);
    contentPane.add(textPane);
    textPane.setEditable(false);
    textPane.setText(bacheca);

    JSeparator separator_1 = new JSeparator();
    separator_1.setBounds(193, 24, 729, 8);
    contentPane.add(separator_1);

    Label Scrittura = new Label("Scrittura");
    Scrittura.setBounds(525, 221, 135, 14);
    Scrittura.setForeground(Color.BLUE);
    ;
    contentPane.add(Scrittura);

    Label Visualizzazione = new Label("Visualizzazione");
    Visualizzazione.setBounds(508, -2, 135, 14);
    Visualizzazione.setForeground(Color.BLUE);
    contentPane.add(Visualizzazione);

    JSeparator separator_2 = new JSeparator();
    separator_2.setBounds(174, 235, 729, 8);
    contentPane.add(separator_2);

    String immagine = new String("C:/Users/ale/Desktop/FL00002.jpg");
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    JFrame frmEditdeleteAuciton = new JFrame();
    frmEditdeleteAuciton.setResizable(false);
    frmEditdeleteAuciton.setTitle("Edit/Delete Auciton");
    frmEditdeleteAuciton.setBounds(100, 100, 712, 467);
    frmEditdeleteAuciton.setLocationRelativeTo(null);
    frmEditdeleteAuciton.getContentPane().setLayout(null);
    frmEditdeleteAuciton.setLocationRelativeTo(null);
    frmEditdeleteAuciton.setVisible(true);

    JButton btnSearch = new JButton("SHOW AUCTIONS CREATED BY YOU");
    btnSearch.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            AuctionMethods.showmyauction(table);
          }
        });
    btnSearch.setFont(new Font("Tahoma", Font.PLAIN, 15));
    btnSearch.setBounds(170, 11, 346, 33);
    frmEditdeleteAuciton.getContentPane().add(btnSearch);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setBounds(164, 262, 166, 30);
    frmEditdeleteAuciton.getContentPane().add(textField_1);

    textField_2 = new JTextField();
    textField_2.setColumns(10);
    textField_2.setBounds(164, 302, 166, 30);
    frmEditdeleteAuciton.getContentPane().add(textField_2);

    textField_3 = new JTextField();
    textField_3.setColumns(10);
    textField_3.setBounds(164, 341, 166, 30);
    frmEditdeleteAuciton.getContentPane().add(textField_3);

    JLabel lblNewCategory = new JLabel("New Category");
    lblNewCategory.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblNewCategory.setBounds(10, 341, 144, 30);
    frmEditdeleteAuciton.getContentPane().add(lblNewCategory);

    JLabel lblNewStartingBid = new JLabel("New Starting Bid");
    lblNewStartingBid.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblNewStartingBid.setBounds(10, 302, 144, 28);
    frmEditdeleteAuciton.getContentPane().add(lblNewStartingBid);

    JLabel lblNewAuctionName = new JLabel("New Auction Name");
    lblNewAuctionName.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblNewAuctionName.setBounds(10, 262, 144, 29);
    frmEditdeleteAuciton.getContentPane().add(lblNewAuctionName);

    table = new JTable();
    table.setShowVerticalLines(false);
    table.setShowHorizontalLines(false);
    table.setShowGrid(false);
    table.setRowSelectionAllowed(false);
    table.setFont(new Font("Tahoma", Font.PLAIN, 12));
    table.setEnabled(false);
    table.setBounds(119, 76, 450, 82);
    frmEditdeleteAuciton.getContentPane().add(table);

    JTextPane txtpnAuctionName = new JTextPane();
    txtpnAuctionName.setText("Auction Name");
    txtpnAuctionName.setForeground(Color.WHITE);
    txtpnAuctionName.setFont(new Font("Tahoma", Font.PLAIN, 13));
    txtpnAuctionName.setEditable(false);
    txtpnAuctionName.setBackground(Color.DARK_GRAY);
    txtpnAuctionName.setBounds(119, 55, 150, 19);
    frmEditdeleteAuciton.getContentPane().add(txtpnAuctionName);

    JTextPane txtpnCategory = new JTextPane();
    txtpnCategory.setText("Category");
    txtpnCategory.setForeground(Color.WHITE);
    txtpnCategory.setFont(new Font("Tahoma", Font.PLAIN, 13));
    txtpnCategory.setEditable(false);
    txtpnCategory.setBackground(Color.DARK_GRAY);
    txtpnCategory.setBounds(269, 55, 150, 19);
    frmEditdeleteAuciton.getContentPane().add(txtpnCategory);

    JTextPane txtpnStaringBid = new JTextPane();
    txtpnStaringBid.setText("Staring Bid");
    txtpnStaringBid.setForeground(Color.WHITE);
    txtpnStaringBid.setFont(new Font("Tahoma", Font.PLAIN, 13));
    txtpnStaringBid.setEditable(false);
    txtpnStaringBid.setBackground(Color.DARK_GRAY);
    txtpnStaringBid.setBounds(419, 55, 150, 19);
    frmEditdeleteAuciton.getContentPane().add(txtpnStaringBid);

    JButton btnEdit = new JButton("EDIT");
    btnEdit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String name = textField.getText();
            String newname = textField_1.getText();
            String bid = textField_2.getText();
            String category = textField_3.getText();
            AuctionMethods.editauction(name, newname, bid, category);

            frmEditdeleteAuciton.dispose();
          }
        });
    btnEdit.setFont(new Font("Tahoma", Font.PLAIN, 15));
    btnEdit.setBounds(93, 382, 137, 33);
    frmEditdeleteAuciton.getContentPane().add(btnEdit);

    JSeparator separator = new JSeparator();
    separator.setOrientation(SwingConstants.VERTICAL);
    separator.setBounds(340, 262, 38, 153);
    frmEditdeleteAuciton.getContentPane().add(separator);

    JLabel lblAreYouSure = new JLabel("Are you sure you want to delete the Auction?");
    lblAreYouSure.setHorizontalAlignment(SwingConstants.CENTER);
    lblAreYouSure.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblAreYouSure.setBounds(340, 262, 346, 33);
    frmEditdeleteAuciton.getContentPane().add(lblAreYouSure);

    JLabel label = new JLabel("This option CANNOT be undone!!");
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 16));
    label.setBounds(358, 322, 328, 31);
    frmEditdeleteAuciton.getContentPane().add(label);

    JButton button = new JButton("YES");
    button.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            String name = textField.getText();
            AuctionMethods.deleteauction(name);

            textField.setText(null);
          }
        });
    button.setFont(new Font("Tahoma", Font.BOLD, 20));
    button.setBounds(358, 364, 127, 51);
    frmEditdeleteAuciton.getContentPane().add(button);

    JButton button_1 = new JButton("NO");
    button_1.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            textField.setText(null);
          }
        });
    button_1.setFont(new Font("Tahoma", Font.BOLD, 20));
    button_1.setBounds(559, 364, 127, 51);
    frmEditdeleteAuciton.getContentPane().add(button_1);

    JSeparator separator_1 = new JSeparator();
    separator_1.setBounds(55, 169, 578, 19);
    frmEditdeleteAuciton.getContentPane().add(separator_1);

    JLabel lblEnterNameOf_1 = new JLabel("Enter name of Auction you want to edit or delete");
    lblEnterNameOf_1.setHorizontalAlignment(SwingConstants.CENTER);
    lblEnterNameOf_1.setFont(new Font("Tahoma", Font.PLAIN, 15));
    lblEnterNameOf_1.setBounds(91, 189, 328, 33);
    frmEditdeleteAuciton.getContentPane().add(lblEnterNameOf_1);

    textField = new JTextField();
    textField.setColumns(10);
    textField.setBounds(432, 189, 174, 33);
    frmEditdeleteAuciton.getContentPane().add(textField);
  }
  private void initGUI() {
    getContentPane().setLayout(null);

    JLabel lblName = new JLabel("Name:");
    lblName.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblName.setBounds(48, 64, 49, 21);
    getContentPane().add(lblName);

    JLabel lblCreateNewSemantics = new JLabel("Create New Semantics Document");
    lblCreateNewSemantics.setFont(new Font("Tahoma", Font.BOLD, 14));
    lblCreateNewSemantics.setBounds(95, 11, 245, 30);
    getContentPane().add(lblCreateNewSemantics);

    txtFieldName = new JTextField();
    txtFieldName.setBounds(108, 65, 275, 20);
    getContentPane().add(txtFieldName);
    txtFieldName.setColumns(10);

    JLabel lblCategory = new JLabel("<html>Category:<br>(Optional)</html>");
    lblCategory.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblCategory.setBounds(48, 96, 60, 28);
    getContentPane().add(lblCategory);

    txtFieldCategory = new JTextField();
    txtFieldCategory.setBounds(108, 96, 275, 20);
    getContentPane().add(txtFieldCategory);
    txtFieldCategory.setColumns(10);

    JLabel lblComments = new JLabel("Comments (Optional) :");
    lblComments.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblComments.setBounds(48, 138, 151, 14);
    getContentPane().add(lblComments);

    JButton btnOk = new JButton("OK");
    btnOk.setBounds(119, 222, 89, 23);
    getContentPane().add(btnOk);
    btnOk.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (isInputValid()) {
              controller.proceed(false);
              setVisible(false);
            } else errorLabel.setText("Please don't leave 'Name' blank.");
          }
        });

    JButton btnCancel = new JButton("Cancel");
    btnCancel.setBounds(218, 222, 89, 23);
    getContentPane().add(btnCancel);
    btnCancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            controller.proceed(true);
            setVisible(false);
          }
        });

    txtAreaComments = new JTextPane();
    txtAreaComments.setBounds(48, 153, 335, 58);
    JScrollPane scrollPane = new JScrollPane(txtAreaComments);
    scrollPane.setBounds(48, 153, 335, 58);
    getContentPane().add(scrollPane);

    errorLabel = new JLabel("");
    errorLabel.setBounds(118, 257, 335, 18);
    errorLabel.setForeground(Color.RED);
    getContentPane().add(errorLabel);
  }
  About() {
    window = new JWindow();
    this.setPreferredSize(new Dimension(650, 550));
    this.setVisible(true);
    this.setLayout(null);

    JTextPane text = new JTextPane();
    text.setBounds(5, 150, 625, 525);
    text.setVisible(true);
    text.setEditable(false);
    text.setOpaque(false);
    HTMLEditorKit htmlKit =
        new HTMLEditorKit() {
          public Parser getParser() {
            return super.getParser();
          }
        };
    HTMLDocument htmlDoc = new HTMLDocument();
    text.addHyperlinkListener(
        new HyperlinkListener() {
          public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
              if (Desktop.isDesktopSupported()) {
                try {
                  Desktop.getDesktop().browse(e.getURL().toURI());
                  return;
                } catch (IOException e1) {
                } catch (URISyntaxException e1) {
                }
              }
              try {
                Runtime.getRuntime().exec("xdg-open ".concat(e.getURL().toString()));
              } catch (IOException ioex) {
                ControlRoom.log(
                    Level.WARNING,
                    "Failed to show file: '"
                        + e.getURL().toString()
                        + "'. Possible unsupported File Manager...",
                    null);
              }
            }
          }
        });
    text.setEditorKit(htmlKit);
    text.setDocument(htmlDoc);
    try {
      BufferedReader reader =
          new BufferedReader(
              new InputStreamReader(
                  this.getClass().getResourceAsStream("/resources/about.html"), "UTF-8"));
      htmlKit.read(reader, htmlDoc, htmlDoc.getLength());
    } catch (IOException ioex) {
      ControlRoom.log(Level.SEVERE, "Failed to read about.html", ioex);
    } catch (BadLocationException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }

    text.addMouseListener(this);
    window.getContentPane().add(text);
    window.getContentPane().add(this);
    window.addMouseListener(this);
    window.pack();
    ControlRoom.setWindowRelativeToCentral(window);
    window.setVisible(true);
    window.setAlwaysOnTop(true);
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.setBounds(100, 100, 450, 300);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    JLabel lblFeedback = new JLabel("Feedback");
    lblFeedback.setBounds(177, 6, 87, 23);
    lblFeedback.setFont(new Font("Lucida Grande", Font.BOLD, 17));
    frame.getContentPane().add(lblFeedback);

    final JTextPane txtpnFeedback = new JTextPane();
    txtpnFeedback.setBounds(177, 98, 240, 80);
    frame.getContentPane().add(txtpnFeedback);

    txtName = new JTextField();
    txtName.setBounds(177, 58, 240, 28);
    frame.getContentPane().add(txtName);
    txtName.setColumns(10);

    JLabel lblYourName = new JLabel("Your name");
    lblYourName.setBounds(57, 64, 108, 16);
    frame.getContentPane().add(lblYourName);

    JLabel lblYourFeedback = new JLabel("Your Feedback");
    lblYourFeedback.setBounds(57, 98, 108, 16);
    frame.getContentPane().add(lblYourFeedback);

    final JComboBox cmbRating = new JComboBox();
    cmbRating.setModel(
        new DefaultComboBoxModel(
            new String[] {"Excellent", "Awesome", "Fantastic", "superfragilisticexpialadocious"}));
    cmbRating.setBounds(177, 190, 240, 27);
    frame.getContentPane().add(cmbRating);

    JLabel lblYourRating = new JLabel("Your rating");
    lblYourRating.setBounds(57, 194, 108, 16);
    frame.getContentPane().add(lblYourRating);

    JButton btnCancel = new JButton("Cancel");
    btnCancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            frame.dispose();
          }
        });
    btnCancel.setBounds(300, 243, 117, 29);
    frame.getContentPane().add(btnCancel);

    JButton btnSendFeedback = new JButton("Send feedback");
    btnSendFeedback.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            System.out.println("Name " + txtName.getText());
            System.out.println("Feedback " + txtpnFeedback.getText());
            System.out.println("Rating " + cmbRating.getSelectedItem().toString());
          }
        });
    btnSendFeedback.setBounds(177, 243, 117, 29);
    frame.getContentPane().add(btnSendFeedback);
  }
  /**
   * Cria uma instância da janela de relatório de funcionário do sistema BVB
   *
   * @param janelaPai <code>Window</code> com a janela pai da caixa de diálogo <code>
   *     IgRelatorioFuncionario</code>
   * @see Window
   */
  public IgRelatorioFuncionario(Window janelaPai) {
    setModal(true);
    Color nephritis = new Color(39, 174, 96);

    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setResizable(false);
    setTitle("BVB - Relat\u00F3rio de Funcion\u00E1rio");
    setBounds(100, 100, 690, 506);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(null);

    JSeparator separatorTitulo = new JSeparator();
    separatorTitulo.setBounds(0, 69, 685, 2);
    contentPanel.add(separatorTitulo);

    JTextPane txtpnSubTitulo = new JTextPane();
    txtpnSubTitulo.setEditable(false);
    txtpnSubTitulo.setForeground(Color.WHITE);
    txtpnSubTitulo.setBackground(nephritis);
    txtpnSubTitulo.setText(
        "Insira o login do funcion\u00E1rio do qual deseja gerar o relat\u00F3rio de conex\u00F5es.");
    txtpnSubTitulo.setFont(new Font("Tahoma", Font.PLAIN, 12));
    txtpnSubTitulo.setBounds(20, 36, 420, 22);
    contentPanel.add(txtpnSubTitulo);

    JTextPane txtpnTitulo = new JTextPane();
    txtpnTitulo.setEditable(false);
    txtpnTitulo.setForeground(Color.WHITE);
    txtpnTitulo.setBackground(nephritis);
    txtpnTitulo.setText("Relat\u00F3rio de Funcion\u00E1rio");
    txtpnTitulo.setFont(new Font("Tahoma", Font.BOLD, 13));
    txtpnTitulo.setBounds(10, 11, 170, 22);
    contentPanel.add(txtpnTitulo);

    JLabel lblImg = new JLabel("Label Img");
    lblImg.setBorder(new LineBorder(Color.WHITE, 1, true));
    lblImg.setIcon(
        new ImageIcon(
            IgRelatorioFuncionario.class.getResource("/tsi/too/bvb/recursos/imagens/User-48.png")));
    lblImg.setBounds(624, 11, 48, 48);
    contentPanel.add(lblImg);

    JEditorPane dtrpnCampoTitulo = new JEditorPane();
    dtrpnCampoTitulo.setBackground(nephritis);
    dtrpnCampoTitulo.setEditable(false);
    dtrpnCampoTitulo.setBounds(0, 0, 685, 70);
    contentPanel.add(dtrpnCampoTitulo);

    JPanel panel = new JPanel();
    panel.setBounds(0, 435, 685, 43);
    contentPanel.add(panel);
    panel.setLayout(new FlowLayout(FlowLayout.RIGHT));

    btnCancelar = new JButton("Cancelar");
    btnCancelar.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            IgRelatorioFuncionario.this.dispose();
          }
        });

    btnGerarRelatorio = new JButton("Gerar Relat\u00F3rio");
    btnGerarRelatorio.setEnabled(false);
    btnGerarRelatorio.addActionListener(new TEActionRelatorioFuncionario(this));
    btnGerarRelatorio.setMnemonic(KeyEvent.VK_G);
    panel.add(btnGerarRelatorio);
    btnCancelar.setMnemonic(KeyEvent.VK_C);
    btnCancelar.setActionCommand("OK");
    panel.add(btnCancelar);

    JSeparator separatorBtn = new JSeparator();
    separatorBtn.setBounds(0, 424, 685, 2);
    contentPanel.add(separatorBtn);

    JPanel panelRelatorio = new JPanel();
    panelRelatorio.setBorder(
        new TitledBorder(
            new LineBorder(new Color(184, 207, 229)),
            "Relat\u00F3rio",
            TitledBorder.LEADING,
            TitledBorder.TOP,
            null,
            new Color(51, 153, 255)));
    panelRelatorio.setBounds(10, 127, 662, 285);
    contentPanel.add(panelRelatorio);
    panelRelatorio.setLayout(new BorderLayout(0, 0));

    JScrollPane relatorioScrollPane = new JScrollPane();
    relatorioScrollPane.setBorder(null);
    relatorioScrollPane.setHorizontalScrollBarPolicy(
        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    panelRelatorio.add(relatorioScrollPane, BorderLayout.CENTER);

    relatorioEditorPane = new JEditorPane();
    relatorioEditorPane.setFont(new Font("Arial", Font.BOLD, 14));
    relatorioEditorPane.setEditable(false);
    relatorioEditorPane.setBackground(new Color(238, 238, 238));
    relatorioScrollPane.setViewportView(relatorioEditorPane);

    JLabel lblLogin = new JLabel("Login:"******"insira o login do funcion\u00E1rio que deseja gerar o relat\u00F3rio, e clique em buscar");
    loginTextField.setColumns(10);
    loginTextField.setBounds(100, 92, 308, 20);
    contentPanel.add(loginTextField);

    btnAlterar = new JButton("Alterar");
    btnAlterar.addActionListener(new TEActionRelatorioFuncionario(this));
    btnAlterar.setVisible(false);

    btnBuscar = new JButton("Buscar");
    btnBuscar.addActionListener(new TEActionRelatorioFuncionario(this));
    btnBuscar.setMnemonic(KeyEvent.VK_B);
    btnBuscar.setBounds(418, 91, 89, 23);
    contentPanel.add(btnBuscar);
    btnAlterar.setMnemonic(KeyEvent.VK_A);
    btnAlterar.setBounds(418, 91, 89, 23);
    contentPanel.add(btnAlterar);

    setLocationRelativeTo(janelaPai);
    setVisible(true);
  }
Example #23
0
  private void initialize() {
    setFont(new Font("Arial", Font.PLAIN, 14));
    setBackground(new Color(204, 51, 153));
    setSize(new Dimension(750, 500));
    setLayout(null);

    // main pic
    final JLabel lblMainPic = new JLabel("");
    lblMainPic.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    lblMainPic.setIcon(new ImageIcon(Packages.class.getResource("/images/wedding.jpg")));
    lblMainPic.setOpaque(true);
    lblMainPic.setHorizontalTextPosition(SwingConstants.CENTER);
    lblMainPic.setForeground(new Color(0, 0, 0));
    lblMainPic.setHorizontalAlignment(SwingConstants.CENTER);
    lblMainPic.setBackground(new Color(240, 255, 255));
    lblMainPic.setBounds(304, 53, 200, 200);
    add(lblMainPic);

    // wedding button
    JButton btnNewButton = new JButton("");

    btnNewButton.setIcon(new ImageIcon(Packages.class.getResource("/images/wedding resized.jpg")));
    btnNewButton.setMargin(new Insets(2, 0, 2, 0));
    btnNewButton.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    btnNewButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    btnNewButton.setHorizontalTextPosition(SwingConstants.CENTER);
    btnNewButton.setBounds(304, 264, 50, 50);
    add(btnNewButton);
    btnNewButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            lblMainPic.setIcon(new ImageIcon(Packages.class.getResource("/images/wedding.jpg")));
          }
        });

    // party button
    JButton button = new JButton("");

    button.setIcon(new ImageIcon(Packages.class.getResource("/images/party resized.jpg")));
    button.setMargin(new Insets(2, 0, 2, 0));
    button.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    button.setHorizontalTextPosition(SwingConstants.CENTER);
    button.setAlignmentX(0.5f);
    button.setBounds(376, 264, 50, 50);
    add(button);
    button.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            lblMainPic.setIcon(new ImageIcon(Packages.class.getResource("/images/party.jpg")));
          }
        });

    // company dinner button
    JButton button_1 = new JButton("");

    button_1.setIcon(
        new ImageIcon(Packages.class.getResource("/images/company dinner resized.jpg")));
    button_1.setMargin(new Insets(2, 0, 2, 0));
    button_1.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    button_1.setHorizontalTextPosition(SwingConstants.CENTER);
    button_1.setAlignmentX(0.5f);
    button_1.setBounds(454, 264, 50, 50);
    add(button_1);
    button_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            lblMainPic.setIcon(
                new ImageIcon(Packages.class.getResource("/images/company dinner.jpg")));
          }
        });

    JLabel lblPackages = new JLabel("Packages");
    lblPackages.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    lblPackages.setForeground(new Color(255, 255, 255));
    lblPackages.setBackground(new Color(153, 51, 153));
    lblPackages.setFont(new Font("Arial", Font.BOLD, 15));
    lblPackages.setHorizontalTextPosition(SwingConstants.CENTER);
    lblPackages.setHorizontalAlignment(SwingConstants.CENTER);
    lblPackages.setAlignmentX(Component.CENTER_ALIGNMENT);
    lblPackages.setOpaque(true);
    lblPackages.setBounds(89, 327, 100, 40);
    add(lblPackages);

    JLabel lblMeetingRm = new JLabel("\u2022\tWeddings");
    lblMeetingRm.setHorizontalAlignment(SwingConstants.LEFT);
    lblMeetingRm.setFont(new Font("Arial", Font.PLAIN, 14));
    lblMeetingRm.setForeground(new Color(0, 0, 0));
    lblMeetingRm.setHorizontalTextPosition(SwingConstants.CENTER);
    lblMeetingRm.setBounds(89, 378, 100, 24);
    add(lblMeetingRm);

    JLabel lblActivityRm = new JLabel("\u2022\tParty");
    lblActivityRm.setHorizontalTextPosition(SwingConstants.CENTER);
    lblActivityRm.setHorizontalAlignment(SwingConstants.LEFT);
    lblActivityRm.setForeground(new Color(0, 0, 0));
    lblActivityRm.setFont(new Font("Arial", Font.PLAIN, 14));
    lblActivityRm.setBounds(89, 413, 100, 24);
    add(lblActivityRm);

    JLabel lblHall = new JLabel("\u2022\tCompany Dinner");
    lblHall.setHorizontalTextPosition(SwingConstants.CENTER);
    lblHall.setHorizontalAlignment(SwingConstants.LEFT);
    lblHall.setForeground(new Color(0, 0, 0));
    lblHall.setFont(new Font("Arial", Font.PLAIN, 14));
    lblHall.setBounds(89, 448, 119, 24);
    add(lblHall);

    JLabel lblPrices = new JLabel("Prices");
    lblPrices.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    lblPrices.setHorizontalTextPosition(SwingConstants.CENTER);
    lblPrices.setHorizontalAlignment(SwingConstants.CENTER);
    lblPrices.setForeground(new Color(255, 255, 255));
    lblPrices.setFont(new Font("Arial", Font.BOLD, 15));
    lblPrices.setOpaque(true);
    lblPrices.setBackground(new Color(153, 51, 153));
    lblPrices.setBounds(234, 327, 100, 40);
    add(lblPrices);

    JLabel lblMeetingPrice = new JLabel("$40,000");
    lblMeetingPrice.setForeground(new Color(0, 0, 0));
    lblMeetingPrice.setFont(new Font("Arial", Font.PLAIN, 14));
    lblMeetingPrice.setBounds(244, 378, 90, 24);
    add(lblMeetingPrice);

    JLabel lblActivityPrice = new JLabel("$6,000");
    lblActivityPrice.setFont(new Font("Arial", Font.PLAIN, 14));
    lblActivityPrice.setForeground(new Color(0, 0, 0));
    lblActivityPrice.setBounds(244, 416, 90, 19);
    add(lblActivityPrice);

    JLabel lblHallPrice = new JLabel("$15,000");
    lblHallPrice.setFont(new Font("Arial", Font.PLAIN, 14));
    lblHallPrice.setForeground(new Color(0, 0, 0));
    lblHallPrice.setBounds(244, 451, 90, 19);
    add(lblHallPrice);

    JLabel lblDesc = new JLabel("Description");
    lblDesc.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0)));
    lblDesc.setBackground(new Color(153, 51, 153));
    lblDesc.setOpaque(true);
    lblDesc.setHorizontalTextPosition(SwingConstants.CENTER);
    lblDesc.setHorizontalAlignment(SwingConstants.CENTER);
    lblDesc.setForeground(new Color(255, 255, 255));
    lblDesc.setFont(new Font("Arial", Font.BOLD, 15));
    lblDesc.setBounds(416, 325, 306, 40);
    add(lblDesc);

    JTextPane txtpnDescTxt = new JTextPane();
    txtpnDescTxt.setFont(new Font("Arial", Font.PLAIN, 14));
    txtpnDescTxt.setForeground(new Color(0, 0, 0));
    txtpnDescTxt.setOpaque(false);
    txtpnDescTxt.setText(
        "Our packages includes services from our experienced staff and the venue where is occasion is taking place. Please approach the receptionist to book a package or for further enquires.");
    txtpnDescTxt.setBounds(416, 377, 306, 112);
    add(txtpnDescTxt);

    JLabel lblPackages_1 = new JLabel("Packages");
    lblPackages_1.setFont(new Font("Tahoma", Font.PLAIN, 30));
    lblPackages_1.setBounds(484, 0, 157, 43);
    add(lblPackages_1);
  }
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.getContentPane().setBackground(Color.WHITE);
    frame.getContentPane().setForeground(Color.RED);
    frame.setBackground(Color.WHITE);
    frame.setBounds(100, 100, 613, 459);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setForeground(Color.BLACK);
    tabbedPane.setBackground(Color.WHITE);
    tabbedPane.setBounds(1, 2, 596, 408);
    frame.getContentPane().add(tabbedPane);

    JPanel panel_1 = new JPanel();
    panel_1.setBackground(Color.WHITE);
    panel_1.setForeground(Color.GREEN);
    tabbedPane.addTab("Recieved Mail", null, panel_1, null);
    panel_1.setLayout(null);

    JTextPane textPane_1 = new JTextPane();
    textPane_1.setBackground(Color.WHITE);
    textPane_1.setForeground(Color.BLACK);
    textPane_1.setEditable(false);

    JScrollPane scrollPane1 = new JScrollPane(textPane_1);
    scrollPane1.setBounds(150, 100, 420, 250);
    panel_1.add(scrollPane1);

    // panel_1.add(textPane_1);

    DefaultListModel listModel = new DefaultListModel();
    File[] files1 = new File("src/inbox").listFiles();
    for (File file : files1) {
      if (file.isFile())
        listModel.addElement((file.getName()).substring(0, (file.getName()).length() - 4));
    }

    JList list = new JList(listModel);
    list.setForeground(Color.BLACK);
    list.setBackground(Color.WHITE);

    // list.setBounds(10, 11, 112, 280);
    // panel_1.add(list);

    JScrollPane scrollPane = new JScrollPane(list);
    // scrollPane.setViewportView(list);
    scrollPane.setBounds(20, 11, 112, 340);
    panel_1.add(scrollPane);

    JLabel lblMessage = new JLabel("Message");
    lblMessage.setForeground(Color.BLACK);
    lblMessage.setBounds(175, 77, 79, 14);
    panel_1.add(lblMessage);

    JPanel panel = new JPanel();
    panel.setBackground(Color.WHITE);
    tabbedPane.addTab("Send Email", null, panel, null);
    panel.setLayout(null);

    JComboBox contactCombo = new JComboBox();
    contactCombo.setForeground(Color.BLACK);
    contactCombo.setBackground(Color.WHITE);
    contactCombo.setBounds(172, 21, 409, 20);
    panel.add(contactCombo);

    JLabel label = new JLabel("Message:");
    label.setForeground(Color.BLACK);
    label.setBounds(13, 117, 91, 14);
    panel.add(label);

    JTextPane messagePane = new JTextPane();
    messagePane.setBackground(Color.WHITE);
    messagePane.setForeground(Color.BLACK);
    messagePane.setBounds(10, 124, 539, 194);
    // panel.add(messagePane);

    JButton button_1 = new JButton("Send");
    button_1.setForeground(Color.BLACK);
    button_1.setBackground(Color.WHITE);
    button_1.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            String to = contactCombo.getSelectedItem().toString();
            String subject = txtSubject.getText();
            Random rn = new Random();
            String ShareID = Integer.toString((new Random()).nextInt((999999999 - 100) + 1) + 100);
            System.out.println(ShareID);
            String from = "src/proxies/proxies.txt";
            String message = messagePane.getText();
            try {
              // if(selectedFileIn == true)
              System.out.println("sendmail1");
              SendMail.Distributor(to, ShareID, from, message, "", subject);
              System.out.println("sendmail2");
              // selectedFileIn = false;
            } catch (IOException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
            }
            messagePane.setText("");
            contactCombo.repaint();
            attField.setText("");
            attField.removeAll();
          }
        });

    JScrollPane sP =
        new JScrollPane(
            messagePane,
            JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    sP.setBounds(13, 142, 568, 194);
    panel.add(sP);
    button_1.setBounds(482, 346, 99, 23);
    panel.add(button_1);

    JLabel lblTo = new JLabel("To");
    lblTo.setForeground(Color.BLACK);
    lblTo.setBackground(Color.BLACK);
    lblTo.setBounds(116, 24, 46, 14);
    panel.add(lblTo);

    attField = new JTextField();
    attField.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {}
        });
    attField.setBounds(172, 52, 409, 20);
    panel.add(attField);
    attField.setColumns(10);

    JButton btnSearchButton = new JButton("Search");
    btnSearchButton.setBackground(Color.WHITE);
    btnSearchButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.showOpenDialog(frame);
            // fileChooser.setCurrentDirectory(new File(System.getProperty("src/")));
            selectedFile = fileChooser.getSelectedFile();
            attField.setText(selectedFile.getName());
            selectedFileIn = true;
            // selectedFile = fileChooser.getSelectedFile();
          }
        });
    btnSearchButton.setBounds(73, 51, 89, 23);
    panel.add(btnSearchButton);

    txtSubject = new JTextField();
    txtSubject.setBounds(172, 83, 409, 20);
    panel.add(txtSubject);
    txtSubject.setColumns(10);

    JLabel lblSubject = new JLabel("Subject");
    lblSubject.setForeground(Color.BLACK);
    lblSubject.setBackground(Color.BLACK);
    lblSubject.setBounds(116, 85, 46, 14);
    panel.add(lblSubject);

    JPanel panel_2 = new JPanel();
    panel_2.setBackground(Color.WHITE);
    tabbedPane.addTab("Add Contact", null, panel_2, null);
    panel_2.setLayout(null);

    JLabel lblEmailAddress = new JLabel("Email Address");
    lblEmailAddress.setForeground(Color.BLACK);
    lblEmailAddress.setBounds(75, 159, 72, 14);
    panel_2.add(lblEmailAddress);

    JTextPane proxyPane = new JTextPane();
    proxyPane.setForeground(Color.BLACK);
    proxyPane.setBackground(Color.LIGHT_GRAY);
    proxyPane.setBounds(157, 159, 298, 102);
    panel_2.add(proxyPane);

    JLabel lblContactName = new JLabel("Contact Name");
    lblContactName.setForeground(Color.BLACK);
    lblContactName.setBounds(69, 124, 72, 14);
    panel_2.add(lblContactName);

    contactField = new JTextField();
    contactField.setBackground(Color.LIGHT_GRAY);
    contactField.setColumns(10);
    contactField.setBounds(157, 121, 298, 20);
    panel_2.add(contactField);

    JButton btnAddContact = new JButton("Add Contact");
    btnAddContact.setBackground(Color.WHITE);
    btnAddContact.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            BufferedWriter output = null;
            // Add new contact
            String conName = contactField.getText();
            String allprox = proxyPane.getText();
            File conFile = new File("src/contacts/" + conName + ".txt");
            try {
              output = new BufferedWriter(new FileWriter(conFile));
              output.write(allprox);
              output.close();
            } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
            }
          }
        });
    btnAddContact.setBounds(157, 301, 118, 23);
    panel_2.add(btnAddContact);

    // List<String> contacts = new ArrayList<String>();
    // comboBox.addItem("hg");
    File[] files = new File("src/contacts").listFiles();
    for (File file : files) {
      if (file.isFile())
        contactCombo.addItem((file.getName()).substring(0, (file.getName()).length() - 4));
    }
    list.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent arg0) {
            String strbldr = "";
            String loc = "src/inbox/" + list.getSelectedValue().toString() + ".txt";
            try {
              BufferedReader buffread = new BufferedReader(new FileReader(loc));
              String line = buffread.readLine();
              while (line != null) {
                strbldr += line;
                strbldr += "\n";
                line = buffread.readLine();
              }
              buffread.close();
            } catch (Exception e) {
            }
            ;
            textPane_1.setText(strbldr);
            textPane_1.setCaretPosition(0);
          }
        });
    class Inner extends Thread {

      public void run() {

        do {
          System.out.println("Hello from a thread!");
          try {
            ReceiveMail.run();
            scrollPane.repaint();
            this.sleep(10000);
          } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        } while (true);
      }

      public void main(String args[]) {
        (new Inner()).start();
      }
    }
    Inner reloads = new Inner();
    reloads.start();
  }
Example #25
0
  public static void ConfigureMainWindow() {
    userNameLabel.setFont(new Font("Lucida Console", 0, 14));
    userNameLabel.setForeground(new Color(255, 255, 255));

    mainWindow.getContentPane().setBackground(new Color(4, 3, 10));
    mainWindow.setSize(800, 600);
    mainWindow.getContentPane().setLayout(null);
    connectButton.setBackground(new Color(255, 255, 255));
    connectButton.setForeground(new Color(4, 3, 10));
    connectButton.setFont(new Font("Lucida Console", 0, 14));

    connectButton.setText("Anslut");
    connectButton.setToolTipText("");
    mainWindow.getContentPane().add(connectButton);
    connectButton.setBounds(455, 10, 100, 25);

    conversation.setColumns(20);
    conversation.setFont(new Font("Lucida Console", 0, 14));
    conversation.setForeground(new Color(4, 3, 10));
    conversation.setLineWrap(true);
    conversation.setRows(5);
    // conversation.setEditable(false);

    tpConversation.setForeground(new Color(255, 255, 255));
    tpConversation.setBounds(10, 10, 600, 500);
    tpConversation.setBackground(new Color(4, 3, 10));
    tpConversation.setFont(new Font("Lucida Console", 0, 14));

    spConversation.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    spConversation.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    spConversation.setViewportView(tpConversation);
    mainWindow.getContentPane().add(spConversation);
    spConversation.setBounds(10, 10, 600, 500);

    userNameBox.setBounds(120, 10, 325, 25);
    userNameLabel.setBounds(10, 10, 130, 25);
    mainWindow.getContentPane().add(userNameBox);
    mainWindow.getContentPane().add(userNameLabel);

    usersOnline.setForeground(new Color(0, 180, 255));
    usersOnline.setBackground(new Color(4, 3, 10));
    usersOnline.setFont(new Font("Lucida Console", 0, 14));
    spUsersOnline.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    spUsersOnline.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    spUsersOnline.setViewportView(usersOnline);
    mainWindow.getContentPane().add(spUsersOnline);
    spUsersOnline.setBounds(620, 10, 165, 300);

    messageField.setForeground(new Color(255, 255, 255));
    messageField.setBackground(new Color(4, 3, 10));
    messageField.requestFocus();
    messageField.addActionListener(action);
    mainWindow.getContentPane().add(messageField);
    messageField.setBounds(10, 520, 600, 30);

    send.setBackground(new Color(255, 255, 255));
    send.setForeground(new Color(4, 3, 10));
    send.setText("Skicka");
    send.setFont(new Font("Lucida Console", 0, 14));
    mainWindow.getContentPane().add(send);
    send.setBounds(620, 520, 165, 30);

    disconnect.setBackground(new Color(255, 255, 255));
    disconnect.setForeground(new Color(4, 3, 10));
    disconnect.setText("Avsluta chatten");
    disconnect.setFont(new Font("Lucida Console", 0, 14));
    mainWindow.getContentPane().add(disconnect);
    disconnect.setBounds(620, 320, 165, 30);

    error.setFont(new Font("Lucida Console", 0, 14));
    error.setForeground(new Color(255, 0, 23));
    error.setBounds(120, 40, 525, 25);

    mainWindow.getContentPane().add(error);
  }
  /** Create the panel. */
  public NursePanel(MedAppController mac) {

    setLayout(null);
    JSeparator separator = new JSeparator();
    separator.setOrientation(SwingConstants.VERTICAL);
    separator.setBounds(150, 0, 1, 600);
    add(separator);

    JSeparator separator_1 = new JSeparator();
    separator_1.setBounds(0, 100, 750, 2);
    add(separator_1);

    JSeparator separator_2 = new JSeparator();
    separator_2.setBounds(0, 400, 150, 2);
    add(separator_2);

    JButton btnAddPatient = new JButton("Add Patient");
    btnAddPatient.setBounds(10, 159, 110, 23);
    add(btnAddPatient);

    JButton btnDeletePatient = new JButton("Delete Patient");
    btnDeletePatient.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {}
        });
    btnDeletePatient.setBounds(10, 193, 110, 23);
    add(btnDeletePatient);

    JButton btnNewButton = new JButton("Look Up Patient");
    btnNewButton.setBounds(10, 227, 110, 23);
    add(btnNewButton);

    JLabel lblNewLabel = new JLabel("Nurse Information");
    lblNewLabel.setBounds(10, 75, 130, 14);
    add(lblNewLabel);

    JButton btnNewButton_1 = new JButton("View Daily");
    btnNewButton_1.setBounds(10, 441, 110, 23);
    add(btnNewButton_1);

    JTextPane textPane = new JTextPane();
    textPane.setBounds(161, 100, 110, 500);
    add(textPane);

    JSeparator separator_3 = new JSeparator();
    separator_3.setOrientation(SwingConstants.VERTICAL);
    separator_3.setBounds(279, 0, 2, 600);
    add(separator_3);

    JLabel lblPatientList = new JLabel("Patient List");
    lblPatientList.setBounds(161, 75, 110, 14);
    add(lblPatientList);

    JLabel lblPatientInformation = new JLabel("Patient Information");
    lblPatientInformation.setBounds(291, 75, 130, 14);
    add(lblPatientInformation);

    textField = new JTextField();
    textField.setBounds(10, 128, 110, 20);
    add(textField);
    textField.setColumns(10);
  }
Example #27
0
  public MoleGamePlay() {
    for (int i = 0; i < 2; i++) {
      pan[i] = new JPanel();
      pan[i].setBackground(Color.black);
      idtf[i] = new JTextField();
      idtf[i].setEditable(false);
      idtf[i].setHorizontalAlignment(JLabel.CENTER);
    }
    // 게임내 채팅창
    ta = new JTextArea();
    ta.setEditable(false);
    JScrollPane js = new JScrollPane(ta);
    bar = js.getVerticalScrollBar();
    tf = new JTextField();

    pan[0].setBounds(455, 15, 150, 150);
    add(pan[0]);
    idtf[0].setBounds(455, 170, 150, 30);
    add(idtf[0]);

    pan[1].setBounds(610, 15, 150, 150);
    add(pan[1]);
    idtf[1].setBounds(610, 170, 150, 30);
    add(idtf[1]);

    // 게임내 채팅창 위치
    js.setBounds(455, 220, 305, 160);
    tf.setBounds(455, 390, 305, 30);

    // 채팅창
    add(js);
    add(tf);

    scoreJLabel = new JLabel(new ImageIcon("image/score.png")); // 스코어 이미지 위치
    scoreJLabel.setBounds(10, 10, 144, 44);

    jTextPane = new JTextPane(); // 스코어  위치
    jTextPane.setEditable(false);
    jTextPane.setBounds(154, 10, 180, 43);
    jTextPane.setText("0");
    jTextPane.setFont(new Font("Pompadour", 50, 35));

    jButtonStn = new JButton(new ImageIcon("image/start.png"));
    jButtonStn.setBounds(10, 20, 144, 44);
    jButtonStn.setBorderPainted(false);
    jButtonStn.setContentAreaFilled(false);

    jButtonRdy = new JButton(new ImageIcon("image/ready.png"));
    jButtonRdy.setBounds(184, 20, 144, 44);
    jButtonRdy.setBorderPainted(false);
    jButtonRdy.setContentAreaFilled(false);

    jButtonPause = new JButton(new ImageIcon("image/pause.png"));
    jButtonPause.setBounds(10, 74, 144, 44);
    jButtonPause.setBorderPainted(false);
    jButtonPause.setContentAreaFilled(false);

    jButtonCancel = new JButton(new ImageIcon("image/cancel.png"));
    jButtonCancel.setBounds(184, 74, 144, 44);
    jButtonCancel.setBorderPainted(false);
    jButtonCancel.setContentAreaFilled(false);

    jButtonExit = new JButton(new ImageIcon("image/exit.png"));
    jButtonExit.setBounds(10, 128, 144, 44);
    jButtonExit.setBorderPainted(false);
    jButtonExit.setContentAreaFilled(false);

    JLabel gamemenuJLabel = new JLabel();
    gamemenuJLabel.setLayout(null);
    gamemenuJLabel.setBounds(440, 400, 338, 192);
    gamemenuJLabel.add(jButtonStn);
    gamemenuJLabel.add(jButtonRdy);
    gamemenuJLabel.add(jButtonPause);
    gamemenuJLabel.add(jButtonCancel);
    gamemenuJLabel.add(jButtonExit);

    image = Toolkit.getDefaultToolkit().getImage("image/back.png");
    cursorImage = Toolkit.getDefaultToolkit().getImage("image/01.png");
    cursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImage, new Point(0, 0), "null");
    this.setCursor(cursor);
    this.setLayout(null);
    moleGameMyView.setBounds(26, 70, 400, 450);
    notiMyBar.setBounds(15, 530, 420, 30); // 타이머 노티 영역

    this.add(notiMyBar);
    this.add(scoreJLabel);
    this.add(jTextPane);
    this.add(moleGameMyView);
    this.add(gamemenuJLabel);
  }
  private void initialize() {
    frame = new JFrame();
    frame.setSize(828, 520);
    frame.setLocationRelativeTo(null);
    frame.getContentPane().setLayout(null);
    textPane.setBounds(10, 5, 772, 125);
    textPane.setEditorKit(new HTMLEditorKit());

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBounds(10, 11, 792, 301);
    frame.getContentPane().add(tabbedPane);

    JPanel panelCase = new JPanel();
    tabbedPane.addTab("Case Tab", null, panelCase, null);
    panelCase.setLayout(null);

    tableCase = new JTable();
    tableCase.setBounds(10, 11, 634, 219);
    caseRows = new ArrayList<CaseRow>();
    panelCase.add(tableCase);
    tableCaseModel = new CaseTableModel(caseRows);
    tableCase.setModel(tableCaseModel);

    JPanel panel_Query = new JPanel();
    panel_Query.setBounds(10, 323, 792, 141);
    frame.getContentPane().add(panel_Query);
    panel_Query.setLayout(null);
    panel_Query.add(textPane);

    JScrollPane scrollPaneCase = new JScrollPane(tableCase);
    scrollPaneCase.setBounds(10, 11, 754, 164);
    panelCase.add(scrollPaneCase);

    JPanel panelCoalesce = new JPanel();
    tabbedPane.addTab("Coalesce Tab", null, panelCoalesce, null);

    tableCoalesce = new JTable();
    tableCoalesce.setBounds(1, 36, 765, 0);
    panelCoalesce.add(tableCoalesce);
    panelCase.setLayout(null);
    coalesceRows = new ArrayList<CoalesceRow>();
    tableCoalesceModel = new CoalesceTableModel(coalesceRows);
    panelCoalesce.setLayout(null);
    tableCoalesce.setModel(tableCoalesceModel);

    JScrollPane scrollPaneCoalesce = new JScrollPane(tableCoalesce);
    scrollPaneCoalesce.setBounds(10, 11, 767, 131);
    panelCoalesce.add(scrollPaneCoalesce);

    JPanel coalesceButtonPanel = new JPanel();
    coalesceButtonPanel.setBounds(10, 201, 757, 50);
    panelCoalesce.add(coalesceButtonPanel);
    coalesceButtonPanel.setLayout(null);

    JButton coalesceAddBtn = new JButton("ADD");
    coalesceAddBtn.setIcon(new ImageIcon(TeslaCase.class.getResource("/png/addd.png")));
    coalesceAddBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (pojoRow.getRowType() == null) {
              pojoRow.setRowType("Coalesce");
              TeslaTransFunctions.initializeCoalesceTables();
            }
            tableCoalesce.editCellAt(-1, -1);
            if (txtEnterStringField.getText().equals("")) {
              query = TeslaTransFunctions.displayCoalesceQuery(coalesceRows);
              textPane.setText(QueryColorUtil.queryColorChange(query));
              tableCoalesceModel.updateUI(pojoRow);
              tableCoalesce.scrollRectToVisible(
                  tableCoalesce.getCellRect(tableCoalesce.getRowCount() - 1, 0, true));
            } else {
              pojoRow.setCoalesceString(txtEnterStringField.getText());
              query =
                  TeslaTransFunctions.displayCoalesceQuery_1(txtEnterStringField.getText(), query);
              tableCoalesce.editCellAt(-1, -1);
              frame.setVisible(false);
            }
          }
        });
    coalesceAddBtn.setBounds(286, 16, 115, 29);
    coalesceButtonPanel.add(coalesceAddBtn);

    JButton coalescebtnDone = new JButton("DONE");
    coalescebtnDone.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            tableCoalesce.editCellAt(-1, -1);
            if (txtEnterStringField.getText().equals("")) {
              query = TeslaTransFunctions.displayCoalesceQuery(coalesceRows);
              textPane.setText(QueryColorUtil.queryColorChange(query));
              tableCoalesceModel.updateUI(pojoRow);
              tableCoalesce.scrollRectToVisible(
                  tableCoalesce.getCellRect(tableCoalesce.getRowCount() - 1, 0, true));
            } else {
              pojoRow.setCoalesceString(txtEnterStringField.getText());
              query =
                  TeslaTransFunctions.displayCoalesceQuery_1(txtEnterStringField.getText(), query);
              tableCoalesce.editCellAt(-1, -1);
              frame.setVisible(false);
            }
            frame.setVisible(false);
          }
        });
    coalescebtnDone.setBounds(499, 19, 89, 23);
    coalesceButtonPanel.add(coalescebtnDone);

    txtEnterStringField = new JTextField();
    txtEnterStringField.setBounds(287, 158, 146, 26);
    panelCoalesce.add(txtEnterStringField);
    txtEnterStringField.setColumns(10);

    JLabel lblEnterText = new JLabel("Enter Text");
    lblEnterText.setBounds(125, 161, 119, 20);
    panelCoalesce.add(lblEnterText);

    JPanel panelCaseButton = new JPanel();
    panelCaseButton.setBounds(26, 202, 726, 44);
    panelCase.add(panelCaseButton);

    JButton btnAddCase = new JButton("ADD");
    btnAddCase.setBounds(288, 11, 89, 23);
    btnAddCase.setIcon(new ImageIcon(TeslaCase.class.getResource("/png/addd.png")));
    btnAddCase.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            if (pojoRow.getRowType() == null) {
              pojoRow.setRowType("Case");
              TeslaTransFunctions.initializeCaseTables();
            }
            tableCase.editCellAt(-1, -1);
            query = TeslaTransFunctions.displayCaseQuery(caseRows);
            textPane.setText(QueryColorUtil.queryColorChange(query));
            tableCaseModel.updateUI(pojoRow);
            tableCase.scrollRectToVisible(
                tableCase.getCellRect(tableCase.getRowCount() - 1, 0, true));
          }
        });
    panelCaseButton.setLayout(null);
    panelCaseButton.add(btnAddCase);

    JButton btnNewButton = new JButton("ELSE");
    btnNewButton.setIcon(new ImageIcon(TeslaCase.class.getResource("/png/Locking.png")));
    btnNewButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            tableCase.editCellAt(-1, -1);
            query = TeslaTransFunctions.displayCaseQuery(caseRows);
            textPane.setText(QueryColorUtil.queryColorChange(query));
            tableCaseModel.updateUI1(pojoRow);
            tableCase.scrollRectToVisible(
                tableCase.getCellRect(tableCase.getRowCount() - 1, 0, true));
          }
        });
    btnNewButton.setBounds(496, 11, 89, 23);
    panelCaseButton.add(btnNewButton);

    JButton btnElse = new JButton("DONE");
    btnElse.setIcon(new ImageIcon(TeslaCase.class.getResource("/png/Exit.png")));
    btnElse.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            tableCase.editCellAt(-1, -1);
            frame.setVisible(false);
          }
        });
    btnElse.setBounds(72, 11, 89, 23);
    panelCaseButton.add(btnElse);

    frame.setVisible(true);
  }
Example #29
0
  /** Initialize the contents of the frame. */
  private void initialize() {
    frame = new JFrame();
    frame.getContentPane().setBackground(Color.WHITE);
    frame.setBounds(100, 100, 1024, 768);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(null);

    txtUsername = new JTextField();
    txtUsername.setText("username");
    txtUsername.setBounds(716, 11, 86, 20);
    frame.getContentPane().add(txtUsername);
    txtUsername.setColumns(10);

    txtPassword = new JTextField();
    txtPassword.setText("password");
    txtPassword.setBounds(812, 11, 86, 20);
    frame.getContentPane().add(txtPassword);
    txtPassword.setColumns(10);

    JButton btnNewButton = new JButton("Login");
    btnNewButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            PrivateDashboard privateDashboard = new PrivateDashboard();
            privateDashboard.getFrame().setVisible(true);
          }
        });
    btnNewButton.setBounds(908, 10, 89, 23);
    frame.getContentPane().add(btnNewButton);

    JLabel lblForgotPassword = new JLabel("Forgot Password");
    lblForgotPassword.setForeground(Color.BLUE);
    lblForgotPassword.setBounds(895, 44, 102, 14);
    frame.getContentPane().add(lblForgotPassword);

    JPanel panel_MainChartPanel = new JPanel();
    panel_MainChartPanel.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_MainChartPanel.setBackground(Color.WHITE);
    panel_MainChartPanel.setBounds(194, 69, 517, 436);
    frame.getContentPane().add(panel_MainChartPanel);
    panel_MainChartPanel.setLayout(null);

    //		JLabel label = new JLabel("");
    //		label.setBounds(0, 0, 67, 57);
    //		label.setIcon(new
    // ImageIcon(PublicDashboard.class.getResource("/ubc/cpsc544/3DBuildingView.png")));
    //		panel_MainChartPanel.add(label);

    BarChart barChart = new BarChart();
    ChartPanel chartPanel = barChart.getChartPanel();
    chartPanel.setVisible(true);
    chartPanel.setBounds(0, 0, 517, 436);
    panel_MainChartPanel.add(chartPanel);

    JPanel panel_Units = new JPanel();
    FlowLayout fl_panel_Units = (FlowLayout) panel_Units.getLayout();
    fl_panel_Units.setAlignment(FlowLayout.LEFT);
    panel_Units.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_Units.setBackground(Color.WHITE);
    panel_Units.setBounds(10, 364, 174, 141);
    frame.getContentPane().add(panel_Units);

    JLabel lblUnits = new JLabel("Units");
    lblUnits.setFont(new Font("Tahoma", Font.BOLD, 14));
    panel_Units.add(lblUnits);

    JRadioButton radioButton = new JRadioButton("Kilo-Watt Hour kWH");
    radioButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
    radioButton.setBackground(Color.WHITE);
    radioButton.setSelected(true);
    panel_Units.add(radioButton);

    JRadioButton radioButton_1 = new JRadioButton("Ibs of CO2");
    radioButton_1.setEnabled(false);
    radioButton_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
    radioButton_1.setBackground(Color.WHITE);
    panel_Units.add(radioButton_1);

    JRadioButton radioButton_2 = new JRadioButton("Dollar Value");
    radioButton_2.setEnabled(false);
    radioButton_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
    radioButton_2.setBackground(Color.WHITE);
    panel_Units.add(radioButton_2);

    JPanel panel_4 = new JPanel();
    FlowLayout flowLayout_1 = (FlowLayout) panel_4.getLayout();
    flowLayout_1.setAlignment(FlowLayout.LEFT);
    panel_4.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_4.setBackground(Color.WHITE);
    panel_4.setBounds(10, 521, 701, 185);
    frame.getContentPane().add(panel_4);
    panel_4.setLayout(null);

    JTextPane txtpnFloors = new JTextPane();
    txtpnFloors.setFont(new Font("Tahoma", Font.PLAIN, 14));
    txtpnFloors.setText(
        "St. John\u2019s College is UBC\u2019s international graduate college. A magnet for international and multicultural exchange, the College offers an academic setting that encourages discussion, debate and cultural expression, all enlivened by the participation of resident graduate students who come from diverse cultural backgrounds.");
    txtpnFloors.setBounds(12, 60, 666, 80);
    panel_4.add(txtpnFloors);

    JTextPane txtpnNoFloors = new JTextPane();
    txtpnNoFloors.setFont(new Font("Helvetica", Font.PLAIN, 15));
    txtpnNoFloors.setText(
        "NO. FLOORS  \t-  05\nOCCUPANTS  \t-  120\n\nSt. John\u2019s College is UBC\u2019s international graduate college. A magnet for international\n and multicultural exchange, the College offers an academic setting that encourages \ndiscussion, debate and cultural expression, all enlivened by the participation of \nresident graduate students who come from diverse cultural backgrounds.");
    panel_4.add(txtpnNoFloors);

    JTextPane txtpnFloorsOccupants = new JTextPane();
    txtpnFloorsOccupants.setFont(new Font("Dialog", Font.PLAIN, 15));
    txtpnFloorsOccupants.setText("Floors:  05\r\nOccupants:  120\r");
    txtpnFloorsOccupants.setBounds(12, 12, 280, 51);
    panel_4.add(txtpnFloorsOccupants);

    JPanel panel_5 = new JPanel();
    panel_5.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_5.setBackground(Color.WHITE);
    panel_5.setBounds(721, 521, 276, 185);
    frame.getContentPane().add(panel_5);

    JLabel label_1 = new JLabel("");
    label_1.setIcon(new ImageIcon(PublicDashboard.class.getResource("/ubc/cpsc544/weather.png")));
    panel_5.add(label_1);

    JLabel lblBulbIcon = new JLabel("");
    lblBulbIcon.setIcon(new ImageIcon(PublicDashboard.class.getResource("/ubc/cpsc544/bulb.png")));
    lblBulbIcon.setBounds(12, 11, 35, 33);
    frame.getContentPane().add(lblBulbIcon);

    JLabel lblUbcEnergyDashboard = new JLabel("UBC Energy Dashboard");
    lblUbcEnergyDashboard.setForeground(new Color(0, 128, 0));
    lblUbcEnergyDashboard.setFont(new Font("Tahoma", Font.BOLD, 18));
    lblUbcEnergyDashboard.setBorder(null);
    lblUbcEnergyDashboard.setBounds(49, 15, 229, 29);
    frame.getContentPane().add(lblUbcEnergyDashboard);

    JPanel panel = new JPanel();
    panel.setBounds(10, 69, 174, 284);
    frame.getContentPane().add(panel);
    panel.setBackground(Color.WHITE);
    panel.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel.setLayout(null);

    JLabel lblCumulative = new JLabel("Cumulative");
    lblCumulative.setBounds(10, 5, 89, 26);
    lblCumulative.setFont(new Font("Tahoma", Font.BOLD, 14));
    lblCumulative.setBorder(null);
    panel.add(lblCumulative);

    JLabel lblK = new JLabel("176,000 kWH");
    lblK.setIcon(new ImageIcon(PublicDashboard.class.getResource("/ubc/cpsc544/Electricity.jpg")));
    lblK.setFont(new Font("Tahoma", Font.BOLD, 17));
    lblK.setBorder(null);
    lblK.setBounds(10, 32, 144, 31);
    panel.add(lblK);

    JLabel lblCo = new JLabel("20,735 CO2");
    lblCo.setIcon(new ImageIcon(PublicDashboard.class.getResource("/ubc/cpsc544/COs.jpg")));
    lblCo.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblCo.setBorder(null);
    lblCo.setBounds(10, 67, 144, 31);
    panel.add(lblCo);

    JLabel label_2 = new JLabel("3,601.25");
    label_2.setIcon(
        new ImageIcon(PublicDashboard.class.getResource("/ubc/cpsc544/Dollar_Symbol.gif")));
    label_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
    label_2.setBorder(null);
    label_2.setBounds(10, 97, 144, 31);
    panel.add(label_2);

    JLabel lblLastMonth = new JLabel("Last month");
    lblLastMonth.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblLastMonth.setBorder(null);
    lblLastMonth.setBounds(10, 139, 89, 26);
    panel.add(lblLastMonth);

    JLabel lblKwh = new JLabel("166,500 kWH");
    lblKwh.setIcon(
        new ImageIcon(PublicDashboard.class.getResource("/ubc/cpsc544/Electricity.jpg")));
    lblKwh.setFont(new Font("Tahoma", Font.BOLD, 17));
    lblKwh.setBorder(null);
    lblKwh.setBounds(10, 176, 144, 31);
    panel.add(lblKwh);

    JLabel label_4 = new JLabel("5.4%");
    label_4.setForeground(new Color(0, 204, 0));
    label_4.setIcon(new ImageIcon(PublicDashboard.class.getResource("/ubc/cpsc544/DownArrow.png")));
    label_4.setFont(new Font("Tahoma", Font.BOLD, 21));
    label_4.setBorder(null);
    label_4.setBounds(10, 224, 144, 31);
    panel.add(label_4);

    JSeparator separator = new JSeparator();
    separator.setBounds(10, 133, 152, 2);
    panel.add(separator);

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(new LineBorder(new Color(0, 0, 0)));
    panel_2.setBackground(Color.WHITE);
    panel_2.setBounds(723, 71, 274, 434);
    frame.getContentPane().add(panel_2);
    panel_2.setLayout(null);

    JTextPane txtpnIdeas = new JTextPane();
    txtpnIdeas.setBounds(12, 55, 259, 339);
    panel_2.add(txtpnIdeas);
    txtpnIdeas.setEditable(false);
    txtpnIdeas.setFont(new Font("Tahoma", Font.PLAIN, 15));
    txtpnIdeas.setBorder(null);
    txtpnIdeas.setMargin(new Insets(30, 30, 30, 30));
    txtpnIdeas.setText(
        "1. Lower your thermostat by 4 - 5 degrees Celsius (7 - 9 degrees Fahrenheit) while you're sleeping at night and when no one is at home. \n\n "
            + "2. Switch to cold when doing your laundry. 85 – 90% of the energy used to wash your clothes is used to heat the water. \n\n "
            + "3. Try setting your dishwasher to start after 7:00 p.m. when off-peak prices begin. ");

    JLabel lblTopIdeas = new JLabel("Top Ideas");
    lblTopIdeas.setBounds(12, 13, 112, 29);
    panel_2.add(lblTopIdeas);
    lblTopIdeas.setFont(new Font("Tahoma", Font.BOLD, 14));
    lblTopIdeas.setBorder(null);

    JLabel lblSt = new JLabel("St. John's College, UBC");
    lblSt.setFont(new Font("Dialog", Font.BOLD, 16));
    lblSt.setBounds(519, 40, 192, 22);
    frame.getContentPane().add(lblSt);
  }