java Class.forName("javax.swing.UIManager");
java new JList()
java new JPanel()
java new JButton("Add")
java new JButton("Remove")
java new JScrollPane() java -8408366249101913307L
java addContactBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { notifyAddClicked(); } }); removeContactBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { notifyRemoveClicked(); } }); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { notifyContactAction(); } } }); list.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_SPACE : case KeyEvent.VK_ENTER : notifyContactAction(); break; } } }); list.setModel(listModel); list.setCellRenderer(new SwingContactCellRenderer()); setLayout(new BorderLayout()); listScroll.getViewport().setView(list); add(listScroll, BorderLayout.CENTER); btnPanel.setLayout(new FlowLayout()); btnPanel.add(addContactBtn); btnPanel.add(removeContactBtn); add(btnPanel, BorderLayout.SOUTH); im.InstantMessagingClient.getInstance().setLayout(new BorderLayout()); im.InstantMessagingClient.getInstance().add(this, BorderLayout.CENTER);
java listModel.insertElementAt(c, index);
java listModel.remove(index);
java return list.getSelectedIndex();
java for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) { ((ContactListViewListener) ls.nextElement()).onContactListAdd(); }
java for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) { ((ContactListViewListener) ls.nextElement()).onContactListRemove(); }
java for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) { ((ContactListViewListener) ls.nextElement()).onContactListAction(); }
java new JPanel()
java new JPanel()
java new JTextPane()
java new JTextField()
java new JButton("Send")
java new JScrollPane() java -3797649023891518661L
java addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { notifyClose(); } }); sendBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { notifySendClicked(); } }); messageField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { notifySendClicked(); } }); setTitle("Message"); getContentPane().setLayout(new BorderLayout()); textConvField.setEditable(false); textConvScroll.setPreferredSize(new Dimension(500, 300)); textConvScroll.getViewport().setView(textConvField); convPanel.setLayout(new BorderLayout()); convPanel.add(textConvScroll, BorderLayout.CENTER); getContentPane().add(convPanel, BorderLayout.CENTER); btnPanel.setLayout(new BorderLayout()); btnPanel.add(sendBtn, BorderLayout.EAST); btnPanel.add(messageField, BorderLayout.CENTER); getContentPane().add(btnPanel, BorderLayout.SOUTH); pack(); setVisible(true); messageField.requestFocus();
java return messageField.getText();
java if (c instanceof String) { textConvField .setText(textConvField.getText() + c.toString() + "\n"); } else if (c instanceof Image) { Image im = (Image) c; convPanel.setSize(im.getWidth(convPanel), im.getHeight(convPanel)); Graphics g = convPanel.getGraphics(); g.drawImage(im, 1, 1, convPanel); g.finalize(); }
java if (!isShowing() && visible) { pop(); } super.setVisible(visible);
java try { im.InstantMessagingClient.getInstance().play( getClass().getResource("pop.wav")); } catch (Exception e) { //some VMs may not support this }
java for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) { ((ConversationViewListener) ls.nextElement()).onConversationClose(); } setVisible(false);
java for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) { ((ConversationViewListener) ls.nextElement()).onConversationSend(); } messageField.setText("");
java new JPanel()
java new JPanel()
java new JButton("OK")
java new JButton("Cancel")
java new JLabel("User ID")
java new JLabel("Name")
java new JTextField()
java new JTextField()
java new JLabel("Network")
java new JComboBox()
java new JLabel("Password")
java new JPasswordField()
java this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); okBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onOk(); } }); setTitle("Add new contact"); getContentPane().setLayout(new BorderLayout()); dlgPanel.setLayout(new GridLayout(4, 2)); dlgPanel.add(network); dlgPanel.add(networkField); dlgPanel.add(uid); dlgPanel.add(uidField); dlgPanel.add(name); dlgPanel.add(nameField); dlgPanel.add(password); dlgPanel.add(passwordField); getContentPane().add(dlgPanel, BorderLayout.CENTER); btnPanel.setLayout(new FlowLayout()); btnPanel.add(okBtn); btnPanel.add(cancelBtn); getContentPane().add(btnPanel, BorderLayout.SOUTH); pack(); setVisible(true);
java return uidField.getText();
java return nameField.getText();
java return networkField.getSelectedIndex();
java return new String(passwordField.getPassword());
java networkField.addItem(new Object() { public String toString() { return n; } });
java setVisible(false); notifyListeners(true);
java setVisible(false); notifyListeners(false);
java for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) { ((NewContactDialogListener) ls.nextElement()) .onNewContactDialogClose(okClicked, this); }
java -6601853458540392600L java super(); this.setBorder(new EmptyBorder(vgap, hgap, vgap, hgap)); java String s = value.toString(); setText(s); if (value instanceof Contact) { String status = ((Contact) value).getStatus(); setIcon(getStatusIcon(status)); } if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } setEnabled(list.isEnabled()); setFont(list.getFont()); setOpaque(true); return this; java final URL iconURL; if (status != null) { if (status.equals("away")) { iconURL = SwingContactCellRenderer.class .getResource("away.png"); } else if (status.equals("dnd")) { iconURL = SwingContactCellRenderer.class .getResource("busy.png"); } else if (status.equals("xa")) { iconURL = SwingContactCellRenderer.class .getResource("extended-away.png"); } else if (status.equals("offline")) { iconURL = SwingContactCellRenderer.class .getResource("offline.png"); } else { iconURL = SwingContactCellRenderer.class .getResource("available.png"); } } else { iconURL = SwingContactCellRenderer.class.getResource("offline.png"); } final im.InstantMessagingClient imc = im.InstantMessagingClient .getInstance(); try { return new ImageIcon(iconURL); } catch (Exception e) { imc.report(e); } return null;