Package JSSHTerminal

Class MainPanel

All Implemented Interfaces:
AdjustmentListener, MouseWheelListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class MainPanel extends JPanel implements AdjustmentListener, MouseWheelListener
SSH Terminal frame
Author:
JL PONS Adapted Doug Gillespie to separate JFrame from the working part of this so that I can more easily incorporate the terminal as a component within more complex GUI. Stop extending JFrame and make available a Swing component instead.
See Also:
  • Field Details

  • Constructor Details

    • MainPanel

      public MainPanel(JFrame parentFrame, String host, String user, String password, int width, int height, int scrollSize, boolean center)
      Construct a SSH terminal frame
      Parameters:
      parentFrame - Parent frame - this will need to set up a couple of listeners on the frame, so it's needed.
      host - Host to connect
      user - Username
      password - Password (if null, password will be prompted)
      width - Terminal width (character)
      height - Terminal height (character)
      scrollSize - ScrollBar height (lines)
      center - Center on screen
    • MainPanel

      public MainPanel(JFrame parentFrame, String host, String user, String password, int width, int height, int scrollSize)
      Construct a SSH terminal frame
      Parameters:
      host - Host to connect
      user - Username
      password - Password (if null, password will be prompted)
      width - Terminal width (character)
      height - Terminal height (character)
      scrollSize - ScrollBar height (lines)
  • Method Details

    • openTerminal

      public void openTerminal()
    • setExitOnClose

      public void setExitOnClose(boolean exitOnClose)
      Exit when terminal is closed or exit
      Parameters:
      exitOnClose -
    • setCommand

      public void setCommand(String cmd)
      Execute the given command after connection
      Parameters:
      cmd - Command to be executed (Do not add \n at the end)
    • setSSHPort

      public void setSSHPort(int port)
      Sets the SSH port
      Parameters:
      port - Port number
    • setAnswerYes

      public void setAnswerYes(boolean enable)
      Automatically answer yes to question
      Parameters:
      enable - Enalbe auto yes
    • setX11Forwarding

      public void setX11Forwarding(boolean enable)
      Enable X11 forwarding, multi display not supported
      Parameters:
      enable -
    • adjustmentValueChanged

      public void adjustmentValueChanged(AdjustmentEvent e)
      Specified by:
      adjustmentValueChanged in interface AdjustmentListener
    • mouseWheelMoved

      public void mouseWheelMoved(MouseWheelEvent e)
      Specified by:
      mouseWheelMoved in interface MouseWheelListener
    • printUsage

      public static void printUsage()
    • main

      public static void main(String[] args)
    • openTerminal

      public static void openTerminal(String host, String user, String password)
    • openTerminal

      public static void openTerminal(String host, String user, String password, int port, int width, int height, int scrollSize)
    • getContentPanel

      public JPanel getContentPanel()
      Returns:
      the contentPanel
    • get_host

      public String get_host()
      Returns:
      the _host