public void go() throws Exception { if (!no_channel && !use_state) { channel.connect(groupname); } mainFrame = new JFrame(); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new DrawPanel(use_state); panel.setBackground(background_color); sub_panel = new JPanel(); mainFrame.getContentPane().add("Center", panel); clear_button = new JButton("Clear"); clear_button.setFont(default_font); clear_button.addActionListener(this); leave_button = new JButton("Leave"); leave_button.setFont(default_font); leave_button.addActionListener(this); sub_panel.add("South", clear_button); sub_panel.add("South", leave_button); mainFrame.getContentPane().add("South", sub_panel); mainFrame.setBackground(background_color); clear_button.setForeground(Color.blue); leave_button.setForeground(Color.blue); mainFrame.pack(); mainFrame.setLocation(15, 25); mainFrame.setBounds(new Rectangle(250, 250)); if (!no_channel && use_state) { channel.connect(groupname, null, null, state_timeout); } mainFrame.setVisible(true); setTitle(); }
public void start(String props) throws Exception { channel = new JChannel(props); channel.setReceiver(this); channel.connect("ViewDemo"); while (true) { Util.sleep(10000); } }