Fix drop of files in the conversation area of the chat window.

cusax-fix
Yana Stamcheva 17 years ago
parent 93ae797ebf
commit fe3fdbff99

@ -760,11 +760,11 @@ else if (e.getEventType() == HyperlinkEvent.EventType.EXITED)
}
/**
* Returns the editor of this conversation panel.
* Returns the text pane of this conversation panel.
*
* @return The editor of this conversation panel.
* @return The text pane of this conversation panel.
*/
public JEditorPane getChatEditorPane()
public JTextPane getChatTextPane()
{
return chatTextPane;
}

@ -118,7 +118,7 @@ public ChatPanel(ChatWindow chatWindow)
this.conversationPanel = new ChatConversationPanel(this);
this.conversationPanel.setPreferredSize(new Dimension(400, 200));
this.conversationPanel.getChatEditorPane()
this.conversationPanel.getChatTextPane()
.setTransferHandler(new ChatTransferHandler(this));
this.sendPanel = new ChatSendPanel(this);
@ -397,7 +397,7 @@ public void setCaretToEnd()
= getChatConversationPanel();
HTMLDocument doc = (HTMLDocument) chatConversationPanel
.getChatEditorPane().getDocument();
.getChatTextPane().getDocument();
Element root = doc.getDefaultRootElement();
@ -683,14 +683,14 @@ public void cut(){
* conversation panel content to the clipboard.
*/
public void copy(){
JEditorPane editorPane = this.conversationPanel.getChatEditorPane();
JTextComponent textPane = this.conversationPanel.getChatTextPane();
if (editorPane.getSelectedText() == null)
if (textPane.getSelectedText() == null)
{
editorPane = this.writeMessagePanel.getEditorPane();
textPane = this.writeMessagePanel.getEditorPane();
}
editorPane.copy();
textPane.copy();
}
/**

@ -87,18 +87,21 @@ public boolean canImport(JComponent comp, DataFlavor flavor[])
{
JTextComponent c = (JTextComponent)comp;
if (!(c.isEditable() && c.isEnabled()))
{
return false;
}
for (int i = 0, n = flavor.length; i < n; i++)
{
if (flavor[i].equals(DataFlavor.javaFileListFlavor)
|| flavor[i].equals(DataFlavor.stringFlavor))
if (flavor[i].equals(DataFlavor.javaFileListFlavor))
{
return true;
}
else if (flavor[i].equals(DataFlavor.stringFlavor))
{
if (c.isEditable() && c.isEnabled())
{
return true;
}
return false;
}
}
return false;

Loading…
Cancel
Save