From: Jim Procter Date: Tue, 4 Jun 2013 10:50:19 +0000 (+0100) Subject: JAL-1307 patch to squash number format exceptions when pressing return X-Git-Tag: Jalview_2_9~248^2~6 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fc853e3c385e32591ceac07070d37932fcf87941;p=jalview.git JAL-1307 patch to squash number format exceptions when pressing return --- diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index 5238750..ac01e2f 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -342,31 +342,35 @@ public class SeqPanel extends Panel implements MouseMotionListener, keyboardNo1.append(value); } } - int getKeyboardNo1() { - if (keyboardNo1 == null) - return 1; - else + try { + if (keyboardNo1 != null) { int value = Integer.parseInt(keyboardNo1.toString()); keyboardNo1 = null; return value; } + } catch (Exception x) + {} + keyboardNo1 = null; + return 1; } int getKeyboardNo2() { - if (keyboardNo2 == null) - return 1; - else - { + try { + if (keyboardNo2!=null){ int value = Integer.parseInt(keyboardNo2.toString()); keyboardNo2 = null; return value; } + } catch (Exception x) + {} + keyboardNo2 = null; + return 1; } - + void setStatusMessage(SequenceI sequence, int res, int seq) { StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: " diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 3095c47..9c3d557 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -518,26 +518,31 @@ public class SeqPanel extends JPanel implements MouseListener, int getKeyboardNo1() { - if (keyboardNo1 == null) - return 1; - else + try { + if (keyboardNo1 != null) { int value = Integer.parseInt(keyboardNo1.toString()); keyboardNo1 = null; return value; } + } catch (Exception x) + {} + keyboardNo1 = null; + return 1; } int getKeyboardNo2() { - if (keyboardNo2 == null) - return 1; - else - { + try { + if (keyboardNo2!=null){ int value = Integer.parseInt(keyboardNo2.toString()); keyboardNo2 = null; return value; } + } catch (Exception x) + {} + keyboardNo2 = null; + return 1; } /**