| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
package docrobot; |
| 20 |
|
| 21 |
import java.awt.BorderLayout; |
| 22 |
import java.net.URL; |
| 23 |
|
| 24 |
import javax.swing.*; |
| 25 |
|
| 26 |
import org.jdesktop.swingx.JXHeader; |
| 27 |
import org.pushingpixels.substance.api.DecorationAreaType; |
| 28 |
import org.pushingpixels.substance.api.SubstanceLookAndFeel; |
| 29 |
import org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel; |
| 30 |
import org.pushingpixels.substance.internal.utils.SubstanceImageCreator; |
| 31 |
|
| 32 |
public class HeaderFrame extends JFrame { |
| 33 |
public HeaderFrame() { |
| 34 |
super("JXHeader example"); |
| 35 |
|
| 36 |
this.setLayout(new BorderLayout()); |
| 37 |
ClassLoader cl = Thread.currentThread().getContextClassLoader(); |
| 38 |
URL iconUrl = cl.getResource("docrobot/applications-internet.png"); |
| 39 |
Icon icon = new ImageIcon(iconUrl); |
| 40 |
icon = new ImageIcon(SubstanceImageCreator.getColorSchemeImage(null, |
| 41 |
icon, SubstanceLookAndFeel.getCurrentSkin(this.getRootPane()) |
| 42 |
.getActiveColorScheme( |
| 43 |
DecorationAreaType.PRIMARY_TITLE_PANE), 0.0f)); |
| 44 |
String title = "LGPL license"; |
| 45 |
String description = "This library is free software; you can redistribute it and/or" |
| 46 |
+ " modify it under the terms of the GNU Lesser General Public" |
| 47 |
+ " License."; |
| 48 |
|
| 49 |
final JXHeader header = new JXHeader(title, description, icon); |
| 50 |
this.add(header, BorderLayout.NORTH); |
| 51 |
|
| 52 |
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
| 53 |
this.setSize(440, 300); |
| 54 |
this.setLocationRelativeTo(null); |
| 55 |
} |
| 56 |
|
| 57 |
public static void main(String[] args) throws Exception { |
| 58 |
JFrame.setDefaultLookAndFeelDecorated(true); |
| 59 |
UIManager.setLookAndFeel(new SubstanceBusinessBlackSteelLookAndFeel()); |
| 60 |
|
| 61 |
SwingUtilities.invokeLater(new Runnable() { |
| 62 |
public void run() { |
| 63 |
new HeaderFrame().setVisible(true); |
| 64 |
} |
| 65 |
}); |
| 66 |
} |
| 67 |
} |