本文整理汇总了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;
}