KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > gulden > framework > amoda > environment > gui > component > PresentationPanel


1 /*
2  * Project: AMODA - Abstract Modeled Application
3  * Class: de.gulden.framework.amoda.environment.gui.component.PresentationPanel
4  * Version: snapshot-beautyj-1.1
5  *
6  * Date: 2004-09-29
7  *
8  * This is a snapshot version of the AMODA 0.2 development branch,
9  * it is not released as a seperate version.
10  * For AMODA, see http://amoda.berlios.de/.
11  *
12  * This is licensed under the GNU Lesser General Public License (LGPL)
13  * and comes with NO WARRANTY.
14  *
15  * Author: Jens Gulden
16  * Email: amoda@jensgulden.de
17  */

18
19 package de.gulden.framework.amoda.environment.gui.component;
20
21 import java.awt.*;
22 import javax.swing.*;
23
24 /**
25  * Class PresentationPanel.
26  *
27  * @author Jens Gulden
28  * @version snapshot-beautyj-1.1
29  */

30 public class PresentationPanel extends JPanel {
31
32     // ------------------------------------------------------------------------
33
// --- field ---
34
// ------------------------------------------------------------------------
35

36     private JLabel imageLabel;
37
38
39     // ------------------------------------------------------------------------
40
// --- constructors ---
41
// ------------------------------------------------------------------------
42

43     public PresentationPanel() {
44         initComponents();
45     }
46
47     public PresentationPanel(ImageIcon image) {
48         this();
49         if (image!=null) {
50             imageLabel.setIcon(image);
51         }
52     }
53
54     public PresentationPanel(ImageIcon image, JComponent component) {
55         this(image);
56         add(component, java.awt.BorderLayout.CENTER);
57         //this.doLayout()
58
this.validate();
59     }
60
61     public PresentationPanel(ImageIcon image, String JavaDoc html) {
62         this(image);
63         JEditorPane editorPane=new JEditorPane();
64         editorPane.setEditable(false);
65         editorPane.setContentType("text/html");
66         editorPane.setText(html);
67         JScrollPane scrollPane=new JScrollPane();
68         scrollPane.setViewportView(editorPane);
69         add(scrollPane, java.awt.BorderLayout.CENTER);
70         editorPane.setCaretPosition(0);
71         this.validate();
72
73     }
74
75
76     // ------------------------------------------------------------------------
77
// --- method ---
78
// ------------------------------------------------------------------------
79

80     private void initComponents() {
81         //GEN-BEGIN:initComponents
82
imageLabel = new javax.swing.JLabel JavaDoc();
83
84                 setLayout(new java.awt.BorderLayout JavaDoc());
85
86                 add(imageLabel, java.awt.BorderLayout.WEST);
87     }
88
89 } // end PresentationPanel
90
Popular Tags