KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lucane > applications > reminder > ReminderFrame


1 /*
2  * Lucane - a collaborative platform
3  * Copyright (C) 2004 Vincent Fiack <vfiack@mail15.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

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