tn5250j/src/org/tn5250j Gui5250Frame.java,1.28,1.29
Patrick Bielen <[email protected]> Thu, 03 Nov 2005 15:03:16 +0000
| Newsgroups | gmane.comp.java.tn5250j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tn5250j/tn5250j/src/org/tn5250j
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17296/src/org/tn5250j
Modified Files:
Gui5250Frame.java
Log Message:
Bug-fix : this fixes the bug related to the close of the last tab resulting in an error.
Index: Gui5250Frame.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Gui5250Frame.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** Gui5250Frame.java 8 Jul 2005 06:08:02 -0000 1.28
--- Gui5250Frame.java 3 Nov 2005 15:03:14 -0000 1.29
***************
*** 373,382 ****
targetSession.removeSessionListener(this);
targetSession.removeSessionJumpListener(this);
- int tabs = sessionPane.getTabCount();
sessionPane.remove(index);
! tabs--;
! if (tabs > 0 && index <= tabs) {
sessionPane.setSelectedIndex(index);
sessionPane.setForegroundAt(index,Color.blue);
--- 373,389 ----
targetSession.removeSessionListener(this);
targetSession.removeSessionJumpListener(this);
sessionPane.remove(index);
!
! // get the tab count to be used later
! int tabs = sessionPane.getTabCount();
+ // if the index removed is the same as the number of tabs
+ // we need to decrement the index offset or we will get
+ // an error because we went over the tab limit which starts
+ // at zero offset.
+ if (tabs == index)
+ index--;
! if (tabs > 0 && index < tabs) {
sessionPane.setSelectedIndex(index);
sessionPane.setForegroundAt(index,Color.blue);
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php