File Source: InfoPanel.java
/*
P/P * Method: com.dmdirc.addons.ui_swing.dialogs.about.InfoPanel__static_init
*/
1 /*
2 * Copyright (c) 2006-2009 Chris Smith, Shane Mc Cormack, Gregory Holmes
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
23 package com.dmdirc.addons.ui_swing.dialogs.about;
24
25 import com.dmdirc.Main;
26 import com.dmdirc.ui.core.util.Info;
27 import com.dmdirc.addons.ui_swing.SwingController;
28 import com.dmdirc.addons.ui_swing.UIUtilities;
29
30
31 import java.awt.Font;
32 import javax.swing.JEditorPane;
33 import javax.swing.JPanel;
34 import javax.swing.JScrollPane;
35 import javax.swing.SwingUtilities;
36
37 import javax.swing.UIManager;
38 import javax.swing.text.html.HTMLDocument;
39 import javax.swing.text.html.HTMLEditorKit;
40 import net.miginfocom.layout.LayoutUtil;
41 import net.miginfocom.swing.MigLayout;
42
43 /** Info panel. */
44 public final class InfoPanel extends JPanel {
45
46 /**
47 * A version number for this class. It should be changed whenever the class
48 * structure is changed (or anything else that would prevent serialized
49 * objects being unserialized with the new class).
50 */
51 private static final long serialVersionUID = 1;
52
53 /** Creates a new instance of InfoPanel. */
54 public InfoPanel() {
/*
P/P * Method: void com.dmdirc.addons.ui_swing.dialogs.about.InfoPanel()
*/
55 super();
56
57 this.setOpaque(UIUtilities.getTabbedPaneOpaque());
58 initComponents();
59 }
60
61 /** Initialises the components. */
62 private void initComponents() {
/*
P/P * Method: void initComponents()
*
* Presumptions:
* javax.swing.JEditorPane:getDocument(...)@67 != null
* javax.swing.UIManager:getFont(...)@66 != null
* javax.swing.text.html.HTMLDocument:getStyleSheet(...)@67 != null
*/
63 final JScrollPane scrollPane = new JScrollPane();
64 final JEditorPane infoPane = new JEditorPane();
65 infoPane.setEditorKit(new HTMLEditorKit());
66 final Font font = UIManager.getFont("Label.font");
67 ((HTMLDocument) infoPane.getDocument()).getStyleSheet().addRule("body " +
68 "{ font-family: " + font.getFamily() + "; " + "font-size: " +
69 font.getSize() + "pt; }");
70
71 infoPane.setText("<html>" +
72 "<b>DMDirc version: </b>" + Info.getDMDircVersion() + "<br>" +
73 "<b>Profile directory: </b>" + Main.getConfigDir() + "<br>" +
74 "<b>Java version: </b>" + Info.getJavaVersion() + "<br>" +
75 "<b>OS Version: </b>" + Info.getOSVersion() + "<br>" +
76 "<b>Look and Feel: </b>" + SwingController.getLookAndFeel() + "<br>" +
77 "<b>MiG Layout version: </b>" + LayoutUtil.getVersion() + "<br>" +
78 "</html>");
79 infoPane.setEditable(false);
80 scrollPane.setViewportView(infoPane);
81
/*
P/P * Method: void com.dmdirc.addons.ui_swing.dialogs.about.InfoPanel$1(InfoPanel, JScrollPane)
*
* Postconditions:
* this.val$scrollPane == Param_2
* init'ed(this.val$scrollPane)
*/
82 SwingUtilities.invokeLater(new Runnable() {
83
84 /** {@inheritDoc} */
85 @Override
86 public void run() {
/*
P/P * Method: void run()
*
* Preconditions:
* this.val$scrollPane != null
*
* Presumptions:
* javax.swing.JScrollPane:getVerticalScrollBar(...)@87 != null
*/
87 scrollPane.getVerticalScrollBar().setValue(0);
88 }
89 });
90
91 setLayout(new MigLayout("ins rel, fill"));
92 add(scrollPane, "grow, push, wrap");
93 }
94 }
SofCheck Inspector Build Version : 2.17854
| InfoPanel.java |
2009-Jun-25 01:54:24 |
| InfoPanel.class |
2009-Sep-02 17:04:15 |
| InfoPanel$1.class |
2009-Sep-02 17:04:15 |