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


Java UIDefaults.get方法代碼示例

本文整理匯總了Java中javax.swing.UIDefaults.get方法的典型用法代碼示例。如果您正苦於以下問題:Java UIDefaults.get方法的具體用法?Java UIDefaults.get怎麽用?Java UIDefaults.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.UIDefaults的用法示例。


在下文中一共展示了UIDefaults.get方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: installKeyboardActions

import javax.swing.UIDefaults; //導入方法依賴的package包/類
@Override
protected void installKeyboardActions() {
    super.installKeyboardActions();

    JTextComponent comp = getComponent();

    UIDefaults uidefaults = XToolkit.getUIDefaults();

    String prefix = getPropertyPrefix();

    InputMap map = (InputMap)uidefaults.get(prefix + ".focusInputMap");

    if (map != null) {
        SwingUtilities.replaceUIInputMap(comp, JComponent.WHEN_FOCUSED,
                                         map);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:18,代碼來源:XTextAreaPeer.java

示例2: main

import javax.swing.UIDefaults; //導入方法依賴的package包/類
public static void main( String[] args ) {
    // Get the currently installed look and feel
    UIDefaults uidefs = UIManager.getLookAndFeelDefaults();

    // Retrieve the keys. We can't use an iterator since the map
    // may be modified during the iteration. So retrieve all keys at once.
    String[] keySet = (String[]) uidefs.keySet().toArray( new String[0] );

    // Sort the keys.
    List keys = Arrays.asList( keySet );
    Collections.sort( keys );

    // Print out each key/value pair.
    for ( int i = 0; i < keys.size(); i++ ) {
        Object key = keys.get( i );
        Object value = uidefs.get( key );
        System.out.println( key + ": " + value );
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:20,代碼來源:PrintLookAndFeelDefaults.java

示例3: printUIDefaults

import javax.swing.UIDefaults; //導入方法依賴的package包/類
/**
 * Debugging routine that prints the UIDefault database key/value pairs.
 * The output is sorted lexigraphically by key.
 */
public static void printUIDefaults() {

    // Get the currently installed look and feel
    UIDefaults uidefs = UIManager.getLookAndFeelDefaults();

    // Retrieve the keys. We can't use an iterator since the map
    // may be modified during the iteration. So retrieve all keys at once. 
    String[] keySet = (String[]) uidefs.keySet().toArray( new String[0] );

    // Sort the keys.
    List keys = Arrays.asList( keySet );
    Collections.sort( keys );

    // Print out each key/value pair.
    for ( int i = 0; i < keys.size(); i++ ) {
        Object key = keys.get( i );
        Object value = uidefs.get( key );
        System.out.println( key + ": " + value );
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:25,代碼來源:PhetLookAndFeel.java

示例4: initSwingConstants

import javax.swing.UIDefaults; //導入方法依賴的package包/類
/** Initialized fields used in Swing Palette. */
private static void initSwingConstants() {
    if (swingColorNames != null)
        return;

    UIDefaults def = UIManager.getDefaults ();
    Enumeration e = def.keys ();
    
    java.util.TreeSet<String> names = new java.util.TreeSet<String>();
    
    while (e.hasMoreElements ()) {
        Object k = e.nextElement ();
        if (! (k instanceof String))
            continue;
        Object v = def.get (k);
        if (! (v instanceof Color))
            continue;
        names.add((String)k);
    }
    
    swingColorNames = new String [names.size ()];
    names.toArray(swingColorNames);
    swingColors = new Color [swingColorNames.length];
    
    int i, k = swingColorNames.length;
    for (i = 0; i < k; i++)
        swingColors [i] = (Color) def.get (swingColorNames [i]);
        }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:ColorEditor.java

示例5: getDefaults

import javax.swing.UIDefaults; //導入方法依賴的package包/類
@Override
public UIDefaults getDefaults() {
    final UIDefaults del = super.getDefaults();
    return new UIDefaults() {
        @Override
        public Object get(Object key) {
            if( "SeparatorUI".equals( key ) )
                assertAWT();
            return del.get(key);
        }
    };
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:MenuBarSeparatorInAWTTest.java

示例6: installFont

import javax.swing.UIDefaults; //導入方法依賴的package包/類
/**
 * Set the default font in all UI elements.
 *
 * @param defaultFont A {@code Font} to use by default.
 */
public static void installFont(Font defaultFont) {
    UIDefaults u = UIManager.getDefaults();
    java.util.Enumeration<Object> keys = u.keys();
    while (keys.hasMoreElements()) {
        Object key = keys.nextElement();
        if (u.get(key) instanceof javax.swing.plaf.FontUIResource) {
            u.put(key, defaultFont);
        }
    }
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:16,代碼來源:FreeColLookAndFeel.java

示例7: createValue

import javax.swing.UIDefaults; //導入方法依賴的package包/類
@Override
public Object createValue(UIDefaults table) {
    try {
        Class c;
        Object cl;
        // See if we should use a separate ClassLoader
        if (table == null || !((cl = table.get("ClassLoader"))
                               instanceof ClassLoader)) {
            cl = Thread.currentThread().
                        getContextClassLoader();
            if (cl == null) {
                // Fallback to the system class loader.
                cl = ClassLoader.getSystemClassLoader();
            }
        }

        c = Class.forName(className, true, (ClassLoader)cl);
        Constructor constructor = c.getConstructor(
                AbstractRegionPainter.PaintContext.class, int.class);
        if (constructor == null) {
            throw new NullPointerException(
                    "Failed to find the constructor for the class: " +
                    className);
        }
        return constructor.newInstance(ctx, which);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:31,代碼來源:NimbusDefaults.java

示例8: markOddRows

import javax.swing.UIDefaults; //導入方法依賴的package包/類
/**
 * Alternates the rows' color in the graphic table.
 */
private void markOddRows() {
	UIDefaults defaults = UIManager.getLookAndFeelDefaults();
	if (defaults.get("Table.alternateRowColor") == null) {
	    defaults.put("Table.alternateRowColor", new Color(ODD_ROW_R, ODD_ROW_G, ODD_ROW_B));
	}
}
 
開發者ID:tteguayco,項目名稱:JITRAX,代碼行數:10,代碼來源:SelectedTableViewer.java

示例9: initUI

import javax.swing.UIDefaults; //導入方法依賴的package包/類
protected void initUI() {
	// Nimbus me
	try {
		for ( LookAndFeelInfo info : UIManager.getInstalledLookAndFeels() ) {
			if ( "Nimbus".equals( info.getName() ) ) {
				logger.trace( "Got the nimbus" );
				UIManager.setLookAndFeel( info.getClassName() );
				//Pretty Colors.
				UIManager.put( "nimbusSelectionBackground", new Color( 67, 144, 212 ) ); //Light blue for selection
				UIManager.put( "controlDkShadow", new Color( 100, 100, 100 ) ); //Color of scroll icons arrows
				UIManager.put( "controlHighlight", new Color( 100, 100, 100 ) ); //Color of scroll icons highlights
				UIManager.put( "ProgressBar.repaintInterval", 250 );//speed of indeterminate progress bar
				UIManager.put( "ProgressBar.cycleTime", 1300 );

				UIDefaults defaults = UIManager.getLookAndFeelDefaults();

				UIDefaults tabPaneDefaults = new UIDefaults();
				tabPaneDefaults.put( "TabbedPane.background", new ColorUIResource( Color.red ) );

				//defaults.put( "ToolTip.background", Color.LIGHT_GRAY );
				//defaults.put( "ToolTip[Enabled].backgroundPainter", null );
				//defaults.put( "ToolTip.contentMargins", new Insets( 3, 3, 3, 3 ) );
				defaults.put( "nimbusOrange", defaults.get( "nimbusInfoBlue" ) );
				Painter blue = (Painter) defaults.get( "Button[Default+Focused+Pressed].backgroundPainter" );
				defaults.put( "ProgressBar[Enabled].foregroundPainter", blue );
				break;
			}
		}
	}
	catch ( ClassNotFoundException | InstantiationException |
			IllegalAccessException | UnsupportedLookAndFeelException e ) {
		// handle exception
		logger.warn( e, e );
	}
}
 
開發者ID:Ostrich-Emulators,項目名稱:semtool,代碼行數:36,代碼來源:Starter.java

示例10: setUIfontSize

import javax.swing.UIDefaults; //導入方法依賴的package包/類
static public void setUIfontSize(float multiplier) {
    UIDefaults defaults = UIManager.getDefaults();
    for (Enumeration<?> e = defaults.keys(); e.hasMoreElements();) {
        Object key = e.nextElement();
        Object value = defaults.get(key);
        if (value instanceof Font) {
            Font font = (Font) value;
            int newSize = Math.round(font.getSize() * multiplier);
            if (value instanceof FontUIResource) {
                defaults.put(key,
                        new FontUIResource(font.getName(), font.getStyle(),
                                newSize));
            }
            else {
                defaults.put(key, new Font(font.getName(), font.getStyle(),
                        newSize));
            }
        }
        else if (value instanceof Integer) {
            if ("Tree.rowHeight".equals(key)) { //$NON-NLS-1$
                // System.out.println(key+": "+value);
                Integer rh = (Integer) value;
                rh = (int) (rh * multiplier * 1.4);
                defaults.put(key, rh);
            }
        }
    }
}
 
開發者ID:kddart,項目名稱:kdxplore,代碼行數:29,代碼來源:KDXplore.java

示例11: getValue

import javax.swing.UIDefaults; //導入方法依賴的package包/類
private static Object getValue(UIDefaults defaults) {
    return defaults.get("MetalTitlePane.restore.titleAndMnemonic");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:4,代碼來源:InternalResourceBundle.java


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