[virtualcommons-svn] commit/irrigation: alllee: fixes issue 12 by adding a hodgepodge of focus list
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2012-02-15 23:02:31
|
1 new commit in irrigation: https://bitbucket.org/virtualcommons/irrigation/changeset/cc7d0ec0c80e/ changeset: cc7d0ec0c80e user: alllee date: 2012-02-16 00:02:11 summary: fixes issue 12 by adding a hodgepodge of focus listeners revisit when we have more time to see if there's a better solution to transfer focus affected #: 1 file diff -r b524f4437f6668bb504f4de4618cbb1c33703545 -r cc7d0ec0c80e657de7aa74599f017bfe7296a579 src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java --- a/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java +++ b/src/main/java/edu/asu/commons/irrigation/client/ChatPanel.java @@ -2,6 +2,8 @@ import java.awt.BorderLayout; import java.awt.Color; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.HashMap; @@ -40,7 +42,7 @@ */ @SuppressWarnings("serial") -public class ChatPanel extends JPanel { +public class ChatPanel extends JPanel implements FocusListener { private IrrigationClient irrigationClient; @@ -171,6 +173,10 @@ add(messageScrollPane, BorderLayout.CENTER); // add(participantButtonPanel, BorderLayout.EAST); add(textEntryPanel, BorderLayout.PAGE_END); + addFocusListener(this); + messageScrollPane.addFocusListener(this); + textEntryPanel.addFocusListener(this); + chatInstructionsPane.addFocusListener(this); } public void displayMessage(String chatHandle, String message) { @@ -209,4 +215,19 @@ chatField.requestFocusInWindow(); } + @Override + public void focusGained(FocusEvent e) { + if (e.getComponent().equals(chatField)) { + System.err.println("chat field got focus, not setting focus again"); + return; + } + System.err.println("gained focus, setting on chat field: " + e); + chatField.requestFocusInWindow(); + } + + @Override + public void focusLost(FocusEvent e) { + + } + } Repository URL: https://bitbucket.org/virtualcommons/irrigation/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |