Exemplo n.º 1
0
 /** Leave Group and close JWhiteBoard */
 public void stop() {
   if (!noChannel) {
     try {
       channel.close();
     } catch (Exception ex) {
       System.err.println(ex);
     }
   }
   mainFrame.setVisible(false);
   mainFrame.dispose();
 }
Exemplo n.º 2
0
 /**
  * Set Frame's title
  *
  * @param title : frame's title
  */
 void setTitle(String title) {
   String tmp = "";
   if (noChannel) {
     mainFrame.setTitle("JWhiteBoard");
     return;
   }
   if (title != null) {
     mainFrame.setTitle(title);
   } else {
     if (channel.getAddress() != null) tmp += channel.getAddress();
     tmp += " (" + memberSize + ")";
     mainFrame.setTitle(tmp);
   }
 }
Exemplo n.º 3
0
  /**
   * Init JWhiteBoard interface
   *
   * @throws Exception
   */
  public void go() throws Exception {
    if (!noChannel && !useState) channel.connect(groupName);
    mainFrame = new JFrame();
    mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    drawPanel = new DrawPanel(useState);
    drawPanel.setBackground(backgroundColor);
    subPanel = new JPanel();
    mainFrame.getContentPane().add("Center", drawPanel);
    clearButton = new JButton("Clean");
    clearButton.setFont(defaultFont);
    clearButton.addActionListener(this);
    leaveButton = new JButton("Exit");
    leaveButton.setFont(defaultFont);
    leaveButton.addActionListener(this);
    subPanel.add("South", clearButton);
    subPanel.add("South", leaveButton);
    mainFrame.getContentPane().add("South", subPanel);
    mainFrame.setBackground(backgroundColor);
    clearButton.setForeground(Color.blue);
    leaveButton.setForeground(Color.blue);
    mainFrame.pack();
    mainFrame.setLocation(15, 25);
    mainFrame.setBounds(new Rectangle(250, 250));

    if (!noChannel && useState) {
      channel.connect(groupName, null, stateTimeout);
    }
    mainFrame.setVisible(true);
  }