swpchat.client.gui
Class ChatFrame
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Window
|
+--java.awt.Frame
|
+--javax.swing.JFrame
|
+--swpchat.client.gui.SWPFrame
|
+--swpchat.client.gui.ChatFrame
- All Implemented Interfaces:
- javax.accessibility.Accessible, java.awt.event.ActionListener, javax.swing.event.ChangeListener, ClientConstantPool, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants
- public class ChatFrame
- extends SWPFrame
- implements java.awt.event.ActionListener, java.awt.event.MouseListener, javax.swing.event.ChangeListener, ClientConstantPool
The chatframe.
- Author:
- Brunner, Sturm, Stuellenberg.
- See Also:
- Serialized Form
Inner classes inherited from class javax.swing.JFrame |
javax.swing.JFrame.AccessibleJFrame |
Inner classes inherited from class java.awt.Frame |
java.awt.Frame.AccessibleAWTFrame |
Inner classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock |
Fields inherited from class javax.swing.JFrame |
accessibleContext, defaultCloseOperation, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, title, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis |
Fields inherited from class java.awt.Window |
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, warningString, windowListener, windowSerializedDataVersion |
Fields inherited from class java.awt.Container |
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads |
Fields inherited from class java.awt.Component |
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y |
Fields inherited from interface swpchat.client.ClientConstantPool |
COLOR_BACKGROUND, iconClose, iconClosePress, iconDelete, iconDeletePress, iconJoin, iconLeave, iconNormal, iconPress, iconSmall, iconSmallPress, IMAGE_DIRECTORY, shipdummy, shipgif, STR_GIF_PATH, STR_PATH_SEPARATOR, userInfoData |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Method Summary |
void |
actionPerformed(java.awt.event.ActionEvent event)
Invoked when an action occurs. |
void |
createNewTab(java.lang.String title,
boolean joinSender,
boolean joinReceiver)
Creates a new tab with the specified title. |
void |
createSoundMenu()
creates the sound menu. |
java.util.HashMap |
getMemberEntryMap()
getting the Map in which the entries are storedd |
MemberListEntry |
getMemberListEntry(java.lang.String channel)
Getting the MemberListEntry |
javax.swing.DefaultListModel |
getMemberListModel()
returns the actual selected tab |
private java.lang.String |
getTitleOfSelectedTab()
Returns the title of the actually selected tab (= channel). |
void |
handleShipAttac(java.lang.String status)
This method handles the ship attac |
boolean |
isJoinedReceiver(java.lang.String channel)
Returns, if the given channel is connected as receiver. |
boolean |
isJoinedSender(java.lang.String channel)
Returns, if the given channel is connected as sender. |
void |
mouseClicked(java.awt.event.MouseEvent event)
|
void |
mouseEntered(java.awt.event.MouseEvent event)
|
void |
mouseExited(java.awt.event.MouseEvent event)
|
void |
mousePressed(java.awt.event.MouseEvent event)
|
void |
mouseReleased(java.awt.event.MouseEvent event)
|
void |
playEmoSound(java.lang.String strAudioKey)
Tries to play an audio file with a certain key
Sound can be enabled with enablePlay() and disabled with disablePlay(). |
private void |
playSound(java.lang.String sound)
Plays sound using client controls. |
void |
removeAllTabs()
Removes all tabs. |
void |
removeTab(java.lang.String title)
removes the specified tab. |
private void |
sendFile()
Shows picture chooser dialog and sends selected
picture with clientControls. |
void |
sendTelephoneRequest()
send a Telephone Request |
boolean |
setTopic(java.lang.String channel,
java.lang.String topic)
set the topic of a channel |
void |
showEmotion(java.lang.String channel,
java.lang.String from,
java.lang.String target,
java.lang.String emo)
Gets the correct tab and shows emotion in it. |
void |
showMessage(java.lang.String channel,
java.lang.String nick,
java.lang.String message)
Gets the correct tab and shows message in it. |
void |
showShipMessage(java.lang.String channel,
java.lang.String sender,
java.lang.String victim,
java.lang.String status)
Gets the correct tab and shows ship-message in it. |
void |
stateChanged(javax.swing.event.ChangeEvent event)
Invoked when a change event occurs. |
Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, createRootPaneException, 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, addToFrameList, constructComponentName, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, initIDs, isResizable, postProcessKeyEvent, readObject, remove, removeFromFrameList, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle, writeObject |
Methods inherited from class java.awt.Window |
addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, show, toBack, toFront, transferFocus |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, removeAll, removeContainerListener, setFont, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, 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, setVisible, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
memberEntryMap
public java.util.HashMap memberEntryMap
CLS
private static final java.lang.String CLS
STR_BTN_CLOSE
private static final java.lang.String STR_BTN_CLOSE
STR_BTN_SEND
private static final java.lang.String STR_BTN_SEND
STR_ACTION
private static final java.lang.String STR_ACTION
STR_CHTOP
private static final java.lang.String STR_CHTOP
STR_WHISPER
private static final java.lang.String STR_WHISPER
STR_TELEPHON_REQUEST
private static final java.lang.String STR_TELEPHON_REQUEST
STR_SHIP
private static final java.lang.String STR_SHIP
STR_SOUNDS
private static final java.lang.String STR_SOUNDS
STR_PLAY
private static final java.lang.String STR_PLAY
STR_FILE
private static final java.lang.String STR_FILE
STR_SEND_FILE
private static final java.lang.String STR_SEND_FILE
STR_EMOTION
private static final java.lang.String STR_EMOTION
STR_MUFF
private static final java.lang.String STR_MUFF
tabbedPane
private javax.swing.JTabbedPane tabbedPane
btnSend
private ChatButton btnSend
btnClose
private ChatButton btnClose
txaSend
private javax.swing.JTextArea txaSend
tb
private javax.swing.JToolBar tb
dimTp
java.awt.Dimension dimTp
dimSend
java.awt.Dimension dimSend
clientControls
private ClientControls clientControls
pictureChooser
private PictureChooser pictureChooser
sendFileDialog
private SendFileDialog sendFileDialog
barMn
private javax.swing.JMenuBar barMn
mnSound
private javax.swing.JMenu mnSound
mnPicture
private javax.swing.JMenu mnPicture
chItem
private javax.swing.JCheckBoxMenuItem chItem
mnItem
private javax.swing.JMenuItem mnItem
sendFileItem
private javax.swing.JMenuItem sendFileItem
mnAction
private javax.swing.JMenu mnAction
chtopItem
private javax.swing.JMenuItem chtopItem
whisperItem
private javax.swing.JMenuItem whisperItem
telephoneItem
private javax.swing.JMenuItem telephoneItem
shipItem
private javax.swing.JMenuItem shipItem
emotionItem
private javax.swing.JMenuItem emotionItem
muffItem
private javax.swing.JMenuItem muffItem
cont
java.awt.Container cont
shipOn
boolean shipOn
jlblShip
javax.swing.JLabel jlblShip
infoPopup
private InfoPopup infoPopup
selectedMember
private java.lang.String selectedMember
whisperWindow
private WhisperWindow whisperWindow
teleReqWindow
private TelephonRequestWindow teleReqWindow
shipWindow
private ShipWindow shipWindow
emotionWindow
private EmotionWindow emotionWindow
muffWindow
private EarmuffsWindow muffWindow
ChatFrame
public ChatFrame(ClientControls clientControls,
DisplayControler displayControler)
- Contructor.
createSoundMenu
public void createSoundMenu()
- creates the sound menu. Gets the information about sounds from
properties about clientControls.
handleShipAttac
public void handleShipAttac(java.lang.String status)
- This method handles the ship attac
- Parameters:
status
- declares wether to put ship ON or take it OFF.
getMemberEntryMap
public java.util.HashMap getMemberEntryMap()
- getting the Map in which the entries are storedd
- Returns:
- The map
getMemberListEntry
public MemberListEntry getMemberListEntry(java.lang.String channel)
- Getting the MemberListEntry
- Parameters:
channel
- the desired channel- Returns:
- the entry
createNewTab
public void createNewTab(java.lang.String title,
boolean joinSender,
boolean joinReceiver)
- Creates a new tab with the specified title.
Title should be the channel name.
removeTab
public void removeTab(java.lang.String title)
- removes the specified tab.
- Parameters:
title
- The title of the tab to be removed.
removeAllTabs
public void removeAllTabs()
- Removes all tabs.
isJoinedSender
public boolean isJoinedSender(java.lang.String channel)
- Returns, if the given channel is connected as sender.
- Parameters:
channel
- The channel name.
isJoinedReceiver
public boolean isJoinedReceiver(java.lang.String channel)
- Returns, if the given channel is connected as receiver.
- Parameters:
channel
- The channel name.
setTopic
public boolean setTopic(java.lang.String channel,
java.lang.String topic)
- set the topic of a channel
- Parameters:
channel
- the channeltopic
- the new topic- Returns:
- false, if the channel, which topic has to
be changed, could not be found. Otherwise true.
showMessage
public void showMessage(java.lang.String channel,
java.lang.String nick,
java.lang.String message)
- Gets the correct tab and shows message in it.
- Parameters:
channel
- The channel.nick
- The sender nick of this message.message
- The message sent.
showShipMessage
public void showShipMessage(java.lang.String channel,
java.lang.String sender,
java.lang.String victim,
java.lang.String status)
- Gets the correct tab and shows ship-message in it.
- Parameters:
channel
- The channel.sender
- The sender nick of ship-attac.victim
- The victim of ship-attac.status
- The ship-attac status.
showEmotion
public void showEmotion(java.lang.String channel,
java.lang.String from,
java.lang.String target,
java.lang.String emo)
- Gets the correct tab and shows emotion in it.
- Parameters:
channel
- The channel.from
- The sender nick of this emo.target
- The target of the emotion.emo
- The emotion.
playEmoSound
public void playEmoSound(java.lang.String strAudioKey)
- Tries to play an audio file with a certain key
Sound can be enabled with enablePlay() and disabled with disablePlay().
Partially copied from AudioActivator.tryToPlay();
- Parameters:
strAudioKey
- String
specifying the Property
with which the file is searched.
stateChanged
public void stateChanged(javax.swing.event.ChangeEvent event)
- Invoked when a change event occurs.
- Specified by:
stateChanged
in interface javax.swing.event.ChangeListener
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent event)
- Invoked when an action occurs.
- Specified by:
actionPerformed
in interface java.awt.event.ActionListener
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent event)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent event)
- Specified by:
mousePressed
in interface java.awt.event.MouseListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent event)
- Specified by:
mouseEntered
in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent event)
- Specified by:
mouseExited
in interface java.awt.event.MouseListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent event)
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
sendTelephoneRequest
public void sendTelephoneRequest()
- Description copied from class:
SWPFrame
- send a Telephone Request
- Overrides:
sendTelephoneRequest
in class SWPFrame
playSound
private void playSound(java.lang.String sound)
- Plays sound using client controls.
sendFile
private void sendFile()
- Shows picture chooser dialog and sends selected
picture with clientControls.
getTitleOfSelectedTab
private java.lang.String getTitleOfSelectedTab()
- Returns the title of the actually selected tab (= channel).
getMemberListModel
public javax.swing.DefaultListModel getMemberListModel()
- returns the actual selected tab