001: package com.nexes.test;
002:
003: import java.awt.*;
004: import java.net.*;
005: import javax.swing.*;
006: import javax.swing.border.*;
007:
008: public class TestPanel1 extends JPanel {
009:
010: private JLabel blankSpace;
011: private JLabel jLabel1;
012: private JLabel jLabel2;
013: private JLabel jLabel3;
014: private JLabel jLabel4;
015: private JLabel jLabel5;
016: private JLabel jLabel6;
017: private JLabel jLabel7;
018: private JLabel jLabel8;
019: private JLabel jLabel9;
020:
021: private JLabel welcomeTitle;
022: private JPanel contentPanel;
023:
024: private JLabel iconLabel;
025: private ImageIcon icon;
026:
027: public TestPanel1() {
028:
029: iconLabel = new JLabel();
030: contentPanel = getContentPanel();
031: contentPanel.setBorder(new EmptyBorder(new Insets(10, 10, 10,
032: 10)));
033:
034: icon = getImageIcon();
035:
036: setLayout(new java.awt.BorderLayout());
037:
038: if (icon != null)
039: iconLabel.setIcon(icon);
040:
041: iconLabel.setBorder(new EtchedBorder(EtchedBorder.RAISED));
042:
043: add(iconLabel, BorderLayout.WEST);
044:
045: JPanel secondaryPanel = new JPanel();
046: secondaryPanel.add(contentPanel, BorderLayout.NORTH);
047: add(secondaryPanel, BorderLayout.CENTER);
048: }
049:
050: private JPanel getContentPanel() {
051:
052: JPanel contentPanel1 = new JPanel();
053: JPanel jPanel1 = new JPanel();
054:
055: welcomeTitle = new JLabel();
056: blankSpace = new JLabel();
057: jLabel1 = new JLabel();
058: jLabel2 = new JLabel();
059: jLabel3 = new JLabel();
060: jLabel4 = new JLabel();
061: jLabel5 = new JLabel();
062: jLabel7 = new JLabel();
063: jLabel6 = new JLabel();
064: jLabel8 = new JLabel();
065: jLabel9 = new JLabel();
066:
067: contentPanel1.setLayout(new java.awt.BorderLayout());
068:
069: welcomeTitle.setFont(new java.awt.Font("MS Sans Serif",
070: Font.BOLD, 11));
071: welcomeTitle.setText("Welcome to the Wizard Dialog!");
072: contentPanel1.add(welcomeTitle, java.awt.BorderLayout.NORTH);
073:
074: jPanel1.setLayout(new java.awt.GridLayout(0, 1));
075:
076: jPanel1.add(blankSpace);
077: jLabel1
078: .setText("This is an example of a wizard dialog, which allows a user to traverse");
079: jPanel1.add(jLabel1);
080: jLabel2
081: .setText("a number of panels (while entering data) until the wizard has enough ");
082: jPanel1.add(jLabel2);
083: jLabel3
084: .setText("information to perform whatever end function is necessary. Note that");
085: jPanel1.add(jLabel3);
086: jLabel4
087: .setText("panels are not necessarily ordered in a linear fashion, but instead in");
088: jPanel1.add(jLabel4);
089: jLabel5
090: .setText("a tree-like manner (e.g., there may be more than one panel with a");
091: jPanel1.add(jLabel5);
092: jLabel7
093: .setText("'Finish' button, and it depends on the user's entries as to how they ");
094: jPanel1.add(jLabel7);
095: jLabel6
096: .setText("traverse the path). That's not the case with this example, however.");
097: jPanel1.add(jLabel6);
098: jPanel1.add(jLabel8);
099: jLabel9.setText("Press the 'Next' button to continue....");
100: jPanel1.add(jLabel9);
101:
102: contentPanel1.add(jPanel1, java.awt.BorderLayout.CENTER);
103:
104: return contentPanel1;
105:
106: }
107:
108: private ImageIcon getImageIcon() {
109: return new ImageIcon((URL) getResource("clouds.jpg"));
110: }
111:
112: private Object getResource(String key) {
113:
114: URL url = null;
115: String name = key;
116:
117: if (name != null) {
118:
119: try {
120: Class c = Class.forName("com.nexes.test.Main");
121: url = c.getResource(name);
122: } catch (ClassNotFoundException cnfe) {
123: System.err.println("Unable to find Main class");
124: }
125: return url;
126: } else
127: return null;
128:
129: }
130:
131: }
|