mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Memory work.
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@9265 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -29,12 +29,15 @@ import javax.swing.undo.UndoManager;
|
|||||||
*/
|
*/
|
||||||
public class ChatInputEditor extends ChatArea implements DocumentListener {
|
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.
|
* Creates a new Default ChatSendField.
|
||||||
*/
|
*/
|
||||||
public ChatInputEditor() {
|
public ChatInputEditor() {
|
||||||
|
undoManager = new UndoManager();
|
||||||
|
|
||||||
this.setDragEnabled(true);
|
this.setDragEnabled(true);
|
||||||
this.getDocument().addUndoableEditListener(undoManager);
|
this.getDocument().addUndoableEditListener(undoManager);
|
||||||
Action undo = new AbstractAction() {
|
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.registerKeyboardAction(undo, KeyStroke.getKeyStroke(KeyEvent.VK_Z, KeyEvent.CTRL_MASK), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
|
||||||
|
|
||||||
this.getDocument().addDocumentListener(this);
|
this.getDocument().addDocumentListener(this);
|
||||||
|
|
||||||
addMouseListener(this);
|
this.addMouseListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
@ -73,6 +78,7 @@ public class ChatInputEditor extends ChatArea implements DocumentListener {
|
|||||||
this.getDocument().removeDocumentListener(this);
|
this.getDocument().removeDocumentListener(this);
|
||||||
this.getDocument().removeUndoableEditListener(undoManager);
|
this.getDocument().removeUndoableEditListener(undoManager);
|
||||||
this.removeMouseListener(this);
|
this.removeMouseListener(this);
|
||||||
|
this.getInputMap().remove(keyStroke);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -133,7 +133,8 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
|||||||
|
|
||||||
transcriptWindow.addMouseListener(transcriptWindowMouseListener);
|
transcriptWindow.addMouseListener(transcriptWindowMouseListener);
|
||||||
|
|
||||||
chatAreaButton = new ChatAreaSendField(SparkRes.getString(SparkRes.SEND)) {
|
chatAreaButton = new ChatAreaSendField(SparkRes.getString(SparkRes.SEND));
|
||||||
|
/*{
|
||||||
public Dimension getPreferredSize() {
|
public Dimension getPreferredSize() {
|
||||||
Dimension dim = super.getPreferredSize();
|
Dimension dim = super.getPreferredSize();
|
||||||
|
|
||||||
@ -146,6 +147,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
|||||||
return dim;
|
return dim;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
textScroller = new JScrollPane(transcriptWindow);
|
textScroller = new JScrollPane(transcriptWindow);
|
||||||
@ -621,6 +623,7 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
|||||||
|
|
||||||
getChatInputEditor().getActionMap().remove("closeTheRoom");
|
getChatInputEditor().getActionMap().remove("closeTheRoom");
|
||||||
chatAreaButton.getButton().removeActionListener(this);
|
chatAreaButton.getButton().removeActionListener(this);
|
||||||
|
bottomPanel.remove(chatAreaButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user