Revision: 470
http://svn.sourceforge.net/japi/?rev=470&view=rev
Author: christianhujer
Date: 2007-06-30 04:45:02 -0700 (Sat, 30 Jun 2007)
Log Message:
-----------
Minor improvements:
* Added missing javadoc comment.
* Added missing @Nullable / @NotNull annotations.
Modified Paths:
--------------
tools/keystrokes/trunk/src/net/sf/japi/tools/keystrokes/KeyStrokes.java
Modified: tools/keystrokes/trunk/src/net/sf/japi/tools/keystrokes/KeyStrokes.java
===================================================================
--- tools/keystrokes/trunk/src/net/sf/japi/tools/keystrokes/KeyStrokes.java 2007-06-30 11:43:33 UTC (rev 469)
+++ tools/keystrokes/trunk/src/net/sf/japi/tools/keystrokes/KeyStrokes.java 2007-06-30 11:45:02 UTC (rev 470)
@@ -42,6 +42,7 @@
import javax.swing.text.JTextComponent;
import net.sf.japi.swing.ActionFactory;
import net.sf.japi.swing.ActionMethod;
+import org.jetbrains.annotations.NotNull;
/** A small tool that displays the keystrokes while typing. */
public class KeyStrokes implements KeyListener {
@@ -59,6 +60,7 @@
private JTextField fieldTyped = new JTextField(" ");
/** The textarea for displaying the history of keystrokes. */
+ @SuppressWarnings({"MagicNumber"})
private JTextArea history = new JTextArea(20, 32);
/** The button for clearing. */
@@ -70,7 +72,7 @@
/** Main program.
* @param args command line arguments
*/
- public static void main(final String... args) {
+ public static void main(@NotNull final String... args) {
//noinspection ResultOfObjectAllocationIgnored
new KeyStrokes();
}
@@ -86,8 +88,10 @@
frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}
- /** Creates the content pane. */
- private Component createContentPane() {
+ /** Creates the content pane.
+ * @return The newly created content pane.
+ */
+ @NotNull private Component createContentPane() {
final JPanel contentPane = new JPanel(new GridBagLayout());
final Insets insets = new Insets(2, 2, 2, 2);
final GridBagConstraints labelGbc = new GridBagConstraints();
@@ -125,17 +129,17 @@
}
/** {@inheritDoc} */
- public void keyPressed(final KeyEvent e) {
+ public void keyPressed(@NotNull final KeyEvent e) {
recordEvent(fieldPressed, e);
}
/** {@inheritDoc} */
- public void keyReleased(final KeyEvent e) {
+ public void keyReleased(@NotNull final KeyEvent e) {
recordEvent(fieldReleased, e);
}
/** {@inheritDoc} */
- public void keyTyped(final KeyEvent e) {
+ public void keyTyped(@NotNull final KeyEvent e) {
recordEvent(fieldTyped, e);
}
@@ -143,7 +147,7 @@
* @param field Field to record at
* @param event KeyEvent to record
*/
- private void recordEvent(final JTextField field, final KeyEvent event) {
+ private void recordEvent(@NotNull final JTextField field, @NotNull final KeyEvent event) {
final String keyStrokeText = KeyStroke.getKeyStrokeForEvent(event).toString();
field.setEditable(true);
field.setText(keyStrokeText);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|