tn5250j/src/org/tn5250j GuiGraphicBuffer.java,1.37,1.38 Session5250.java,1.8,1.9 Gui5250Frame.java,1.26,1.27 RubberBandCanvasIF.java,1.1.1.1,1.2 ScanMulticaster.java,1.3,1.4 My5250App.java,1.23,1.24 BootStrapper.java,1.2,1.3 TN5250jConstants.java,1.57,1.58 OptionAccess.java,1.3,1.4 Gui5250.java,1.77,1.78 SessionConfig.java,1.14,1.15 GlobalConfigure.java,1.19,1.20 My5250.java,1.40,1.41 SessionScroller.java,1.6,1.7 KeyPad.java,1.3,1.4 SessionBean.java,1.5,1.6 SessionPopup.java,1.14,1.15 Gui5250SplitFrame.java,1.7,1.8 SessionAttributes.java,1.18,1.19 PrinterThread.java,1.16,1.17 SessionGUI.java,1.6,1.7 SessionScroller14.java,1.4,1.5 RubberBand.java,1.7,1.8 Gui5250MDIFrame.java,1.20,1.21

"Kenneth J. Pouncey" <[email protected]> Thu, 16 Jun 2005 04:41:19 +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-serv24279/src/org/tn5250j

Modified Files:
	GuiGraphicBuffer.java Session5250.java Gui5250Frame.java 
	RubberBandCanvasIF.java ScanMulticaster.java My5250App.java 
	BootStrapper.java TN5250jConstants.java OptionAccess.java 
	Gui5250.java SessionConfig.java GlobalConfigure.java 
	My5250.java SessionScroller.java KeyPad.java SessionBean.java 
	SessionPopup.java Gui5250SplitFrame.java 
	SessionAttributes.java PrinterThread.java SessionGUI.java 
	SessionScroller14.java RubberBand.java Gui5250MDIFrame.java 
Log Message:
the rest of the story

Index: BootStrapper.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/BootStrapper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BootStrapper.java	27 Apr 2002 10:47:31 -0000	1.2
--- BootStrapper.java	16 Jun 2005 04:41:17 -0000	1.3
***************
*** 1,108 ****
! package org.tn5250j;
! 
! import java.net.*;
! import java.io.*;
! import java.util.Vector;
! import org.tn5250j.event.*;
! 
! public class BootStrapper extends Thread {
! 
!    private Socket socket = null;
!    private ServerSocket serverSocket = null;
!    boolean listening = true;
!    private Vector listeners;
!    private BootEvent bootEvent;
! 
!    public BootStrapper() {
!       super("BootStrapper");
!       try {
!          serverSocket = new ServerSocket(3036);
!       }
!       catch (IOException e) {
!          System.err.println("Could not listen on port: 3036.");
!       }
! 
!    }
! 
!    public void run() {
! 
!       System.out.println("BootStrapper listening");
!       while (true) {
!          listen();
!          getNewSessionOptions();
!          System.out.println("got one");
!       }
! 
!    }
! 
!    /**
!     * Add a BootListener to the listener list.
!     *
!     * @param listener  The BootListener to be added
!     */
!    public synchronized void addBootListener(BootListener listener) {
! 
!       if (listeners == null) {
!           listeners = new java.util.Vector(3);
!       }
!       listeners.addElement(listener);
! 
!    }
! 
!    /**
!     * Notify all registered listeners of the BootEvent.
!     *
!     */
!    private void fireBootEvent() {
! 
!    	if (listeners != null) {
! 	      int size = listeners.size();
! 	      for (int i = 0; i < size; i++) {
! 	         BootListener target =
!                     (BootListener)listeners.elementAt(i);
! 	         target.bootOptionsReceived(bootEvent);
! 	      }
!    	}
!    }
! 
!    /**
!     * Listen for a connection from another tn5250j session starting.
!     */
!    private void listen() {
! 
!       try {
!          socket = serverSocket.accept();
!       }
!       catch (IOException ioe) {
!          System.out.println(this.getName() + ": " + ioe.getMessage());
!       }
! 
!    }
! 
!    /**
!     * Retrieve the boot options from the other JVM wanting to start a new
!     *    session.
!     */
!    private void getNewSessionOptions() {
! 
!       try {
! 
!          BufferedReader in = new BufferedReader(
!                               new InputStreamReader(
!                               socket.getInputStream()));
! 
!          bootEvent = new BootEvent(this,in.readLine());
! 
!          System.out.println(bootEvent.getNewSessionOptions());
!          fireBootEvent();
! 
!          in.close();
!          socket.close();
! 
!       }
!       catch (IOException e) {
!          e.printStackTrace();
!       }
! 
!    }
! }
--- 1,108 ----
! package org.tn5250j;
! 
! import java.net.*;
! import java.io.*;
! import java.util.Vector;
! import org.tn5250j.event.*;
! 
! public class BootStrapper extends Thread {
! 
!    private Socket socket = null;
!    private ServerSocket serverSocket = null;
!    boolean listening = true;
!    private Vector listeners;
!    private BootEvent bootEvent;
! 
!    public BootStrapper() {
!       super("BootStrapper");
!       try {
!          serverSocket = new ServerSocket(3036);
!       }
!       catch (IOException e) {
!          System.err.println("Could not listen on port: 3036.");
!       }
! 
!    }
! 
!    public void run() {
! 
!       System.out.println("BootStrapper listening");
!       while (true) {
!          listen();
!          getNewSessionOptions();
!          System.out.println("got one");
!       }
! 
!    }
! 
!    /**
!     * Add a BootListener to the listener list.
!     *
!     * @param listener  The BootListener to be added
!     */
!    public synchronized void addBootListener(BootListener listener) {
! 
!       if (listeners == null) {
!           listeners = new java.util.Vector(3);
!       }
!       listeners.addElement(listener);
! 
!    }
! 
!    /**
!     * Notify all registered listeners of the BootEvent.
!     *
!     */
!    private void fireBootEvent() {
! 
!    	if (listeners != null) {
! 	      int size = listeners.size();
! 	      for (int i = 0; i < size; i++) {
! 	         BootListener target =
!                     (BootListener)listeners.elementAt(i);
! 	         target.bootOptionsReceived(bootEvent);
! 	      }
!    	}
!    }
! 
!    /**
!     * Listen for a connection from another tn5250j session starting.
!     */
!    private void listen() {
! 
!       try {
!          socket = serverSocket.accept();
!       }
!       catch (IOException ioe) {
!          System.out.println(this.getName() + ": " + ioe.getMessage());
!       }
! 
!    }
! 
!    /**
!     * Retrieve the boot options from the other JVM wanting to start a new
!     *    session.
!     */
!    private void getNewSessionOptions() {
! 
!       try {
! 
!          BufferedReader in = new BufferedReader(
!                               new InputStreamReader(
!                               socket.getInputStream()));
! 
!          bootEvent = new BootEvent(this,in.readLine());
! 
!          System.out.println(bootEvent.getNewSessionOptions());
!          fireBootEvent();
! 
!          in.close();
!          socket.close();
! 
!       }
!       catch (IOException e) {
!          e.printStackTrace();
!       }
! 
!    }
! }

Index: My5250App.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/My5250App.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** My5250App.java	8 Jun 2005 19:32:49 -0000	1.23
--- My5250App.java	16 Jun 2005 04:41:17 -0000	1.24
***************
*** 1,178 ****
! package org.tn5250j;
! 
! import java.awt.*;
! import javax.swing.*;
! import java.util.*;
! 
! import org.tn5250j.tools.logging.*;
! import org.tn5250j.tools.LangTool;
! import org.tn5250j.gui.TN5250jSecurityAccessDialog;
! import org.tn5250j.framework.common.*;
! 
! //import org.tn5250j.swing.JTerminal;
! 
! public class My5250App extends JApplet implements TN5250jConstants {
!    boolean isStandalone = true;
!    private SessionManager manager;
! 
!    private TN5250jLogger log;
! 
!    /**Get a parameter value*/
!    public String getParameter(String key, String def) {
! 
!       return isStandalone ? System.getProperty(key, def) :
!          (getParameter(key) != null ? getParameter(key) : def);
!    }
! 
!    /**Construct the applet*/
!    public My5250App() {
! 
!    }
!    /**Initialize the applet*/
!    public void init() {
!       try {
!          jbInit();
!       }
!       catch(Exception e) {
!       	if (log == null)
!             System.out.println(e.getMessage());
!          else
!          	log.warn("In constructor: ", e);
!       }
!    }
! 
!    /**Component initialization*/
!    private void jbInit() throws Exception {
!       this.setSize(new Dimension(400,300));
! 
!       if (isSpecified("-L"))
!       	LangTool.init(parseLocale(getParameter("-L")));
!       else
!       	LangTool.init();
! 
!      //Let's check some permissions
!      try {
!         System.getProperty(".java.policy");
!      }
!      catch (SecurityException e) {
!         e.printStackTrace();
!         TN5250jSecurityAccessDialog.showErrorMessage(e);
!         return;
!      }
!      log = TN5250jLogFactory.getLogger (this.getClass());
! 
!       Properties sesProps = new Properties();
!       log.info(" We have loaded a new one");
! 
!       // Start loading properties - Host must exist
!       sesProps.put(SESSION_HOST,getParameter("host"));
! 
!       if (isSpecified("-e"))
!          sesProps.put(SESSION_TN_ENHANCED,"1");
! 
!       if (isSpecified("-p")) {
!          sesProps.put(SESSION_HOST_PORT,getParameter("-p"));
!       }
! 
! //      if (isSpecified("-f",args))
! //         propFileName = getParm("-f",args);
! 
!       if (isSpecified("-cp"))
!          sesProps.put(SESSION_CODE_PAGE ,getParameter("-cp"));
! 
!       if (isSpecified("-gui"))
!          sesProps.put(SESSION_USE_GUI,"1");
! 
!       if (isSpecified("-132"))
!          sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR);
!       else
!          sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR);
! 
!       // socks proxy host argument
!       if (isSpecified("-sph")) {
!          sesProps.put(SESSION_PROXY_HOST ,getParameter("-sph"));
!       }
! 
!       // socks proxy port argument
!       if (isSpecified("-spp"))
!          sesProps.put(SESSION_PROXY_PORT ,getParameter("-spp"));
! 
!       // check if device name is specified
!       if (isSpecified("-dn"))
!          sesProps.put(SESSION_DEVICE_NAME ,getParameter("-dn"));
! 
!       loadSystemProperty("SESSION_CONNECT_USER");
!       loadSystemProperty("SESSION_CONNECT_PASSWORD");
!       loadSystemProperty("SESSION_CONNECT_PROGRAM");
!       loadSystemProperty("SESSION_CONNECT_LIBRARY");
!       loadSystemProperty("SESSION_CONNECT_MENU");
! 
!       manager = SessionManager.instance();
!       final Session5250 s = manager.openSession(sesProps,"","Test Applet");
!       final SessionGUI gui = new SessionGUI(s);
! //      final JTerminal jt = new JTerminal(s);
! 
!       this.getContentPane().add(gui);
! 
!       s.connect();
!       SwingUtilities.invokeLater(new Runnable() {
!          public void run() {
! //            jt.grabFocus();
!             gui.grabFocus();
!          }
!       });
! 
!    }
! 
!    private void loadSystemProperty(String param) {
! 
!       if (isSpecified(param))
!          System.getProperties().put(param,getParameter(param));
! 
!    }
! 
!    /**Get Applet information*/
!    public String getAppletInfo() {
!       return "tn5250j - " + tn5250jRelease + tn5250jVersion + tn5250jSubVer + " - Jave tn5250 Client";
!    }
! 
!    /**Get parameter info*/
!    public String[][] getParameterInfo() {
!       return null;
!    }
! 
!    /**
!     * Tests if a parameter was specified or not.
!     */
!    private boolean isSpecified(String parm) {
! 
!       if (getParameter(parm) != null) {
!          log.info("Parameter " + parm + " is specified as: " + getParameter(parm));
!          return true;
!       }
!       return false;
!    }
! 
!    /**
!     * Returns a local specified by the string localString
!     */
!    protected static Locale parseLocale(String localString) {
!       int x = 0;
!       String[] s = {"","",""};
!       StringTokenizer tokenizer = new StringTokenizer(localString, "_");
!       while (tokenizer.hasMoreTokens()) {
!          s[x++] = tokenizer.nextToken();
!       }
!       return new Locale(s[0],s[1],s[2]);
!    }
! 
!    //static initializer for setting look & feel
!    static {
!       try {
!          //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
!          //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
!       }
!       catch(Exception e) {
!       }
!    }
  }
\ No newline at end of file
--- 1,178 ----
! package org.tn5250j;
! 
! import java.awt.*;
! import javax.swing.*;
! import java.util.*;
! 
! import org.tn5250j.tools.logging.*;
! import org.tn5250j.tools.LangTool;
! import org.tn5250j.gui.TN5250jSecurityAccessDialog;
! import org.tn5250j.framework.common.*;
! 
! //import org.tn5250j.swing.JTerminal;
! 
! public class My5250App extends JApplet implements TN5250jConstants {
!    boolean isStandalone = true;
!    private SessionManager manager;
! 
!    private TN5250jLogger log;
! 
!    /**Get a parameter value*/
!    public String getParameter(String key, String def) {
! 
!       return isStandalone ? System.getProperty(key, def) :
!          (getParameter(key) != null ? getParameter(key) : def);
!    }
! 
!    /**Construct the applet*/
!    public My5250App() {
! 
!    }
!    /**Initialize the applet*/
!    public void init() {
!       try {
!          jbInit();
!       }
!       catch(Exception e) {
!       	if (log == null)
!             System.out.println(e.getMessage());
!          else
!          	log.warn("In constructor: ", e);
!       }
!    }
! 
!    /**Component initialization*/
!    private void jbInit() throws Exception {
!       this.setSize(new Dimension(400,300));
! 
!       if (isSpecified("-L"))
!       	LangTool.init(parseLocale(getParameter("-L")));
!       else
!       	LangTool.init();
! 
!      //Let's check some permissions
!      try {
!         System.getProperty(".java.policy");
!      }
!      catch (SecurityException e) {
!         e.printStackTrace();
!         TN5250jSecurityAccessDialog.showErrorMessage(e);
!         return;
!      }
!      log = TN5250jLogFactory.getLogger (this.getClass());
! 
!       Properties sesProps = new Properties();
!       log.info(" We have loaded a new one");
! 
!       // Start loading properties - Host must exist
!       sesProps.put(SESSION_HOST,getParameter("host"));
! 
!       if (isSpecified("-e"))
!          sesProps.put(SESSION_TN_ENHANCED,"1");
! 
!       if (isSpecified("-p")) {
!          sesProps.put(SESSION_HOST_PORT,getParameter("-p"));
!       }
! 
! //      if (isSpecified("-f",args))
! //         propFileName = getParm("-f",args);
! 
!       if (isSpecified("-cp"))
!          sesProps.put(SESSION_CODE_PAGE ,getParameter("-cp"));
! 
!       if (isSpecified("-gui"))
!          sesProps.put(SESSION_USE_GUI,"1");
! 
!       if (isSpecified("-132"))
!          sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_27X132_STR);
!       else
!          sesProps.put(SESSION_SCREEN_SIZE,SCREEN_SIZE_24X80_STR);
! 
!       // socks proxy host argument
!       if (isSpecified("-sph")) {
!          sesProps.put(SESSION_PROXY_HOST ,getParameter("-sph"));
!       }
! 
!       // socks proxy port argument
!       if (isSpecified("-spp"))
!          sesProps.put(SESSION_PROXY_PORT ,getParameter("-spp"));
! 
!       // check if device name is specified
!       if (isSpecified("-dn"))
!          sesProps.put(SESSION_DEVICE_NAME ,getParameter("-dn"));
! 
!       loadSystemProperty("SESSION_CONNECT_USER");
!       loadSystemProperty("SESSION_CONNECT_PASSWORD");
!       loadSystemProperty("SESSION_CONNECT_PROGRAM");
!       loadSystemProperty("SESSION_CONNECT_LIBRARY");
!       loadSystemProperty("SESSION_CONNECT_MENU");
! 
!       manager = SessionManager.instance();
!       final Session5250 s = manager.openSession(sesProps,"","Test Applet");
!       final SessionGUI gui = new SessionGUI(s);
! //      final JTerminal jt = new JTerminal(s);
! 
!       this.getContentPane().add(gui);
! 
!       s.connect();
!       SwingUtilities.invokeLater(new Runnable() {
!          public void run() {
! //            jt.grabFocus();
!             gui.grabFocus();
!          }
!       });
! 
!    }
! 
!    private void loadSystemProperty(String param) {
! 
!       if (isSpecified(param))
!          System.getProperties().put(param,getParameter(param));
! 
!    }
! 
!    /**Get Applet information*/
!    public String getAppletInfo() {
!       return "tn5250j - " + tn5250jRelease + tn5250jVersion + tn5250jSubVer + " - Jave tn5250 Client";
!    }
! 
!    /**Get parameter info*/
!    public String[][] getParameterInfo() {
!       return null;
!    }
! 
!    /**
!     * Tests if a parameter was specified or not.
!     */
!    private boolean isSpecified(String parm) {
! 
!       if (getParameter(parm) != null) {
!          log.info("Parameter " + parm + " is specified as: " + getParameter(parm));
!          return true;
!       }
!       return false;
!    }
! 
!    /**
!     * Returns a local specified by the string localString
!     */
!    protected static Locale parseLocale(String localString) {
!       int x = 0;
!       String[] s = {"","",""};
!       StringTokenizer tokenizer = new StringTokenizer(localString, "_");
!       while (tokenizer.hasMoreTokens()) {
!          s[x++] = tokenizer.nextToken();
!       }
!       return new Locale(s[0],s[1],s[2]);
!    }
! 
!    //static initializer for setting look & feel
!    static {
!       try {
!          //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
!          //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
!       }
!       catch(Exception e) {
!       }
!    }
  }
\ No newline at end of file

Index: SessionPopup.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionPopup.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** SessionPopup.java	8 Jun 2005 19:32:49 -0000	1.14
--- SessionPopup.java	16 Jun 2005 04:41:17 -0000	1.15
***************
*** 1,755 ****
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
[...1481 lines suppressed...]
!          // lets set this puppy up to connect within its own thread
!          Runnable connectIt = new Runnable() {
!             public void run() {
!                vt.connect();
!             }
! 
!            };
! 
!          // now lets set it to connect within its own daemon thread
!          //    this seems to work better and is more responsive than using
!          //    swingutilities's invokelater
!          Thread ct = new Thread(connectIt);
!          ct.setDaemon(true);
!          ct.start();
! 
!       }
! 
!    }
! 
! }

Index: ScanMulticaster.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/ScanMulticaster.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ScanMulticaster.java	26 Jun 2004 13:14:43 -0000	1.3
--- ScanMulticaster.java	16 Jun 2005 04:41:17 -0000	1.4
***************
*** 1,66 ****
! package org.tn5250j;
! 
! import org.tn5250j.interfaces.ScanListener;
! 
! public class ScanMulticaster implements ScanListener
! {
!   public static ScanListener add(ScanListener a, ScanListener b)
!   {
!     if (a == null)  return b;
!     if (b == null)  return a;
! 
!     return new ScanMulticaster(a, b);
!   }
! 
!   public static ScanListener remove(ScanListener l, ScanListener oldl)
!   {
!     return removeInternal(l, oldl);
!   }
! 
!   protected static ScanListener removeInternal(ScanListener l, ScanListener oldl)
!   {
!     if (l == null || l == oldl)
!     {
!     return null;
!     }
!     else if (l instanceof ScanMulticaster)
!     {
!       return ((ScanMulticaster)l).remove(oldl);
!     }
!     else
!     {
!       return l; // it's not here
!     }
!   }
! 
!   public ScanMulticaster(ScanListener a, ScanListener b)
!   {
!     this.a = a;
!     this.b = b;
!   }
! 
!   public void scanned(String command, String remainder)
!   {
!     a.scanned(command, remainder);
!     b.scanned(command, remainder);
!   }
! 
!   protected ScanListener remove(ScanListener old)
!   {
!     if (old == a)  return b;
!     if (old == b)  return a;
! 
!     ScanListener a2 = removeInternal(a, old);
!     ScanListener b2 = removeInternal(b, old);
! 
!     if (a2 == a && b2 == b)
!     {
!       return this; // it's not here
!     }
! 
!     return removeInternal(a2, b2);
!     }
! 
!   private ScanListener a; // = null;
!   private ScanListener b; // = null;
  }
\ No newline at end of file
--- 1,66 ----
! package org.tn5250j;
! 
! import org.tn5250j.interfaces.ScanListener;
! 
! public class ScanMulticaster implements ScanListener
! {
!   public static ScanListener add(ScanListener a, ScanListener b)
!   {
!     if (a == null)  return b;
!     if (b == null)  return a;
! 
!     return new ScanMulticaster(a, b);
!   }
! 
!   public static ScanListener remove(ScanListener l, ScanListener oldl)
!   {
!     return removeInternal(l, oldl);
!   }
! 
!   protected static ScanListener removeInternal(ScanListener l, ScanListener oldl)
!   {
!     if (l == null || l == oldl)
!     {
!     return null;
!     }
!     else if (l instanceof ScanMulticaster)
!     {
!       return ((ScanMulticaster)l).remove(oldl);
!     }
!     else
!     {
!       return l; // it's not here
!     }
!   }
! 
!   public ScanMulticaster(ScanListener a, ScanListener b)
!   {
!     this.a = a;
!     this.b = b;
!   }
! 
!   public void scanned(String command, String remainder)
!   {
!     a.scanned(command, remainder);
!     b.scanned(command, remainder);
!   }
! 
!   protected ScanListener remove(ScanListener old)
!   {
!     if (old == a)  return b;
!     if (old == b)  return a;
! 
!     ScanListener a2 = removeInternal(a, old);
!     ScanListener b2 = removeInternal(b, old);
! 
!     if (a2 == a && b2 == b)
!     {
!       return this; // it's not here
!     }
! 
!     return removeInternal(a2, b2);
!     }
! 
!   private ScanListener a; // = null;
!   private ScanListener b; // = null;
  }
\ No newline at end of file

Index: RubberBandCanvasIF.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/RubberBandCanvasIF.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** RubberBandCanvasIF.java	10 Apr 2002 19:46:12 -0000	1.1.1.1
--- RubberBandCanvasIF.java	16 Jun 2005 04:41:17 -0000	1.2
***************
*** 1,42 ****
! package org.tn5250j;
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! 
! public interface RubberBandCanvasIF {
!    void addMouseListener(MouseListener l);
!    void addMouseMotionListener(MouseMotionListener l);
!    void areaBounded(RubberBand b, int startX, int startY, int endX, int endY);
!    boolean canDrawRubberBand(RubberBand band);
!    Point translateStart(Point startPoint);
!    Point translateEnd(Point endPoint);
!    Color getBackground();
! //   Graphics getGraphics();
!    Graphics getDrawingGraphics();
! 
  }
\ No newline at end of file
--- 1,42 ----
! package org.tn5250j;
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! 
! public interface RubberBandCanvasIF {
!    void addMouseListener(MouseListener l);
!    void addMouseMotionListener(MouseMotionListener l);
!    void areaBounded(RubberBand b, int startX, int startY, int endX, int endY);
!    boolean canDrawRubberBand(RubberBand band);
!    Point translateStart(Point startPoint);
!    Point translateEnd(Point endPoint);
!    Color getBackground();
! //   Graphics getGraphics();
!    Graphics getDrawingGraphics();
! 
  }
\ No newline at end of file

Index: OptionAccess.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/OptionAccess.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** OptionAccess.java	26 Jun 2004 09:20:07 -0000	1.3
--- OptionAccess.java	16 Jun 2005 04:41:17 -0000	1.4
***************
*** 1,149 ****
! /**
!  * Title: OptionAccess.java
!  * Copyright:   Copyright (c) 2001, 2002, 2003
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.1
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.util.Collections;
! import java.util.StringTokenizer;
! import java.util.Vector;
! 
! import org.tn5250j.interfaces.ConfigureFactory;
! import org.tn5250j.interfaces.OptionAccessFactory;
! import org.tn5250j.tools.LangTool;
! 
! /**
!  * Utility class for referencing the global options allowed for access
!  * of which at most one instance can exist per VM.
!  *
!  * Use OptionAccessFactory.instance() to access this instance.
!  */
! public class OptionAccess extends OptionAccessFactory implements TN5250jConstants {
! 
!    /**
!     * A handle to the unique OptionAccess class
!     */
!    static private OptionAccess _instance;
! 
!    /**
!     * A handle to non valid options.
!     */
!    static private Vector restricted = new Vector();
! 
!    /**
!     * The constructor is made protected to allow overriding.
!     */
!    public OptionAccess() {
!        if (_instance == null) {
!            // initialize the settings information
!            initialize();
!            // set our instance to this one.
!            _instance = this;
!        }
!    }
! 
!    /**
!     *
!     * @return The unique instance of this class.
!     */
!    static public OptionAccess instance() {
! 
!       if (_instance == null) {
!          _instance = new OptionAccess();
!       }
!       return _instance;
! 
!    }
! 
!    /**
!     * Initialize the properties registry for use later.
!     *
!     */
!    private void initialize() {
! 
!       loadOptions();
!    }
! 
!    /**
!     * Load a list of available options
!     */
!    private void loadOptions() {
! 
!       restricted.clear();
! 		String restrictedProp =
! 			ConfigureFactory.getInstance().getProperties(
! 				ConfigureFactory.SESSIONS).getProperty("emul.restricted");
! 
!       if (restrictedProp != null) {
!          int x = 0;
!          StringTokenizer tokenizer = new StringTokenizer(restrictedProp, ";");
!          while (tokenizer.hasMoreTokens()) {
!             restricted.add(tokenizer.nextToken());
!          }
!       }
! 
!    }
! 
!    public Vector getOptions() {
! 
!       Vector v = new Vector(mnemonicData.length);
!       for (int x = 0; x < mnemonicData.length; x++) {
!          v.add(mnemonicData[x]);
!       }
! 
!       Collections.sort(v);
! 
!       return v;
!    }
! 
!    public Vector getOptionDescriptions() {
! 
!       Vector v = new Vector(mnemonicData.length);
!       for (int x = 0; x < mnemonicData.length; x++) {
!          v.add(LangTool.getString("key."+mnemonicData[x]));
!       }
! 
!       Collections.sort(v);
!       return v;
!    }
! 
!    public boolean isValidOption(String option) {
! 
!       return !restricted.contains(option);
!    }
! 
!    public boolean isRestrictedOption(String option) {
! 
!       return restricted.contains(option);
!    }
! 
!    public int getNumberOfRestrictedOptions() {
! 
!       return restricted.size();
!    }
! 
!    public void reload() {
!       loadOptions();
!    }
! }
--- 1,149 ----
! /**
!  * Title: OptionAccess.java
!  * Copyright:   Copyright (c) 2001, 2002, 2003
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.1
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.util.Collections;
! import java.util.StringTokenizer;
! import java.util.Vector;
! 
! import org.tn5250j.interfaces.ConfigureFactory;
! import org.tn5250j.interfaces.OptionAccessFactory;
! import org.tn5250j.tools.LangTool;
! 
! /**
!  * Utility class for referencing the global options allowed for access
!  * of which at most one instance can exist per VM.
!  *
!  * Use OptionAccessFactory.instance() to access this instance.
!  */
! public class OptionAccess extends OptionAccessFactory implements TN5250jConstants {
! 
!    /**
!     * A handle to the unique OptionAccess class
!     */
!    static private OptionAccess _instance;
! 
!    /**
!     * A handle to non valid options.
!     */
!    static private Vector restricted = new Vector();
! 
!    /**
!     * The constructor is made protected to allow overriding.
!     */
!    public OptionAccess() {
!        if (_instance == null) {
!            // initialize the settings information
!            initialize();
!            // set our instance to this one.
!            _instance = this;
!        }
!    }
! 
!    /**
!     *
!     * @return The unique instance of this class.
!     */
!    static public OptionAccess instance() {
! 
!       if (_instance == null) {
!          _instance = new OptionAccess();
!       }
!       return _instance;
! 
!    }
! 
!    /**
!     * Initialize the properties registry for use later.
!     *
!     */
!    private void initialize() {
! 
!       loadOptions();
!    }
! 
!    /**
!     * Load a list of available options
!     */
!    private void loadOptions() {
! 
!       restricted.clear();
! 		String restrictedProp =
! 			ConfigureFactory.getInstance().getProperties(
! 				ConfigureFactory.SESSIONS).getProperty("emul.restricted");
! 
!       if (restrictedProp != null) {
!          int x = 0;
!          StringTokenizer tokenizer = new StringTokenizer(restrictedProp, ";");
!          while (tokenizer.hasMoreTokens()) {
!             restricted.add(tokenizer.nextToken());
!          }
!       }
! 
!    }
! 
!    public Vector getOptions() {
! 
!       Vector v = new Vector(mnemonicData.length);
!       for (int x = 0; x < mnemonicData.length; x++) {
!          v.add(mnemonicData[x]);
!       }
! 
!       Collections.sort(v);
! 
!       return v;
!    }
! 
!    public Vector getOptionDescriptions() {
! 
!       Vector v = new Vector(mnemonicData.length);
!       for (int x = 0; x < mnemonicData.length; x++) {
!          v.add(LangTool.getString("key."+mnemonicData[x]));
!       }
! 
!       Collections.sort(v);
!       return v;
!    }
! 
!    public boolean isValidOption(String option) {
! 
!       return !restricted.contains(option);
!    }
! 
!    public boolean isRestrictedOption(String option) {
! 
!       return restricted.contains(option);
!    }
! 
!    public int getNumberOfRestrictedOptions() {
! 
!       return restricted.size();
!    }
! 
!    public void reload() {
!       loadOptions();
!    }
! }

Index: GlobalConfigure.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/GlobalConfigure.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** GlobalConfigure.java	8 Jun 2005 19:32:48 -0000	1.19
--- GlobalConfigure.java	16 Jun 2005 04:41:17 -0000	1.20
***************
*** 1,557 ****
! /**
!  * Title: GlobalConfigure.java
!  * Copyright:   Copyright (c) 2001, 2002, 2003
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.1
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
[...1085 lines suppressed...]
!       //System.out.println(settings.getProperty("emulator.settingsDirectory"));
!       return settings.getProperty("emulator.settingsDirectory");
! 
!    }
! 
!    /**
!     * Not sure yet so be careful using this.
!     *
!     * @return
!     */
!    public ClassLoader getClassLoader() {
! 
!       ClassLoader loader = GlobalConfigure.class.getClassLoader();
!       if (loader == null)
!         loader = ClassLoader.getSystemClassLoader();
! 
!       return loader;
!    }
! 
! }

Index: TN5250jConstants.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/TN5250jConstants.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** TN5250jConstants.java	8 Jun 2005 19:32:50 -0000	1.57
--- TN5250jConstants.java	16 Jun 2005 04:41:17 -0000	1.58
***************
*** 1,529 ****
! /*
!  * @(#)TN5250jConstants.java
!  * Copyright:    Copyright (c) 2001
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
[...1029 lines suppressed...]
!    public static final int BUTTON_MIDDLE = 15;
!    public static final int BUTTON_ONE = 16;
!    public static final int BUTTON_LEFT_UP = 17;
!    public static final int BUTTON_RIGHT_UP = 18;
!    public static final int BUTTON_MIDDLE_UP = 19;
!    public static final int BUTTON_ONE_UP = 20;
!    public static final int BUTTON_LEFT_DN = 21;
!    public static final int BUTTON_RIGHT_DN = 22;
!    public static final int BUTTON_MIDDLE_DN = 23;
!    public static final int BUTTON_ONE_DN = 24;
!    public static final int BUTTON_LEFT_EB = 25;
!    public static final int BUTTON_RIGHT_EB = 26;
!    public static final int BUTTON_MIDDLE_EB = 27;
!    public static final int BUTTON_SB_UP = 28;
!    public static final int BUTTON_SB_DN = 29;
!    public static final int BUTTON_SB_GUIDE = 30;
!    public static final int BUTTON_SB_THUMB = 31;
!    public static final int BUTTON_LAST = 31;
! 
! }

Index: Session5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Session5250.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Session5250.java	8 Jun 2005 19:32:49 -0000	1.8
--- Session5250.java	16 Jun 2005 04:41:17 -0000	1.9
***************
*** 1,351 ****
! /*
!  * @(#)Session5250.java
!  * Copyright:    Copyright (c) 2001
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.util.*;
! 
! import org.tn5250j.interfaces.SessionInterface;
! import org.tn5250j.event.SessionListener;
! import org.tn5250j.event.SessionChangeEvent;
! import org.tn5250j.interfaces.ScanListener;
! import org.tn5250j.framework.tn5250.Screen5250;
! import org.tn5250j.framework.tn5250.tnvt;
! import org.tn5250j.framework.common.SessionManager;
! 
! /**
!  * A host session
!  */
! public class Session5250 implements SessionInterface,TN5250jConstants {
! 
!    private String configurationResource;
!    private String sessionName;
!    private boolean connected;
!    private int sessionType;
!    protected Properties sesProps;
!    private Vector listeners;
!    private SessionChangeEvent sce;
!    private String sslType;
!    private boolean heartBeat;
!    String propFileName;
!    protected SessionConfig sesConfig;
!    tnvt vt;
!    Screen5250 screen;
!    SessionGUI guiComponent;
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    private boolean scan; // = false;
!    private ScanListener scanListener; // = null;
! 
!    public Session5250 (Properties props, String configurationResource,
!                      String sessionName,
!                      SessionConfig config) {
! 
!       propFileName = config.getConfigurationResource();
! 
!       sesConfig = config;
!       this.configurationResource = configurationResource;
!       this.sessionName = sessionName;
!       sesProps = props;
!       sce = new SessionChangeEvent(this);
! 
!       if (sesProps.containsKey(SESSION_HEART_BEAT))
!          heartBeat = true;
! 
!       screen = new Screen5250();
! 
!       //screen.setVT(vt);
! 
!    }
! 
!    public String getConfigurationResource() {
! 
!       return configurationResource;
! 
!    }
! 
!    public SessionConfig getConfiguration() {
! 
!       return sesConfig;
!    }
! 
!    public SessionManager getSessionManager() {
!       return SessionManager.instance();
!    }
! 
!    public boolean isConnected() {
! 
!       if (vt == null)
!          return false;
!       else
!          return vt.isConnected();
! 
!    }
! 
!    public boolean isSendKeepAlive() {
!       return heartBeat;
!    }
! 
!    public Properties getConnectionProperties() {
!       return sesProps;
!    }
! 
!    public void setGUI (SessionGUI gui) {
!       guiComponent = gui;
!    }
! 
!    public SessionGUI getGUI() {
!       return guiComponent;
!    }
!    public String getSessionName() {
!       return sessionName;
!    }
! 
!    public String getAllocDeviceName() {
!       if (vt != null)
!          return vt.getAllocatedDeviceName();
!       else
!          return null;
!    }
! 
!    public int getSessionType() {
! 
!       return sessionType;
! 
!    }
! 
!    public String getHostName() {
!       return vt.getHostName();
!    }
! 
!    public Screen5250 getScreen() {
! 
!       return screen;
! 
!    }
! 
!    public void connect() {
! 
!       String proxyPort = "1080"; // default socks proxy port
!       boolean enhanced = false;
!       boolean support132 = false;
!       int port = 23; // default telnet port
! 
!       enhanced = sesProps.containsKey(SESSION_TN_ENHANCED);
! 
!       if (sesProps.containsKey(SESSION_SCREEN_SIZE))
!          if (((String)sesProps.getProperty(SESSION_SCREEN_SIZE)).equals(SCREEN_SIZE_27X132_STR))
!             support132 = true;
! 
!       final tnvt vt = new tnvt(this,screen,enhanced,support132);
!       setVT(vt);
! 
! //      vt.setController(this);
! 
!       if (sesProps.containsKey(SESSION_PROXY_PORT))
!          proxyPort = (String)sesProps.getProperty(SESSION_PROXY_PORT);
! 
!       if (sesProps.containsKey(SESSION_PROXY_HOST))
!          vt.setProxy((String)sesProps.getProperty(SESSION_PROXY_HOST),
!                      proxyPort);
! 
!       if (sesProps.containsKey(TN5250jConstants.SSL_TYPE)) {
!          sslType = (String)sesProps.getProperty(TN5250jConstants.SSL_TYPE);
!       }
!       else {
!          // set default to none
!          sslType = TN5250jConstants.SSL_TYPE_NONE;
!       }
! 
!       vt.setSSLType(sslType);
! 
!       if (sesProps.containsKey(SESSION_CODE_PAGE))
!          vt.setCodePage((String)sesProps.getProperty(SESSION_CODE_PAGE));
! 
!       if (sesProps.containsKey(SESSION_DEVICE_NAME))
!          vt.setDeviceName((String)sesProps.getProperty(SESSION_DEVICE_NAME));
! 
!       if (sesProps.containsKey(SESSION_HOST_PORT)) {
!          port = Integer.parseInt((String)sesProps.getProperty(SESSION_HOST_PORT));
!       }
!       else {
!          // set to default 23 of telnet
!          port = 23;
!       }
! 
!       final String ses = (String)sesProps.getProperty(SESSION_HOST);
!       final int portp = port;
! 
!       // lets set this puppy up to connect within its own thread
!       Runnable connectIt = new Runnable() {
!             public void run() {
!                vt.connect(ses,portp);
!             }
! 
!         };
! 
!       // now lets set it to connect within its own daemon thread
!       //    this seems to work better and is more responsive than using
!       //    swingutilities's invokelater
!       Thread ct = new Thread(connectIt);
!       ct.setDaemon(true);
!       ct.start();
! 
!    }
! 
!    public void disconnect() {
! 
!       connected = false;
!       vt.disconnect();
! 
!    }
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    protected void setVT(tnvt v)
!    {
!      vt = v;
!      screen.setVT(vt);
!      if (vt != null)
!        vt.setScanningEnabled(this.scan);
!    }
! 
!    public tnvt getVT() {
!       return vt;
!    }
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    /**
!     * Enables or disables scanning.
!     *
!     * @param scan enables scanning when true; disables otherwise.
!     *
!     * @see tnvt#setCommandScanning(boolean);
!     * @see tnvt#isCommandScanning();
!     * @see tnvt#scan();
!     * @see tnvt#parseCommand();
!     * @see scanned(String,String)
!     */
!    public void setScanningEnabled(boolean scan)
!    {
!      this.scan = scan;
! 
!      if (this.vt != null)
!        this.vt.setScanningEnabled(scan);
!    }
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    /**
!     * Checks whether scanning is enabled.
!     *
!     * @return true if command scanning is enabled; false otherwise.
!     *
!     * @see tnvt#setCommandScanning(boolean);
!     * @see tnvt#isCommandScanning();
!     * @see tnvt#scan();
!     * @see tnvt#parseCommand();
!     * @see scanned(String,String)
!     */
!    public boolean isScanningEnabled()
!    {
!      if (this.vt != null)
!        return this.vt.isScanningEnabled();
! 
!      return this.scan;
!    }
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    /**
!     * This is the callback method for the TNVT when sensing the action cmd
!     * screen pattern (!# at position 0,0).
!     *
!     * This is <strong>NOT a threadsafe method</strong> and will be called
!     * from the TNVT read thread!
!     *
!     * @param command discovered in the 5250 stream.
!     * @param remainder are all the other characters on the screen.
!     *
!     * @see tnvt#setCommandScanning(boolean);
!     * @see tnvt#isCommandScanning();
!     * @see tnvt#scan();
!     * @see tnvt#parseCommand();
!     * @see scanned(String,String)
!     */
!   public void scanned(String command, String remainder)
!   {
!     if (scanListener != null)
!       scanListener.scanned(command, remainder);
!    }
! 
!    public void addScanListener(ScanListener listener)
!    {
!      scanListener = ScanMulticaster.add(scanListener, listener);
!    }
! 
!    public void removeScanListener(ScanListener listener)
!    {
!      scanListener = ScanMulticaster.remove(scanListener, listener);
!    }
! 
!    /**
!     * Notify all registered listeners of the onSessionChanged event.
!     *
!     * @param state  The state change property object.
!     */
!    public void fireSessionChanged(int state) {
! 
!       if (listeners != null) {
!          int size = listeners.size();
!          for (int i = 0; i < size; i++) {
!             SessionListener target =
!                     (SessionListener)listeners.elementAt(i);
!             sce.setState(state);
!             target.onSessionChanged(sce);
!          }
!       }
!    }
! 
!    /**
!     * Add a SessionListener to the listener list.
!     *
!     * @param listener  The SessionListener to be added
!     */
!    public synchronized void addSessionListener(SessionListener listener) {
! 
!       if (listeners == null) {
!           listeners = new java.util.Vector(3);
!       }
!       listeners.addElement(listener);
! 
!    }
! 
!    /**
!     * Remove a SessionListener from the listener list.
!     *
!     * @param listener  The SessionListener to be removed
!     */
!    public synchronized void removeSessionListener(SessionListener listener) {
!       if (listeners == null) {
!           return;
!       }
!       listeners.removeElement(listener);
! 
!    }
! 
  }
\ No newline at end of file
--- 1,351 ----
! /*
!  * @(#)Session5250.java
!  * Copyright:    Copyright (c) 2001
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.util.*;
! 
! import org.tn5250j.interfaces.SessionInterface;
! import org.tn5250j.event.SessionListener;
! import org.tn5250j.event.SessionChangeEvent;
! import org.tn5250j.interfaces.ScanListener;
! import org.tn5250j.framework.tn5250.Screen5250;
! import org.tn5250j.framework.tn5250.tnvt;
! import org.tn5250j.framework.common.SessionManager;
! 
! /**
!  * A host session
!  */
! public class Session5250 implements SessionInterface,TN5250jConstants {
! 
!    private String configurationResource;
!    private String sessionName;
!    private boolean connected;
!    private int sessionType;
!    protected Properties sesProps;
!    private Vector listeners;
!    private SessionChangeEvent sce;
!    private String sslType;
!    private boolean heartBeat;
!    String propFileName;
!    protected SessionConfig sesConfig;
!    tnvt vt;
!    Screen5250 screen;
!    SessionGUI guiComponent;
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    private boolean scan; // = false;
!    private ScanListener scanListener; // = null;
! 
!    public Session5250 (Properties props, String configurationResource,
!                      String sessionName,
!                      SessionConfig config) {
! 
!       propFileName = config.getConfigurationResource();
! 
!       sesConfig = config;
!       this.configurationResource = configurationResource;
!       this.sessionName = sessionName;
!       sesProps = props;
!       sce = new SessionChangeEvent(this);
! 
!       if (sesProps.containsKey(SESSION_HEART_BEAT))
!          heartBeat = true;
! 
!       screen = new Screen5250();
! 
!       //screen.setVT(vt);
! 
!    }
! 
!    public String getConfigurationResource() {
! 
!       return configurationResource;
! 
!    }
! 
!    public SessionConfig getConfiguration() {
! 
!       return sesConfig;
!    }
! 
!    public SessionManager getSessionManager() {
!       return SessionManager.instance();
!    }
! 
!    public boolean isConnected() {
! 
!       if (vt == null)
!          return false;
!       else
!          return vt.isConnected();
! 
!    }
! 
!    public boolean isSendKeepAlive() {
!       return heartBeat;
!    }
! 
!    public Properties getConnectionProperties() {
!       return sesProps;
!    }
! 
!    public void setGUI (SessionGUI gui) {
!       guiComponent = gui;
!    }
! 
!    public SessionGUI getGUI() {
!       return guiComponent;
!    }
!    public String getSessionName() {
!       return sessionName;
!    }
! 
!    public String getAllocDeviceName() {
!       if (vt != null)
!          return vt.getAllocatedDeviceName();
!       else
!          return null;
!    }
! 
!    public int getSessionType() {
! 
!       return sessionType;
! 
!    }
! 
!    public String getHostName() {
!       return vt.getHostName();
!    }
! 
!    public Screen5250 getScreen() {
! 
!       return screen;
! 
!    }
! 
!    public void connect() {
! 
!       String proxyPort = "1080"; // default socks proxy port
!       boolean enhanced = false;
!       boolean support132 = false;
!       int port = 23; // default telnet port
! 
!       enhanced = sesProps.containsKey(SESSION_TN_ENHANCED);
! 
!       if (sesProps.containsKey(SESSION_SCREEN_SIZE))
!          if (((String)sesProps.getProperty(SESSION_SCREEN_SIZE)).equals(SCREEN_SIZE_27X132_STR))
!             support132 = true;
! 
!       final tnvt vt = new tnvt(this,screen,enhanced,support132);
!       setVT(vt);
! 
! //      vt.setController(this);
! 
!       if (sesProps.containsKey(SESSION_PROXY_PORT))
!          proxyPort = (String)sesProps.getProperty(SESSION_PROXY_PORT);
! 
!       if (sesProps.containsKey(SESSION_PROXY_HOST))
!          vt.setProxy((String)sesProps.getProperty(SESSION_PROXY_HOST),
!                      proxyPort);
! 
!       if (sesProps.containsKey(TN5250jConstants.SSL_TYPE)) {
!          sslType = (String)sesProps.getProperty(TN5250jConstants.SSL_TYPE);
!       }
!       else {
!          // set default to none
!          sslType = TN5250jConstants.SSL_TYPE_NONE;
!       }
! 
!       vt.setSSLType(sslType);
! 
!       if (sesProps.containsKey(SESSION_CODE_PAGE))
!          vt.setCodePage((String)sesProps.getProperty(SESSION_CODE_PAGE));
! 
!       if (sesProps.containsKey(SESSION_DEVICE_NAME))
!          vt.setDeviceName((String)sesProps.getProperty(SESSION_DEVICE_NAME));
! 
!       if (sesProps.containsKey(SESSION_HOST_PORT)) {
!          port = Integer.parseInt((String)sesProps.getProperty(SESSION_HOST_PORT));
!       }
!       else {
!          // set to default 23 of telnet
!          port = 23;
!       }
! 
!       final String ses = (String)sesProps.getProperty(SESSION_HOST);
!       final int portp = port;
! 
!       // lets set this puppy up to connect within its own thread
!       Runnable connectIt = new Runnable() {
!             public void run() {
!                vt.connect(ses,portp);
!             }
! 
!         };
! 
!       // now lets set it to connect within its own daemon thread
!       //    this seems to work better and is more responsive than using
!       //    swingutilities's invokelater
!       Thread ct = new Thread(connectIt);
!       ct.setDaemon(true);
!       ct.start();
! 
!    }
! 
!    public void disconnect() {
! 
!       connected = false;
!       vt.disconnect();
! 
!    }
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    protected void setVT(tnvt v)
!    {
!      vt = v;
!      screen.setVT(vt);
!      if (vt != null)
!        vt.setScanningEnabled(this.scan);
!    }
! 
!    public tnvt getVT() {
!       return vt;
!    }
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    /**
!     * Enables or disables scanning.
!     *
!     * @param scan enables scanning when true; disables otherwise.
!     *
!     * @see tnvt#setCommandScanning(boolean);
!     * @see tnvt#isCommandScanning();
!     * @see tnvt#scan();
!     * @see tnvt#parseCommand();
!     * @see scanned(String,String)
!     */
!    public void setScanningEnabled(boolean scan)
!    {
!      this.scan = scan;
! 
!      if (this.vt != null)
!        this.vt.setScanningEnabled(scan);
!    }
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    /**
!     * Checks whether scanning is enabled.
!     *
!     * @return true if command scanning is enabled; false otherwise.
!     *
!     * @see tnvt#setCommandScanning(boolean);
!     * @see tnvt#isCommandScanning();
!     * @see tnvt#scan();
!     * @see tnvt#parseCommand();
!     * @see scanned(String,String)
!     */
!    public boolean isScanningEnabled()
!    {
!      if (this.vt != null)
!        return this.vt.isScanningEnabled();
! 
!      return this.scan;
!    }
! 
!    // WVL - LDC : TR.000300 : Callback scenario from 5250
!    /**
!     * This is the callback method for the TNVT when sensing the action cmd
!     * screen pattern (!# at position 0,0).
!     *
!     * This is <strong>NOT a threadsafe method</strong> and will be called
!     * from the TNVT read thread!
!     *
!     * @param command discovered in the 5250 stream.
!     * @param remainder are all the other characters on the screen.
!     *
!     * @see tnvt#setCommandScanning(boolean);
!     * @see tnvt#isCommandScanning();
!     * @see tnvt#scan();
!     * @see tnvt#parseCommand();
!     * @see scanned(String,String)
!     */
!   public void scanned(String command, String remainder)
!   {
!     if (scanListener != null)
!       scanListener.scanned(command, remainder);
!    }
! 
!    public void addScanListener(ScanListener listener)
!    {
!      scanListener = ScanMulticaster.add(scanListener, listener);
!    }
! 
!    public void removeScanListener(ScanListener listener)
!    {
!      scanListener = ScanMulticaster.remove(scanListener, listener);
!    }
! 
!    /**
!     * Notify all registered listeners of the onSessionChanged event.
!     *
!     * @param state  The state change property object.
!     */
!    public void fireSessionChanged(int state) {
! 
!       if (listeners != null) {
!          int size = listeners.size();
!          for (int i = 0; i < size; i++) {
!             SessionListener target =
!                     (SessionListener)listeners.elementAt(i);
!             sce.setState(state);
!             target.onSessionChanged(sce);
!          }
!       }
!    }
! 
!    /**
!     * Add a SessionListener to the listener list.
!     *
!     * @param listener  The SessionListener to be added
!     */
!    public synchronized void addSessionListener(SessionListener listener) {
! 
!       if (listeners == null) {
!           listeners = new java.util.Vector(3);
!       }
!       listeners.addElement(listener);
! 
!    }
! 
!    /**
!     * Remove a SessionListener from the listener list.
!     *
!     * @param listener  The SessionListener to be removed
!     */
!    public synchronized void removeSessionListener(SessionListener listener) {
!       if (listeners == null) {
!           return;
!       }
!       listeners.removeElement(listener);
! 
!    }
! 
  }
\ No newline at end of file

Index: My5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/My5250.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** My5250.java	8 Jun 2005 19:32:49 -0000	1.40
--- My5250.java	16 Jun 2005 04:41:17 -0000	1.41
***************
*** 1,939 ****
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
[...1849 lines suppressed...]
! //                  rb+=chunk;
! //               }
! //               ii = new ImageIcon(b);
! //            }
! //         }
! //         zis.close();
! //         fis.close();
! //
! //      }
! //      catch( ZipException zexc) {
! //         System.out.println("ze " + zexc.getMessage());
! //      }
! //      catch( IOException ioe) {
! //         System.out.println("ioe " + ioe.getMessage());
! //      }
! //
! //      return ii;
! //   }
! 
! }

Index: Gui5250SplitFrame.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Gui5250SplitFrame.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Gui5250SplitFrame.java	8 Jun 2005 19:32:49 -0000	1.7
--- Gui5250SplitFrame.java	16 Jun 2005 04:41:17 -0000	1.8
***************
*** 1,398 ****
! package org.tn5250j;
! /**
!  * Title: Gui5250SplitFrame
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.*;
! import java.util.*;
! import javax.swing.event.ListSelectionEvent;
! import javax.swing.event.ListSelectionListener;
! 
! import org.tn5250j.tools.logging.*;
! import org.tn5250j.interfaces.GUIViewInterface;
! import org.tn5250j.event.SessionJumpListener;
! import org.tn5250j.event.SessionJumpEvent;
! import org.tn5250j.event.SessionListener;
! import org.tn5250j.event.SessionChangeEvent;
! import org.tn5250j.framework.common.SessionManager;
! 
! public class Gui5250SplitFrame extends GUIViewInterface implements
!                                                     TN5250jConstants,
!                                                     SessionListener,
!                                                     SessionJumpListener {
! 
!    BorderLayout borderLayout1 = new BorderLayout();
!    JSplitPane sessionPane;
!    private SessionManager manager;
!    private int selectedIndex = 0;
! 
!    private Vector sessionList;
!    private JList sessionPicker;
!    private DefaultListModel lm = new DefaultListModel();
!    private JPanel sessionPanel;
!    private JScrollPane scroller;
!    private JPanel toolsPanel;
! 
!    private TN5250jLogger log = TN5250jLogFactory.getLogger(this.getClass());
! 
!    //Construct the frame
!    public Gui5250SplitFrame(My5250 m) {
! 
!       super(m);
! 
!       enableEvents(AWTEvent.WINDOW_EVENT_MASK);
!       try  {
!          jbInit();
!       }
!       catch(Exception e) {
!          log.warn("In constructor: "+e);
!       }
!    }
! 
!    //Component initialization
!    private void jbInit() throws Exception  {
! 
!       this.getContentPane().setLayout(borderLayout1);
! 
!       if (sequence > 0)
!          setTitle("tn5250j <" + sequence + "> - " + tn5250jRelease + tn5250jVersion + tn5250jSubVer);
!       else
!          setTitle("tn5250j - " + tn5250jRelease + tn5250jVersion + tn5250jSubVer);
! 
!       // update the frame sequences
!       frameSeq = sequence++;
! 
!       sessionList = new Vector(3);
! 
! //    note to myself if needed on how to add a listener to the the divider of
! //    of a scroll pane.  This is really a pain in the ass to figure out.
! //
! //      You can use a mouse listener but you cannot add a mouse listener
! //         directly to a split pane. You will have to get the splitpanedivider
! //          and then add the mouselistener to that.
! //
! //      (((BasicSplitPaneUI)yoursplitpane.getUI()).getDivider()).addMouseListener(yourmouselistener);      // create the split pane
!       sessionPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
!       sessionPane.setOneTouchExpandable(true);
!       sessionPane.setContinuousLayout(true);
! 
!       sessionPane.setBorder(BorderFactory.createEtchedBorder());
!       sessionPane.setOpaque(true);
!       sessionPane.setRequestFocusEnabled(false);
!       sessionPane.setDoubleBuffered(false);
! 
!       this.getContentPane().add(sessionPane, BorderLayout.CENTER);
!       sessionPanel = new JPanel();
!       sessionPanel.setLayout(new BorderLayout());
! 
!       sessionPane.setLeftComponent(sessionPanel);
! 
! 
!       toolsPanel = new JPanel();
!       toolsPanel.setLayout(new BorderLayout());
! 
!       sessionPane.setRightComponent(toolsPanel);
! 
!       sessionPicker = new JList(lm);
!       sessionPicker.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
!       SessionRenderer renderer = new SessionRenderer();
!       sessionPicker.setCellRenderer(renderer);
! 
!       // add list selection listener to our functions list so that we
!       //   can display the mapped key(s) to the function when a new
!       //   function is selected.
!       sessionPicker.addListSelectionListener(new ListSelectionListener() {
!          public void valueChanged(ListSelectionEvent lse) {
!             if (!lse.getValueIsAdjusting()) {
!                showSelectedSession(sessionPicker.getSelectedIndex());
!             }
!          }
!       });
! 
!       if (packFrame)
!          pack();
!       else
!          validate();
! 
!    }
! 
!    //Overridden so we can exit on System Close
!    protected void processWindowEvent(WindowEvent e) {
!       super.processWindowEvent(e);
!       if(e.getID() == WindowEvent.WINDOW_CLOSING) {
!          me.closingDown(this);
!       }
!    }
! 
! 
!    void showSelectedSession(int whichOne) {
! 
!       if (whichOne < 0 || whichOne > sessionList.size() - 1)
!          return;
! 
!       SessionGUI session = (SessionGUI)sessionList.get(whichOne);
!       sessionPicker.setSelectedIndex(whichOne);
! 
!       SessionGUI current = getCurrentViewedSession();
! 
!       if (current != null)
!          current.setVisible(false);
! 
!       // now remove all components from the panel
!       sessionPanel.removeAll();
!       // set the session to visible so that we get screen updates again
!       session.setVisible(true);
! 
!       // add the session to the panel so that we can see it.
!       sessionPanel.add(session,BorderLayout.CENTER);
!       // make sure we update the screen
!       sessionPanel.revalidate();
!       sessionPanel.repaint();
!       // make sure we have the focus after switching.
!       session.grabFocus();
!    }
! 
!    public void update(Graphics g) {
!       paint(g);
!       sessionPanel.repaint();
!    }
! 
!    public void onSessionJump(SessionJumpEvent jumpEvent) {
! 
!       switch (jumpEvent.getJumpDirection()) {
! 
!          case JUMP_PREVIOUS:
!             prevSession();
!             break;
!          case JUMP_NEXT:
!             nextSession();
!             break;
!       }
!    }
! 
!    /**
!     * Helper method to return the currently viewed session
!     *
!     * @return
!     */
!    private SessionGUI getCurrentViewedSession() {
! 
!       SessionGUI current = null;
!       Component[] comps = sessionPanel.getComponents();
!       int count = comps.length;
!       // make the current session non visible to keep from over writting the
!       //  session screens.
!       for (int x = 0; x < count; x++) {
! 
!          if (comps[x] instanceof SessionGUI) {
!             current = (SessionGUI)comps[x];
!          }
!       }
! 
!       return current;
! 
!    }
! 
!    /**
!     * Bring the next session to front
!     */
!    private void nextSession() {
! 
!       SessionGUI current = getCurrentViewedSession();
! 
!       int index = sessionList.indexOf(current) + 1;
! 
!       int size = sessionList.size() - 1;
! 
!       if (index > size)
!          showSelectedSession(0);
!       else
!          showSelectedSession(index);
!    }
! 
!    /**
!     * Bring the previous session to front
!     */
!    private void prevSession() {
! 
!       SessionGUI current = getCurrentViewedSession();
! 
!       int index = sessionList.indexOf(current) - 1;
! 
!       int size = sessionList.size() - 1;
! 
!       if (index < 0)
!          showSelectedSession(size);
!       else
!          showSelectedSession(index);
! 
!    }
! 
!    /**
!     * Add a session to the view
!     *
!     * @param sessionName
!     * @param session
!     */
!    public void addSessionView(String sessionName,SessionGUI session) {
! 
!       lm.addElement(session);
! 
!       if (sessionList.size() == 0) {
!          sessionList.addElement(session);
!          sessionPanel.add(session,BorderLayout.CENTER);
!          scroller = new JScrollPane();
!          scroller.setViewportView(sessionPicker);
!          toolsPanel.add(scroller,BorderLayout.CENTER);
!          sessionPane.setDividerLocation(0.90);
!       }
!       else {
!          sessionList.addElement(session);
!          sessionPicker.setSelectedIndex(sessionList.size()-1);
!       }
! 
!       // add ourselves to the listner list
!       session.addSessionListener(this);
!       session.addSessionJumpListener(this);
! 
!       // now show it to the user
!       showSelectedSession(sessionList.size()-1);
! 
! 
!    }
! 
!    public void removeSessionView(SessionGUI targetSession) {
! 
! 
!       int index = sessionList.indexOf(targetSession);
! 
!       lm.remove(index);
! 
!       if (index > 0 || index == sessionList.size() - 1)
!          prevSession();
!       if (index == 0)
!          nextSession();
! 
!       sessionList.remove(targetSession);
! 
!       updateScrollPane();
! 
!    }
! 
!    /**
!     * Return the count of views contained in the frame
!     * @return
!     */
!    public int getSessionViewCount() {
! 
!       return sessionList.size();
! 
!    }
! 
!    /**
!     * Return the Session object at the specific index.
!     *
!     * @param index
!     * @return
!     */
!    public SessionGUI getSessionAt( int index) {
! 
!       return (SessionGUI)sessionList.get(index);
!    }
! 
!    public void onSessionChanged(SessionChangeEvent changeEvent) {
! 
!       updateScrollPane();
!    }
! 
!    /**
!     * Update the scroll pane whenever something changes
!     */
!    private void updateScrollPane() {
! 
!       scroller.invalidate();
!       scroller.repaint();
!    }
! 
!    public boolean containsSession(SessionGUI session) {
! 
!       return sessionList.contains(session);
! 
!    }
! 
!    /**
!     * List renderer for sessions
!     */
!    class SessionRenderer extends JLabel
!                        implements ListCellRenderer {
! 
!       public SessionRenderer() {
!          setOpaque(true);
!          setHorizontalAlignment(LEFT);
!          setVerticalAlignment(CENTER);
!       }
! 
!       /*
!        * This method finds the image and text corresponding
!        * to the selected value and returns the label, set up
!        * to display the text and image.
!        */
!       public Component getListCellRendererComponent(
!                                        JList list,
!                                        Object value,
!                                        int index,
!                                        boolean isSelected,
!                                        boolean cellHasFocus) {
! 
!          //Get the selected index. (The index param isn't
!          //always valid, so just use the value.)
!          SessionGUI ses = (SessionGUI)value;
! 
!          // set the correct focused or unfocused and selected or unselected
!          //  colors
!          if (isSelected) {
!             setIcon(focused);
!             setBackground(list.getSelectionBackground());
!             setForeground(list.getSelectionForeground());
!          }
!          else {
!             setIcon(unfocused);
!             setBackground(list.getBackground());
!             setForeground(list.getForeground());
!          }
! 
!          //Set the text of this label.
!          if (ses.getAllocDeviceName() != null)
!             setText(ses.getAllocDeviceName());
!          else
!             setText(ses.getSessionName());
! 
!          return this;
!       }
!    }
! 
! }
--- 1,398 ----
! package org.tn5250j;
! /**
!  * Title: Gui5250SplitFrame
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.*;
! import java.util.*;
! import javax.swing.event.ListSelectionEvent;
! import javax.swing.event.ListSelectionListener;
! 
! import org.tn5250j.tools.logging.*;
! import org.tn5250j.interfaces.GUIViewInterface;
! import org.tn5250j.event.SessionJumpListener;
! import org.tn5250j.event.SessionJumpEvent;
! import org.tn5250j.event.SessionListener;
! import org.tn5250j.event.SessionChangeEvent;
! import org.tn5250j.framework.common.SessionManager;
! 
! public class Gui5250SplitFrame extends GUIViewInterface implements
!                                                     TN5250jConstants,
!                                                     SessionListener,
!                                                     SessionJumpListener {
! 
!    BorderLayout borderLayout1 = new BorderLayout();
!    JSplitPane sessionPane;
!    private SessionManager manager;
!    private int selectedIndex = 0;
! 
!    private Vector sessionList;
!    private JList sessionPicker;
!    private DefaultListModel lm = new DefaultListModel();
!    private JPanel sessionPanel;
!    private JScrollPane scroller;
!    private JPanel toolsPanel;
! 
!    private TN5250jLogger log = TN5250jLogFactory.getLogger(this.getClass());
! 
!    //Construct the frame
!    public Gui5250SplitFrame(My5250 m) {
! 
!       super(m);
! 
!       enableEvents(AWTEvent.WINDOW_EVENT_MASK);
!       try  {
!          jbInit();
!       }
!       catch(Exception e) {
!          log.warn("In constructor: "+e);
!       }
!    }
! 
!    //Component initialization
!    private void jbInit() throws Exception  {
! 
!       this.getContentPane().setLayout(borderLayout1);
! 
!       if (sequence > 0)
!          setTitle("tn5250j <" + sequence + "> - " + tn5250jRelease + tn5250jVersion + tn5250jSubVer);
!       else
!          setTitle("tn5250j - " + tn5250jRelease + tn5250jVersion + tn5250jSubVer);
! 
!       // update the frame sequences
!       frameSeq = sequence++;
! 
!       sessionList = new Vector(3);
! 
! //    note to myself if needed on how to add a listener to the the divider of
! //    of a scroll pane.  This is really a pain in the ass to figure out.
! //
! //      You can use a mouse listener but you cannot add a mouse listener
! //         directly to a split pane. You will have to get the splitpanedivider
! //          and then add the mouselistener to that.
! //
! //      (((BasicSplitPaneUI)yoursplitpane.getUI()).getDivider()).addMouseListener(yourmouselistener);      // create the split pane
!       sessionPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
!       sessionPane.setOneTouchExpandable(true);
!       sessionPane.setContinuousLayout(true);
! 
!       sessionPane.setBorder(BorderFactory.createEtchedBorder());
!       sessionPane.setOpaque(true);
!       sessionPane.setRequestFocusEnabled(false);
!       sessionPane.setDoubleBuffered(false);
! 
!       this.getContentPane().add(sessionPane, BorderLayout.CENTER);
!       sessionPanel = new JPanel();
!       sessionPanel.setLayout(new BorderLayout());
! 
!       sessionPane.setLeftComponent(sessionPanel);
! 
! 
!       toolsPanel = new JPanel();
!       toolsPanel.setLayout(new BorderLayout());
! 
!       sessionPane.setRightComponent(toolsPanel);
! 
!       sessionPicker = new JList(lm);
!       sessionPicker.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
!       SessionRenderer renderer = new SessionRenderer();
!       sessionPicker.setCellRenderer(renderer);
! 
!       // add list selection listener to our functions list so that we
!       //   can display the mapped key(s) to the function when a new
!       //   function is selected.
!       sessionPicker.addListSelectionListener(new ListSelectionListener() {
!          public void valueChanged(ListSelectionEvent lse) {
!             if (!lse.getValueIsAdjusting()) {
!                showSelectedSession(sessionPicker.getSelectedIndex());
!             }
!          }
!       });
! 
!       if (packFrame)
!          pack();
!       else
!          validate();
! 
!    }
! 
!    //Overridden so we can exit on System Close
!    protected void processWindowEvent(WindowEvent e) {
!       super.processWindowEvent(e);
!       if(e.getID() == WindowEvent.WINDOW_CLOSING) {
!          me.closingDown(this);
!       }
!    }
! 
! 
!    void showSelectedSession(int whichOne) {
! 
!       if (whichOne < 0 || whichOne > sessionList.size() - 1)
!          return;
! 
!       SessionGUI session = (SessionGUI)sessionList.get(whichOne);
!       sessionPicker.setSelectedIndex(whichOne);
! 
!       SessionGUI current = getCurrentViewedSession();
! 
!       if (current != null)
!          current.setVisible(false);
! 
!       // now remove all components from the panel
!       sessionPanel.removeAll();
!       // set the session to visible so that we get screen updates again
!       session.setVisible(true);
! 
!       // add the session to the panel so that we can see it.
!       sessionPanel.add(session,BorderLayout.CENTER);
!       // make sure we update the screen
!       sessionPanel.revalidate();
!       sessionPanel.repaint();
!       // make sure we have the focus after switching.
!       session.grabFocus();
!    }
! 
!    public void update(Graphics g) {
!       paint(g);
!       sessionPanel.repaint();
!    }
! 
!    public void onSessionJump(SessionJumpEvent jumpEvent) {
! 
!       switch (jumpEvent.getJumpDirection()) {
! 
!          case JUMP_PREVIOUS:
!             prevSession();
!             break;
!          case JUMP_NEXT:
!             nextSession();
!             break;
!       }
!    }
! 
!    /**
!     * Helper method to return the currently viewed session
!     *
!     * @return
!     */
!    private SessionGUI getCurrentViewedSession() {
! 
!       SessionGUI current = null;
!       Component[] comps = sessionPanel.getComponents();
!       int count = comps.length;
!       // make the current session non visible to keep from over writting the
!       //  session screens.
!       for (int x = 0; x < count; x++) {
! 
!          if (comps[x] instanceof SessionGUI) {
!             current = (SessionGUI)comps[x];
!          }
!       }
! 
!       return current;
! 
!    }
! 
!    /**
!     * Bring the next session to front
!     */
!    private void nextSession() {
! 
!       SessionGUI current = getCurrentViewedSession();
! 
!       int index = sessionList.indexOf(current) + 1;
! 
!       int size = sessionList.size() - 1;
! 
!       if (index > size)
!          showSelectedSession(0);
!       else
!          showSelectedSession(index);
!    }
! 
!    /**
!     * Bring the previous session to front
!     */
!    private void prevSession() {
! 
!       SessionGUI current = getCurrentViewedSession();
! 
!       int index = sessionList.indexOf(current) - 1;
! 
!       int size = sessionList.size() - 1;
! 
!       if (index < 0)
!          showSelectedSession(size);
!       else
!          showSelectedSession(index);
! 
!    }
! 
!    /**
!     * Add a session to the view
!     *
!     * @param sessionName
!     * @param session
!     */
!    public void addSessionView(String sessionName,SessionGUI session) {
! 
!       lm.addElement(session);
! 
!       if (sessionList.size() == 0) {
!          sessionList.addElement(session);
!          sessionPanel.add(session,BorderLayout.CENTER);
!          scroller = new JScrollPane();
!          scroller.setViewportView(sessionPicker);
!          toolsPanel.add(scroller,BorderLayout.CENTER);
!          sessionPane.setDividerLocation(0.90);
!       }
!       else {
!          sessionList.addElement(session);
!          sessionPicker.setSelectedIndex(sessionList.size()-1);
!       }
! 
!       // add ourselves to the listner list
!       session.addSessionListener(this);
!       session.addSessionJumpListener(this);
! 
!       // now show it to the user
!       showSelectedSession(sessionList.size()-1);
! 
! 
!    }
! 
!    public void removeSessionView(SessionGUI targetSession) {
! 
! 
!       int index = sessionList.indexOf(targetSession);
! 
!       lm.remove(index);
! 
!       if (index > 0 || index == sessionList.size() - 1)
!          prevSession();
!       if (index == 0)
!          nextSession();
! 
!       sessionList.remove(targetSession);
! 
!       updateScrollPane();
! 
!    }
! 
!    /**
!     * Return the count of views contained in the frame
!     * @return
!     */
!    public int getSessionViewCount() {
! 
!       return sessionList.size();
! 
!    }
! 
!    /**
!     * Return the Session object at the specific index.
!     *
!     * @param index
!     * @return
!     */
!    public SessionGUI getSessionAt( int index) {
! 
!       return (SessionGUI)sessionList.get(index);
!    }
! 
!    public void onSessionChanged(SessionChangeEvent changeEvent) {
! 
!       updateScrollPane();
!    }
! 
!    /**
!     * Update the scroll pane whenever something changes
!     */
!    private void updateScrollPane() {
! 
!       scroller.invalidate();
!       scroller.repaint();
!    }
! 
!    public boolean containsSession(SessionGUI session) {
! 
!       return sessionList.contains(session);
! 
!    }
! 
!    /**
!     * List renderer for sessions
!     */
!    class SessionRenderer extends JLabel
!                        implements ListCellRenderer {
! 
!       public SessionRenderer() {
!          setOpaque(true);
!          setHorizontalAlignment(LEFT);
!          setVerticalAlignment(CENTER);
!       }
! 
!       /*
!        * This method finds the image and text corresponding
!        * to the selected value and returns the label, set up
!        * to display the text and image.
!        */
!       public Component getListCellRendererComponent(
!                                        JList list,
!                                        Object value,
!                                        int index,
!                                        boolean isSelected,
!                                        boolean cellHasFocus) {
! 
!          //Get the selected index. (The index param isn't
!          //always valid, so just use the value.)
!          SessionGUI ses = (SessionGUI)value;
! 
!          // set the correct focused or unfocused and selected or unselected
!          //  colors
!          if (isSelected) {
!             setIcon(focused);
!             setBackground(list.getSelectionBackground());
!             setForeground(list.getSelectionForeground());
!          }
!          else {
!             setIcon(unfocused);
!             setBackground(list.getBackground());
!             setForeground(list.getForeground());
!          }
! 
!          //Set the text of this label.
!          if (ses.getAllocDeviceName() != null)
!             setText(ses.getAllocDeviceName());
!          else
!             setText(ses.getSessionName());
! 
!          return this;
!       }
!    }
! 
! }

Index: SessionGUI.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionGUI.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SessionGUI.java	8 Jun 2005 19:32:49 -0000	1.6
--- SessionGUI.java	16 Jun 2005 04:41:17 -0000	1.7
***************
*** 1,183 ****
! /*
!  * @(#)SessionGUI.java
!  * Copyright:    Copyright (c) 2001 - 2004
!  * @author Kenneth J. Pouncey
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.util.*;
! import java.awt.Rectangle;
! 
! import org.tn5250j.event.SessionListener;
! import org.tn5250j.event.SessionChangeEvent;
! import org.tn5250j.framework.tn5250.*;
! 
! /**
!  * A host GUI session
!  */
! public class SessionGUI extends Gui5250 implements SessionListener,TN5250jConstants {
! 
!    private String configurationResource;
!    private String sessionName;
!    private boolean connected;
!    private Vector listeners;
!    private boolean firstScreen;
!    private char[] signonSave;
! 
! 
!    public SessionGUI (Session5250 session) {
!       super(session);
! 
!       this.configurationResource = session.getConfigurationResource();
!       this.sessionName = session.getSessionName();
! 
!       session.getConfiguration().addSessionConfigListener(this);
!       session.addSessionListener(this);
!    }
! 
!    public Session5250 getSession() {
!       return super.session;
!    }
! 
!    public void setSession(Session5250 session) {
!       this.session = session;
!    }
! 
! 
!    public boolean isConnected() {
! 
!       return session.getVT().isConnected();
! 
!    }
! 
!    public boolean isOnSignOnScreen() {
! 
!       // check to see if we should check.
!       if (firstScreen) {
! 
!          char[] so = screen.getScreenAsChars();
!          int size = signonSave.length;
! 
!          Rectangle region = super.sesConfig.getRectangleProperty("signOnRegion");
! 
!          int fromRow = region.x;
!          int fromCol = region.y;
!          int toRow = region.width;
!          int toCol = region.height;
! 
!          // make sure we are within range.
!          if (fromRow == 0)
!             fromRow = 1;
!          if (fromCol == 0)
!             fromCol = 1;
!          if (toRow == 0)
!             toRow = 24;
!          if (toCol == 0)
!             toCol = 80;
! 
!          int pos = 0;
! 
!          for (int r = fromRow; r <= toRow; r++)
!             for (int c =fromCol;c <= toCol; c++) {
!                pos = screen.getPos(r - 1, c - 1);
! //               System.out.println(signonSave[pos]);
!                if (signonSave[pos] != so[pos])
!                   return false;
!             }
!       }
! 
!       return true;
!    }
! 
!    public String getSessionName() {
!       return sessionName;
!    }
! 
!    public String getAllocDeviceName() {
!       if (session.getVT() != null)
!          return session.getVT().getAllocatedDeviceName();
!       else
!          return null;
!    }
! 
!    public String getHostName() {
!       return session.getVT().getHostName();
!    }
! 
!    public Screen5250 getScreen() {
! 
!       return screen;
! 
!    }
! 
! 
!    public void connect() {
! 
!       session.connect();
!    }
! 
!    public void disconnect() {
! 
!       session.disconnect();
!    }
! 
!    public void onSessionChanged(SessionChangeEvent changeEvent) {
! 
!       switch (changeEvent.getState()) {
!          case STATE_CONNECTED:
!             // first we check for the signon save or now
!             if (!firstScreen) {
!                firstScreen = true;
!                signonSave = screen.getScreenAsChars();
! //               System.out.println("Signon saved");
!             }
! 
!             // check for on connect macro
!             String mac = sesConfig.getStringProperty("connectMacro");
!             if (mac.length() > 0)
!                executeMacro(mac);
!             break;
!          default:
!             firstScreen = false;
!             signonSave = null;
!       }
!    }
! 
!    /**
!     * Add a SessionListener to the listener list.
!     *
!     * @param listener  The SessionListener to be added
!     */
!    public synchronized void addSessionListener(SessionListener listener) {
! 
!       session.addSessionListener(listener);
! 
!    }
! 
!    /**
!     * Remove a SessionListener from the listener list.
!     *
!     * @param listener  The SessionListener to be removed
!     */
!    public synchronized void removeSessionListener(SessionListener listener) {
!       session.removeSessionListener(listener);
! 
!    }
! 
  }
\ No newline at end of file
--- 1,183 ----
! /*
!  * @(#)SessionGUI.java
!  * Copyright:    Copyright (c) 2001 - 2004
!  * @author Kenneth J. Pouncey
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.util.*;
! import java.awt.Rectangle;
! 
! import org.tn5250j.event.SessionListener;
! import org.tn5250j.event.SessionChangeEvent;
! import org.tn5250j.framework.tn5250.*;
! 
! /**
!  * A host GUI session
!  */
! public class SessionGUI extends Gui5250 implements SessionListener,TN5250jConstants {
! 
!    private String configurationResource;
!    private String sessionName;
!    private boolean connected;
!    private Vector listeners;
!    private boolean firstScreen;
!    private char[] signonSave;
! 
! 
!    public SessionGUI (Session5250 session) {
!       super(session);
! 
!       this.configurationResource = session.getConfigurationResource();
!       this.sessionName = session.getSessionName();
! 
!       session.getConfiguration().addSessionConfigListener(this);
!       session.addSessionListener(this);
!    }
! 
!    public Session5250 getSession() {
!       return super.session;
!    }
! 
!    public void setSession(Session5250 session) {
!       this.session = session;
!    }
! 
! 
!    public boolean isConnected() {
! 
!       return session.getVT().isConnected();
! 
!    }
! 
!    public boolean isOnSignOnScreen() {
! 
!       // check to see if we should check.
!       if (firstScreen) {
! 
!          char[] so = screen.getScreenAsChars();
!          int size = signonSave.length;
! 
!          Rectangle region = super.sesConfig.getRectangleProperty("signOnRegion");
! 
!          int fromRow = region.x;
!          int fromCol = region.y;
!          int toRow = region.width;
!          int toCol = region.height;
! 
!          // make sure we are within range.
!          if (fromRow == 0)
!             fromRow = 1;
!          if (fromCol == 0)
!             fromCol = 1;
!          if (toRow == 0)
!             toRow = 24;
!          if (toCol == 0)
!             toCol = 80;
! 
!          int pos = 0;
! 
!          for (int r = fromRow; r <= toRow; r++)
!             for (int c =fromCol;c <= toCol; c++) {
!                pos = screen.getPos(r - 1, c - 1);
! //               System.out.println(signonSave[pos]);
!                if (signonSave[pos] != so[pos])
!                   return false;
!             }
!       }
! 
!       return true;
!    }
! 
!    public String getSessionName() {
!       return sessionName;
!    }
! 
!    public String getAllocDeviceName() {
!       if (session.getVT() != null)
!          return session.getVT().getAllocatedDeviceName();
!       else
!          return null;
!    }
! 
!    public String getHostName() {
!       return session.getVT().getHostName();
!    }
! 
!    public Screen5250 getScreen() {
! 
!       return screen;
! 
!    }
! 
! 
!    public void connect() {
! 
!       session.connect();
!    }
! 
!    public void disconnect() {
! 
!       session.disconnect();
!    }
! 
!    public void onSessionChanged(SessionChangeEvent changeEvent) {
! 
!       switch (changeEvent.getState()) {
!          case STATE_CONNECTED:
!             // first we check for the signon save or now
!             if (!firstScreen) {
!                firstScreen = true;
!                signonSave = screen.getScreenAsChars();
! //               System.out.println("Signon saved");
!             }
! 
!             // check for on connect macro
!             String mac = sesConfig.getStringProperty("connectMacro");
!             if (mac.length() > 0)
!                executeMacro(mac);
!             break;
!          default:
!             firstScreen = false;
!             signonSave = null;
!       }
!    }
! 
!    /**
!     * Add a SessionListener to the listener list.
!     *
!     * @param listener  The SessionListener to be added
!     */
!    public synchronized void addSessionListener(SessionListener listener) {
! 
!       session.addSessionListener(listener);
! 
!    }
! 
!    /**
!     * Remove a SessionListener from the listener list.
!     *
!     * @param listener  The SessionListener to be removed
!     */
!    public synchronized void removeSessionListener(SessionListener listener) {
!       session.removeSessionListener(listener);
! 
!    }
! 
  }
\ No newline at end of file

Index: RubberBand.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/RubberBand.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** RubberBand.java	8 Jun 2005 19:32:49 -0000	1.7
--- RubberBand.java	16 Jun 2005 04:41:17 -0000	1.8
***************
*** 1,255 ****
! package org.tn5250j;
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.SwingUtilities;
! 
! public abstract class RubberBand {
!    private RubberBandCanvasIF canvas;
!    protected Point startPoint;
!    protected Point endPoint;
!    private boolean eraseSomething = false;
!    private boolean isSomethingBounded = false;
!    private boolean isDragging = false;
! 
!    private class MouseHandler extends MouseAdapter
!    {
!       public void mousePressed(MouseEvent e) {
!          if (!SwingUtilities.isRightMouseButton(e)) {
!             if (!isSomethingBounded)
!                start(canvas.translateStart(e.getPoint()));
!             else {
! //               if (isSomethingBounded) {
! //                  erase();
! //                  notifyRubberBandCanvas();
! //                  reset();
! //                  start(canvas.translateStart(e.getPoint()));
! //               }
!             }
!          }
! 
! //         System.out.println("mouse pressed rb");
!       }
! 
!       public void mouseReleased(MouseEvent e) {
!          isDragging = false;
!       }
! 
!    }
! 
!    private class MouseMotionHandler extends MouseMotionAdapter	{
! 
!       public void mouseDragged(MouseEvent e) {
! 
!          if(!SwingUtilities.isRightMouseButton(e) && getCanvas().canDrawRubberBand(RubberBand.this)) {
! 
! //            if (!isDragging) {
! //
! //               if (isSomethingBounded) {
! //                  erase();
! //                  notifyRubberBandCanvas();
! //                  reset();
! //                  start(canvas.translateStart(e.getPoint()));
! //               }
! //
! //
! //            }
!             isDragging = true;
!             erase();
!             stop(canvas.translateEnd(e.getPoint()));
!             notifyRubberBandCanvas();
!             draw();
!             notifyRubberBandCanvas();
!          }
!       }
! 
!    }
! 
!    public boolean isDragging() {
!       return isDragging;
!    }
! 
!    public RubberBand(RubberBandCanvasIF c) {
!       super();
!       setCanvas(c);
!       getCanvas().addMouseListener(new MouseHandler());
!       getCanvas().addMouseMotionListener(new MouseMotionHandler());
!    }
! 
!    protected void draw() {
! //      Graphics g = getCanvas().getGraphics();
!       Graphics g = getCanvas().getDrawingGraphics();
! 
!       if(g != null){
!          try {
!             if(getCanvas().canDrawRubberBand(this)) {
!                g.setXORMode(canvas.getBackground());
!                drawRubberBand(g);
!                // we have drawn something, set the flag to indicate this
!                setEraseSomething(true);
!             }
!          }
!          finally {
!             g.dispose();
!          }
!       }
!    }
! 
!    protected abstract void drawBoundingShape(Graphics g,int startx, int starty, int width, int height);
! 
!    protected void drawRubberBand(Graphics g) {
! 
!       if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) {
!          drawBoundingShape(g,getStartPoint().x,getStartPoint().y,getEndPoint().x-getStartPoint().x,getEndPoint().y-getStartPoint().y);
!       }
! 
!       else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y < getStartPoint().y)) {
!          drawBoundingShape(g,getEndPoint().x,getEndPoint().y,getStartPoint().x-getEndPoint().x,getStartPoint().y-getEndPoint().y);
!       }
! 
!       else if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y < getStartPoint().y))  {
!          drawBoundingShape(g,getStartPoint().x,getEndPoint().y,getEndPoint().x-getStartPoint().x,getStartPoint().y-getEndPoint().y);
!       }
! 
!       else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) {
!          drawBoundingShape(g,getEndPoint().x,getStartPoint().y,getStartPoint().x-getEndPoint().x,getEndPoint().y-getStartPoint().y);
!       }
!       isSomethingBounded = true;
! 
!    }
! 
!    protected void erase()  {
! 
!       if(getEraseSomething()) {
!          draw();
!          setEraseSomething(false);
!       }
! 
!    }
! 
!    public final RubberBandCanvasIF getCanvas()  {
!       return this.canvas;
!    }
! 
!    protected Point getEndPoint() {
!       if(this.endPoint == null) {
!          setEndPoint(new Point(0,0));
!       }
!       return this.endPoint;
!    }
! 
!    protected Point getStartPoint() {
! 
!       if(this.startPoint == null) {
!          setStartPoint(new Point(0,0));
!       }
!       return this.startPoint;
! 
!    }
! 
!    protected final boolean getEraseSomething() {
!       return this.eraseSomething;
!    }
! 
!    protected void notifyRubberBandCanvas() {
! 
!       int startX, startY, endX, endY;
! 
!       if(getStartPoint().x < getEndPoint().x)  {
!          startX = getStartPoint().x;
!          endX = getEndPoint().x;
!       }
!       else {
!          startX = getEndPoint().x;
!          endX = getStartPoint().x;
!       }
!       if(getStartPoint().y < getEndPoint().y)  {
!          startY = getStartPoint().y;
!          endY = getEndPoint().y;
!       }
!       else {
!          startY = getEndPoint().y;
!          endY = getStartPoint().y;
!       }
! 
!       getCanvas().areaBounded(this,startX, startY, endX, endY);
! 
!    }
! 
!    public final void setCanvas(RubberBandCanvasIF c) {
!       this.canvas = c;
!    }
! 
!    protected final void setEndPoint(Point newValue){
!       this.endPoint = newValue;
!    }
! 
!    protected final void setEraseSomething(boolean newValue)  {
!       this.eraseSomething = newValue;
!    }
! 
!    protected final void setStartPoint(Point newValue) {
!       this.startPoint = newValue;
!       if (startPoint == null)
!          endPoint = null;
! 
!    }
! 
!    protected void start(Point p) {
!       setEndPoint(p);
!       setStartPoint(p);
! //      System.out.println("start " + startPoint + " end " + endPoint);
!    }
! 
!    protected void stop(Point p) {
! 
!       if(p.x < 0) {
!          p.x = 0;
!       }
! 
!       if(p.y < 0) {
!          p.y = 0;
!       }
! 
!       setEndPoint(p);
! //      System.out.println("stop " + startPoint + " end " + endPoint);
! 
!    }
! 
!    protected void reset() {
!       setStartPoint(null);
!       setEndPoint(null);
!       isSomethingBounded = false;
! 
!    }
! 
!    protected final boolean isAreaSelected() {
!       return isSomethingBounded;
!    }
! 
  }
\ No newline at end of file
--- 1,255 ----
! package org.tn5250j;
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.SwingUtilities;
! 
! public abstract class RubberBand {
!    private RubberBandCanvasIF canvas;
!    protected Point startPoint;
!    protected Point endPoint;
!    private boolean eraseSomething = false;
!    private boolean isSomethingBounded = false;
!    private boolean isDragging = false;
! 
!    private class MouseHandler extends MouseAdapter
!    {
!       public void mousePressed(MouseEvent e) {
!          if (!SwingUtilities.isRightMouseButton(e)) {
!             if (!isSomethingBounded)
!                start(canvas.translateStart(e.getPoint()));
!             else {
! //               if (isSomethingBounded) {
! //                  erase();
! //                  notifyRubberBandCanvas();
! //                  reset();
! //                  start(canvas.translateStart(e.getPoint()));
! //               }
!             }
!          }
! 
! //         System.out.println("mouse pressed rb");
!       }
! 
!       public void mouseReleased(MouseEvent e) {
!          isDragging = false;
!       }
! 
!    }
! 
!    private class MouseMotionHandler extends MouseMotionAdapter	{
! 
!       public void mouseDragged(MouseEvent e) {
! 
!          if(!SwingUtilities.isRightMouseButton(e) && getCanvas().canDrawRubberBand(RubberBand.this)) {
! 
! //            if (!isDragging) {
! //
! //               if (isSomethingBounded) {
! //                  erase();
! //                  notifyRubberBandCanvas();
! //                  reset();
! //                  start(canvas.translateStart(e.getPoint()));
! //               }
! //
! //
! //            }
!             isDragging = true;
!             erase();
!             stop(canvas.translateEnd(e.getPoint()));
!             notifyRubberBandCanvas();
!             draw();
!             notifyRubberBandCanvas();
!          }
!       }
! 
!    }
! 
!    public boolean isDragging() {
!       return isDragging;
!    }
! 
!    public RubberBand(RubberBandCanvasIF c) {
!       super();
!       setCanvas(c);
!       getCanvas().addMouseListener(new MouseHandler());
!       getCanvas().addMouseMotionListener(new MouseMotionHandler());
!    }
! 
!    protected void draw() {
! //      Graphics g = getCanvas().getGraphics();
!       Graphics g = getCanvas().getDrawingGraphics();
! 
!       if(g != null){
!          try {
!             if(getCanvas().canDrawRubberBand(this)) {
!                g.setXORMode(canvas.getBackground());
!                drawRubberBand(g);
!                // we have drawn something, set the flag to indicate this
!                setEraseSomething(true);
!             }
!          }
!          finally {
!             g.dispose();
!          }
!       }
!    }
! 
!    protected abstract void drawBoundingShape(Graphics g,int startx, int starty, int width, int height);
! 
!    protected void drawRubberBand(Graphics g) {
! 
!       if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) {
!          drawBoundingShape(g,getStartPoint().x,getStartPoint().y,getEndPoint().x-getStartPoint().x,getEndPoint().y-getStartPoint().y);
!       }
! 
!       else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y < getStartPoint().y)) {
!          drawBoundingShape(g,getEndPoint().x,getEndPoint().y,getStartPoint().x-getEndPoint().x,getStartPoint().y-getEndPoint().y);
!       }
! 
!       else if((getEndPoint().x > getStartPoint().x) && (getEndPoint().y < getStartPoint().y))  {
!          drawBoundingShape(g,getStartPoint().x,getEndPoint().y,getEndPoint().x-getStartPoint().x,getStartPoint().y-getEndPoint().y);
!       }
! 
!       else if((getEndPoint().x < getStartPoint().x) && (getEndPoint().y > getStartPoint().y)) {
!          drawBoundingShape(g,getEndPoint().x,getStartPoint().y,getStartPoint().x-getEndPoint().x,getEndPoint().y-getStartPoint().y);
!       }
!       isSomethingBounded = true;
! 
!    }
! 
!    protected void erase()  {
! 
!       if(getEraseSomething()) {
!          draw();
!          setEraseSomething(false);
!       }
! 
!    }
! 
!    public final RubberBandCanvasIF getCanvas()  {
!       return this.canvas;
!    }
! 
!    protected Point getEndPoint() {
!       if(this.endPoint == null) {
!          setEndPoint(new Point(0,0));
!       }
!       return this.endPoint;
!    }
! 
!    protected Point getStartPoint() {
! 
!       if(this.startPoint == null) {
!          setStartPoint(new Point(0,0));
!       }
!       return this.startPoint;
! 
!    }
! 
!    protected final boolean getEraseSomething() {
!       return this.eraseSomething;
!    }
! 
!    protected void notifyRubberBandCanvas() {
! 
!       int startX, startY, endX, endY;
! 
!       if(getStartPoint().x < getEndPoint().x)  {
!          startX = getStartPoint().x;
!          endX = getEndPoint().x;
!       }
!       else {
!          startX = getEndPoint().x;
!          endX = getStartPoint().x;
!       }
!       if(getStartPoint().y < getEndPoint().y)  {
!          startY = getStartPoint().y;
!          endY = getEndPoint().y;
!       }
!       else {
!          startY = getEndPoint().y;
!          endY = getStartPoint().y;
!       }
! 
!       getCanvas().areaBounded(this,startX, startY, endX, endY);
! 
!    }
! 
!    public final void setCanvas(RubberBandCanvasIF c) {
!       this.canvas = c;
!    }
! 
!    protected final void setEndPoint(Point newValue){
!       this.endPoint = newValue;
!    }
! 
!    protected final void setEraseSomething(boolean newValue)  {
!       this.eraseSomething = newValue;
!    }
! 
!    protected final void setStartPoint(Point newValue) {
!       this.startPoint = newValue;
!       if (startPoint == null)
!          endPoint = null;
! 
!    }
! 
!    protected void start(Point p) {
!       setEndPoint(p);
!       setStartPoint(p);
! //      System.out.println("start " + startPoint + " end " + endPoint);
!    }
! 
!    protected void stop(Point p) {
! 
!       if(p.x < 0) {
!          p.x = 0;
!       }
! 
!       if(p.y < 0) {
!          p.y = 0;
!       }
! 
!       setEndPoint(p);
! //      System.out.println("stop " + startPoint + " end " + endPoint);
! 
!    }
! 
!    protected void reset() {
!       setStartPoint(null);
!       setEndPoint(null);
!       isSomethingBounded = false;
! 
!    }
! 
!    protected final boolean isAreaSelected() {
!       return isSomethingBounded;
!    }
! 
  }
\ No newline at end of file

Index: Gui5250Frame.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Gui5250Frame.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** Gui5250Frame.java	8 Jun 2005 19:32:49 -0000	1.26
--- Gui5250Frame.java	16 Jun 2005 04:41:17 -0000	1.27
***************
*** 1,513 ****
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001-2003
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
[...997 lines suppressed...]
!       }
!    }
! 
!    public boolean containsSession(SessionGUI session) {
! 
!       if (hideTabBar && sessionPane.getTabCount() == 0) {
!          for (int x=0; x < this.getContentPane().getComponentCount(); x++) {
! 
!             if (this.getContentPane().getComponent(x) instanceof SessionGUI) {
!                return ((SessionGUI)getContentPane().getComponent(x)).equals(session);
!             }
!          }
!          return false;
!       }
!       else
!          return (sessionPane.indexOfComponent(session) >= 0);
! 
!    }
! 
! }

Index: SessionScroller14.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionScroller14.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SessionScroller14.java	8 Jun 2005 19:32:50 -0000	1.4
--- SessionScroller14.java	16 Jun 2005 04:41:17 -0000	1.5
***************
*** 1,90 ****
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.awt.event.*;
! 
! import org.tn5250j.interfaces.SessionScrollerInterface;
! import org.tn5250j.framework.tn5250.Screen5250;
! 
! /**
!  * Session Scroller to allow the use of the mouse wheel to move the list on the
!  * screen up and down.
!  */
! public class SessionScroller14 implements SessionScrollerInterface,
!                                              MouseWheelListener,TN5250jConstants {
! 
!    Screen5250 screen;
! 
! 	public SessionScroller14(SessionGUI ses) {
! 
!       screen = ses.getScreen();
! 	}
! 
!    public void addMouseWheelListener(SessionGUI ses) {
! 
!       ses.addMouseWheelListener(this);
! 
!    }
! 
!    public void removeMouseWheelListener(SessionGUI ses) {
! 
!       ses.removeMouseWheelListener(this);
! 
!    }
! 
!    public void mouseWheelMoved(MouseWheelEvent e) {
! 
! //       String message;
!        int notches = e.getWheelRotation();
!        if (notches < 0) {
! //           message = "Mouse wheel moved UP "
! //                        + -notches + " notch(es)" + newline;
!             screen.sendKeys(MNEMONIC_PAGE_UP);
!        } else {
! //           message = "Mouse wheel moved DOWN "
! //                        + notches + " notch(es)" + newline;
!             screen.sendKeys(MNEMONIC_PAGE_DOWN);
!        }
! //          if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
! //              message += "    Scroll type: WHEEL_UNIT_SCROLL" + newline;
! //              message += "    Scroll amount: " + e.getScrollAmount()
! //                      + " unit increments per notch" + newline;
! //              message += "    Units to scroll: " + e.getUnitsToScroll()
! //                      + " unit increments" + newline;
! //              message += "    Vertical unit increment: "
! //   //               + scrollPane.getVerticalScrollBar().getUnitIncrement(1)
! //                  + " pixels" + newline;
! //          } else { //scroll type == MouseWheelEvent.WHEEL_BLOCK_SCROLL
! //              message += "    Scroll type: WHEEL_BLOCK_SCROLL" + newline;
! //              message += "    Vertical block increment: "
! //   //               + scrollPane.getVerticalScrollBar().getBlockIncrement(1)
! //                  + " pixels" + newline;
! //          }
! //          System.out.println(message);
! //          System.out.println(e);
!    }
! }
--- 1,90 ----
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.awt.event.*;
! 
! import org.tn5250j.interfaces.SessionScrollerInterface;
! import org.tn5250j.framework.tn5250.Screen5250;
! 
! /**
!  * Session Scroller to allow the use of the mouse wheel to move the list on the
!  * screen up and down.
!  */
! public class SessionScroller14 implements SessionScrollerInterface,
!                                              MouseWheelListener,TN5250jConstants {
! 
!    Screen5250 screen;
! 
! 	public SessionScroller14(SessionGUI ses) {
! 
!       screen = ses.getScreen();
! 	}
! 
!    public void addMouseWheelListener(SessionGUI ses) {
! 
!       ses.addMouseWheelListener(this);
! 
!    }
! 
!    public void removeMouseWheelListener(SessionGUI ses) {
! 
!       ses.removeMouseWheelListener(this);
! 
!    }
! 
!    public void mouseWheelMoved(MouseWheelEvent e) {
! 
! //       String message;
!        int notches = e.getWheelRotation();
!        if (notches < 0) {
! //           message = "Mouse wheel moved UP "
! //                        + -notches + " notch(es)" + newline;
!             screen.sendKeys(MNEMONIC_PAGE_UP);
!        } else {
! //           message = "Mouse wheel moved DOWN "
! //                        + notches + " notch(es)" + newline;
!             screen.sendKeys(MNEMONIC_PAGE_DOWN);
!        }
! //          if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
! //              message += "    Scroll type: WHEEL_UNIT_SCROLL" + newline;
! //              message += "    Scroll amount: " + e.getScrollAmount()
! //                      + " unit increments per notch" + newline;
! //              message += "    Units to scroll: " + e.getUnitsToScroll()
! //                      + " unit increments" + newline;
! //              message += "    Vertical unit increment: "
! //   //               + scrollPane.getVerticalScrollBar().getUnitIncrement(1)
! //                  + " pixels" + newline;
! //          } else { //scroll type == MouseWheelEvent.WHEEL_BLOCK_SCROLL
! //              message += "    Scroll type: WHEEL_BLOCK_SCROLL" + newline;
! //              message += "    Vertical block increment: "
! //   //               + scrollPane.getVerticalScrollBar().getBlockIncrement(1)
! //                  + " pixels" + newline;
! //          }
! //          System.out.println(message);
! //          System.out.println(e);
!    }
! }

Index: GuiGraphicBuffer.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/GuiGraphicBuffer.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** GuiGraphicBuffer.java	8 Jun 2005 19:32:49 -0000	1.37
--- GuiGraphicBuffer.java	16 Jun 2005 04:41:16 -0000	1.38
***************
*** 1,2185 ****
! /**
!  * Title: GuiGraphicBuffer.java
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
[...4341 lines suppressed...]
!    Color fg;
!    Color bg;
! 
!    private void setDrawAttr(int pos) {
! 
!       Screen5250 s = screen;
!       colSep = false;
!       underLine = false;
!       nonDisplay = false;
! 
!       fg = getColor(updateRect.color[pos],false);
!       bg = getColor(updateRect.color[pos],true);
!       underLine = (updateRect.extended[pos] & EXTENDED_5250_UNDERLINE) != 0;
!       colSep = (updateRect.extended[pos] & EXTENDED_5250_COL_SEP) != 0;
!       nonDisplay = (updateRect.extended[pos] & EXTENDED_5250_NON_DSP) != 0;
! 
!    }
! 
! 
! }

Index: Gui5250MDIFrame.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Gui5250MDIFrame.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** Gui5250MDIFrame.java	22 Jul 2004 05:49:47 -0000	1.20
--- Gui5250MDIFrame.java	16 Jun 2005 04:41:17 -0000	1.21
***************
*** 1,647 ****
! package org.tn5250j;
! /**
!  * Title: Gui5250MDIFrame.java
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
[...1265 lines suppressed...]
!              y=0;                    // flush against the top
!            }
!            else {
!              if (y+h > d.height) {   // too low?
!                if (resizing)
!                  h = d.height - y;   // don't get taller!
!                else
!                  y = d.height-h;     // flush against the bottom
!              }
!            }
! 
!            // Set 'em the way we like 'em
!            super.setBoundsForFrame(f, x, y, w, h);
! //           ((MyInternalFrame)f).resizeMe();
!          }
! 
!        }
! 
!      }
! }

Index: SessionAttributes.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionAttributes.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** SessionAttributes.java	8 Jun 2005 19:32:49 -0000	1.18
--- SessionAttributes.java	16 Jun 2005 04:41:17 -0000	1.19
***************
*** 1,323 ****
! package org.tn5250j;
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.*;
! import javax.swing.tree.DefaultMutableTreeNode;
! import javax.swing.event.TreeSelectionListener;
! import javax.swing.event.TreeSelectionEvent;
! import javax.swing.tree.TreeSelectionModel;
! import java.util.*;
! import java.beans.*;
! 
! import org.tn5250j.tools.*;
! import org.tn5250j.settings.*;
! 
! public class SessionAttributes extends JDialog {
! 
!    String fileName;
!    Properties props = null;
!    JPanel jpm = new JPanel(new BorderLayout());
! 
!    private SessionConfig changes = null;
! 
!    JTree tree = new JTree();
!    CardLayout cardLayout;
!    JPanel jp;
! 
!    public SessionAttributes(Frame parent, SessionConfig config ) {
!       super(parent);
! 
!       parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
! 
!       this.fileName = config.getConfigurationResource();
!       this.props = config.getProperties();
!       changes = config;
! 
!       try {
!          jbInit();
!          parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
!       }
!       catch(Exception e) {
!          e.printStackTrace();
!       }
!    }
! 
!    /**Component initialization*/
!    private void jbInit() throws Exception  {
! 
!       // define default
!       jp = new JPanel();
!       cardLayout = new CardLayout();
!       jp.setLayout(cardLayout);
! 
!       DefaultMutableTreeNode root = (DefaultMutableTreeNode)tree.getModel().getRoot();
!       Enumeration e = root.children();
!       Object child;
!       while (e.hasMoreElements()) {
!          child = e.nextElement();
!          Object obj = ((DefaultMutableTreeNode)child).getUserObject();
!          if (obj instanceof AttributesPanel) {
!             jp.add((AttributesPanel)obj,((AttributesPanel)obj).toString());
!          }
!       }
! 
!       //Create the nodes.
!       DefaultMutableTreeNode top = new DefaultMutableTreeNode(fileName);
!       createNodes(top);
! 
!       //Create a tree that allows one selection at a time.
!       tree = new JTree(top);
! 
!       tree.getSelectionModel().setSelectionMode
!              (TreeSelectionModel.SINGLE_TREE_SELECTION);
! 
!       //Listen for when the selection changes.
!       tree.addTreeSelectionListener(new TreeSelectionListener() {
!          public void valueChanged(TreeSelectionEvent e) {
! 
!             DefaultMutableTreeNode node = (DefaultMutableTreeNode)
!                                 tree.getLastSelectedPathComponent();
! 
!             if (node == null)
!                return;
! 
!             Object nodeInfo = node.getUserObject();
! 
!             showPanel(nodeInfo);
! 
!             }
!       });
! 
! 
!       // define tree selection panel
!       JPanel jsp = new JPanel();
!       jsp.setBackground(Color.white);
!       jsp.add(tree);
! 
!       jpm.add(jp,BorderLayout.EAST);
!       jpm.add(jsp,BorderLayout.WEST);
! 
!       cardLayout.first(jp);
! 
! 
!    }
! 
!    private void showPanel(Object node) {
! 
!       cardLayout.show(jp,node.toString());
!    }
! 
!    private void createNodes(DefaultMutableTreeNode top) {
!       createNode(top,new ColorAttributesPanel(changes));
!       createNode(top,new DisplayAttributesPanel(changes));
!       createNode(top,new CursorAttributesPanel(changes));
!       createNode(top,new FontAttributesPanel(changes));
!       createNode(top,new SignoffAttributesPanel(changes));
!       createNode(top,new OnConnectAttributesPanel(changes));
!       createNode(top,new MouseAttributesPanel(changes));
!       createNode(top,new HotspotAttributesPanel(changes));
!       createNode(top,new KeypadAttributesPanel(changes));
!       createNode(top,new PrinterAttributesPanel(changes));
!       createNode(top,new ErrorResetAttributesPanel(changes));
! 
!    }
! 
!    private void createNode(DefaultMutableTreeNode top, AttributesPanel ap) {
! 
!       top.add(new DefaultMutableTreeNode(ap));
!       jp.add(ap,ap.toString());
! 
!    }
! 
!    protected final String getStringProperty(String prop) {
! 
!       if (props.containsKey(prop))
!          return (String)props.get(prop);
!       else
!          return "";
! 
!    }
! 
!    protected final String getStringProperty(String prop,String defaultValue) {
! 
!       if (props.containsKey(prop)) {
!          String p = (String)props.get(prop);
!          if (p.length() > 0)
!             return p;
!          else
!             return defaultValue;
!       }
!       else
!          return defaultValue;
! 
!    }
! 
!    protected final int getIntProperty(String prop) {
! 
!       return Integer.parseInt((String)props.get(prop));
! 
!    }
! 
!    protected final void setProperty(String key, String val) {
! 
!       props.setProperty(key,val);
! 
!    }
! 
!    public Properties getProperties() {
! 
!       return props;
!    }
! 
!    public void showIt() {
! 
!       Object[]      message = new Object[1];
!       message[0] = jpm;
!       String[] options = {LangTool.getString("sa.optApply"),
!                            LangTool.getString("sa.optCancel"),
!                            LangTool.getString("sa.optSave")
!                           };
! 
!       final JOptionPane saOptionPane = new JOptionPane(
!              message,                           // the dialog message array
!              JOptionPane.PLAIN_MESSAGE,   // message type
!              JOptionPane.YES_NO_CANCEL_OPTION,        // option type
!              null,                              // optional icon, use null to use the default icon
!              options,                           // options string array, will be made into buttons//
!              options[1]                         // option that should be made into a default button
!          );
! 
!       setTitle(LangTool.getString("sa.title"));
!       setModal(true);
!       setContentPane(saOptionPane);
! 
!       addWindowListener(new WindowAdapter() {
!            public void windowClosing(WindowEvent we) {
! 
!            }
!        });
! 
!        saOptionPane.addPropertyChangeListener(
!            new PropertyChangeListener() {
!                public void propertyChange(PropertyChangeEvent e) {
!                    String prop = e.getPropertyName();
! 
! //                     System.out.println("prop > " + prop);
! 
!                    if (isVisible()
!                     && (e.getSource() == saOptionPane)
!                     && (prop.equals(JOptionPane.VALUE_PROPERTY) ||
!                         prop.equals(JOptionPane.INPUT_VALUE_PROPERTY)))
!                    {
! 
!                      saOptionPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
! 
!                      doOptionStuff(saOptionPane);
! 
!                      saOptionPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
!                    }
!                }
!            });
! 
!       pack();
! 
!       //Center the dialog
!       Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
!       Dimension dialogSize = getSize();
!       if (dialogSize.height > screenSize.height)
!          dialogSize.height = screenSize.height;
!       if (dialogSize.width > screenSize.width)
!          dialogSize.width = screenSize.width;
!       setLocation((screenSize.width - dialogSize.width) / 2,
!                      (screenSize.height - dialogSize.height) / 2);
! 
!       setVisible(true);
! 
!    }
! 
!    private void doOptionStuff(JOptionPane optionPane) {
! 
!       String result = (String)optionPane.getValue();
! 
!       if (LangTool.getString("sa.optApply").equals(result)) {
! 
!          applyAttributes();
!          optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
! 
!       }
!       if (LangTool.getString("sa.optCancel").equals(result)) {
!          setVisible(false);
!          dispose();
!       }
!       if (LangTool.getString("sa.optSave").equals(result)) {
! 
!          if (props.containsKey("saveme")){
!             props.remove("saveme");
!          }
!          saveProps();
!          setVisible(false);
!          dispose();
!       }
!    }
! 
!    private void applyAttributes() {
! 
!       DefaultMutableTreeNode root = (DefaultMutableTreeNode)tree.getModel().getRoot();
!       Enumeration e = root.children();
!       Object child;
!       while (e.hasMoreElements()) {
!          child = e.nextElement();
!          Object obj = ((DefaultMutableTreeNode)child).getUserObject();
!          if (obj instanceof AttributesPanel) {
!             ((AttributesPanel)obj).applyAttributes();
!          }
!       }
! 
!       setProperty("saveme","yes");
! 
!    }
! 
!    private void saveProps() {
! 
!       DefaultMutableTreeNode root = (DefaultMutableTreeNode)tree.getModel().getRoot();
!       Enumeration e = root.children();
!       Object child;
!       while (e.hasMoreElements()) {
!          child = e.nextElement();
!          Object obj = ((DefaultMutableTreeNode)child).getUserObject();
!          if (obj instanceof AttributesPanel) {
!             ((AttributesPanel)obj).save();
!          }
!       }
! 
!       changes.saveSessionProps();
! 
!    }
! 
  }
\ No newline at end of file
--- 1,323 ----
! package org.tn5250j;
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.*;
! import javax.swing.tree.DefaultMutableTreeNode;
! import javax.swing.event.TreeSelectionListener;
! import javax.swing.event.TreeSelectionEvent;
! import javax.swing.tree.TreeSelectionModel;
! import java.util.*;
! import java.beans.*;
! 
! import org.tn5250j.tools.*;
! import org.tn5250j.settings.*;
! 
! public class SessionAttributes extends JDialog {
! 
!    String fileName;
!    Properties props = null;
!    JPanel jpm = new JPanel(new BorderLayout());
! 
!    private SessionConfig changes = null;
! 
!    JTree tree = new JTree();
!    CardLayout cardLayout;
!    JPanel jp;
! 
!    public SessionAttributes(Frame parent, SessionConfig config ) {
!       super(parent);
! 
!       parent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
! 
!       this.fileName = config.getConfigurationResource();
!       this.props = config.getProperties();
!       changes = config;
! 
!       try {
!          jbInit();
!          parent.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
!       }
!       catch(Exception e) {
!          e.printStackTrace();
!       }
!    }
! 
!    /**Component initialization*/
!    private void jbInit() throws Exception  {
! 
!       // define default
!       jp = new JPanel();
!       cardLayout = new CardLayout();
!       jp.setLayout(cardLayout);
! 
!       DefaultMutableTreeNode root = (DefaultMutableTreeNode)tree.getModel().getRoot();
!       Enumeration e = root.children();
!       Object child;
!       while (e.hasMoreElements()) {
!          child = e.nextElement();
!          Object obj = ((DefaultMutableTreeNode)child).getUserObject();
!          if (obj instanceof AttributesPanel) {
!             jp.add((AttributesPanel)obj,((AttributesPanel)obj).toString());
!          }
!       }
! 
!       //Create the nodes.
!       DefaultMutableTreeNode top = new DefaultMutableTreeNode(fileName);
!       createNodes(top);
! 
!       //Create a tree that allows one selection at a time.
!       tree = new JTree(top);
! 
!       tree.getSelectionModel().setSelectionMode
!              (TreeSelectionModel.SINGLE_TREE_SELECTION);
! 
!       //Listen for when the selection changes.
!       tree.addTreeSelectionListener(new TreeSelectionListener() {
!          public void valueChanged(TreeSelectionEvent e) {
! 
!             DefaultMutableTreeNode node = (DefaultMutableTreeNode)
!                                 tree.getLastSelectedPathComponent();
! 
!             if (node == null)
!                return;
! 
!             Object nodeInfo = node.getUserObject();
! 
!             showPanel(nodeInfo);
! 
!             }
!       });
! 
! 
!       // define tree selection panel
!       JPanel jsp = new JPanel();
!       jsp.setBackground(Color.white);
!       jsp.add(tree);
! 
!       jpm.add(jp,BorderLayout.EAST);
!       jpm.add(jsp,BorderLayout.WEST);
! 
!       cardLayout.first(jp);
! 
! 
!    }
! 
!    private void showPanel(Object node) {
! 
!       cardLayout.show(jp,node.toString());
!    }
! 
!    private void createNodes(DefaultMutableTreeNode top) {
!       createNode(top,new ColorAttributesPanel(changes));
!       createNode(top,new DisplayAttributesPanel(changes));
!       createNode(top,new CursorAttributesPanel(changes));
!       createNode(top,new FontAttributesPanel(changes));
!       createNode(top,new SignoffAttributesPanel(changes));
!       createNode(top,new OnConnectAttributesPanel(changes));
!       createNode(top,new MouseAttributesPanel(changes));
!       createNode(top,new HotspotAttributesPanel(changes));
!       createNode(top,new KeypadAttributesPanel(changes));
!       createNode(top,new PrinterAttributesPanel(changes));
!       createNode(top,new ErrorResetAttributesPanel(changes));
! 
!    }
! 
!    private void createNode(DefaultMutableTreeNode top, AttributesPanel ap) {
! 
!       top.add(new DefaultMutableTreeNode(ap));
!       jp.add(ap,ap.toString());
! 
!    }
! 
!    protected final String getStringProperty(String prop) {
! 
!       if (props.containsKey(prop))
!          return (String)props.get(prop);
!       else
!          return "";
! 
!    }
! 
!    protected final String getStringProperty(String prop,String defaultValue) {
! 
!       if (props.containsKey(prop)) {
!          String p = (String)props.get(prop);
!          if (p.length() > 0)
!             return p;
!          else
!             return defaultValue;
!       }
!       else
!          return defaultValue;
! 
!    }
! 
!    protected final int getIntProperty(String prop) {
! 
!       return Integer.parseInt((String)props.get(prop));
! 
!    }
! 
!    protected final void setProperty(String key, String val) {
! 
!       props.setProperty(key,val);
! 
!    }
! 
!    public Properties getProperties() {
! 
!       return props;
!    }
! 
!    public void showIt() {
! 
!       Object[]      message = new Object[1];
!       message[0] = jpm;
!       String[] options = {LangTool.getString("sa.optApply"),
!                            LangTool.getString("sa.optCancel"),
!                            LangTool.getString("sa.optSave")
!                           };
! 
!       final JOptionPane saOptionPane = new JOptionPane(
!              message,                           // the dialog message array
!              JOptionPane.PLAIN_MESSAGE,   // message type
!              JOptionPane.YES_NO_CANCEL_OPTION,        // option type
!              null,                              // optional icon, use null to use the default icon
!              options,                           // options string array, will be made into buttons//
!              options[1]                         // option that should be made into a default button
!          );
! 
!       setTitle(LangTool.getString("sa.title"));
!       setModal(true);
!       setContentPane(saOptionPane);
! 
!       addWindowListener(new WindowAdapter() {
!            public void windowClosing(WindowEvent we) {
! 
!            }
!        });
! 
!        saOptionPane.addPropertyChangeListener(
!            new PropertyChangeListener() {
!                public void propertyChange(PropertyChangeEvent e) {
!                    String prop = e.getPropertyName();
! 
! //                     System.out.println("prop > " + prop);
! 
!                    if (isVisible()
!                     && (e.getSource() == saOptionPane)
!                     && (prop.equals(JOptionPane.VALUE_PROPERTY) ||
!                         prop.equals(JOptionPane.INPUT_VALUE_PROPERTY)))
!                    {
! 
!                      saOptionPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
! 
!                      doOptionStuff(saOptionPane);
! 
!                      saOptionPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
!                    }
!                }
!            });
! 
!       pack();
! 
!       //Center the dialog
!       Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
!       Dimension dialogSize = getSize();
!       if (dialogSize.height > screenSize.height)
!          dialogSize.height = screenSize.height;
!       if (dialogSize.width > screenSize.width)
!          dialogSize.width = screenSize.width;
!       setLocation((screenSize.width - dialogSize.width) / 2,
!                      (screenSize.height - dialogSize.height) / 2);
! 
!       setVisible(true);
! 
!    }
! 
!    private void doOptionStuff(JOptionPane optionPane) {
! 
!       String result = (String)optionPane.getValue();
! 
!       if (LangTool.getString("sa.optApply").equals(result)) {
! 
!          applyAttributes();
!          optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE);
! 
!       }
!       if (LangTool.getString("sa.optCancel").equals(result)) {
!          setVisible(false);
!          dispose();
!       }
!       if (LangTool.getString("sa.optSave").equals(result)) {
! 
!          if (props.containsKey("saveme")){
!             props.remove("saveme");
!          }
!          saveProps();
!          setVisible(false);
!          dispose();
!       }
!    }
! 
!    private void applyAttributes() {
! 
!       DefaultMutableTreeNode root = (DefaultMutableTreeNode)tree.getModel().getRoot();
!       Enumeration e = root.children();
!       Object child;
!       while (e.hasMoreElements()) {
!          child = e.nextElement();
!          Object obj = ((DefaultMutableTreeNode)child).getUserObject();
!          if (obj instanceof AttributesPanel) {
!             ((AttributesPanel)obj).applyAttributes();
!          }
!       }
! 
!       setProperty("saveme","yes");
! 
!    }
! 
!    private void saveProps() {
! 
!       DefaultMutableTreeNode root = (DefaultMutableTreeNode)tree.getModel().getRoot();
!       Enumeration e = root.children();
!       Object child;
!       while (e.hasMoreElements()) {
!          child = e.nextElement();
!          Object obj = ((DefaultMutableTreeNode)child).getUserObject();
!          if (obj instanceof AttributesPanel) {
!             ((AttributesPanel)obj).save();
!          }
!       }
! 
!       changes.saveSessionProps();
! 
!    }
! 
  }
\ No newline at end of file

Index: SessionBean.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionBean.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SessionBean.java	8 Jun 2005 19:32:49 -0000	1.5
--- SessionBean.java	16 Jun 2005 04:41:17 -0000	1.6
***************
*** 1,569 ****
! /**
! *
! * <p>Title: SessionBean</p>
! * <p>Description: TN5250 Session as a bean with auto signon features</p>
! * <p>Copyright: Copyright (c) 2000 - 2004</p>
! * <p>
! *
! * @author Luc Gorrens
! * @version 1.0
! *
[...1109 lines suppressed...]
!   }
! 
! 
!   private class DoVisible
!       implements ActionListener, Runnable
!   {
!     public void actionPerformed(ActionEvent event)
!     {
!       SwingUtilities.invokeLater(this);
!     }
! 
! 
!     public void run()
!     {
!       SessionBean.this.setVisible(true);
!       SessionBean.this.resizeMe();
!       SessionBean.this.requestFocusInWindow();
!     }
!   }
! }

Index: PrinterThread.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/PrinterThread.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** PrinterThread.java	8 Jun 2005 19:32:49 -0000	1.16
--- PrinterThread.java	16 Jun 2005 04:41:17 -0000	1.17
***************
*** 1,280 ****
! /**
!  * Title: PrinterThread
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.awt.print.*;
! import java.awt.*;
! import java.awt.font.*;
! import org.tn5250j.SessionGUI;
! import org.tn5250j.SessionConfig;
! import org.tn5250j.framework.tn5250.Screen5250;
! 
! public class PrinterThread extends Thread implements Printable, TN5250jConstants {
! 
!    char[] screen;
!    char[] screenExtendedAttr;
!    char[] screenAttrPlace;
!    Screen5250 scr;
!    int numCols;
!    int numRows;
!    Color colorBg;
!    Font font;
!    SessionGUI session;
!    boolean toDefault;
!    SessionConfig config;
! 
!    public PrinterThread (Screen5250 scr, Font font, int cols, int rows,
!                            Color colorBg, boolean toDefaultPrinter, SessionGUI ses) {
! 
! 
!       setPriority(1);
!       session = ses;
!       session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
!       config = ses.getSession().getConfiguration();
! 
!       int len = scr.getScreenLength();
!       screen = new char[len];
!       screenExtendedAttr = new char[len];
!       screenAttrPlace = new char[len];
!       int ret = scr.GetScreen(screen, len, PLANE_TEXT);
!       ret = scr.GetScreen(screenExtendedAttr, len, PLANE_EXTENDED);
!       ret = scr.GetScreen(screenAttrPlace, len, PLANE_IS_ATTR_PLACE);
!       toDefault = toDefaultPrinter;
! 
!       numCols = cols;
!       numRows = rows;
!       this.colorBg = colorBg;
!       this.font = font;
!    }
! 
!    public void run () {
! // Toolkit tk = Toolkit.getDefaultToolkit();
! //int [][] range = new int[][] {
! //new int[] { 1, 1 }
! //};
! // JobAttributes jobAttributes = new JobAttributes(1, JobAttributes.DefaultSelectionType.ALL, JobAttributes.DestinationType.PRINTER, JobAttributes.DialogType.NONE, "file", 1, 1, JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES, range, "HP LaserJet", JobAttributes.SidesType.ONE_SIDED);
! //PrintJob job = tk.getPrintJob(null, "Print", jobAttributes, null);
! //if (job != null) {
!       //--- Create a printerJob object
!       PrinterJob printJob = PrinterJob.getPrinterJob ();
!       printJob.setJobName("tn5250j");
! 
!       // will have to remember this for the next time.
!       //   Always set a page format before call setPrintable to
!       //   set the orientation.
!       PageFormat pf = printJob.defaultPage();
!       if (numCols == 132)
!          pf.setOrientation(PageFormat.LANDSCAPE);
!       else
!          pf.setOrientation(PageFormat.PORTRAIT);
! 
! 
!       if (numCols != 132) {
!          if (config.getStringProperty("print.portWidth").length() != 0 &&
!                config.getStringProperty("print.portHeight").length() != 0 &&
!                config.getStringProperty("print.portImageWidth").length() != 0 &&
!                config.getStringProperty("print.portImageHeight").length() != 0 &&
!                config.getStringProperty("print.portImage.X").length() != 0 &&
!                config.getStringProperty("print.portImage.Y").length() != 0) {
! 
!             Paper paper = pf.getPaper();
! 
!             paper.setSize(
!                Double.parseDouble(config.getStringProperty("print.portWidth")),
!                Double.parseDouble(config.getStringProperty("print.portHeight")));
! 
!             paper.setImageableArea(
!                Double.parseDouble(config.getStringProperty("print.portImage.X")),
!                Double.parseDouble(config.getStringProperty("print.portImage.Y")),
!                Double.parseDouble(config.getStringProperty("print.portImageWidth")),
!                Double.parseDouble(config.getStringProperty("print.portImageHeight")));
!             pf.setPaper(paper);
!          }
!       }
!       else {
! 
!          if (config.getStringProperty("print.landWidth").length() != 0 &&
!                config.getStringProperty("print.landHeight").length() != 0 &&
!                config.getStringProperty("print.landImageWidth").length() != 0 &&
!                config.getStringProperty("print.landImageHeight").length() != 0 &&
!                config.getStringProperty("print.landImage.X").length() != 0 &&
!                config.getStringProperty("print.landImage.Y").length() != 0) {
! 
!             Paper paper = pf.getPaper();
! 
!             paper.setSize(
!                Double.parseDouble(config.getStringProperty("print.landWidth")),
!                Double.parseDouble(config.getStringProperty("print.landHeight")));
! 
!             paper.setImageableArea(
!                Double.parseDouble(config.getStringProperty("print.landImage.X")),
!                Double.parseDouble(config.getStringProperty("print.landImage.Y")),
!                Double.parseDouble(config.getStringProperty("print.landImageWidth")),
!                Double.parseDouble(config.getStringProperty("print.landImageHeight")));
!          }
!       }
! 
!       if (config.getStringProperty("print.font").length() > 0) {
! 
!          font = new Font(config.getStringProperty("print.font"),
!                            Font.PLAIN, 8);
!       }
! 
!       //--- Set the printable class to this one since we
!       //--- are implementing the Printable interface
!       printJob.setPrintable (this,pf);
! 
!       // set the cursor back
!       session.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
! 
! 
!       //--- Show a print dialog to the user. If the user
!       //--- clicks the print button, then print, otherwise
!       //--- cancel the print job
!       if (printJob.printDialog()) {
!          try {
!             // we do this because of loosing focus with jdk 1.4.0
!             session.requestFocus();
!             printJob.print();
!          } catch (Exception PrintException) {
!             PrintException.printStackTrace();
!          }
!       }
!       else {
!          // we do this because of loosing focus with jdk 1.4.0
!          session.requestFocus();
!       }
! 
!       session = null;
! 
!       screen = null;
!       screenExtendedAttr = null;
! 
!    }
! 
!    /**
!      * Method: print <p>
!      *
!      * This routine is responsible for rendering a page using
!      * the provided parameters. The result will be a screen
!      * print of the current screen to the printer graphics object
!      *
!      * @param g a value of type Graphics
!      * @param pageFormat a value of type PageFormat
!      * @param page a value of type int
!      * @return a value of type int
!      */
!    public int print (Graphics g, PageFormat pageFormat, int page) {
! 
!       Graphics2D g2;
! 
!       //--- Validate the page number, we only print the first page
!       if (page == 0) {
! 
!          //--- Create a graphic2D object and set the default parameters
!          g2 = (Graphics2D) g;
!          g2.setColor (Color.black);
! 
!          //--- Translate the origin to be (0,0)
!          g2.translate (pageFormat.getImageableX (), pageFormat.getImageableY ());
! 
!          int w = (int)pageFormat.getImageableWidth() / numCols;     // proposed width
!          int h = (int)pageFormat.getImageableHeight() / numRows;     // proposed height
! 
!          Font k = font;
! 
!          LineMetrics l;
!          FontRenderContext f = null;
! 
!          float j = 1;
! 
!          for (; j < 50; j++) {
! 
!             // derive the font and obtain the relevent information to compute
!             // the width and height
!             k = font.deriveFont(j);
!             f = new FontRenderContext(k.getTransform(),true,true);
!             l = k.getLineMetrics("Wy",f);
! 
!             if (
!                   (w < (int)k.getStringBounds("W",f).getWidth()) ||
!                      h < (int)(k.getStringBounds("y",f).getHeight() +
!                            l.getDescent() + l.getLeading())
! 
!                )
!                break;
!          }
! 
!          // since we were looking for an overrun of the width or height we need
!          // to adjust the font one down to get the last one that fit.
!          k = font.deriveFont(--j);
!          f = new FontRenderContext(k.getTransform(),true,true);
!          l = k.getLineMetrics("Wy",f);
! 
!          // set the font of the print job
!          g2.setFont(k);
! 
!          // get the width and height of the character bounds
!          int w1 = (int)k.getStringBounds("W",f).getWidth();
!          int h1 = (int)(k.getStringBounds("y",f).getHeight() +
!                      l.getDescent() + l.getLeading());
!          int x;
!          int y;
! 
! //         int pos = 0;
! 
!          // loop through all the screen characters and print them out.
!          for (int m = 0;m < numRows; m++)
!             for (int i = 0; i < numCols; i++) {
!                x = w1 * i;
!                y = h1 * (m + 1);
! 
!                // only draw printable characters (in this case >= ' ')
!                if (screen[getPos(m,i)] >= ' ' && ((screenExtendedAttr[getPos(m,i)] & EXTENDED_5250_NON_DSP) == 0)) {
! 
!                   g2.drawChars(screen, getPos(m,i), 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2));
! 
!                }
! 
!                // if it is underlined then underline the character
! //               if (screen[getPos(m,i)].underLine && !screen[getPos(m,i)].attributePlace)
!                if ((screenExtendedAttr[getPos(m,i)] & EXTENDED_5250_UNDERLINE) != 0 &&
!                         screenAttrPlace[getPos(m,i)] != 1)
!                   g.drawLine(x, (int)(y + (h1 - l.getLeading()-3)), (int)(x + w1), (int)(y + (h1 - l.getLeading())-3));
! 
!             }
! 
!          return (PAGE_EXISTS);
!       }
!       else
!          return (NO_SUCH_PAGE);
!    }
! 
!    private int getPos(int row, int col) {
! 
!       return (row * numCols) + col;
!    }
  }
\ No newline at end of file
--- 1,280 ----
! /**
!  * Title: PrinterThread
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.awt.print.*;
! import java.awt.*;
! import java.awt.font.*;
! import org.tn5250j.SessionGUI;
! import org.tn5250j.SessionConfig;
! import org.tn5250j.framework.tn5250.Screen5250;
! 
! public class PrinterThread extends Thread implements Printable, TN5250jConstants {
! 
!    char[] screen;
!    char[] screenExtendedAttr;
!    char[] screenAttrPlace;
!    Screen5250 scr;
!    int numCols;
!    int numRows;
!    Color colorBg;
!    Font font;
!    SessionGUI session;
!    boolean toDefault;
!    SessionConfig config;
! 
!    public PrinterThread (Screen5250 scr, Font font, int cols, int rows,
!                            Color colorBg, boolean toDefaultPrinter, SessionGUI ses) {
! 
! 
!       setPriority(1);
!       session = ses;
!       session.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
!       config = ses.getSession().getConfiguration();
! 
!       int len = scr.getScreenLength();
!       screen = new char[len];
!       screenExtendedAttr = new char[len];
!       screenAttrPlace = new char[len];
!       int ret = scr.GetScreen(screen, len, PLANE_TEXT);
!       ret = scr.GetScreen(screenExtendedAttr, len, PLANE_EXTENDED);
!       ret = scr.GetScreen(screenAttrPlace, len, PLANE_IS_ATTR_PLACE);
!       toDefault = toDefaultPrinter;
! 
!       numCols = cols;
!       numRows = rows;
!       this.colorBg = colorBg;
!       this.font = font;
!    }
! 
!    public void run () {
! // Toolkit tk = Toolkit.getDefaultToolkit();
! //int [][] range = new int[][] {
! //new int[] { 1, 1 }
! //};
! // JobAttributes jobAttributes = new JobAttributes(1, JobAttributes.DefaultSelectionType.ALL, JobAttributes.DestinationType.PRINTER, JobAttributes.DialogType.NONE, "file", 1, 1, JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES, range, "HP LaserJet", JobAttributes.SidesType.ONE_SIDED);
! //PrintJob job = tk.getPrintJob(null, "Print", jobAttributes, null);
! //if (job != null) {
!       //--- Create a printerJob object
!       PrinterJob printJob = PrinterJob.getPrinterJob ();
!       printJob.setJobName("tn5250j");
! 
!       // will have to remember this for the next time.
!       //   Always set a page format before call setPrintable to
!       //   set the orientation.
!       PageFormat pf = printJob.defaultPage();
!       if (numCols == 132)
!          pf.setOrientation(PageFormat.LANDSCAPE);
!       else
!          pf.setOrientation(PageFormat.PORTRAIT);
! 
! 
!       if (numCols != 132) {
!          if (config.getStringProperty("print.portWidth").length() != 0 &&
!                config.getStringProperty("print.portHeight").length() != 0 &&
!                config.getStringProperty("print.portImageWidth").length() != 0 &&
!                config.getStringProperty("print.portImageHeight").length() != 0 &&
!                config.getStringProperty("print.portImage.X").length() != 0 &&
!                config.getStringProperty("print.portImage.Y").length() != 0) {
! 
!             Paper paper = pf.getPaper();
! 
!             paper.setSize(
!                Double.parseDouble(config.getStringProperty("print.portWidth")),
!                Double.parseDouble(config.getStringProperty("print.portHeight")));
! 
!             paper.setImageableArea(
!                Double.parseDouble(config.getStringProperty("print.portImage.X")),
!                Double.parseDouble(config.getStringProperty("print.portImage.Y")),
!                Double.parseDouble(config.getStringProperty("print.portImageWidth")),
!                Double.parseDouble(config.getStringProperty("print.portImageHeight")));
!             pf.setPaper(paper);
!          }
!       }
!       else {
! 
!          if (config.getStringProperty("print.landWidth").length() != 0 &&
!                config.getStringProperty("print.landHeight").length() != 0 &&
!                config.getStringProperty("print.landImageWidth").length() != 0 &&
!                config.getStringProperty("print.landImageHeight").length() != 0 &&
!                config.getStringProperty("print.landImage.X").length() != 0 &&
!                config.getStringProperty("print.landImage.Y").length() != 0) {
! 
!             Paper paper = pf.getPaper();
! 
!             paper.setSize(
!                Double.parseDouble(config.getStringProperty("print.landWidth")),
!                Double.parseDouble(config.getStringProperty("print.landHeight")));
! 
!             paper.setImageableArea(
!                Double.parseDouble(config.getStringProperty("print.landImage.X")),
!                Double.parseDouble(config.getStringProperty("print.landImage.Y")),
!                Double.parseDouble(config.getStringProperty("print.landImageWidth")),
!                Double.parseDouble(config.getStringProperty("print.landImageHeight")));
!          }
!       }
! 
!       if (config.getStringProperty("print.font").length() > 0) {
! 
!          font = new Font(config.getStringProperty("print.font"),
!                            Font.PLAIN, 8);
!       }
! 
!       //--- Set the printable class to this one since we
!       //--- are implementing the Printable interface
!       printJob.setPrintable (this,pf);
! 
!       // set the cursor back
!       session.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
! 
! 
!       //--- Show a print dialog to the user. If the user
!       //--- clicks the print button, then print, otherwise
!       //--- cancel the print job
!       if (printJob.printDialog()) {
!          try {
!             // we do this because of loosing focus with jdk 1.4.0
!             session.requestFocus();
!             printJob.print();
!          } catch (Exception PrintException) {
!             PrintException.printStackTrace();
!          }
!       }
!       else {
!          // we do this because of loosing focus with jdk 1.4.0
!          session.requestFocus();
!       }
! 
!       session = null;
! 
!       screen = null;
!       screenExtendedAttr = null;
! 
!    }
! 
!    /**
!      * Method: print <p>
!      *
!      * This routine is responsible for rendering a page using
!      * the provided parameters. The result will be a screen
!      * print of the current screen to the printer graphics object
!      *
!      * @param g a value of type Graphics
!      * @param pageFormat a value of type PageFormat
!      * @param page a value of type int
!      * @return a value of type int
!      */
!    public int print (Graphics g, PageFormat pageFormat, int page) {
! 
!       Graphics2D g2;
! 
!       //--- Validate the page number, we only print the first page
!       if (page == 0) {
! 
!          //--- Create a graphic2D object and set the default parameters
!          g2 = (Graphics2D) g;
!          g2.setColor (Color.black);
! 
!          //--- Translate the origin to be (0,0)
!          g2.translate (pageFormat.getImageableX (), pageFormat.getImageableY ());
! 
!          int w = (int)pageFormat.getImageableWidth() / numCols;     // proposed width
!          int h = (int)pageFormat.getImageableHeight() / numRows;     // proposed height
! 
!          Font k = font;
! 
!          LineMetrics l;
!          FontRenderContext f = null;
! 
!          float j = 1;
! 
!          for (; j < 50; j++) {
! 
!             // derive the font and obtain the relevent information to compute
!             // the width and height
!             k = font.deriveFont(j);
!             f = new FontRenderContext(k.getTransform(),true,true);
!             l = k.getLineMetrics("Wy",f);
! 
!             if (
!                   (w < (int)k.getStringBounds("W",f).getWidth()) ||
!                      h < (int)(k.getStringBounds("y",f).getHeight() +
!                            l.getDescent() + l.getLeading())
! 
!                )
!                break;
!          }
! 
!          // since we were looking for an overrun of the width or height we need
!          // to adjust the font one down to get the last one that fit.
!          k = font.deriveFont(--j);
!          f = new FontRenderContext(k.getTransform(),true,true);
!          l = k.getLineMetrics("Wy",f);
! 
!          // set the font of the print job
!          g2.setFont(k);
! 
!          // get the width and height of the character bounds
!          int w1 = (int)k.getStringBounds("W",f).getWidth();
!          int h1 = (int)(k.getStringBounds("y",f).getHeight() +
!                      l.getDescent() + l.getLeading());
!          int x;
!          int y;
! 
! //         int pos = 0;
! 
!          // loop through all the screen characters and print them out.
!          for (int m = 0;m < numRows; m++)
!             for (int i = 0; i < numCols; i++) {
!                x = w1 * i;
!                y = h1 * (m + 1);
! 
!                // only draw printable characters (in this case >= ' ')
!                if (screen[getPos(m,i)] >= ' ' && ((screenExtendedAttr[getPos(m,i)] & EXTENDED_5250_NON_DSP) == 0)) {
! 
!                   g2.drawChars(screen, getPos(m,i), 1,x , (int)(y + h1 - (l.getDescent() + l.getLeading())-2));
! 
!                }
! 
!                // if it is underlined then underline the character
! //               if (screen[getPos(m,i)].underLine && !screen[getPos(m,i)].attributePlace)
!                if ((screenExtendedAttr[getPos(m,i)] & EXTENDED_5250_UNDERLINE) != 0 &&
!                         screenAttrPlace[getPos(m,i)] != 1)
!                   g.drawLine(x, (int)(y + (h1 - l.getLeading()-3)), (int)(x + w1), (int)(y + (h1 - l.getLeading())-3));
! 
!             }
! 
!          return (PAGE_EXISTS);
!       }
!       else
!          return (NO_SUCH_PAGE);
!    }
! 
!    private int getPos(int row, int col) {
! 
!       return (row * numCols) + col;
!    }
  }
\ No newline at end of file

Index: KeyPad.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/KeyPad.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** KeyPad.java	8 Jun 2005 19:32:49 -0000	1.3
--- KeyPad.java	16 Jun 2005 04:41:17 -0000	1.4
***************
*** 1,391 ****
! package org.tn5250j;
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.*;
! import org.tn5250j.tools.*;
! import org.tn5250j.framework.tn5250.Screen5250;
! 
! public class KeyPad extends JPanel implements SwingConstants {
! 
!    BorderLayout borderLayout1 = new BorderLayout();
!    JButton[] buttons = new JButton[30];
!    int bSize = 0;
!    JPanel keyPadTop;
!    JPanel keyPadBottom;
!    GridLayout gridLayout1 = new GridLayout();
!    int numPad = 1;
! 
!    public KeyPad() {
!       try {
!          jbInit();
!       }
!       catch(Exception ex) {
!          ex.printStackTrace();
!       }
!    }
! 
!    void jbInit() throws Exception {
!       this.setLayout(borderLayout1);
!       keyPadTop = new JPanel();
!       keyPadBottom = new JPanel();
!       keyPadTop.setLayout(gridLayout1);
!       keyPadBottom.setLayout(gridLayout1);
!       this.setBorder(BorderFactory.createRaisedBevelBorder());
!       this.setBorder(BorderFactory.createLoweredBevelBorder());
!       bSize = buttons.length;
!       Insets noMargin = new Insets(0,0,0,0);
! 
!       for (int x = 0; x < bSize; x++) {
! 
!          buttons[x] = new JButton();
!          buttons[x].setMargin(noMargin);
!       }
! 
!       setButtonText(1);
!       setButtonTop();
!       setButtonBottom();
! 
!       this.add(keyPadTop, BorderLayout.NORTH);
!       this.add(keyPadBottom,BorderLayout.SOUTH);
! 
!    }
! 
!    public void addActionListener(ActionListener actionlistener) {
!       for(int x = 0; x < bSize; x++)
!          buttons[x].addActionListener(actionlistener);
! 
!    }
! 
!    public void nextPad() {
! 
!       if (numPad == 1)
!          setButtonText(2);
!       else
!          setButtonText(1);
!    }
! 
!    private void setButtonText(int which) {
!       numPad = which;
! 
!       switch (which) {
! 
! //         case 1:
! //            buttons[0].setLabel("PF1 ");
! //            buttons[0].setActionCommand("PF1");
! //            buttons[1].setLabel("PF2 ");
! //            buttons[1].setActionCommand("PF2");
! //            buttons[2].setLabel("PF3 ");
! //            buttons[2].setActionCommand("PF3");
! //            buttons[3].setLabel("PF4 ");
! //            buttons[3].setActionCommand("PF4");
! //            buttons[4].setLabel("PF5 ");
! //            buttons[4].setActionCommand("PF5");
! //            buttons[5].setLabel("PF6 ");
! //            buttons[5].setActionCommand("PF6");
! //            buttons[6].setLabel("Enter");
! //            buttons[6].setActionCommand("ENTER");
! //            buttons[7].setLabel("PgUp");
! //            buttons[7].setActionCommand("PGUP");
! //            buttons[8].setLabel("Clear");
! //            buttons[8].setActionCommand("CLEAR");
! //
! //            buttons[9].setLabel("PF7 ");
! //            buttons[9].setActionCommand("PF7");
! //            buttons[10].setLabel("PF8 ");
! //            buttons[10].setActionCommand("PF8");
! //            buttons[11].setLabel("PF9 ");
! //            buttons[11].setActionCommand("PF9");
! //            buttons[12].setLabel("PF10");
! //            buttons[12].setActionCommand("PF10");
! //            buttons[13].setLabel("PF11");
! //            buttons[13].setActionCommand("PF11");
! //            buttons[14].setLabel("PF12");
! //            buttons[14].setActionCommand("PF12");
! //            buttons[15].setLabel("SyRq");
! //            buttons[15].setActionCommand("SR");
! //            buttons[16].setLabel("PgDn");
! //            buttons[16].setActionCommand("PGDN");
! //
! //            break;
! //         case 2:
! //
! //            buttons[0].setLabel("PF13");
! //            buttons[0].setActionCommand("PF13");
! //            buttons[1].setLabel("PF14");
! //            buttons[1].setActionCommand("PF14");
! //            buttons[2].setLabel("PF15");
! //            buttons[2].setActionCommand("PF15");
! //            buttons[3].setLabel("PF16");
! //            buttons[3].setActionCommand("PF16");
! //            buttons[4].setLabel("PF17");
! //            buttons[4].setActionCommand("PF17");
! //            buttons[5].setLabel("PF18");
! //            buttons[5].setActionCommand("PF18");
! //            buttons[6].setLabel("Enter");
! //            buttons[6].setActionCommand("ENTER");
! //            buttons[7].setLabel("Pg Up");
! //            buttons[7].setActionCommand("PGUP");
! //            buttons[8].setLabel("Help");
! //            buttons[8].setActionCommand("HELP");
! //
! //
! //            buttons[9].setLabel("PF19");
! //            buttons[9].setActionCommand("PF19");
! //            buttons[10].setLabel("PF20");
! //            buttons[10].setActionCommand("PF20");
! //            buttons[11].setLabel("PF21");
! //            buttons[11].setActionCommand("PF21");
! //            buttons[12].setLabel("PF22");
! //            buttons[12].setActionCommand("PF22");
! //            buttons[13].setLabel("PF23");
! //            buttons[13].setActionCommand("PF23");
! //            buttons[14].setLabel("PF24");
! //            buttons[14].setActionCommand("PF24");
! //            buttons[15].setLabel("SyRq");
! //            buttons[15].setActionCommand("SR");
! //            buttons[16].setLabel("PgDn");
! //            buttons[16].setActionCommand("PGDN");
! //
! //            break;
! //      }
! //      buttons[17].setLabel("Next Pad");
! //      buttons[17].setActionCommand("NXTPAD");
! 
!          case 1:
!             buttons[0].setText(LangTool.getString("KP_F1",  "PF1"));
!             buttons[0].setActionCommand(Screen5250.MNEMONIC_PF1);
!             buttons[1].setText(LangTool.getString("KP_F2","PF2"));
!             buttons[1].setActionCommand(Screen5250.MNEMONIC_PF2);
!             buttons[2].setText(LangTool.getString("KP_F3","PF3"));
!             buttons[2].setActionCommand(Screen5250.MNEMONIC_PF3);
!             buttons[3].setText(LangTool.getString("KP_F4","PF4"));
!             buttons[3].setActionCommand(Screen5250.MNEMONIC_PF4);
!             buttons[4].setText(LangTool.getString("KP_F5","PF5"));
!             buttons[4].setActionCommand(Screen5250.MNEMONIC_PF5);
!             buttons[5].setText(LangTool.getString("KP_F6","PF6"));
!             buttons[5].setActionCommand(Screen5250.MNEMONIC_PF6);
!             buttons[6].setText(LangTool.getString("KP_F7","PF7"));
!             buttons[6].setActionCommand(Screen5250.MNEMONIC_PF7);
!             buttons[7].setText(LangTool.getString("KP_F8","PF8"));
!             buttons[7].setActionCommand(Screen5250.MNEMONIC_PF8);
!             buttons[8].setText(LangTool.getString("KP_F9","PF9"));
!             buttons[8].setActionCommand(Screen5250.MNEMONIC_PF9);
!             buttons[9].setText(LangTool.getString("KP_F10","PF10"));
!             buttons[9].setActionCommand(Screen5250.MNEMONIC_PF10);
!             buttons[10].setText(LangTool.getString("KP_F11","PF11"));
!             buttons[10].setActionCommand(Screen5250.MNEMONIC_PF11);
!             buttons[11].setText(LangTool.getString("KP_F12","PF12"));
!             buttons[11].setActionCommand(Screen5250.MNEMONIC_PF12);
!             buttons[12].setText(LangTool.getString("KP_ENTER","Enter"));
!             buttons[12].setActionCommand(Screen5250.MNEMONIC_ENTER);
!             buttons[13].setText(LangTool.getString("KP_PGUP","PgUp"));
!             buttons[13].setActionCommand(Screen5250.MNEMONIC_PAGE_UP);
!             buttons[14].setText(LangTool.getString("KP_CLEAR","Clear"));
!             buttons[14].setActionCommand(Screen5250.MNEMONIC_CLEAR);
! 
!             buttons[15].setText(LangTool.getString("KP_F13","PF13"));
!             buttons[15].setActionCommand(Screen5250.MNEMONIC_PF13);
!             buttons[16].setText(LangTool.getString("KP_F14","PF14"));
!             buttons[16].setActionCommand(Screen5250.MNEMONIC_PF14);
!             buttons[17].setText(LangTool.getString("KP_F15","PF15"));
!             buttons[17].setActionCommand(Screen5250.MNEMONIC_PF15);
!             buttons[18].setText(LangTool.getString("KP_F16","PF16"));
!             buttons[18].setActionCommand(Screen5250.MNEMONIC_PF16);
!             buttons[19].setText(LangTool.getString("KP_F17","PF17"));
!             buttons[19].setActionCommand(Screen5250.MNEMONIC_PF17);
!             buttons[20].setText(LangTool.getString("KP_F18","PF18"));
!             buttons[20].setActionCommand(Screen5250.MNEMONIC_PF18);
!             buttons[21].setText(LangTool.getString("KP_F19","PF19"));
!             buttons[21].setActionCommand(Screen5250.MNEMONIC_PF19);
!             buttons[22].setText(LangTool.getString("KP_F20","PF20"));
!             buttons[22].setActionCommand(Screen5250.MNEMONIC_PF20);
!             buttons[23].setText(LangTool.getString("KP_F21","PF21"));
!             buttons[23].setActionCommand(Screen5250.MNEMONIC_PF21);
!             buttons[24].setText(LangTool.getString("KP_F22","PF22"));
!             buttons[24].setActionCommand(Screen5250.MNEMONIC_PF22);
!             buttons[25].setText(LangTool.getString("KP_F23","PF23"));
!             buttons[25].setActionCommand(Screen5250.MNEMONIC_PF23);
!             buttons[26].setText(LangTool.getString("KP_F24","PF24"));
!             buttons[26].setActionCommand(Screen5250.MNEMONIC_PF24);
!             buttons[27].setText(LangTool.getString("KP_SR","SysReq"));
!             buttons[27].setActionCommand(Screen5250.MNEMONIC_SYSREQ);
!             buttons[28].setText(LangTool.getString("KP_PGDN","PgDn"));
!             buttons[28].setActionCommand(Screen5250.MNEMONIC_PAGE_DOWN);
! 
!             break;
! 
!          case 2:
! 
!             buttons[0].setText(LangTool.getString("KP_F1",  "PF1"));
!             buttons[0].setActionCommand(Screen5250.MNEMONIC_PF1);
!             buttons[1].setText(LangTool.getString("KP_F2","PF2"));
!             buttons[1].setActionCommand(Screen5250.MNEMONIC_PF2);
!             buttons[2].setText(LangTool.getString("KP_F3","PF3"));
!             buttons[2].setActionCommand(Screen5250.MNEMONIC_PF3);
!             buttons[3].setText(LangTool.getString("KP_F4","PF4"));
!             buttons[3].setActionCommand(Screen5250.MNEMONIC_PF4);
!             buttons[4].setText(LangTool.getString("KP_F5","PF5"));
!             buttons[4].setActionCommand(Screen5250.MNEMONIC_PF5);
!             buttons[5].setText(LangTool.getString("KP_F6","PF6"));
!             buttons[5].setActionCommand(Screen5250.MNEMONIC_PF6);
!             buttons[6].setText(LangTool.getString("KP_F7","PF7"));
!             buttons[6].setActionCommand(Screen5250.MNEMONIC_PF7);
!             buttons[7].setText(LangTool.getString("KP_F8","PF8"));
!             buttons[7].setActionCommand(Screen5250.MNEMONIC_PF8);
!             buttons[8].setText(LangTool.getString("KP_F9","PF9"));
!             buttons[8].setActionCommand(Screen5250.MNEMONIC_PF9);
!             buttons[9].setText(LangTool.getString("KP_F10","PF10"));
!             buttons[9].setActionCommand(Screen5250.MNEMONIC_PF10);
!             buttons[10].setText(LangTool.getString("KP_F11","PF11"));
!             buttons[10].setActionCommand(Screen5250.MNEMONIC_PF11);
!             buttons[11].setText(LangTool.getString("KP_F12","PF12"));
!             buttons[11].setActionCommand(Screen5250.MNEMONIC_PF12);
!             buttons[12].setText(LangTool.getString("KP_ENTER","Enter"));
!             buttons[12].setActionCommand(Screen5250.MNEMONIC_ENTER);
!             buttons[13].setText(LangTool.getString("KP_PGUP","PgUp"));
!             buttons[13].setActionCommand(Screen5250.MNEMONIC_PAGE_UP);
!             buttons[14].setText(LangTool.getString("KP_HELP","Help"));
!             buttons[14].setActionCommand(Screen5250.MNEMONIC_HELP);
! 
!             buttons[15].setText(LangTool.getString("KP_F13","PF13"));
!             buttons[15].setActionCommand(Screen5250.MNEMONIC_PF13);
!             buttons[16].setText(LangTool.getString("KP_F14","PF14"));
!             buttons[16].setActionCommand(Screen5250.MNEMONIC_PF14);
!             buttons[17].setText(LangTool.getString("KP_F15","PF15"));
!             buttons[17].setActionCommand(Screen5250.MNEMONIC_PF15);
!             buttons[18].setText(LangTool.getString("KP_F16","PF16"));
!             buttons[18].setActionCommand(Screen5250.MNEMONIC_PF16);
!             buttons[19].setText(LangTool.getString("KP_F17","PF17"));
!             buttons[19].setActionCommand(Screen5250.MNEMONIC_PF17);
!             buttons[20].setText(LangTool.getString("KP_F18","PF18"));
!             buttons[20].setActionCommand(Screen5250.MNEMONIC_PF18);
!             buttons[21].setText(LangTool.getString("KP_F19","PF19"));
!             buttons[21].setActionCommand(Screen5250.MNEMONIC_PF19);
!             buttons[22].setText(LangTool.getString("KP_F20","PF20"));
!             buttons[22].setActionCommand(Screen5250.MNEMONIC_PF20);
!             buttons[23].setText(LangTool.getString("KP_F21","PF21"));
!             buttons[23].setActionCommand(Screen5250.MNEMONIC_PF21);
!             buttons[24].setText(LangTool.getString("KP_F22","PF22"));
!             buttons[24].setActionCommand(Screen5250.MNEMONIC_PF22);
!             buttons[25].setText(LangTool.getString("KP_F23","PF23"));
!             buttons[25].setActionCommand(Screen5250.MNEMONIC_PF23);
!             buttons[26].setText(LangTool.getString("KP_F24","PF24"));
!             buttons[26].setActionCommand(Screen5250.MNEMONIC_PF24);
!             buttons[27].setText(LangTool.getString("KP_SR","SysReq"));
!             buttons[27].setActionCommand(Screen5250.MNEMONIC_SYSREQ);
!             buttons[28].setText(LangTool.getString("KP_PGDN","PgDn"));
!             buttons[28].setActionCommand(Screen5250.MNEMONIC_PAGE_DOWN);
! 
!             break;
!       }
! 
!       buttons[29].setText(LangTool.getString("KP_NXTPAD","Next Pad"));
!       buttons[29].setActionCommand("NXTPAD");
! 
!    }
! 
!    private void setButtonTop() {
!       for (int x = 0; x < bSize / 2; x++) {
! 
!          keyPadTop.add(buttons[x]);
! 
!       }
!    }
! 
!    private void setButtonBottom() {
!       for (int x = bSize / 2; x < bSize; x++) {
! 
!          keyPadBottom.add(buttons[x]);
! 
!       }
! 
!    }
! 
!    /* These rectangles/insets are allocated once for all
!      * calls.  Re-using rectangles rather than allocating them in each paint
!      * call substantially reduced the time it took paint to run.
!      */
!    private static Rectangle viewRect = new Rectangle();
!    private static Rectangle textRect = new Rectangle();
!    private static Rectangle iconRect = new Rectangle();
!    private static String endsWithSuffix = "...";
!    private static int minSize = 3;
! 
!    /**
!     */
!    protected void paintComponent(Graphics g) {
!       super.paintComponent(g);
! 
!       Font k = buttons[0].getFont();
!       float fs = 12; // start size
!       k = k.deriveFont(fs);
! 
!       FontMetrics fm = buttons[0].getFontMetrics(k);
! 
!       // initializ the viewRect which is the visible rectangle
!       viewRect = buttons[0].getVisibleRect();
! 
!       Insets i = buttons[0].getInsets();
! 
!       // we now subtract the insets which include the border insets as well
!       viewRect.x = i.left;
!       viewRect.y = i.top;
!       viewRect.width = buttons[0].getWidth() - (i.right + viewRect.x);
!       viewRect.height = buttons[0].getHeight() - (i.bottom + viewRect.y);
! 
!       // initialize the textRect and iconRect to 0 so they will be calculated
!       textRect.x = textRect.y = textRect.width = textRect.height = 0;
!       iconRect.x = iconRect.y = iconRect.width = iconRect.height = 0;
! 
!       // now compute the text that will be displayed until we run do not get
!       //    elipses or we go passes the minimum of our text size that we want
!       while (SwingUtilities.layoutCompoundLabel(fm,buttons[bSize-1].getText(),null,
!                            buttons[0].getVerticalAlignment(),
!                            buttons[0].getHorizontalAlignment(),
!                            buttons[0].getVerticalTextPosition(),
!                            buttons[0].getHorizontalTextPosition(),
!                            viewRect,
!                            textRect,
!                            iconRect,
!                            0).endsWith(endsWithSuffix)
!                    && fs > (minSize - 1)) {
!          k = k.deriveFont(--fs);
!          fm = buttons[0].getFontMetrics(k);
! 
!       }
! 
!       if (fs >= minSize) {
! 
!          for (int x = 0; x < bSize; x++ ) {
!             buttons[x].setFont(k);
!          }
!       }
!    }
! 
! }
--- 1,391 ----
! package org.tn5250j;
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.4
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! 
! import java.awt.*;
! import java.awt.event.*;
! import javax.swing.*;
! import org.tn5250j.tools.*;
! import org.tn5250j.framework.tn5250.Screen5250;
! 
! public class KeyPad extends JPanel implements SwingConstants {
! 
!    BorderLayout borderLayout1 = new BorderLayout();
!    JButton[] buttons = new JButton[30];
!    int bSize = 0;
!    JPanel keyPadTop;
!    JPanel keyPadBottom;
!    GridLayout gridLayout1 = new GridLayout();
!    int numPad = 1;
! 
!    public KeyPad() {
!       try {
!          jbInit();
!       }
!       catch(Exception ex) {
!          ex.printStackTrace();
!       }
!    }
! 
!    void jbInit() throws Exception {
!       this.setLayout(borderLayout1);
!       keyPadTop = new JPanel();
!       keyPadBottom = new JPanel();
!       keyPadTop.setLayout(gridLayout1);
!       keyPadBottom.setLayout(gridLayout1);
!       this.setBorder(BorderFactory.createRaisedBevelBorder());
!       this.setBorder(BorderFactory.createLoweredBevelBorder());
!       bSize = buttons.length;
!       Insets noMargin = new Insets(0,0,0,0);
! 
!       for (int x = 0; x < bSize; x++) {
! 
!          buttons[x] = new JButton();
!          buttons[x].setMargin(noMargin);
!       }
! 
!       setButtonText(1);
!       setButtonTop();
!       setButtonBottom();
! 
!       this.add(keyPadTop, BorderLayout.NORTH);
!       this.add(keyPadBottom,BorderLayout.SOUTH);
! 
!    }
! 
!    public void addActionListener(ActionListener actionlistener) {
!       for(int x = 0; x < bSize; x++)
!          buttons[x].addActionListener(actionlistener);
! 
!    }
! 
!    public void nextPad() {
! 
!       if (numPad == 1)
!          setButtonText(2);
!       else
!          setButtonText(1);
!    }
! 
!    private void setButtonText(int which) {
!       numPad = which;
! 
!       switch (which) {
! 
! //         case 1:
! //            buttons[0].setLabel("PF1 ");
! //            buttons[0].setActionCommand("PF1");
! //            buttons[1].setLabel("PF2 ");
! //            buttons[1].setActionCommand("PF2");
! //            buttons[2].setLabel("PF3 ");
! //            buttons[2].setActionCommand("PF3");
! //            buttons[3].setLabel("PF4 ");
! //            buttons[3].setActionCommand("PF4");
! //            buttons[4].setLabel("PF5 ");
! //            buttons[4].setActionCommand("PF5");
! //            buttons[5].setLabel("PF6 ");
! //            buttons[5].setActionCommand("PF6");
! //            buttons[6].setLabel("Enter");
! //            buttons[6].setActionCommand("ENTER");
! //            buttons[7].setLabel("PgUp");
! //            buttons[7].setActionCommand("PGUP");
! //            buttons[8].setLabel("Clear");
! //            buttons[8].setActionCommand("CLEAR");
! //
! //            buttons[9].setLabel("PF7 ");
! //            buttons[9].setActionCommand("PF7");
! //            buttons[10].setLabel("PF8 ");
! //            buttons[10].setActionCommand("PF8");
! //            buttons[11].setLabel("PF9 ");
! //            buttons[11].setActionCommand("PF9");
! //            buttons[12].setLabel("PF10");
! //            buttons[12].setActionCommand("PF10");
! //            buttons[13].setLabel("PF11");
! //            buttons[13].setActionCommand("PF11");
! //            buttons[14].setLabel("PF12");
! //            buttons[14].setActionCommand("PF12");
! //            buttons[15].setLabel("SyRq");
! //            buttons[15].setActionCommand("SR");
! //            buttons[16].setLabel("PgDn");
! //            buttons[16].setActionCommand("PGDN");
! //
! //            break;
! //         case 2:
! //
! //            buttons[0].setLabel("PF13");
! //            buttons[0].setActionCommand("PF13");
! //            buttons[1].setLabel("PF14");
! //            buttons[1].setActionCommand("PF14");
! //            buttons[2].setLabel("PF15");
! //            buttons[2].setActionCommand("PF15");
! //            buttons[3].setLabel("PF16");
! //            buttons[3].setActionCommand("PF16");
! //            buttons[4].setLabel("PF17");
! //            buttons[4].setActionCommand("PF17");
! //            buttons[5].setLabel("PF18");
! //            buttons[5].setActionCommand("PF18");
! //            buttons[6].setLabel("Enter");
! //            buttons[6].setActionCommand("ENTER");
! //            buttons[7].setLabel("Pg Up");
! //            buttons[7].setActionCommand("PGUP");
! //            buttons[8].setLabel("Help");
! //            buttons[8].setActionCommand("HELP");
! //
! //
! //            buttons[9].setLabel("PF19");
! //            buttons[9].setActionCommand("PF19");
! //            buttons[10].setLabel("PF20");
! //            buttons[10].setActionCommand("PF20");
! //            buttons[11].setLabel("PF21");
! //            buttons[11].setActionCommand("PF21");
! //            buttons[12].setLabel("PF22");
! //            buttons[12].setActionCommand("PF22");
! //            buttons[13].setLabel("PF23");
! //            buttons[13].setActionCommand("PF23");
! //            buttons[14].setLabel("PF24");
! //            buttons[14].setActionCommand("PF24");
! //            buttons[15].setLabel("SyRq");
! //            buttons[15].setActionCommand("SR");
! //            buttons[16].setLabel("PgDn");
! //            buttons[16].setActionCommand("PGDN");
! //
! //            break;
! //      }
! //      buttons[17].setLabel("Next Pad");
! //      buttons[17].setActionCommand("NXTPAD");
! 
!          case 1:
!             buttons[0].setText(LangTool.getString("KP_F1",  "PF1"));
!             buttons[0].setActionCommand(Screen5250.MNEMONIC_PF1);
!             buttons[1].setText(LangTool.getString("KP_F2","PF2"));
!             buttons[1].setActionCommand(Screen5250.MNEMONIC_PF2);
!             buttons[2].setText(LangTool.getString("KP_F3","PF3"));
!             buttons[2].setActionCommand(Screen5250.MNEMONIC_PF3);
!             buttons[3].setText(LangTool.getString("KP_F4","PF4"));
!             buttons[3].setActionCommand(Screen5250.MNEMONIC_PF4);
!             buttons[4].setText(LangTool.getString("KP_F5","PF5"));
!             buttons[4].setActionCommand(Screen5250.MNEMONIC_PF5);
!             buttons[5].setText(LangTool.getString("KP_F6","PF6"));
!             buttons[5].setActionCommand(Screen5250.MNEMONIC_PF6);
!             buttons[6].setText(LangTool.getString("KP_F7","PF7"));
!             buttons[6].setActionCommand(Screen5250.MNEMONIC_PF7);
!             buttons[7].setText(LangTool.getString("KP_F8","PF8"));
!             buttons[7].setActionCommand(Screen5250.MNEMONIC_PF8);
!             buttons[8].setText(LangTool.getString("KP_F9","PF9"));
!             buttons[8].setActionCommand(Screen5250.MNEMONIC_PF9);
!             buttons[9].setText(LangTool.getString("KP_F10","PF10"));
!             buttons[9].setActionCommand(Screen5250.MNEMONIC_PF10);
!             buttons[10].setText(LangTool.getString("KP_F11","PF11"));
!             buttons[10].setActionCommand(Screen5250.MNEMONIC_PF11);
!             buttons[11].setText(LangTool.getString("KP_F12","PF12"));
!             buttons[11].setActionCommand(Screen5250.MNEMONIC_PF12);
!             buttons[12].setText(LangTool.getString("KP_ENTER","Enter"));
!             buttons[12].setActionCommand(Screen5250.MNEMONIC_ENTER);
!             buttons[13].setText(LangTool.getString("KP_PGUP","PgUp"));
!             buttons[13].setActionCommand(Screen5250.MNEMONIC_PAGE_UP);
!             buttons[14].setText(LangTool.getString("KP_CLEAR","Clear"));
!             buttons[14].setActionCommand(Screen5250.MNEMONIC_CLEAR);
! 
!             buttons[15].setText(LangTool.getString("KP_F13","PF13"));
!             buttons[15].setActionCommand(Screen5250.MNEMONIC_PF13);
!             buttons[16].setText(LangTool.getString("KP_F14","PF14"));
!             buttons[16].setActionCommand(Screen5250.MNEMONIC_PF14);
!             buttons[17].setText(LangTool.getString("KP_F15","PF15"));
!             buttons[17].setActionCommand(Screen5250.MNEMONIC_PF15);
!             buttons[18].setText(LangTool.getString("KP_F16","PF16"));
!             buttons[18].setActionCommand(Screen5250.MNEMONIC_PF16);
!             buttons[19].setText(LangTool.getString("KP_F17","PF17"));
!             buttons[19].setActionCommand(Screen5250.MNEMONIC_PF17);
!             buttons[20].setText(LangTool.getString("KP_F18","PF18"));
!             buttons[20].setActionCommand(Screen5250.MNEMONIC_PF18);
!             buttons[21].setText(LangTool.getString("KP_F19","PF19"));
!             buttons[21].setActionCommand(Screen5250.MNEMONIC_PF19);
!             buttons[22].setText(LangTool.getString("KP_F20","PF20"));
!             buttons[22].setActionCommand(Screen5250.MNEMONIC_PF20);
!             buttons[23].setText(LangTool.getString("KP_F21","PF21"));
!             buttons[23].setActionCommand(Screen5250.MNEMONIC_PF21);
!             buttons[24].setText(LangTool.getString("KP_F22","PF22"));
!             buttons[24].setActionCommand(Screen5250.MNEMONIC_PF22);
!             buttons[25].setText(LangTool.getString("KP_F23","PF23"));
!             buttons[25].setActionCommand(Screen5250.MNEMONIC_PF23);
!             buttons[26].setText(LangTool.getString("KP_F24","PF24"));
!             buttons[26].setActionCommand(Screen5250.MNEMONIC_PF24);
!             buttons[27].setText(LangTool.getString("KP_SR","SysReq"));
!             buttons[27].setActionCommand(Screen5250.MNEMONIC_SYSREQ);
!             buttons[28].setText(LangTool.getString("KP_PGDN","PgDn"));
!             buttons[28].setActionCommand(Screen5250.MNEMONIC_PAGE_DOWN);
! 
!             break;
! 
!          case 2:
! 
!             buttons[0].setText(LangTool.getString("KP_F1",  "PF1"));
!             buttons[0].setActionCommand(Screen5250.MNEMONIC_PF1);
!             buttons[1].setText(LangTool.getString("KP_F2","PF2"));
!             buttons[1].setActionCommand(Screen5250.MNEMONIC_PF2);
!             buttons[2].setText(LangTool.getString("KP_F3","PF3"));
!             buttons[2].setActionCommand(Screen5250.MNEMONIC_PF3);
!             buttons[3].setText(LangTool.getString("KP_F4","PF4"));
!             buttons[3].setActionCommand(Screen5250.MNEMONIC_PF4);
!             buttons[4].setText(LangTool.getString("KP_F5","PF5"));
!             buttons[4].setActionCommand(Screen5250.MNEMONIC_PF5);
!             buttons[5].setText(LangTool.getString("KP_F6","PF6"));
!             buttons[5].setActionCommand(Screen5250.MNEMONIC_PF6);
!             buttons[6].setText(LangTool.getString("KP_F7","PF7"));
!             buttons[6].setActionCommand(Screen5250.MNEMONIC_PF7);
!             buttons[7].setText(LangTool.getString("KP_F8","PF8"));
!             buttons[7].setActionCommand(Screen5250.MNEMONIC_PF8);
!             buttons[8].setText(LangTool.getString("KP_F9","PF9"));
!             buttons[8].setActionCommand(Screen5250.MNEMONIC_PF9);
!             buttons[9].setText(LangTool.getString("KP_F10","PF10"));
!             buttons[9].setActionCommand(Screen5250.MNEMONIC_PF10);
!             buttons[10].setText(LangTool.getString("KP_F11","PF11"));
!             buttons[10].setActionCommand(Screen5250.MNEMONIC_PF11);
!             buttons[11].setText(LangTool.getString("KP_F12","PF12"));
!             buttons[11].setActionCommand(Screen5250.MNEMONIC_PF12);
!             buttons[12].setText(LangTool.getString("KP_ENTER","Enter"));
!             buttons[12].setActionCommand(Screen5250.MNEMONIC_ENTER);
!             buttons[13].setText(LangTool.getString("KP_PGUP","PgUp"));
!             buttons[13].setActionCommand(Screen5250.MNEMONIC_PAGE_UP);
!             buttons[14].setText(LangTool.getString("KP_HELP","Help"));
!             buttons[14].setActionCommand(Screen5250.MNEMONIC_HELP);
! 
!             buttons[15].setText(LangTool.getString("KP_F13","PF13"));
!             buttons[15].setActionCommand(Screen5250.MNEMONIC_PF13);
!             buttons[16].setText(LangTool.getString("KP_F14","PF14"));
!             buttons[16].setActionCommand(Screen5250.MNEMONIC_PF14);
!             buttons[17].setText(LangTool.getString("KP_F15","PF15"));
!             buttons[17].setActionCommand(Screen5250.MNEMONIC_PF15);
!             buttons[18].setText(LangTool.getString("KP_F16","PF16"));
!             buttons[18].setActionCommand(Screen5250.MNEMONIC_PF16);
!             buttons[19].setText(LangTool.getString("KP_F17","PF17"));
!             buttons[19].setActionCommand(Screen5250.MNEMONIC_PF17);
!             buttons[20].setText(LangTool.getString("KP_F18","PF18"));
!             buttons[20].setActionCommand(Screen5250.MNEMONIC_PF18);
!             buttons[21].setText(LangTool.getString("KP_F19","PF19"));
!             buttons[21].setActionCommand(Screen5250.MNEMONIC_PF19);
!             buttons[22].setText(LangTool.getString("KP_F20","PF20"));
!             buttons[22].setActionCommand(Screen5250.MNEMONIC_PF20);
!             buttons[23].setText(LangTool.getString("KP_F21","PF21"));
!             buttons[23].setActionCommand(Screen5250.MNEMONIC_PF21);
!             buttons[24].setText(LangTool.getString("KP_F22","PF22"));
!             buttons[24].setActionCommand(Screen5250.MNEMONIC_PF22);
!             buttons[25].setText(LangTool.getString("KP_F23","PF23"));
!             buttons[25].setActionCommand(Screen5250.MNEMONIC_PF23);
!             buttons[26].setText(LangTool.getString("KP_F24","PF24"));
!             buttons[26].setActionCommand(Screen5250.MNEMONIC_PF24);
!             buttons[27].setText(LangTool.getString("KP_SR","SysReq"));
!             buttons[27].setActionCommand(Screen5250.MNEMONIC_SYSREQ);
!             buttons[28].setText(LangTool.getString("KP_PGDN","PgDn"));
!             buttons[28].setActionCommand(Screen5250.MNEMONIC_PAGE_DOWN);
! 
!             break;
!       }
! 
!       buttons[29].setText(LangTool.getString("KP_NXTPAD","Next Pad"));
!       buttons[29].setActionCommand("NXTPAD");
! 
!    }
! 
!    private void setButtonTop() {
!       for (int x = 0; x < bSize / 2; x++) {
! 
!          keyPadTop.add(buttons[x]);
! 
!       }
!    }
! 
!    private void setButtonBottom() {
!       for (int x = bSize / 2; x < bSize; x++) {
! 
!          keyPadBottom.add(buttons[x]);
! 
!       }
! 
!    }
! 
!    /* These rectangles/insets are allocated once for all
!      * calls.  Re-using rectangles rather than allocating them in each paint
!      * call substantially reduced the time it took paint to run.
!      */
!    private static Rectangle viewRect = new Rectangle();
!    private static Rectangle textRect = new Rectangle();
!    private static Rectangle iconRect = new Rectangle();
!    private static String endsWithSuffix = "...";
!    private static int minSize = 3;
! 
!    /**
!     */
!    protected void paintComponent(Graphics g) {
!       super.paintComponent(g);
! 
!       Font k = buttons[0].getFont();
!       float fs = 12; // start size
!       k = k.deriveFont(fs);
! 
!       FontMetrics fm = buttons[0].getFontMetrics(k);
! 
!       // initializ the viewRect which is the visible rectangle
!       viewRect = buttons[0].getVisibleRect();
! 
!       Insets i = buttons[0].getInsets();
! 
!       // we now subtract the insets which include the border insets as well
!       viewRect.x = i.left;
!       viewRect.y = i.top;
!       viewRect.width = buttons[0].getWidth() - (i.right + viewRect.x);
!       viewRect.height = buttons[0].getHeight() - (i.bottom + viewRect.y);
! 
!       // initialize the textRect and iconRect to 0 so they will be calculated
!       textRect.x = textRect.y = textRect.width = textRect.height = 0;
!       iconRect.x = iconRect.y = iconRect.width = iconRect.height = 0;
! 
!       // now compute the text that will be displayed until we run do not get
!       //    elipses or we go passes the minimum of our text size that we want
!       while (SwingUtilities.layoutCompoundLabel(fm,buttons[bSize-1].getText(),null,
!                            buttons[0].getVerticalAlignment(),
!                            buttons[0].getHorizontalAlignment(),
!                            buttons[0].getVerticalTextPosition(),
!                            buttons[0].getHorizontalTextPosition(),
!                            viewRect,
!                            textRect,
!                            iconRect,
!                            0).endsWith(endsWithSuffix)
!                    && fs > (minSize - 1)) {
!          k = k.deriveFont(--fs);
!          fm = buttons[0].getFontMetrics(k);
! 
!       }
! 
!       if (fs >= minSize) {
! 
!          for (int x = 0; x < bSize; x++ ) {
!             buttons[x].setFont(k);
!          }
!       }
!    }
! 
! }

Index: SessionScroller.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionScroller.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SessionScroller.java	8 Jun 2005 19:32:50 -0000	1.6
--- SessionScroller.java	16 Jun 2005 04:41:17 -0000	1.7
***************
*** 1,122 ****
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.lang.reflect.*;
! 
! import org.tn5250j.interfaces.SessionScrollerInterface;
! import org.tn5250j.tools.system.OperatingSystem;
! import org.tn5250j.framework.tn5250.Screen5250;
! 
! /**
!  * Session Scroller to allow the use of the mouse wheel to move the list on the
!  * screen up and down.
!  */
! public class SessionScroller implements SessionScrollerInterface, TN5250jConstants {
! 
!    Screen5250 screen;
!    SessionGUI session;
!    static boolean useJava14;
! 
!    SessionScrollerInterface _instance;
! 
!    /**
!     * String value for the jdk 1.4 version of Scroller
!     */
!    private static final String      SCROLLER_NAME14 = "org.tn5250j.SessionScroller14";
! 
!    static {
! 
!       useJava14 = OperatingSystem.hasJava14() && !OperatingSystem.isMacOS();
! 
!    }
! 
! 	public SessionScroller() {
! 
! 	}
! 
! 
!    protected SessionScrollerInterface getScrollerInstance(SessionGUI ses) {
! 
!       if (_instance != null)
!          return _instance;
! 
!       if (!useJava14) {
!          _instance = this;
!          return _instance;
!       }
! 
!       screen = ses.getScreen();
!       session = ses;
! 
!       Class       scroller_class;
! 
!       Constructor constructor1;
! 
!       try {
! 
!          ClassLoader loader = SessionScroller.class.getClassLoader();
! 
!          if (loader == null)
!            loader = ClassLoader.getSystemClassLoader();
! 
!          scroller_class       = loader.loadClass(SCROLLER_NAME14);
! 
!          constructor1 = scroller_class.getConstructor(new Class[] {SessionGUI.class});
! 
!          try {
!             Object obj= constructor1.newInstance(new Object[] {session});
!             _instance = (SessionScrollerInterface)obj;
! 
!          }
!          catch (Throwable crap) {
!             _instance = this;
!          }
! 
! 
!       }
!       catch (Throwable t) {
!          _instance = this;
!          scroller_class = null;
!          constructor1  = null;
!       }
! 
!       _instance.addMouseWheelListener(session);
!       return _instance;
! 
!    }
! 
!    public void addMouseWheelListener(SessionGUI ses) {
! 
! 
!    }
! 
!    public void removeMouseWheelListener(SessionGUI ses) {
! 
! 
!    }
! 
! }
--- 1,122 ----
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.lang.reflect.*;
! 
! import org.tn5250j.interfaces.SessionScrollerInterface;
! import org.tn5250j.tools.system.OperatingSystem;
! import org.tn5250j.framework.tn5250.Screen5250;
! 
! /**
!  * Session Scroller to allow the use of the mouse wheel to move the list on the
!  * screen up and down.
!  */
! public class SessionScroller implements SessionScrollerInterface, TN5250jConstants {
! 
!    Screen5250 screen;
!    SessionGUI session;
!    static boolean useJava14;
! 
!    SessionScrollerInterface _instance;
! 
!    /**
!     * String value for the jdk 1.4 version of Scroller
!     */
!    private static final String      SCROLLER_NAME14 = "org.tn5250j.SessionScroller14";
! 
!    static {
! 
!       useJava14 = OperatingSystem.hasJava14() && !OperatingSystem.isMacOS();
! 
!    }
! 
! 	public SessionScroller() {
! 
! 	}
! 
! 
!    protected SessionScrollerInterface getScrollerInstance(SessionGUI ses) {
! 
!       if (_instance != null)
!          return _instance;
! 
!       if (!useJava14) {
!          _instance = this;
!          return _instance;
!       }
! 
!       screen = ses.getScreen();
!       session = ses;
! 
!       Class       scroller_class;
! 
!       Constructor constructor1;
! 
!       try {
! 
!          ClassLoader loader = SessionScroller.class.getClassLoader();
! 
!          if (loader == null)
!            loader = ClassLoader.getSystemClassLoader();
! 
!          scroller_class       = loader.loadClass(SCROLLER_NAME14);
! 
!          constructor1 = scroller_class.getConstructor(new Class[] {SessionGUI.class});
! 
!          try {
!             Object obj= constructor1.newInstance(new Object[] {session});
!             _instance = (SessionScrollerInterface)obj;
! 
!          }
!          catch (Throwable crap) {
!             _instance = this;
!          }
! 
! 
!       }
!       catch (Throwable t) {
!          _instance = this;
!          scroller_class = null;
!          constructor1  = null;
!       }
! 
!       _instance.addMouseWheelListener(session);
!       return _instance;
! 
!    }
! 
!    public void addMouseWheelListener(SessionGUI ses) {
! 
! 
!    }
! 
!    public void removeMouseWheelListener(SessionGUI ses) {
! 
! 
!    }
! 
! }

Index: SessionConfig.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/SessionConfig.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** SessionConfig.java	8 Jun 2005 19:32:49 -0000	1.14
--- SessionConfig.java	16 Jun 2005 04:41:17 -0000	1.15
***************
*** 1,380 ****
! /*
!  * @(#)SessionConfig.java
!  * Copyright:    Copyright (c) 2001
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.util.*;
! import javax.swing.*;
! import java.io.*;
! import java.text.MessageFormat;
! import java.awt.Color;
! import java.awt.Rectangle;
! 
! import org.tn5250j.tools.LangTool;
! import org.tn5250j.event.SessionConfigListener;
! import org.tn5250j.event.SessionConfigEvent;
! import org.tn5250j.interfaces.ConfigureFactory;
! import org.tn5250j.tools.GUIGraphicsUtils;
! 
! /**
!  * A host session configuration object
!  */
! public class SessionConfig implements TN5250jConstants {
! 
!    private String configurationResource;
!    private String sessionName;
!    private boolean connected;
!    private int sessionType;
!    private Properties sesProps;
!    private Vector listeners;
!    private String sslType;
!    private boolean usingDefaults;
! 
!    public SessionConfig (String configurationResource,
!                            String sessionName) {
! 
!       this.configurationResource = configurationResource;
!       this.sessionName = sessionName;
!       loadConfigurationResource();
! 
!    }
! 
!    public String getConfigurationResource() {
! 
!       if (configurationResource == null || configurationResource == "") {
!          configurationResource = "TN5250JDefaults.props";
!          usingDefaults = true;
!       }
! 
!       return configurationResource;
! 
!    }
! 
!    public String getSessionName() {
!       return sessionName;
!    }
! 
!    /**
!     * Notify all registered listeners of the onSessionChanged event.
!     *
!     * @param state  The state change property object.
!     */
!    protected void fireConfigChanged(SessionConfigEvent sce) {
! 
!       if (listeners != null) {
!          int size = listeners.size();
!          for (int i = 0; i < size; i++) {
!             SessionConfigListener target =
!                     (SessionConfigListener)listeners.elementAt(i);
!             target.onConfigChanged(sce);
!          }
!       }
!    }
! 
!    public void firePropertyChange(Object source, String propertyName,
!             Object oldValue, Object newValue) {
! 
!       if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
!          return;
!       }
! 
!       java.util.Vector targets = null;
!       synchronized (this) {
!          if (listeners != null) {
!             targets = (java.util.Vector) listeners.clone();
!          }
!       }
! 
!       SessionConfigEvent sce = new SessionConfigEvent(source,
!              propertyName, oldValue, newValue);
! 
!       if (targets != null) {
!          int size = targets.size();
!          for (int i = 0; i < size; i++) {
!             SessionConfigListener target =
!                     (SessionConfigListener)targets.elementAt(i);
!             target.onConfigChanged(sce);
!          }
!       }
!    }
! 
!    public Properties getProperties() {
! 
!       return sesProps;
!    }
! 
!    public void setSessionProps(Properties props) {
! 
!       sesProps.putAll(props);
! 
!    }
! 
!    public void setModified() {
! 
!       sesProps.setProperty("saveme","");
!    }
! 
!    public void saveSessionProps(java.awt.Container parent) {
! 
!       if (sesProps.containsKey("saveme")) {
! 
!          sesProps.remove("saveme");
! 
!          Object[] args = {getConfigurationResource()};
!          String message = MessageFormat.format(
!                            LangTool.getString("messages.saveSettings"),
!                            args);
! 
!          int result = JOptionPane.showConfirmDialog(parent,message);
! 
!          if (result == JOptionPane.OK_OPTION) {
!             saveSessionProps();
!          }
! 
! 
!       }
! 
!    }
! 
!    public void saveSessionProps() {
! 
!       if (usingDefaults) {
! 
!          ConfigureFactory.getInstance().saveSettings("dfltSessionProps",
!                                                       getConfigurationResource(),
!                                                       "");
! 
!       }
!       else {
!          try {
!             FileOutputStream out = new FileOutputStream(settingsDirectory() + getConfigurationResource());
!                // save off the width and height to be restored later
!             sesProps.store(out,"------ Defaults --------");
!          }
!          catch (FileNotFoundException fnfe) {}
!          catch (IOException ioe) {}
!       }
!    }
! 
!    private void loadConfigurationResource() {
! 
!       sesProps = new Properties();
! 
!       if (configurationResource == null || configurationResource == "") {
!          configurationResource = "TN5250JDefaults.props";
!          usingDefaults = true;
!          loadDefaults();
!       }
!       else {
!          try {
!             FileInputStream in = new FileInputStream(settingsDirectory() + getConfigurationResource());
!             sesProps.load(in);
!             if (sesProps.size() == 0)
!                loadDefaults();
!          }
!          catch (IOException ioe) {
!             System.out.println("Information Message: Properties file is being "
!                                  + "created for first time use:  File name "
!                                  + getConfigurationResource());
!             loadDefaults();
!          }
!          catch (SecurityException se) {
!             System.out.println(se.getMessage());
!          }
!       }
!    }
! 
!    private String settingsDirectory() {
!       return ConfigureFactory.getInstance().getProperty("emulator.settingsDirectory");
!    }
! 
!    private void loadDefaults() {
! 
!       try {
! 
!          sesProps = ConfigureFactory.getInstance().getProperties(
!                                     "dfltSessionProps",
!                                     getConfigurationResource(),true,
!                                     "Default Settings");
!          if (sesProps.size() == 0) {
! 
!             Properties schemaProps = new Properties();
! 
!             java.net.URL file=null;
! 
!             ClassLoader cl = this.getClass().getClassLoader();
!             if (cl == null)
!                cl = ClassLoader.getSystemClassLoader();
!             file = cl.getResource("tn5250jSchemas.properties");
!             schemaProps.load(file.openStream());
! 
!             // we will now load the default schema
!             String prefix = schemaProps.getProperty("schemaDefault");
!             sesProps.setProperty("colorBg",schemaProps.getProperty(prefix + ".colorBg"));
!             sesProps.setProperty("colorRed",schemaProps.getProperty(prefix + ".colorRed"));
!             sesProps.setProperty("colorTurq",schemaProps.getProperty(prefix + ".colorTurq"));
!             sesProps.setProperty("colorCursor",schemaProps.getProperty(prefix + ".colorCursor"));
!             sesProps.setProperty("colorGUIField",schemaProps.getProperty(prefix + ".colorGUIField"));
!             sesProps.setProperty("colorWhite",schemaProps.getProperty(prefix + ".colorWhite"));
!             sesProps.setProperty("colorYellow",schemaProps.getProperty(prefix + ".colorYellow"));
!             sesProps.setProperty("colorGreen",schemaProps.getProperty(prefix + ".colorGreen"));
!             sesProps.setProperty("colorPink",schemaProps.getProperty(prefix + ".colorPink"));
!             sesProps.setProperty("colorBlue",schemaProps.getProperty(prefix + ".colorBlue"));
!             sesProps.setProperty("colorSep",schemaProps.getProperty(prefix + ".colorSep"));
!             sesProps.setProperty("colorHexAttr",schemaProps.getProperty(prefix + ".colorHexAttr"));
!             sesProps.setProperty("font",GUIGraphicsUtils.getDefaultFont());
!             ConfigureFactory.getInstance().saveSettings("dfltSessionProps",
!                                                          getConfigurationResource(),
!                                                          "");
!          }
!       }
!       catch (IOException ioe) {
!          System.out.println("Information Message: Properties file is being "
!                               + "created for first time use:  File name "
!                               + getConfigurationResource());
!       }
!       catch (SecurityException se) {
!          System.out.println(se.getMessage());
!       }
!    }
! 
!    public boolean isPropertyExists(String prop) {
!       return sesProps.containsKey(prop);
!    }
! 
!    public String getStringProperty(String prop) {
! 
!       if (sesProps.containsKey(prop))
!          return (String)sesProps.get(prop);
!       else
!          return "";
! 
!    }
! 
!    public int getIntegerProperty(String prop) {
! 
!       if (sesProps.containsKey(prop)) {
!          try {
!             int i = Integer.parseInt((String)sesProps.get(prop));
!             return i;
!          }
!          catch (NumberFormatException ne) {
!             return 0;
!          }
!       }
!       else
!          return 0;
! 
!    }
! 
!    public Color getColorProperty(String prop) {
! 
!       if (sesProps.containsKey(prop)) {
!          Color c = new Color(getIntegerProperty(prop));
!          return c;
!       }
!       else
!          return null;
! 
!    }
! 
!    public Rectangle getRectangleProperty(String key) {
! 
!       Rectangle rectProp = new Rectangle();
! 
!       if (sesProps.containsKey(key)) {
!          String rect = sesProps.getProperty(key);
!          StringTokenizer stringtokenizer = new StringTokenizer(rect, ",");
!          if (stringtokenizer.hasMoreTokens())
!             rectProp.x = Integer.parseInt(stringtokenizer.nextToken());
!          if (stringtokenizer.hasMoreTokens())
!             rectProp.y = Integer.parseInt(stringtokenizer.nextToken());
!          if (stringtokenizer.hasMoreTokens())
!             rectProp.width = Integer.parseInt(stringtokenizer.nextToken());
!          if (stringtokenizer.hasMoreTokens())
!             rectProp.height = Integer.parseInt(stringtokenizer.nextToken());
! 
!       }
! 
!       return rectProp;
! 
!    }
! 
!    public void setRectangleProperty(String key, Rectangle rect) {
! 
!       String rectStr = rect.x + "," +
!                         rect.y + "," +
!                         rect.width + "," +
!                         rect.height;
!       sesProps.setProperty(key,rectStr);
!    }
! 
!    public float getFloatProperty(String prop) {
! 
!       if (sesProps.containsKey(prop)) {
!          float f = Float.parseFloat((String)sesProps.get(prop));
!          return f;
!       }
!       else
!          return 0.0f;
! 
!    }
! 
!    public Object setProperty(String key, String value ) {
!       return sesProps.setProperty(key,value);
!    }
! 
!    public Object removeProperty(String key) {
!       return sesProps.remove(key);
!    }
! 
!    public synchronized Vector getSessionConfigListeners () {
! 
!       return listeners;
!    }
! 
!    /**
!     * Add a SessionConfigListener to the listener list.
!     *
!     * @param listener  The SessionListener to be added
!     */
!    public synchronized void addSessionConfigListener(SessionConfigListener listener) {
! 
!       if (listeners == null) {
!           listeners = new java.util.Vector(3);
!       }
!       listeners.addElement(listener);
! 
!    }
! 
!    /**
!     * Remove a SessionListener from the listener list.
!     *
!     * @param listener  The SessionListener to be removed
!     */
!    public synchronized void removeSessionConfigListener(SessionConfigListener listener) {
!       if (listeners == null) {
!           return;
!       }
!       listeners.removeElement(listener);
! 
!    }
! 
  }
\ No newline at end of file
--- 1,380 ----
! /*
!  * @(#)SessionConfig.java
!  * Copyright:    Copyright (c) 2001
!  *
!  * This program is free software; you can redistribute it and/or modify
!  * it under the terms of the GNU General Public License as published by
!  * the Free Software Foundation; either version 2, or (at your option)
!  * any later version.
!  *
!  * This program is distributed in the hope that it will be useful,
!  * but WITHOUT ANY WARRANTY; without even the implied warranty of
!  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
!  * GNU General Public License for more details.
!  *
!  * You should have received a copy of the GNU General Public License
!  * along with this software; see the file COPYING.  If not, write to
!  * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
!  * Boston, MA 02111-1307 USA
!  *
!  */
! package org.tn5250j;
! 
! import java.util.*;
! import javax.swing.*;
! import java.io.*;
! import java.text.MessageFormat;
! import java.awt.Color;
! import java.awt.Rectangle;
! 
! import org.tn5250j.tools.LangTool;
! import org.tn5250j.event.SessionConfigListener;
! import org.tn5250j.event.SessionConfigEvent;
! import org.tn5250j.interfaces.ConfigureFactory;
! import org.tn5250j.tools.GUIGraphicsUtils;
! 
! /**
!  * A host session configuration object
!  */
! public class SessionConfig implements TN5250jConstants {
! 
!    private String configurationResource;
!    private String sessionName;
!    private boolean connected;
!    private int sessionType;
!    private Properties sesProps;
!    private Vector listeners;
!    private String sslType;
!    private boolean usingDefaults;
! 
!    public SessionConfig (String configurationResource,
!                            String sessionName) {
! 
!       this.configurationResource = configurationResource;
!       this.sessionName = sessionName;
!       loadConfigurationResource();
! 
!    }
! 
!    public String getConfigurationResource() {
! 
!       if (configurationResource == null || configurationResource == "") {
!          configurationResource = "TN5250JDefaults.props";
!          usingDefaults = true;
!       }
! 
!       return configurationResource;
! 
!    }
! 
!    public String getSessionName() {
!       return sessionName;
!    }
! 
!    /**
!     * Notify all registered listeners of the onSessionChanged event.
!     *
!     * @param state  The state change property object.
!     */
!    protected void fireConfigChanged(SessionConfigEvent sce) {
! 
!       if (listeners != null) {
!          int size = listeners.size();
!          for (int i = 0; i < size; i++) {
!             SessionConfigListener target =
!                     (SessionConfigListener)listeners.elementAt(i);
!             target.onConfigChanged(sce);
!          }
!       }
!    }
! 
!    public void firePropertyChange(Object source, String propertyName,
!             Object oldValue, Object newValue) {
! 
!       if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
!          return;
!       }
! 
!       java.util.Vector targets = null;
!       synchronized (this) {
!          if (listeners != null) {
!             targets = (java.util.Vector) listeners.clone();
!          }
!       }
! 
!       SessionConfigEvent sce = new SessionConfigEvent(source,
!              propertyName, oldValue, newValue);
! 
!       if (targets != null) {
!          int size = targets.size();
!          for (int i = 0; i < size; i++) {
!             SessionConfigListener target =
!                     (SessionConfigListener)targets.elementAt(i);
!             target.onConfigChanged(sce);
!          }
!       }
!    }
! 
!    public Properties getProperties() {
! 
!       return sesProps;
!    }
! 
!    public void setSessionProps(Properties props) {
! 
!       sesProps.putAll(props);
! 
!    }
! 
!    public void setModified() {
! 
!       sesProps.setProperty("saveme","");
!    }
! 
!    public void saveSessionProps(java.awt.Container parent) {
! 
!       if (sesProps.containsKey("saveme")) {
! 
!          sesProps.remove("saveme");
! 
!          Object[] args = {getConfigurationResource()};
!          String message = MessageFormat.format(
!                            LangTool.getString("messages.saveSettings"),
!                            args);
! 
!          int result = JOptionPane.showConfirmDialog(parent,message);
! 
!          if (result == JOptionPane.OK_OPTION) {
!             saveSessionProps();
!          }
! 
! 
!       }
! 
!    }
! 
!    public void saveSessionProps() {
! 
!       if (usingDefaults) {
! 
!          ConfigureFactory.getInstance().saveSettings("dfltSessionProps",
!                                                       getConfigurationResource(),
!                                                       "");
! 
!       }
!       else {
!          try {
!             FileOutputStream out = new FileOutputStream(settingsDirectory() + getConfigurationResource());
!                // save off the width and height to be restored later
!             sesProps.store(out,"------ Defaults --------");
!          }
!          catch (FileNotFoundException fnfe) {}
!          catch (IOException ioe) {}
!       }
!    }
! 
!    private void loadConfigurationResource() {
! 
!       sesProps = new Properties();
! 
!       if (configurationResource == null || configurationResource == "") {
!          configurationResource = "TN5250JDefaults.props";
!          usingDefaults = true;
!          loadDefaults();
!       }
!       else {
!          try {
!             FileInputStream in = new FileInputStream(settingsDirectory() + getConfigurationResource());
!             sesProps.load(in);
!             if (sesProps.size() == 0)
!                loadDefaults();
!          }
!          catch (IOException ioe) {
!             System.out.println("Information Message: Properties file is being "
!                                  + "created for first time use:  File name "
!                                  + getConfigurationResource());
!             loadDefaults();
!          }
!          catch (SecurityException se) {
!             System.out.println(se.getMessage());
!          }
!       }
!    }
! 
!    private String settingsDirectory() {
!       return ConfigureFactory.getInstance().getProperty("emulator.settingsDirectory");
!    }
! 
!    private void loadDefaults() {
! 
!       try {
! 
!          sesProps = ConfigureFactory.getInstance().getProperties(
!                                     "dfltSessionProps",
!                                     getConfigurationResource(),true,
!                                     "Default Settings");
!          if (sesProps.size() == 0) {
! 
!             Properties schemaProps = new Properties();
! 
!             java.net.URL file=null;
! 
!             ClassLoader cl = this.getClass().getClassLoader();
!             if (cl == null)
!                cl = ClassLoader.getSystemClassLoader();
!             file = cl.getResource("tn5250jSchemas.properties");
!             schemaProps.load(file.openStream());
! 
!             // we will now load the default schema
!             String prefix = schemaProps.getProperty("schemaDefault");
!             sesProps.setProperty("colorBg",schemaProps.getProperty(prefix + ".colorBg"));
!             sesProps.setProperty("colorRed",schemaProps.getProperty(prefix + ".colorRed"));
!             sesProps.setProperty("colorTurq",schemaProps.getProperty(prefix + ".colorTurq"));
!             sesProps.setProperty("colorCursor",schemaProps.getProperty(prefix + ".colorCursor"));
!             sesProps.setProperty("colorGUIField",schemaProps.getProperty(prefix + ".colorGUIField"));
!             sesProps.setProperty("colorWhite",schemaProps.getProperty(prefix + ".colorWhite"));
!             sesProps.setProperty("colorYellow",schemaProps.getProperty(prefix + ".colorYellow"));
!             sesProps.setProperty("colorGreen",schemaProps.getProperty(prefix + ".colorGreen"));
!             sesProps.setProperty("colorPink",schemaProps.getProperty(prefix + ".colorPink"));
!             sesProps.setProperty("colorBlue",schemaProps.getProperty(prefix + ".colorBlue"));
!             sesProps.setProperty("colorSep",schemaProps.getProperty(prefix + ".colorSep"));
!             sesProps.setProperty("colorHexAttr",schemaProps.getProperty(prefix + ".colorHexAttr"));
!             sesProps.setProperty("font",GUIGraphicsUtils.getDefaultFont());
!             ConfigureFactory.getInstance().saveSettings("dfltSessionProps",
!                                                          getConfigurationResource(),
!                                                          "");
!          }
!       }
!       catch (IOException ioe) {
!          System.out.println("Information Message: Properties file is being "
!                               + "created for first time use:  File name "
!                               + getConfigurationResource());
!       }
!       catch (SecurityException se) {
!          System.out.println(se.getMessage());
!       }
!    }
! 
!    public boolean isPropertyExists(String prop) {
!       return sesProps.containsKey(prop);
!    }
! 
!    public String getStringProperty(String prop) {
! 
!       if (sesProps.containsKey(prop))
!          return (String)sesProps.get(prop);
!       else
!          return "";
! 
!    }
! 
!    public int getIntegerProperty(String prop) {
! 
!       if (sesProps.containsKey(prop)) {
!          try {
!             int i = Integer.parseInt((String)sesProps.get(prop));
!             return i;
!          }
!          catch (NumberFormatException ne) {
!             return 0;
!          }
!       }
!       else
!          return 0;
! 
!    }
! 
!    public Color getColorProperty(String prop) {
! 
!       if (sesProps.containsKey(prop)) {
!          Color c = new Color(getIntegerProperty(prop));
!          return c;
!       }
!       else
!          return null;
! 
!    }
! 
!    public Rectangle getRectangleProperty(String key) {
! 
!       Rectangle rectProp = new Rectangle();
! 
!       if (sesProps.containsKey(key)) {
!          String rect = sesProps.getProperty(key);
!          StringTokenizer stringtokenizer = new StringTokenizer(rect, ",");
!          if (stringtokenizer.hasMoreTokens())
!             rectProp.x = Integer.parseInt(stringtokenizer.nextToken());
!          if (stringtokenizer.hasMoreTokens())
!             rectProp.y = Integer.parseInt(stringtokenizer.nextToken());
!          if (stringtokenizer.hasMoreTokens())
!             rectProp.width = Integer.parseInt(stringtokenizer.nextToken());
!          if (stringtokenizer.hasMoreTokens())
!             rectProp.height = Integer.parseInt(stringtokenizer.nextToken());
! 
!       }
! 
!       return rectProp;
! 
!    }
! 
!    public void setRectangleProperty(String key, Rectangle rect) {
! 
!       String rectStr = rect.x + "," +
!                         rect.y + "," +
!                         rect.width + "," +
!                         rect.height;
!       sesProps.setProperty(key,rectStr);
!    }
! 
!    public float getFloatProperty(String prop) {
! 
!       if (sesProps.containsKey(prop)) {
!          float f = Float.parseFloat((String)sesProps.get(prop));
!          return f;
!       }
!       else
!          return 0.0f;
! 
!    }
! 
!    public Object setProperty(String key, String value ) {
!       return sesProps.setProperty(key,value);
!    }
! 
!    public Object removeProperty(String key) {
!       return sesProps.remove(key);
!    }
! 
!    public synchronized Vector getSessionConfigListeners () {
! 
!       return listeners;
!    }
! 
!    /**
!     * Add a SessionConfigListener to the listener list.
!     *
!     * @param listener  The SessionListener to be added
!     */
!    public synchronized void addSessionConfigListener(SessionConfigListener listener) {
! 
!       if (listeners == null) {
!           listeners = new java.util.Vector(3);
!       }
!       listeners.addElement(listener);
! 
!    }
! 
!    /**
!     * Remove a SessionListener from the listener list.
!     *
!     * @param listener  The SessionListener to be removed
!     */
!    public synchronized void removeSessionConfigListener(SessionConfigListener listener) {
!       if (listeners == null) {
!           return;
!       }
!       listeners.removeElement(listener);
! 
!    }
! 
  }
\ No newline at end of file

Index: Gui5250.java
===================================================================
RCS file: /cvsroot/tn5250j/tn5250j/src/org/tn5250j/Gui5250.java,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** Gui5250.java	8 Jun 2005 19:32:48 -0000	1.77
--- Gui5250.java	16 Jun 2005 04:41:17 -0000	1.78
***************
*** 1,1129 ****
! /**
!  * Title: tn5250J
!  * Copyright:   Copyright (c) 2001
!  * Company:
!  * @author  Kenneth J. Pouncey
!  * @version 0.5
!  *
!  * Description:
!  *
!  * This program is free software; you can redistribute it and/or modify
[...2229 lines suppressed...]
!             setEndPoint(p);
!          }
!          return this.endPoint;
!       }
! 
!       protected Point getStartPoint() {
! 
!          if(this.startPoint == null) {
!             Point p = new Point(0,0);
!             bi.getPointFromRowCol(0,0,p);
!             setStartPoint(p);
!          }
!          return this.startPoint;
! 
!       }
!    }
! 
! }
! 
! 



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click