Beispiel #1
0
 public void closeNotification() {
   notificationPanel.closeNotification();
 }
Beispiel #2
0
  public MainForm() {
    GUIStandartOperations.FrameStartOperations(this);
    setSize(960, 610);
    setLocationRelativeTo(null);
    setLayout(null);

    addMouseListener(
        new MouseAdapter() {
          public void mouseReleased(MouseEvent e) {
            mouseDownCompCoords = null;
          }

          public void mousePressed(MouseEvent e) {
            mouseDownCompCoords = e.getPoint();
          }
        });

    addMouseMotionListener(
        new MouseAdapter() {
          public void mouseDragged(MouseEvent e) {
            Point currCoords = e.getLocationOnScreen();
            setLocation(currCoords.x - mouseDownCompCoords.x, currCoords.y - mouseDownCompCoords.y);
          }
        });

    dialogPanelArrayList = new ArrayList<>();
    dialogTabArrayList = new ArrayList<>();

    bigPanel = new JPanel(null);
    bigPanel.setSize(1300, 600);
    bigPanel.setOpaque(false);
    bigPanel.setBackground(new Color(0, 0, 0, 0));

    dialogTabsPanel = new JPanel(null);
    dialogTabsPanel.setBackground(new Color(0, 0, 0, 150));

    JPanel topPanel = new JPanel(null);
    topPanel.setBackground(new Color(0, 0, 0, 150));
    topPanel.setBounds(30, 20, 900, 65);
    topPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 0, Color.WHITE));
    bigPanel.add(topPanel);

    notificationPanel = new NotificationPanel();
    notificationPanel.setBounds(5, 0, 500, 65);
    notificationPanel.setBorder(null);
    topPanel.add(notificationPanel);

    RepaintPanel repaintPanel = new RepaintPanel(notificationPanel);
    Thread thread = new Thread(repaintPanel);
    thread.start();

    RepaintPanel repaintPanel2 = new RepaintPanel(bigPanel);
    Thread thread2 = new Thread(repaintPanel2);
    thread2.start();

    changeAccButton =
        GUIStandartOperations.ButtonStartOperations(
            changeAccButIcon, changeAccButIconEntered, true);
    settingsButton =
        GUIStandartOperations.ButtonStartOperations(settingsButIcon, settingsButIconEntered, true);
    contactsButton =
        GUIStandartOperations.ButtonStartOperations(contactsButIcon, contactsButIconEntered, true);
    exitButton = GUIStandartOperations.ButtonStartOperations(exitButIcon, exitButIconEntered, true);
    plusButton = GUIStandartOperations.ButtonStartOperations(plusButIcon, plusButIconEntered, true);
    homeButton =
        GUIStandartOperations.ButtonStartOperations(dialogButIcon, dialogButIconEntered, true);

    changeAccButton.setToolTipText("Change account");
    settingsButton.setToolTipText("Your personal settings");
    contactsButton.setToolTipText("Contacts");
    exitButton.setToolTipText("Exit ChatApp");
    homeButton.setToolTipText("Dialog page / Home");

    friendPanelButton = new JButton();
    friendPanelButton.setOpaque(false);
    friendPanelButton.setBorder(null);
    friendPanelButton.setFocusPainted(false);
    friendPanelButton.setContentAreaFilled(false);
    friendPanelButton.setIcon(friendSideOpenIcon);
    friendPanelButton.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseEntered(MouseEvent e) {
            friendPanelButton.setIcon(friendSideOpenIconEntered);
          }

          @Override
          public void mouseExited(MouseEvent e) {
            friendPanelButton.setIcon(friendSideOpenIcon);
          }
        });

    friendPanelButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            isFriendPanelOpened = !isFriendPanelOpened;
            friendPanelMode();
          }
        });

    friendSidePanel = new FriendSidePanel();
    friendSidePanel.setBorder(null);
    friendSidePanel.setBounds(970, 50, 450, 650);
    bigPanel.add(friendSidePanel);

    noConversationsPanel = new JPanel(null);
    noConversationsPanel.setOpaque(false);
    noConversationsPanel.setBackground(new Color(0, 0, 0, 0));
    noConversationsPanel.setBounds(0, 0, 960, 600);
    JLabel noConversationLabel = new JLabel("You have no active conversations now...");
    noConversationLabel.setFont(Fonts.nickFont);
    noConversationLabel.setHorizontalAlignment(SwingConstants.CENTER);
    noConversationLabel.setForeground(Color.WHITE);
    noConversationLabel.setBackground(new Color(0, 0, 0, 0));
    noConversationLabel.setBounds(0, 300, 960, 50);

    JButton noConversationsButton = GUIStandartOperations.ButtonStartOperations(null, null, false);
    noConversationsButton.setText("<HTML><U>It's time to begin, isn't it?</U></HTML>");
    noConversationsButton.setFont(Fonts.nickFont);
    noConversationsButton.setBounds(0, 350, 960, 50);
    noConversationsButton.setHorizontalAlignment(SwingConstants.CENTER);
    noConversationsButton.setForeground(Color.RED);
    noConversationsButton.addActionListener(
        new AbstractAction() {
          @Override
          public void actionPerformed(ActionEvent e) {
            isFriendPanelOpened = true;
            friendPanelMode();
          }
        });

    noConversationsPanel.add(noConversationsButton);
    noConversationsPanel.add(noConversationLabel);
    noConversationsPanel.setVisible(false);

    final int shiftRight = 90;

    changeAccButton.setBounds(420 + shiftRight, 6, 64, 64);
    topPanel.add(changeAccButton);
    homeButton.setBounds(550 + shiftRight, 6, 64, 64);
    topPanel.add(homeButton);
    settingsButton.setBounds(650 + shiftRight, 0, 64, 64);
    topPanel.add(settingsButton);
    contactsButton.setBounds(600 + shiftRight, 0, 64, 64);
    topPanel.add(contactsButton);
    exitButton.setBounds(470 + shiftRight, 0, 64, 64);
    topPanel.add(exitButton);
    friendPanelButton.setBounds(730 + shiftRight, 6, 64, 64);
    topPanel.add(friendPanelButton);

    friendPanelButton.setVisible(false);

    homePanel = new HomePanel();
    homePanel.setBounds(0, 84, 960, 1000);

    dialogTabsPanel.setBounds(30, 100, 900, 40);
    dialogTabsPanel.setVisible(false);

    bigPanel.add(dialogTabsPanel);
    bigPanel.add(homePanel);
    bigPanel.add(noConversationsPanel);

    this.add(bigPanel);

    exitButton.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });
  }
Beispiel #3
0
 public void addNotificationPanel(Notification notification) {
   notificationPanel.addNotification(notification);
 }