1 44 45 package org.jfree.ui.about; 46 47 import java.awt.BorderLayout ; 48 import java.awt.Color ; 49 import java.awt.Font ; 50 import java.awt.GridLayout ; 51 import java.awt.Image ; 52 53 import javax.swing.BorderFactory ; 54 import javax.swing.JLabel ; 55 import javax.swing.JPanel ; 56 import javax.swing.SwingConstants ; 57 58 import org.jfree.ui.RefineryUtilities; 59 60 65 public class AboutPanel extends JPanel { 66 67 75 public AboutPanel(final String application, 76 final String version, 77 final String copyright, 78 final String info) { 79 80 this(application, version, copyright, info, null); 81 82 } 83 84 93 public AboutPanel(final String application, 94 final String version, 95 final String copyright, 96 final String info, 97 final Image logo) { 98 99 setLayout(new BorderLayout ()); 100 101 final JPanel textPanel = new JPanel (new GridLayout (4, 1, 0, 4)); 102 103 final JPanel appPanel = new JPanel (); 104 final Font f1 = new Font ("Dialog", Font.BOLD, 14); 105 final JLabel appLabel = RefineryUtilities.createJLabel(application, f1, Color.black); 106 appLabel.setHorizontalTextPosition(SwingConstants.CENTER); 107 appPanel.add(appLabel); 108 109 final JPanel verPanel = new JPanel (); 110 final Font f2 = new Font ("Dialog", Font.PLAIN, 12); 111 final JLabel verLabel = RefineryUtilities.createJLabel(version, f2, Color.black); 112 verLabel.setHorizontalTextPosition(SwingConstants.CENTER); 113 verPanel.add(verLabel); 114 115 final JPanel copyrightPanel = new JPanel (); 116 final JLabel copyrightLabel = RefineryUtilities.createJLabel(copyright, f2, Color.black); 117 copyrightLabel.setHorizontalTextPosition(SwingConstants.CENTER); 118 copyrightPanel.add(copyrightLabel); 119 120 final JPanel infoPanel = new JPanel (); 121 final JLabel infoLabel = RefineryUtilities.createJLabel(info, f2, Color.black); 122 infoLabel.setHorizontalTextPosition(SwingConstants.CENTER); 123 infoPanel.add(infoLabel); 124 125 textPanel.add(appPanel); 126 textPanel.add(verPanel); 127 textPanel.add(copyrightPanel); 128 textPanel.add(infoPanel); 129 130 add(textPanel); 131 132 if (logo != null) { 133 final JPanel imagePanel = new JPanel (new BorderLayout ()); 134 imagePanel.add(new javax.swing.JLabel (new javax.swing.ImageIcon (logo))); 135 imagePanel.setBorder(BorderFactory.createLineBorder(Color.black)); 136 final JPanel imageContainer = new JPanel (new BorderLayout ()); 137 imageContainer.add(imagePanel, BorderLayout.NORTH); 138 add(imageContainer, BorderLayout.WEST); 139 } 140 141 } 142 143 } 144 | Popular Tags |