Class MiniChat

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--javax.swing.JApplet
                                |
                                +--MiniChat
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable

public class MiniChat
extends javax.swing.JApplet
implements java.awt.event.ActionListener

MiniChat class is where code starts execution. It sets up the GUI, gets the host IP, and sets up the event listeners.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Inner classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
 java.awt.Container ChatRootPane
          This is the container used to hold the chat text.
 javax.swing.JScrollPane ChatScrollPane
          This scroll pane is used to create a vertically scrollable chat window
 javax.swing.JTextArea ChatText
          This is the actual big chat text area.
 javax.swing.JPanel MainPanel
          Applets content pane
 java.awt.FlowLayout MainPanelLayout
          Layout manager for the MainPanel object
 ChatConnection MiniChatConnection
          Object that actually performs the network communication stuff with the server
 javax.swing.JButton SendMessage
          Button that sends the message to other users.
 javax.swing.JTextField UserMessage
          This field is where the user types in a new message for the chat window.
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
MiniChat()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent AEvent)
          This event listener only listens for the send message event, all others are ignored.
 void init()
          Applet interface method that is called initially.
 void initializeComponents()
          Initializes all the user interface components.
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
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, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, 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, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ChatRootPane

public java.awt.Container ChatRootPane
This is the container used to hold the chat text. The container is used by the ChatScrollPane

ChatText

public javax.swing.JTextArea ChatText
This is the actual big chat text area.

UserMessage

public javax.swing.JTextField UserMessage
This field is where the user types in a new message for the chat window. It also has an action listener for when the user hits return it is the same action as pressing the send button.

SendMessage

public javax.swing.JButton SendMessage
Button that sends the message to other users. Has same event listener as the UserMessage JTextField

ChatScrollPane

public javax.swing.JScrollPane ChatScrollPane
This scroll pane is used to create a vertically scrollable chat window

MainPanel

public javax.swing.JPanel MainPanel
Applets content pane

MainPanelLayout

public java.awt.FlowLayout MainPanelLayout
Layout manager for the MainPanel object

MiniChatConnection

public ChatConnection MiniChatConnection
Object that actually performs the network communication stuff with the server
Constructor Detail

MiniChat

public MiniChat()
Method Detail

initializeComponents

public void initializeComponents()
Initializes all the user interface components. Sets up the GUI properties, and displays the GUI.

init

public void init()
Applet interface method that is called initially. This method calls the GUI initialization method and opens the MiniChatConnection object
Overrides:
init in class java.applet.Applet

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent AEvent)
This event listener only listens for the send message event, all others are ignored. When a message is sent, it executes the MiniChatConnection sendMessage method.
Specified by:
actionPerformed in interface java.awt.event.ActionListener