Пример #1
0
  private JPanel createWaitingPanel() {
    logger.entry();
    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(0, 50, 10, 50));
    panel.setOpaque(false);

    panel.add(new JLabel(getLocalized(AUTHORIZE)));

    try {
      BufferedImage myPicture = ImageIO.read(ResourceLoader.getURL(Template.AUTHORIZE));
      JLabel picLabel = new JLabel();
      ImageIcon icon = new ImageIcon(myPicture);
      picLabel.setIcon(icon);
      picLabel.setPreferredSize(new Dimension(PANEL_WIDTH, LIST_HEIGHT));
      panel.add(picLabel);
    } catch (IOException e) {
    }

    nextButton = new ModernButton(getLocalized(NEXT_BUTTON_NAME));
    nextButton.setPreferredSize(new Dimension(PANEL_WIDTH, 30));
    nextButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent arg0) {
            requestAccessToken();
          }
        });
    panel.add(nextButton);

    return logger.exit(panel);
  }
Пример #2
0
  private JPanel createUniSelectPanel() {
    logger.entry();
    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(0, 50, 10, 50));
    panel.setOpaque(false);

    uniNameLabel = createLabel(getLocalized(UNI_NAME_LABEL));
    panel.add(uniNameLabel);

    uniList = new JList<OAuthServer>(new Vector<>(loginModel.getServers()));
    uniList.addListSelectionListener(
        new ListSelectionListener() {

          @Override
          public void valueChanged(ListSelectionEvent arg0) {
            authorizeButton.setEnabled(true);
          }
        });
    uniList.addMouseListener(
        new MouseAdapter() {

          @Override
          public void mousePressed(MouseEvent arg0) {
            if (arg0.getClickCount() == 2 && uniList.getSelectedValue() != null) {
              requestServerSelection();
            }
          }
        });
    uniList.setCellRenderer(new UniCellListRenderer());
    uniList.setForeground(Template.COLOR_ACCENT);

    JScrollPane scrollPane = new JScrollPane(uniList);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setPreferredSize(new Dimension(PANEL_WIDTH, LIST_HEIGHT));

    panel.add(scrollPane);

    authorizeButton = new ModernButton(getLocalized(AUTHORIZE_BUTTON_NAME));
    authorizeButton.setPreferredSize(new Dimension(PANEL_WIDTH, 30));
    authorizeButton.setEnabled(false);
    authorizeButton.addActionListener(
        new ActionListener() {

          @Override
          public void actionPerformed(ActionEvent e) {
            requestServerSelection();
          }
        });

    panel.add(authorizeButton);

    return logger.exit(panel);
  }