| 1 19 package org.lucane.applications.audioconf.gui; 20 21 import java.awt.BorderLayout ; 22 import java.awt.event.*; 23 24 import javax.swing.*; 25 26 import org.lucane.applications.audioconf.AudioConf; 27 import org.lucane.client.Client; 28 import org.lucane.client.widgets.ManagedWindow; 29 30 public class Controller 31 implements ActionListener, WindowListener 32 { 33 private AudioConf plugin; 34 private ManagedWindow controller; 35 36 public Controller(AudioConf plugin) 37 { 38 this.plugin = plugin; 39 } 40 41 public void showController() 42 { 43 controller = new ManagedWindow(plugin, plugin.getTitle()); 44 45 JButton stop = new JButton(plugin.tr("btn.stop")); 46 stop.addActionListener(this); 47 String msg = plugin.tr("msg.nowStreamingWith"); 48 msg = msg.replaceAll("%1", plugin.getFriendName()); 49 JLabel label = new JLabel(msg); 50 51 try { 52 label.setIcon(plugin.getImageIcon(plugin.getIcon())); 53 stop.setIcon(Client.getImageIcon("cancel.png")); 54 } catch(Exception e) { 55 } 57 58 controller.getContentPane().setLayout(new BorderLayout ()); 59 controller.getContentPane().add(label, BorderLayout.CENTER); 60 controller.getContentPane().add(stop, BorderLayout.EAST); 61 62 controller.addWindowListener(this); 63 controller.show(); 64 } 65 66 public void hideController() 67 { 68 controller.dispose(); 69 } 70 71 public void actionPerformed(ActionEvent ae) 72 { 73 plugin.stopAndExit(); 74 } 75 76 public void windowIconified(WindowEvent we) {} 77 public void windowDeiconified(WindowEvent we) {} 78 public void windowActivated(WindowEvent we) {} 79 public void windowDeactivated(WindowEvent we) {} 80 public void windowOpened(WindowEvent we) {} 81 public void windowClosing(WindowEvent we) {} 82 public void windowClosed(WindowEvent we) 83 { 84 plugin.stopAndExit(); 85 } 86 } | Popular Tags |