01: /*
02: * Copyright 2005 Paul Hinds
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.tp23.antinstaller.runtime.exe;
17:
18: import java.awt.BorderLayout;
19: import java.awt.Dimension;
20: import java.awt.HeadlessException;
21:
22: import javax.swing.JEditorPane;
23: import javax.swing.JFrame;
24: import javax.swing.JScrollPane;
25:
26: /**
27: * ReleaseNotes frame for displaying plain text
28: * @author Paul Hinds
29: * @version $Id: ReleaseNotesFrame.java,v 1.3 2006/12/21 00:03:23 teknopaul Exp $
30: */
31: public class ReleaseNotesFrame extends JFrame {
32:
33: private BorderLayout borderLayout1 = new BorderLayout();
34: private JEditorPane contentsEditorPane = new JEditorPane();
35: private JScrollPane hPanelScrollPane = new JScrollPane();
36:
37: public ReleaseNotesFrame(String title) throws HeadlessException {
38: super (title);
39: }
40:
41: public void init(String text) {
42: contentsEditorPane.setMinimumSize(new Dimension(200, 200));
43: contentsEditorPane.setPreferredSize(new Dimension(1000,
44: Integer.MAX_VALUE));
45: contentsEditorPane.setEditable(false);
46: contentsEditorPane.setContentType("text/plain");
47: contentsEditorPane.setCaretPosition(0);
48: contentsEditorPane.setText(text);
49: this .getContentPane().setLayout(borderLayout1);
50: hPanelScrollPane.setMinimumSize(new Dimension(200, 200));
51: hPanelScrollPane.setPreferredSize(new Dimension(
52: Integer.MAX_VALUE, Integer.MAX_VALUE));
53: this .getContentPane()
54: .add(hPanelScrollPane, BorderLayout.CENTER);
55: hPanelScrollPane.getViewport().add(contentsEditorPane);
56: hPanelScrollPane
57: .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
58: this .setSize(new Dimension(500, 500));
59: hPanelScrollPane.setWheelScrollingEnabled(true);
60: this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
61: this.show();
62:
63: }
64:
65: }
|