1 19 20 package org.lucane.applications.reminder; 21 22 import javax.swing.*; 23 24 import org.lucane.client.*; 25 import org.lucane.client.widgets.HTMLEditor; 26 import org.lucane.client.widgets.ManagedWindow; 27 28 import java.awt.event.*; 29 import java.awt.*; 30 31 public class ReminderFrame extends ManagedWindow 32 implements ActionListener 33 { 34 private ReminderInfos infos; 35 private JButton btnPlugin; 36 private JButton btnClose; 37 38 public ReminderFrame(ReminderPlugin plugin, ReminderInfos infos) 39 { 40 super(plugin, plugin.tr("reminder") + " " + infos.getTitle()); 41 this.infos = infos; 42 getContentPane().setLayout(new BorderLayout()); 43 44 HTMLEditor content = new HTMLEditor(); 45 content.setText(infos.getMessage()); 46 content.setEditable(false); 47 content.setToolbarVisible(false); 48 getContentPane().add(content, BorderLayout.CENTER); 49 50 Plugin p = PluginManager.getInstance().getPlugin(infos.getPlugin()); 51 btnPlugin = new JButton(p.getTitle(), p.getImageIcon(p.getIcon())); 52 btnClose = new JButton(plugin.tr("close"), Client.getImageIcon("cancel.png")); 53 btnPlugin.addActionListener(this); 54 btnClose.addActionListener(this); 55 56 JPanel container = new JPanel(new BorderLayout()); 57 JPanel buttons = new JPanel(new GridLayout(2, 1)); 58 buttons.add(btnPlugin); 59 buttons.add(btnClose); 60 container.add(buttons, BorderLayout.NORTH); 61 getContentPane().add(container, BorderLayout.EAST); 62 setPreferredSize(new Dimension(450, 200)); 63 } 64 65 public void actionPerformed(ActionEvent ae) 66 { 67 if(ae.getSource() == btnPlugin) 68 PluginManager.getInstance().run(infos.getPlugin(), null); 69 dispose(); 70 } 71 } | Popular Tags |