KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > corbaclient > ItemView


1 package org.enhydra.shark.corbaclient;
2
3 import java.awt.*;
4 import java.awt.event.*;
5
6 import javax.swing.*;
7
8 /**
9  * Used to view some text within a JTextArea.
10  *
11  * @author Sasa Bojanic
12  * @version 1.0
13  */

14 public class ItemView extends ActionPanel {
15
16    private static Dimension spDimension=new Dimension(600,400);
17
18    private String JavaDoc itemName;
19    private String JavaDoc itemValue;
20
21    public ItemView (Window parent,String JavaDoc dialogTitle,String JavaDoc itemName,String JavaDoc itemValue){
22       super();
23       this.itemName=itemName;
24       this.itemValue=itemValue;
25       super.init();
26       super.initDialog(parent,dialogTitle,true,false);
27    }
28
29    protected void createActions () {}
30
31    protected Component createCenterComponent () {
32       JPanel panel = new JPanel();
33
34       panel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
35       panel.setLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));
36
37       JLabel itemL=new JLabel(itemName+":");
38       panel.add(Box.createVerticalStrut(5));
39
40       JTextArea itemV=new JTextArea(itemValue);
41       itemV.setEnabled(false);
42       itemV.setLineWrap(true);
43       itemV.setWrapStyleWord(true);
44
45       JScrollPane jsp=new JScrollPane();
46       jsp.setViewportView(itemV);
47       jsp.setMinimumSize(new Dimension(spDimension));
48       jsp.setPreferredSize(new Dimension(spDimension));
49       jsp.setMaximumSize(new Dimension(spDimension));
50
51       panel.add(jsp);
52
53       return panel;
54    }
55
56    protected void applyChanges () {
57       myDialog.dispose();
58    }
59
60 }
61
62
Popular Tags