public void addUserStatusMessage( User source, Message message, MessageRow.Type type, TabAction action) { for (Tab tab : getItems()) { if (tab.getEntity().equals(source) || (tab.getEntity() instanceof Channel && ((Channel) tab.getEntity()).getUsers().contains(source))) { tab.getContentPane().getMessagePane().addRow(new MessageRow(message, type)); if (action != null) { action.process(tab); } } } }
public XmlTextPane() { XMLEditorKit kit = new XMLEditorKit(true, this); kit.setLineWrappingEnabled(false); kit.setStyle(XMLStyleConstants.ELEMENT_NAME, new Color(128, 0, 0), Font.PLAIN); kit.setStyle(XMLStyleConstants.ELEMENT_VALUE, new Color(0, 0, 0), Font.PLAIN); kit.setStyle(XMLStyleConstants.ELEMENT_PREFIX, new Color(128, 0, 0), Font.PLAIN); kit.setStyle(XMLStyleConstants.ATTRIBUTE_NAME, new Color(255, 0, 0), Font.PLAIN); kit.setStyle(XMLStyleConstants.ATTRIBUTE_VALUE, new Color(0, 0, 0), Font.PLAIN); kit.setStyle(XMLStyleConstants.ATTRIBUTE_PREFIX, new Color(128, 0, 0), Font.PLAIN); kit.setStyle(XMLStyleConstants.NAMESPACE_NAME, new Color(102, 102, 102), Font.PLAIN); kit.setStyle(XMLStyleConstants.NAMESPACE_VALUE, new Color(0, 51, 51), Font.PLAIN); kit.setStyle(XMLStyleConstants.NAMESPACE_PREFIX, new Color(102, 102, 102), Font.PLAIN); kit.setStyle(XMLStyleConstants.ENTITY, new Color(0, 0, 0), Font.PLAIN); kit.setStyle(XMLStyleConstants.COMMENT, new Color(153, 153, 153), Font.PLAIN); kit.setStyle(XMLStyleConstants.CDATA, new Color(0, 0, 0), Font.PLAIN); kit.setStyle(XMLStyleConstants.SPECIAL, new Color(0, 0, 0), Font.PLAIN); this.setEditorKit(kit); this.setFont(new Font("Monospaced", Font.PLAIN, 12)); this.registerKeyboardAction( shiftTabAction, KeyStroke.getKeyStroke(KeyEvent.VK_TAB, ActionEvent.SHIFT_MASK), JComponent.WHEN_FOCUSED); this.registerKeyboardAction( deleteLineAction, KeyStroke.getKeyStroke(KeyEvent.VK_Y, ActionEvent.CTRL_MASK), JComponent.WHEN_FOCUSED); ActionListener escAction = new ActionListener() { public void actionPerformed(ActionEvent e) { clearMarkerLine(); clearErrorLine(); } }; this.registerKeyboardAction( escAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_FOCUSED); this.getActionMap().put(tabAction.getValue(Action.NAME), tabAction); }