1 /* 
2  * Copyright 2005 Paul Hinds
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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 */
16package org.tp23.antinstaller.runtime.exe;
17
18import java.awt.BorderLayout;
19import java.awt.Dimension;
20import java.awt.GraphicsConfiguration;
21import java.awt.HeadlessException;
22
23import javax.swing.JEditorPane;
24import javax.swing.JFrame;
25import javax.swing.JScrollPane;
26
27
28/**
29 * ReleaseNotes frame for displaying plain text
30 * @author Paul Hinds
31 * @version $Id: ReleaseNotesFrame.java,v 1.3 2006/12/21 00:03:23 teknopaul Exp $
32 */
33public class ReleaseNotesFrame extends JFrame {
34
35    private BorderLayout borderLayout1 = new BorderLayout();
36    private JEditorPane contentsEditorPane = new JEditorPane();
37    private JScrollPane hPanelScrollPane = new JScrollPane();
38
39    public ReleaseNotesFrame(String title) throws HeadlessException {
40        super(title);
41    }
42
43    public void init(String text){
44        contentsEditorPane.setMinimumSize(new Dimension(200, 200));
45        contentsEditorPane.setPreferredSize(new Dimension(1000, Integer.MAX_VALUE));
46        contentsEditorPane.setEditable(false);
47        contentsEditorPane.setContentType("text/plain");
48        contentsEditorPane.setCaretPosition(0);
49        contentsEditorPane.setText(text);
50        this.getContentPane().setLayout(borderLayout1);
51        hPanelScrollPane.setMinimumSize(new Dimension(200, 200));
52        hPanelScrollPane.setPreferredSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
53        this.getContentPane().add(hPanelScrollPane, BorderLayout.CENTER);
54        hPanelScrollPane.getViewport().add(contentsEditorPane);
55        hPanelScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
56        this.setSize(new Dimension(500,500));
57        hPanelScrollPane.setWheelScrollingEnabled(true);
58        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
59        this.show();
60        
61    }
62
63}
64