AdventNet CLI 2.0 API Specification

com.adventnet.telnet.telnetwindow
Class TelnetFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--com.adventnet.telnet.telnetwindow.TelnetFrame

public class TelnetFrame
extends javax.swing.JFrame
implements java.lang.Runnable, java.awt.event.ActionListener, java.awt.event.KeyListener

This class can be used to start an application that can be used like an ordinary Telnet Client to communicate with remote devices. Commands that are sent and recieved will be displayed in the Window that is opened. To write an application using the TelnetFrame you may use the following piece of code as an example:


   TelnetFrame frame = new TelnetFrame();

   frame.setHostName("localhost");
   frame.setPortNo(23);
   frame.setTitle("Telnet Window");
   frame.setFontSize(12);
   frame.setVisible(true);

 
Please note that the setVisible(true) method that opens the Window for sending and receiving commands is called after other parameters are set.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
TelnetFrame()
          Constructs a new Frame that is initially invisible.
TelnetFrame(java.applet.Applet applet)
          Constructs a new Frame that is initially invisible by passing an Applet as the argument.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent evt)
          This method is internally used by the API which overrides the method in the Interface ActionListener and should not be invoked by the user.
 java.lang.String getEncoding()
          Gets the specified character encoding name.
 int getFontSize()
          Gets the font size of the Telnet Frame.
 java.awt.Image getFrameIconImage()
          Gets the image to be displayed in the minimized icon for this frame.
 java.lang.String getFrameTitle()
          Gets the title of the frame.
 java.awt.MenuBar getMenuBar()
          Gets the MenuBar for this frame.
 int getSocketTimeout()
          Gets the socket time-out.
 void init(javax.swing.JApplet applet)
          This is used to initialize the applet.
 void keyPressed(java.awt.event.KeyEvent ke)
          This method is internally used by the API which overrides the method in the Interface KeyListener and should not be invoked by the user.
 void keyReleased(java.awt.event.KeyEvent arg0)
          This method is internally used by the API which overrides the method in the Interface KeyListener and should not be invoked by the user.
 void keyTyped(java.awt.event.KeyEvent arg0)
          This method is internally used by the API which overrides the method in the Interface KeyListener and should not be invoked by the user.
 void run()
          This method is internally used by the API which overrides the method in the Interface Runnable and should not be invoked by the user.
 void setEncoding(java.lang.String encoding)
          Sets the specified character Encoding.
 void setFontSize(int fontSize)
          Sets the font size in the telnet frame.
 void setFrameIconImage(java.awt.Image image)
          Sets the image to displayed in the minimized icon for this frame.
 void setFrameTitle(java.lang.String title)
          Sets the title for this frame to the specified string.
 void setHostName(java.lang.String hostName)
          Sets the Remote Host name or IP address in dotted format.
 void setPortNo(int port)
          Sets the Remote Port number in which the Telnet Server is running.
 void setSocketTimeout(int timeout)
          Sets the socket time-out.
 void setVisible(boolean bl)
          Shows or hides this component depending on the value of parameter bl.
 void start()
          This should be called when the start method of the applet is called by the browser or applet viewer to inform this applet that it should start its execution.
 void stop()
          This should be called when the stop method of the applet is called by the browser or applet viewer to inform this applet that it should stop its execution.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getFrames, getIconImage, getState, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TelnetFrame

public TelnetFrame()
Constructs a new Frame that is initially invisible.

TelnetFrame

public TelnetFrame(java.applet.Applet applet)
Constructs a new Frame that is initially invisible by passing an Applet as the argument. This is used to initialize the applet.
Parameters:
applet - the applet parameter.
Method Detail

getMenuBar

public java.awt.MenuBar getMenuBar()
Gets the MenuBar for this frame.
Overrides:
getMenuBar in class java.awt.Frame
Returns:
the MenuBar instance.

setVisible

public void setVisible(boolean bl)
Shows or hides this component depending on the value of parameter bl. This method should be called after setting all the other parameters like the remote host, port number, character encoding, socket time-out and others.
Overrides:
setVisible in class java.awt.Component
Parameters:
bl - If true, shows this component; otherwise, hides this component.

init

public void init(javax.swing.JApplet applet)
This is used to initialize the applet. This method can be called if the TelnetFrame object is created using the default constructor.
Parameters:
applet - the applet parameter.

stop

public void stop()
This should be called when the stop method of the applet is called by the browser or applet viewer to inform this applet that it should stop its execution.

start

public void start()
This should be called when the start method of the applet is called by the browser or applet viewer to inform this applet that it should start its execution.

keyPressed

public void keyPressed(java.awt.event.KeyEvent ke)
This method is internally used by the API which overrides the method in the Interface KeyListener and should not be invoked by the user.
Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
ke - the event that characterizes the action when a key is pressed.

keyReleased

public void keyReleased(java.awt.event.KeyEvent arg0)
This method is internally used by the API which overrides the method in the Interface KeyListener and should not be invoked by the user.
Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
ke - the event that characterizes the action when a key is released.

keyTyped

public void keyTyped(java.awt.event.KeyEvent arg0)
This method is internally used by the API which overrides the method in the Interface KeyListener and should not be invoked by the user.
Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
ke - the event that characterizes the action when a key is typed.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent evt)
This method is internally used by the API which overrides the method in the Interface ActionListener and should not be invoked by the user.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
ae - the event that characterizes the action invoked.

run

public void run()
This method is internally used by the API which overrides the method in the Interface Runnable and should not be invoked by the user.
Specified by:
run in interface java.lang.Runnable

setHostName

public void setHostName(java.lang.String hostName)
Sets the Remote Host name or IP address in dotted format.
Parameters:
hostName - the remoteHost to connect.

setPortNo

public void setPortNo(int port)
Sets the Remote Port number in which the Telnet Server is running. Default is 23( the standard telnet port ).
Parameters:
remotePort - the Remote Port to connect with.

setFontSize

public void setFontSize(int fontSize)
Sets the font size in the telnet frame. Default font size is 12 and this value is set even if an invalid size is specified.
Parameters:
fontSize - the font size to be set in the telnet frame.

getFontSize

public int getFontSize()
Gets the font size of the Telnet Frame.
Returns:
the font size.

setEncoding

public void setEncoding(java.lang.String encoding)
Sets the specified character Encoding. Default character encoding is latin-1.
Parameters:
encoding - A character encoding name.

getEncoding

public java.lang.String getEncoding()
Gets the specified character encoding name.
Returns:
the character encoding name.

setFrameTitle

public void setFrameTitle(java.lang.String title)
Sets the title for this frame to the specified string.
Parameters:
title - the title to be displayed in the frame's border.

getFrameTitle

public java.lang.String getFrameTitle()
Gets the title of the frame. The title is displayed in the frame's border.
Returns:
the title of this frame.

setFrameIconImage

public void setFrameIconImage(java.awt.Image image)
Sets the image to displayed in the minimized icon for this frame.
Parameters:
image - the icon image to be displayed.

getFrameIconImage

public java.awt.Image getFrameIconImage()
Gets the image to be displayed in the minimized icon for this frame.
Returns:
the icon image for this frame.

setSocketTimeout

public void setSocketTimeout(int timeout)
Sets the socket time-out. This is the time in seconds for which the connection with the remote device is alive if idle. If the time-out expires, connection is closed with the remote device. Default value set is zero( infinite timeout ).
Parameters:
timeout - the socket time-out.

getSocketTimeout

public int getSocketTimeout()
Gets the socket time-out. This is the time in seconds for which the connection with the remote device is alive if idle. If the time-out expires, connection is closed with the remote device.
Returns:
the socket time-out.

AdventNet CLI 2.0 API Specification