本文整理汇总了Java中javax.swing.LookAndFeel.getName方法的典型用法代码示例。如果您正苦于以下问题:Java LookAndFeel.getName方法的具体用法?Java LookAndFeel.getName怎么用?Java LookAndFeel.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.LookAndFeel
的用法示例。
在下文中一共展示了LookAndFeel.getName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyNbSkin
import javax.swing.LookAndFeel; //导入方法依赖的package包/类
static void applyNbSkin() {
LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
String name = lookAndFeel.getName();
switch (name) {
case "Mac OS X":
name = "mac";
break;
case "Metal":
name = "metal";
break;
case "GTK look and feel":
name = "gtk";
break;
case "Nimbus":
name = "nimbus";
break;
case "Windows":
name = "win";
break;
case "Darcula":
name = "darcula";
break;
}
final String resource = "nbres:/org/netbeans/modules/htmlui/css/wizard-" + name + ".css";
loadCss(resource);
}
示例2: paintComponent
import javax.swing.LookAndFeel; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected void paintComponent(Graphics graphics) {
// Surchargée pour dessiner le fond avec gradient
final LookAndFeel lookAndFeel = UIManager.getLookAndFeel();
final String lafName = lookAndFeel != null ? lookAndFeel.getName() : null;
if ("Substance".equals(lafName)) {
super.paintComponent(graphics); // le gradient fonctionne mal en substance ?
}
final Color startColor = getBackground();
final Color endColor = GRADIENT_COLOR;
final int w = getWidth();
final int h = getHeight();
// l'image du gradient pourrait être mise en cache, mais ce n'est pas grave
final Paint paint = new GradientPaint(0, h / 2f, startColor, 1, h, endColor, false);
final Graphics2D graphix = (Graphics2D) graphics.create();
graphix.setPaint(paint);
graphix.fillRect(0, 0, w, h);
graphix.dispose();
}
示例3: updateLookAndFeels
import javax.swing.LookAndFeel; //导入方法依赖的package包/类
protected void updateLookAndFeels()
{
clearButtons();
LookAndFeel currentLookAndFeel = UIManager.getLookAndFeel();
String current = currentLookAndFeel == null ? "" : currentLookAndFeel.getName();
LookAndFeelInfo[] infoArray = UIManager.getInstalledLookAndFeels();
if (infoArray == null || infoArray.length == 0) {
return;
}
for (LookAndFeelInfo info : infoArray) {
JRadioButtonMenuItem button = new JRadioButtonMenuItem(info.getName());
button.setActionCommand(info.getClassName());
if (info.getName().equals(current))
button.setSelected(true);
addButton(button);
}
}
示例4: createPanelJava
import javax.swing.LookAndFeel; //导入方法依赖的package包/类
private JPanel createPanelJava()
{
StringBuilder buffer = new StringBuilder(256);
String name = Platform.getJavaRuntimeName();
buffer.append("<p align=\"center\"><img src=\""
+ getImage("java.png") + "\"></p>");
if (name == null)
{
buffer.append("<p align=\"center\">");
XmlUtil.escapeText(i18n("MSG_ABOUT_UNKNOWN_JAVA"));
buffer.append("</p>");
}
else
{
buffer.append("<p align=\"center\"><b>");
buffer.append(name);
buffer.append("</b></p>");
String version = System.getProperty("java.version");
if (version != null)
{
buffer.append("<p align=\"center\">");
buffer.append(XmlUtil.escapeText(format(i18n("MSG_ABOUT_VERSION"), version)));
buffer.append("</p>");
}
buffer.append("<p align=\"center\">");
String vendor = System.getProperty("java.vm.vendor");
if (vendor != null)
buffer.append(vendor);
buffer.append("<br>");
}
Runtime runtime = Runtime.getRuntime();
long max = runtime.maxMemory();
String maxString =
(max == Long.MAX_VALUE ? i18n("LB_ABOUT_MEMORYLIMIT_NONE")
: getMemorySizeString(max));
buffer.append(XmlUtil.escapeText(i18n("LB_ABOUT_JAVA_MEMLIMIT")));
buffer.append(' ');
buffer.append(XmlUtil.escapeText(maxString));
buffer.append("<br>");
buffer.append(XmlUtil.escapeText(format(i18n("LB_ABOUT_JAVA_MEMLIMIT_1"),
getMemorySizeString(runtime.totalMemory()),
getMemorySizeString(runtime.freeMemory()))));
String lafName = i18n("LB_ABOUT_LAF_UNKNOWN");
LookAndFeel laf = UIManager.getLookAndFeel();
if (laf != null)
lafName = laf.getName();
buffer.append("<br>");
buffer.append(XmlUtil.escapeText(i18n("LB_ABOUT_LAF")));
buffer.append(' ');
buffer.append(lafName);
return createPanel(buffer.toString());
}