KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lucane > applications > slideshow > gui > PreloadDialog


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 package org.lucane.applications.slideshow.gui;
20
21 import java.awt.BorderLayout JavaDoc;
22 import java.awt.Color JavaDoc;
23 import java.awt.Dimension JavaDoc;
24 import java.awt.Toolkit JavaDoc;
25
26 import javax.swing.BorderFactory JavaDoc;
27 import javax.swing.ImageIcon JavaDoc;
28 import javax.swing.JDialog JavaDoc;
29 import javax.swing.JLabel JavaDoc;
30 import javax.swing.JProgressBar JavaDoc;
31
32 import org.lucane.client.Plugin;
33
34 public class PreloadDialog extends JDialog JavaDoc
35 {
36     private JProgressBar JavaDoc bar;
37     
38     public PreloadDialog(Plugin plugin)
39     {
40         ImageIcon JavaDoc ii = plugin.getImageIcon(plugin.getIcon());
41         
42         JLabel JavaDoc message = new JLabel JavaDoc(plugin.tr("msg.loadingImages"));
43         message.setOpaque(true);
44         message.setBackground(Color.WHITE);
45         message.setHorizontalAlignment(JLabel.CENTER);
46         message.setIcon(ii);
47         message.setIconTextGap(20);
48                 
49                 
50         bar = new JProgressBar JavaDoc();
51         bar.setStringPainted(true);
52         bar.setString("");
53         bar.setBorder(BorderFactory.createLineBorder(Color.WHITE, 5));
54
55         getContentPane().setLayout(new BorderLayout JavaDoc());
56         getContentPane().add(message, BorderLayout.CENTER);
57         getContentPane().add(bar, BorderLayout.SOUTH);
58         
59         setSize(400, 150);
60         this.rootPane.setBorder(BorderFactory.createLineBorder(Color.BLACK, 1));
61         
62         Dimension JavaDoc d = Toolkit.getDefaultToolkit().getScreenSize();
63         setLocation((d.width-getWidth())/2, (d.height-getHeight())/2);
64         this.setUndecorated(true);
65     }
66     
67     public void setMaxValue(int max)
68     {
69         bar.setMaximum(max);
70     }
71     
72     public void setValue(int value, String JavaDoc message)
73     {
74         bar.setValue(value);
75         bar.setString(message);
76     }
77 }
Popular Tags