test.QuaquaButtonLogo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quaqua Show documentation
Show all versions of quaqua Show documentation
A Mavenisation of the Quaqua Mac OSX Swing Look and Feel (Java library)
Quaqua Look and Feel (C) 2003-2017, Werner Randelshofer.
Mavenisation by Matt Gumbley, DevZendo.org - for problems with
Mavenisation, see Matt; for issues with Quaqua, see the Quaqua home page.
For full license details, see http://randelshofer.ch/quaqua/license.html
The newest version!
/*
* @(#)QuaquaButtonLogo.java 1.0 2013-05-15
*
* Copyright (c) 2013 Werner Randelshofer, Switzerland.
* All rights reserved.
*
* You may not use, copy or modify this file, except in compliance with the
* license agreement you entered into with Werner Randelshofer.
* For details see accompanying license terms.
*/
package test;
import ch.randelshofer.quaqua.QuaquaManager;
import java.security.AccessControlException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
/**
* QuaquaButtonLogo.
*
* @author Werner Randelshofer
* @version 1.0 2013-05-15 Created.
*/
public class QuaquaButtonLogo extends javax.swing.JFrame {
/** Creates new form QuaquaButtonLogo */
public QuaquaButtonLogo() {
initComponents();
getRootPane().setDefaultButton(jButton1);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// //GEN-BEGIN:initComponents
private void initComponents() {
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Quaqua");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(160, Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(148, 148, 148))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(126, 126, 126)
.addComponent(jButton1)
.addContainerGap(145, Short.MAX_VALUE))
);
pack();
}// //GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
final long start = System.currentTimeMillis();
final java.util.List argList = Arrays.asList(args);
// Explicitly turn on font antialiasing.
try {
System.setProperty("swing.aatext", "true");
} catch (AccessControlException e) {
// can't do anything about this
}
// Use screen menu bar, if not switched off explicitly
try {
if (System.getProperty("apple.laf.useScreenMenuBar") == null
&& System.getProperty("com.apple.macos.useScreenMenuBar") == null) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
System.setProperty("com.apple.macos.useScreenMenuBar", "true");
}
} catch (AccessControlException e) {
// can't do anything about this
}
// Configure Quaqua system properties
System.setProperty("Quaqua.design", "jaguar");
// Add Quaqua to the lafs
ArrayList infos = new ArrayList(Arrays.asList(UIManager.getInstalledLookAndFeels()));
infos.add(new UIManager.LookAndFeelInfo("Quaqua", QuaquaManager.getLookAndFeelClassName()));
UIManager.setInstalledLookAndFeels(infos.toArray(new UIManager.LookAndFeelInfo[infos.size()]));
// Turn on look and feel decoration when not running on Mac OS X or Darwin.
// This will still not look pretty, because we haven't got cast shadows
// for the frame on other operating systems.
boolean useDefaultLookAndFeelDecoration =
!System.getProperty("os.name").toLowerCase().startsWith("mac")
&& !System.getProperty("os.name").toLowerCase().startsWith("darwin");
int index = argList.indexOf("-decoration");
if (index != -1 && index < argList.size() - 1) {
useDefaultLookAndFeelDecoration = argList.get(index + 1).equals("true");
}
if (useDefaultLookAndFeelDecoration) {
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
}
// Launch the test program
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
long edtEnd = System.currentTimeMillis();
int index;
index = argList.indexOf("-include");
if (index != -1 && index < argList.size() - 1) {
HashSet includes = new HashSet();
includes.addAll(Arrays.asList(((String) argList.get(index + 1)).split(",")));
QuaquaManager.setIncludedUIs(includes);
}
index = argList.indexOf("-exclude");
if (index != -1 && index < argList.size() - 1) {
HashSet excludes = new HashSet();
excludes.addAll(Arrays.asList(((String) argList.get(index + 1)).split(",")));
QuaquaManager.setExcludedUIs(excludes);
}
index = argList.indexOf("-laf");
String lafName;
if (index != -1 && index < argList.size() - 1) {
lafName = (String) argList.get(index + 1);
} else {
lafName = QuaquaManager.getLookAndFeelClassName();
}
long lafCreate = 0;
if (!lafName.equals("default")) {
if (lafName.equals("system")) {
lafName = UIManager.getSystemLookAndFeelClassName();
} else if (lafName.equals("crossplatform")) {
lafName = UIManager.getCrossPlatformLookAndFeelClassName();
}
try {
//UIManager.setLookAndFeel(lafName);
System.out.println(" CREATING LAF " + lafName);
LookAndFeel laf = (LookAndFeel) Class.forName(lafName).newInstance();
lafCreate = System.currentTimeMillis();
System.out.println(" LAF CREATED ");
System.out.println(" SETTING LAF ");
UIManager.setLookAndFeel(laf);
System.out.println(" LAF SET ");
} catch (Exception e) {
System.err.println("Error setting " + lafName + " in UIManager.");
e.printStackTrace();
// can't do anything about this
}
}
long lafEnd = System.currentTimeMillis();
new QuaquaButtonLogo().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
// End of variables declaration//GEN-END:variables
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy