本文整理匯總了Java中javax.swing.UIManager.LookAndFeelInfo.getClassName方法的典型用法代碼示例。如果您正苦於以下問題:Java LookAndFeelInfo.getClassName方法的具體用法?Java LookAndFeelInfo.getClassName怎麽用?Java LookAndFeelInfo.getClassName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.UIManager.LookAndFeelInfo
的用法示例。
在下文中一共展示了LookAndFeelInfo.getClassName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLookAndFeelClassName
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
/**
* Returns the class name of the installed LookAndFeel with a name
* containing the name snippet or null if none found.
*
* @param nameSnippet
* @return
*/
public static String getLookAndFeelClassName(String nameSnippet) {
LookAndFeelInfo[] plafs = UIManager.getInstalledLookAndFeels();
for (LookAndFeelInfo info : plafs) {
if (info.getName().contains(nameSnippet)) {
return info.getClassName();
}
}
return null;
}
示例2: getLafIndex
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
private static int getLafIndex(final String searchLafClassName) {
for (int i = 0; i < lafs.length; i++) {
final LookAndFeelInfo lookAndFeelInfo = lafs[i];
final String lafClassName = lookAndFeelInfo.getClassName();
if (lafClassName.equals(searchLafClassName)) {
return i;
}
}
return -1;
}
示例3: setLookAndFeel
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
private void setLookAndFeel(LookAndFeelInfo info)
{
String lookAndFeel = info.getClassName();
try {
UIManager.setLookAndFeel(lookAndFeel);
} catch (Exception e) {
logger.error("error while setting look and feel '" + lookAndFeel
+ "': " + e.getClass().getSimpleName() + ", message: "
+ e.getMessage());
}
SwingUtilities.updateComponentTreeUI(this);
this.pack();
}
示例4: getLookAndFeelClassName
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
/**
* Returns the class name of the installed LookAndFeel with a name
* containing the name snippet or null if none found.
*
* @param nameSnippet a snippet contained in the Laf's name
* @return the class name if installed, or null
*/
public static String getLookAndFeelClassName(String nameSnippet) {
LookAndFeelInfo[] plafs = UIManager.getInstalledLookAndFeels();
for (LookAndFeelInfo info : plafs) {
if (info.getName().contains(nameSnippet)) {
return info.getClassName();
}
}
return null;
}
示例5: main
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
/**
* Run a conversion or open the application window.
*/
public static void main(String[] args) {
if (args == null || args.length == 0) {
// set the look and feel
// if the Nimbus look and feel is available it is selected
// otherwise the platforms look and feel is selected
try {
String lookAndFeel = null;
for (LookAndFeelInfo info : UIManager
.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
lookAndFeel = info.getClassName();
break;
}
}
if (lookAndFeel == null) {
lookAndFeel = UIManager.getSystemLookAndFeelClassName();
}
UIManager.setLookAndFeel(lookAndFeel);
} catch (Exception e) {
e.printStackTrace();
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
ConversionWindow.getInstance().setVisible(true);
}
});
} else {
// interpret the command line arguments
if (args[0] != null
&& (args[0].equals("-h") || args[0].equals("-help"))) {
printHelp();
}
}
}
示例6: switchLookAndFeelType
import javax.swing.UIManager.LookAndFeelInfo; //導入方法依賴的package包/類
/**
* Switch Look and Feel. Call this method before creating any Swing GUI. Runtime switching may work, but Windows and
* Frames must be recreated.
*/
public static boolean switchLookAndFeelType(LookAndFeelType lafType)
{
// Set Look & Feel
try
{
switch (lafType)
{
case NATIVE:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
break;
case DEFAULT:
case METAL:
javax.swing.UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
break;
case WINDOWS:
javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
break;
case GTK:
javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
break;
case KDEQT:
// org.freeasinspeech.kdelaf.KdeLAF
break;
case PLASTIC_3D:
javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.Plastic3DLookAndFeel");
break;
case PLASTIC_XP:
javax.swing.UIManager.setLookAndFeel("com.jgoodies.looks.plastic.PlasticXPLookAndFeel");
break;
case NIMBUS:
{
if (nimbusLookAndFeelClassName == null)
{
// name of nimbus package may vary
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels())
{
if ("Nimbus".equals(info.getName()))
{
nimbusLookAndFeelClassName = info.getClassName();
break;
}
}
}
javax.swing.UIManager.setLookAndFeel(nimbusLookAndFeelClassName);
break;
}
default:
return false;
// break;
}
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
return true;
}