Memory work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@9265 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-10-02 20:36:24 +00:00
committed by derek
parent 4eac4d1ed6
commit ad6ff6c78c
2 changed files with 13 additions and 4 deletions

View File

@ -29,12 +29,15 @@ import javax.swing.undo.UndoManager;
*/
public class ChatInputEditor extends ChatArea implements DocumentListener {
private final UndoManager undoManager = new UndoManager();
private final UndoManager undoManager;
private KeyStroke keyStroke;
/**
* Creates a new Default ChatSendField.
*/
public ChatInputEditor() {
undoManager = new UndoManager();
this.setDragEnabled(true);
this.getDocument().addUndoableEditListener(undoManager);
Action undo = new AbstractAction() {
@ -43,12 +46,14 @@ public class ChatInputEditor extends ChatArea implements DocumentListener {
}
};
this.getInputMap().put(KeyStroke.getKeyStroke('z', ActionEvent.CTRL_MASK), "undo");
keyStroke = KeyStroke.getKeyStroke('z', ActionEvent.CTRL_MASK);
this.getInputMap().put(keyStroke, "undo");
this.registerKeyboardAction(undo, KeyStroke.getKeyStroke(KeyEvent.VK_Z, KeyEvent.CTRL_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
this.getDocument().addDocumentListener(this);
addMouseListener(this);
this.addMouseListener(this);
}
public void insertUpdate(DocumentEvent e) {
@ -73,6 +78,7 @@ public class ChatInputEditor extends ChatArea implements DocumentListener {
this.getDocument().removeDocumentListener(this);
this.getDocument().removeUndoableEditListener(undoManager);
this.removeMouseListener(this);
this.getInputMap().remove(keyStroke);
}
/**

View File

@ -133,7 +133,8 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
transcriptWindow.addMouseListener(transcriptWindowMouseListener);
chatAreaButton = new ChatAreaSendField(SparkRes.getString(SparkRes.SEND)) {
chatAreaButton = new ChatAreaSendField(SparkRes.getString(SparkRes.SEND));
/*{
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
@ -146,6 +147,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
return dim;
}
};
*/
textScroller = new JScrollPane(transcriptWindow);
@ -621,6 +623,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
getChatInputEditor().getActionMap().remove("closeTheRoom");
chatAreaButton.getButton().removeActionListener(this);
bottomPanel.remove(chatAreaButton);
}
/**