org.objectweb.tribe.demos.draw
Class WhiteBoard

java.lang.Object
  extended byorg.objectweb.tribe.demos.draw.WhiteBoard
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class WhiteBoard
extends java.lang.Object
implements java.awt.event.ActionListener

Shared whiteboard, each new instance joins the same group. Each instance chooses a random color, mouse moves are broadcast to all group members, which then apply them to their canvas

Version:
1.0
Author:
Bela Ban, Oct 17 2001, Emmanuel Cecchet

Nested Class Summary
private  class WhiteBoard.DrawPanel
          This class defines a DrawPanel used for handling mouse events and display.
 
Field Summary
private  java.awt.Color backgroundColor
           
private  ReliableGroupChannelWithGms channel
           
private  javax.swing.JButton clearButton
           
(package private)  boolean cummulative
           
private  java.awt.Font defaultFont
           
private  java.awt.Color drawColor
           
(package private)  boolean first
           
private static java.lang.String GROUP_NAME
           
private  javax.swing.JButton leaveButton
           
private  javax.swing.JFrame mainFrame
           
private  int memberSize
           
private  WhiteBoard.DrawPanel panel
           
private  java.util.Random random
           
private  javax.swing.JPanel subPanel
           
 
Constructor Summary
WhiteBoard()
          Creates a new WhiteBoard object
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void clearPanel()
          Clear the panel
 void go()
          Join the group, create the frame and listen for events.
static void main(java.lang.String[] args)
          Starts the WhiteBoard application.
 void mainLoop()
          Main loop handling incoming messages.
private  java.awt.Color selectColor()
          Randomly chooses a color.
 void sendClearPanelMsg()
          Send the clear panel order to other members.
(package private)  void setTitle()
          Set the windows title
(package private)  void setTitle(java.lang.String title)
          Set the windows title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUP_NAME

private static final java.lang.String GROUP_NAME
See Also:
Constant Field Values

channel

private ReliableGroupChannelWithGms channel

memberSize

private int memberSize

first

boolean first

cummulative

boolean cummulative

mainFrame

private javax.swing.JFrame mainFrame

subPanel

private javax.swing.JPanel subPanel

panel

private WhiteBoard.DrawPanel panel

clearButton

private javax.swing.JButton clearButton

leaveButton

private javax.swing.JButton leaveButton

random

private java.util.Random random

defaultFont

private final java.awt.Font defaultFont

drawColor

private java.awt.Color drawColor

backgroundColor

private java.awt.Color backgroundColor
Constructor Detail

WhiteBoard

public WhiteBoard()
           throws java.lang.Exception
Creates a new WhiteBoard object

Throws:
java.lang.Exception - if an error occurs
Method Detail

main

public static void main(java.lang.String[] args)
Starts the WhiteBoard application. No parameter are required.

Parameters:
args - not used

selectColor

private java.awt.Color selectColor()
Randomly chooses a color.

Returns:
a new Color

go

public void go()
        throws java.lang.Exception
Join the group, create the frame and listen for events.

Throws:
java.lang.Exception - if an error occurs

setTitle

void setTitle(java.lang.String title)
Set the windows title.

Parameters:
title - title to set.

setTitle

void setTitle()
Set the windows title


mainLoop

public void mainLoop()
Main loop handling incoming messages.


clearPanel

public void clearPanel()
Clear the panel


sendClearPanelMsg

public void sendClearPanelMsg()
Send the clear panel order to other members.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener
See Also:
ActionListener.actionPerformed(java.awt.event.ActionEvent)


Copyright © 2004 - ObjectWeb Consortium - All Rights Reserved.