當前位置: 首頁>>代碼示例>>Java>>正文


Java LookAndFeel.getName方法代碼示例

本文整理匯總了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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:NbBrowsers.java

示例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();
}
 
開發者ID:evernat,項目名稱:dead-code-detector,代碼行數:23,代碼來源:DeadCodeDetectorUI.java

示例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);
}
   }
 
開發者ID:nomencurator,項目名稱:taxonaut,代碼行數:19,代碼來源:LookAndFeelMenuItem.java

示例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());
}
 
開發者ID:havkarl,項目名稱:gogui2,代碼行數:53,代碼來源:AboutDialog.java


注:本文中的javax.swing.LookAndFeel.getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。