コード例 #1
0
  private void setupUsernameRequestView() {
    PANEL = new JPanel();
    PANEL.setBackground(Color.BLACK);
    userName = new CstmTextField("", "Enter your name");
    enter = new CstmButton("ENTER");
    userNameLabel = new CstmLabel("USER NAME", SwingConstants.CENTER);
    serverTalkLabel = new CstmLabel("", SwingConstants.CENTER);
    PANEL.setLayout(new BoxLayout(PANEL, BoxLayout.Y_AXIS));
    userName.setPreferredSize(new Dimension(200, 30));
    userName.setAlignmentX(Component.CENTER_ALIGNMENT);
    enter.setPreferredSize(new Dimension(200, 30));
    enter.setAlignmentX(Component.CENTER_ALIGNMENT);
    serverTalkLabel.setPreferredSize(new Dimension(450, 30));
    serverTalkLabel.setAlignmentX(Component.CENTER_ALIGNMENT);

    enter.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent e) {
            CHAT_CLIENT.chatNameRequest(userName.getText().trim());
          }
        });
    userNameLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
    PANEL.add(userNameLabel);
    PANEL.add(userName);
    PANEL.add(enter);
    PANEL.add(serverTalkLabel);
    Container container = getContentPane();
    container.setLayout(new GridBagLayout());
    container.add(PANEL, new GridBagConstraints());
    container.setBackground(Color.BLACK);
    pack();
    setVisible(true);
  }
コード例 #2
0
  private void setupConvoPanel() {
    convoPanel = new JPanel();
    convoPanel.setLayout(new BorderLayout());
    convoPanel.setBackground(BACKGROUND);
    convoList = new EntryPanel(this);
    convoList.PANEL.setBackground(BACKGROUND);
    convoList.PANEL.setForeground(new Color(255, 69, 0));

    convoList.enforceSingleSelection(true);

    convoControlPanel = new JPanel();
    convoTitle = new CstmTextField("", "Enter Convo Name");
    joinConvo = new CstmButton("JOIN", "Join Convo");
    joinConvo.addMouseListener(this);
    startConvo = new CstmButton("START", "Start Convo");
    startConvo.addMouseListener(this);
    convoControlPanel.setLayout(new BorderLayout());

    convoControlPanel.add(convoTitle, BorderLayout.CENTER);
    convoControlPanel.add(joinConvo, BorderLayout.WEST);
    convoControlPanel.add(startConvo, BorderLayout.EAST);

    convoListPane = new JScrollPane(convoList.PANEL);
    convoPanel.add(convoListPane, BorderLayout.CENTER);

    convoPanel.add(convoControlPanel, BorderLayout.SOUTH);
  }
コード例 #3
0
  private void setupChatPanel() {
    chatPanel = new JPanel();

    chatPanel.setLayout(new BorderLayout());
    chatPanel.setPreferredSize(new Dimension(400, 400));
    chatArea = new ChatArea();
    chat = new JPanel();
    chat.setLayout(new BorderLayout());
    chat.add(chatArea.SCROLL_PANE);

    chatInputPanel = new JPanel();
    chatInputPanel.setLayout(new BorderLayout());
    chatInputPanel.add(new UserInput(this));

    chatPanel.add(chat, BorderLayout.CENTER);
    chatPanel.add(chatInputPanel, BorderLayout.SOUTH);
  }
コード例 #4
0
  private void setupUserPanel() {
    userPanel = new JPanel();
    userPanel.setLayout(new BorderLayout());
    userPanel.setBackground(BACKGROUND);

    peepLists = new HashMap<String, EntryPanel>();
    peepListPane = new JScrollPane();

    userControlPanel = new JPanel();
    userControlPanel.setBackground(BACKGROUND);
    userControlPanel.setLayout(new BorderLayout());
    leaveConvo = new CstmButton("LEAVE", "Leave Convo");
    leaveConvo.addMouseListener(this);
    userControlPanel.add(leaveConvo, BorderLayout.CENTER);

    userPanel.add(peepListPane, BorderLayout.CENTER);
    userPanel.add(userControlPanel, BorderLayout.SOUTH);
  }