Project JXTA

net.jxta.impl.shell
Class ShellConsole

java.lang.Object
  |
  +--net.jxta.impl.shell.ShellConsole

public class ShellConsole
extends java.lang.Object
implements java.lang.Runnable, java.awt.event.KeyListener, java.awt.event.MouseListener


Constructor Summary
ShellConsole(int rows, int cols)
          Creates a new terminal window with rows row and cols columns to display.
ShellConsole(java.lang.String useName, int rows, int cols)
          Creates a new terminal window with rows row and cols columns to display.
 
Method Summary
 void clear()
           
 void destroy()
          Terminates the current terminal window.
 java.lang.String getConsoleName()
           
 java.lang.String getCursorDownName()
          Returns the command this console send if the cursor down key was pressed.
 java.lang.String getCursorUpName()
          Returns the command this console send if the cursor up key was pressed.
 void handling(int val, char ch, int modifiers)
          Handles the editing of the command line.
 void keyPressed(java.awt.event.KeyEvent e)
          Handles KeyEvent events.s
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse has entered the component.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse has exited component.
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when the mouse has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when the mouse has been released on a component.
 void print(java.lang.String s)
           
 void println(java.lang.String s)
           
 java.lang.String read()
           
 void run()
           
 void setCommandLine(java.lang.String prompt, java.lang.String cmd)
          Replaces the current command line with the command indicated
 void write(java.lang.String msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShellConsole

public ShellConsole(int rows,
                    int cols)
Creates a new terminal window with rows row and cols columns to display.
Parameters:
rows - the number of rows displayed
cols - the number of columns displayed

ShellConsole

public ShellConsole(java.lang.String useName,
                    int rows,
                    int cols)
Creates a new terminal window with rows row and cols columns to display.
Parameters:
useName - the name of the console
rows - the number of rows displayed
cols - the number of columns displayed
Method Detail

getConsoleName

public java.lang.String getConsoleName()

destroy

public void destroy()
Terminates the current terminal window. If this was the last window open, the program is terminated.

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Handles KeyEvent events.s

The events currrently handled are:

All events (except for the ones mentioned above) are consumed, so that they are not handled by the TextArea object.
Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
e - the triggering KeyEvent object

handling

public void handling(int val,
                     char ch,
                     int modifiers)
Handles the editing of the command line. Handling is as follows:
Parameters:
val - the KeyCode value of the key pressed
ch - the character associated with the key pressed
modifiers - any modifiers that might have been pressed

setCommandLine

public void setCommandLine(java.lang.String prompt,
                           java.lang.String cmd)
Replaces the current command line with the command indicated
Parameters:
prompt - if not null, this is set as the new prompt
cmd - the command replacing the typed command

print

public void print(java.lang.String s)

println

public void println(java.lang.String s)

run

public void run()
Specified by:
run in interface java.lang.Runnable

read

public java.lang.String read()

write

public void write(java.lang.String msg)

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

clear

public void clear()

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component. Changes the isEditable status of text to false.
Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - triggering mouse event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse has entered the component. Does nothing
Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - triggering mouse event

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse has exited component. Does nothing
Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - triggering mouse event

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when the mouse has been pressed on a component. Changes the isEditable status of text to false.
Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - triggering mouse event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when the mouse has been released on a component. Changes the isEditable status of text to false.
Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - triggering mouse event

getCursorUpName

public java.lang.String getCursorUpName()
Returns the command this console send if the cursor up key was pressed.
Returns:
command this console send if the cursor up key was pressed

getCursorDownName

public java.lang.String getCursorDownName()
Returns the command this console send if the cursor down key was pressed.
Returns:
command this console send if the cursor down key was pressed

Project JXTA