Java Code Examples for javax.swing.UIManager#getString()

The following examples show how to use javax.swing.UIManager#getString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlatSpinnerUI.java    From FlatLaf with Apache License 2.0 6 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installProperty( spinner, "opaque", false );

	minimumWidth = UIManager.getInt( "Component.minimumWidth" );
	buttonStyle = UIManager.getString( "Spinner.buttonStyle" );
	arrowType = UIManager.getString( "Component.arrowType" );
	isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
	borderColor = UIManager.getColor( "Component.borderColor" );
	disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );
	disabledBackground = UIManager.getColor( "Spinner.disabledBackground" );
	disabledForeground = UIManager.getColor( "Spinner.disabledForeground" );
	buttonBackground = UIManager.getColor( "Spinner.buttonBackground" );
	buttonArrowColor = UIManager.getColor( "Spinner.buttonArrowColor" );
	buttonDisabledArrowColor = UIManager.getColor( "Spinner.buttonDisabledArrowColor" );
	buttonHoverArrowColor = UIManager.getColor( "Spinner.buttonHoverArrowColor" );
	padding = UIManager.getInsets( "Spinner.padding" );

	// scale
	padding = scale( padding );

	MigLayoutVisualPadding.install( spinner );
}
 
Example 2
Source File: Test6524757.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static Object convert(Locale locale, String key) {
    if (key.endsWith("Text")) { // NON-NLS: suffix for text message
        return UIManager.getString(key, locale);
    }
    if (key.endsWith("Size")) { // NON-NLS: suffix for dimension
        return UIManager.getDimension(key, locale);
    }
    if (key.endsWith("Color")) { // NON-NLS: suffix for color
        return UIManager.getColor(key, locale);
    }
    int value = SwingUtilities2.getUIDefaultsInt(key, locale, -1);
    return Integer.valueOf(value);
}
 
Example 3
Source File: WindowsTipOfTheDayUI.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void installComponents() {
  tipPane.setLayout(new BorderLayout());

  // tip icon
  JLabel tipIcon = new JLabel();
  tipIcon.setPreferredSize(new Dimension(60, 100));
  tipIcon.setIcon(UIManager.getIcon("TipOfTheDay.icon"));
  tipIcon.setHorizontalAlignment(JLabel.CENTER);
  tipIcon.setVerticalAlignment(JLabel.TOP);
  tipIcon.setBorder(BorderFactory.createEmptyBorder(24, 0, 0, 0));
  tipPane.add("West", tipIcon);

  // tip area
  JPanel rightPane = new JPanel(new BorderLayout());
  JLabel didYouKnow = new JLabel(UIManager
    .getString("TipOfTheDay.didYouKnowText"));
  didYouKnow.setPreferredSize(new Dimension(50, 32));
  didYouKnow.setOpaque(true);
  didYouKnow.setBackground(UIManager.getColor("TextArea.background"));
  didYouKnow.setBorder(new CompoundBorder(BorderFactory.createMatteBorder(0,
    0, 2, 0, tipPane.getBackground()), BorderFactory.createEmptyBorder(4, 4,
    4, 4)));
  didYouKnow.setFont(tipPane.getFont().deriveFont(Font.BOLD, 15));
  rightPane.add("North", didYouKnow);

  tipArea = new JPanel(new BorderLayout());
  tipArea.setOpaque(true);
  tipArea.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
  tipArea.setBackground(UIManager.getColor("TextArea.background"));
  rightPane.add("Center", tipArea);

  tipPane.add("Center", rightPane);
}
 
Example 4
Source File: ActionsSupport.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
public static String keyAcceleratorString(KeyStroke keyStroke) {
    if (keyStroke == null || NO_KEYSTROKE.equals(keyStroke)) return null;
    
    String keyText = KeyEvent.getKeyText(keyStroke.getKeyCode());
    
    int modifiers = keyStroke.getModifiers();
    if (modifiers == 0) return keyText;
    
    if (ACC_DELIMITER == null) {
        ACC_DELIMITER = UIManager.getString("MenuItem.acceleratorDelimiter"); // NOI18N
        if (ACC_DELIMITER == null) ACC_DELIMITER = "+"; // NOI18N // Note: NetBeans default, Swing uses '-' by default
    }
    
    return KeyEvent.getKeyModifiersText(modifiers) + ACC_DELIMITER + keyText;
}
 
Example 5
Source File: FlatComboBoxUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	LookAndFeel.installProperty( comboBox, "opaque", false );

	minimumWidth = UIManager.getInt( "ComboBox.minimumWidth" );
	editorColumns = UIManager.getInt( "ComboBox.editorColumns" );
	buttonStyle = UIManager.getString( "ComboBox.buttonStyle" );
	arrowType = UIManager.getString( "Component.arrowType" );
	isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
	borderColor = UIManager.getColor( "Component.borderColor" );
	disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" );

	editableBackground = UIManager.getColor( "ComboBox.editableBackground" );
	disabledBackground = UIManager.getColor( "ComboBox.disabledBackground" );
	disabledForeground = UIManager.getColor( "ComboBox.disabledForeground" );

	buttonBackground = UIManager.getColor( "ComboBox.buttonBackground" );
	buttonEditableBackground = UIManager.getColor( "ComboBox.buttonEditableBackground" );
	buttonArrowColor = UIManager.getColor( "ComboBox.buttonArrowColor" );
	buttonDisabledArrowColor = UIManager.getColor( "ComboBox.buttonDisabledArrowColor" );
	buttonHoverArrowColor = UIManager.getColor( "ComboBox.buttonHoverArrowColor" );

	// set maximumRowCount
	int maximumRowCount = UIManager.getInt( "ComboBox.maximumRowCount" );
	if( maximumRowCount > 0 && maximumRowCount != 8 && comboBox.getMaximumRowCount() == 8 )
		comboBox.setMaximumRowCount( maximumRowCount );

	// scale
	padding = UIScale.scale( padding );

	MigLayoutVisualPadding.install( comboBox );
}
 
Example 6
Source File: SwingSearch.java    From pumpernickel with MIT License 4 votes vote down vote up
/**
 * This can create a highlight effect for a selection of text. Originally
 * this was designed to work with the
 * {@link com.pump.plaf.AbstractSearchHighlight} class, but it can work with
 * any object that has a constructor accepting the same arguments this
 * method uses.
 * <P>
 * By default this will use the <code>AquaSearchHighlight</code>, but you
 * can call
 * <Code>UIManager.put("textSearchHighlightEffect", myClassName)</code> to
 * change this default class.
 * 
 * @param table
 *            the table to highlight.
 * @param selectedRow
 *            the row that is selected.
 * @param selectedColumn
 *            the column that is selected.
 */
public static void highlight(JTable table, int selectedRow,
		int selectedColumn) {
	String className = UIManager.getString("textSearchHighlightEffect");
	if (className == null) {
		className = "com.pump.plaf.AquaSearchHighlight";
	}
	try {
		Class<?> c = Class.forName(className);
		Constructor<?> constructor = c.getConstructor(new Class[] {
				JTable.class, Integer.TYPE, Integer.TYPE });
		constructor.newInstance(new Object[] { table,
				new Integer(selectedRow), new Integer(selectedColumn) });
	} catch (Throwable t) {
		if (t instanceof RuntimeException)
			throw (RuntimeException) t;
	}
}
 
Example 7
Source File: BETitlePane.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
/**
 * Instantiates a new restore action.
 */
public RestoreAction()
{
	super(//"还原(R)");
			UIManager.getString("BETitlePane.restoreButtonText",getLocale()));
}
 
Example 8
Source File: AbstractUndoableEdit.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 * Retreives the value from the defaults table with key
 * <code>AbstractUndoableEdit.redoText</code> and returns
 * that value followed by a space, followed by
 * <code>getPresentationName</code>.
 * If <code>getPresentationName</code> returns "",
 * then the defaults value is returned alone.
 *
 * @return the value from the defaults table with key
 *    <code>AbstractUndoableEdit.redoText</code>, followed
 *    by a space, followed by <code>getPresentationName</code>
 *    unless <code>getPresentationName</code> is "" in which
 *    case, the defaults value is returned alone.
 * @see #getPresentationName
 */
public String getRedoPresentationName() {
    String name = getPresentationName();
    if (!"".equals(name)) {
        name = UIManager.getString("AbstractUndoableEdit.redoText") +
            " " + name;
    } else {
        name = UIManager.getString("AbstractUndoableEdit.redoText");
    }

    return name;
}
 
Example 9
Source File: UndoManager.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns a description of the undoable form of this edit.
 * If <code>end</code> has been invoked this calls into super.
 * Otherwise if there are edits to be undone, this returns
 * the value from the next significant edit that will be undone.
 * If there are no edits to be undone and <code>end</code> has not
 * been invoked this returns the value from the <code>UIManager</code>
 * property "AbstractUndoableEdit.undoText".
 *
 * @return a description of the undoable form of this edit
 * @see     #undo
 * @see     CompoundEdit#getUndoPresentationName
 */
public synchronized String getUndoPresentationName() {
    if (inProgress) {
        if (canUndo()) {
            return editToBeUndone().getUndoPresentationName();
        } else {
            return UIManager.getString("AbstractUndoableEdit.undoText");
        }
    } else {
        return super.getUndoPresentationName();
    }
}
 
Example 10
Source File: UndoManager.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Returns a description of the redoable form of this edit.
 * If <code>end</code> has been invoked this calls into super.
 * Otherwise if there are edits to be redone, this returns
 * the value from the next significant edit that will be redone.
 * If there are no edits to be redone and <code>end</code> has not
 * been invoked this returns the value from the <code>UIManager</code>
 * property "AbstractUndoableEdit.redoText".
 *
 * @return a description of the redoable form of this edit
 * @see     #redo
 * @see     CompoundEdit#getRedoPresentationName
 */
public synchronized String getRedoPresentationName() {
    if (inProgress) {
        if (canRedo()) {
            return editToBeRedone().getRedoPresentationName();
        } else {
            return UIManager.getString("AbstractUndoableEdit.redoText");
        }
    } else {
        return super.getRedoPresentationName();
    }
}
 
Example 11
Source File: AbstractUndoableEdit.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retreives the value from the defaults table with key
 * <code>AbstractUndoableEdit.redoText</code> and returns
 * that value followed by a space, followed by
 * <code>getPresentationName</code>.
 * If <code>getPresentationName</code> returns "",
 * then the defaults value is returned alone.
 *
 * @return the value from the defaults table with key
 *    <code>AbstractUndoableEdit.redoText</code>, followed
 *    by a space, followed by <code>getPresentationName</code>
 *    unless <code>getPresentationName</code> is "" in which
 *    case, the defaults value is returned alone.
 * @see #getPresentationName
 */
public String getRedoPresentationName() {
    String name = getPresentationName();
    if (!"".equals(name)) {
        name = UIManager.getString("AbstractUndoableEdit.redoText") +
            " " + name;
    } else {
        name = UIManager.getString("AbstractUndoableEdit.redoText");
    }

    return name;
}
 
Example 12
Source File: UndoManager.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * Returns a description of the redoable form of this edit.
 * If <code>end</code> has been invoked this calls into super.
 * Otherwise if there are edits to be redone, this returns
 * the value from the next significant edit that will be redone.
 * If there are no edits to be redone and <code>end</code> has not
 * been invoked this returns the value from the <code>UIManager</code>
 * property "AbstractUndoableEdit.redoText".
 *
 * @return a description of the redoable form of this edit
 * @see     #redo
 * @see     CompoundEdit#getRedoPresentationName
 */
public synchronized String getRedoPresentationName() {
    if (inProgress) {
        if (canRedo()) {
            return editToBeRedone().getRedoPresentationName();
        } else {
            return UIManager.getString("AbstractUndoableEdit.redoText");
        }
    } else {
        return super.getRedoPresentationName();
    }
}
 
Example 13
Source File: AbstractUndoableEdit.java    From jdk8u-dev-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retreives the value from the defaults table with key
 * <code>AbstractUndoableEdit.redoText</code> and returns
 * that value followed by a space, followed by
 * <code>getPresentationName</code>.
 * If <code>getPresentationName</code> returns "",
 * then the defaults value is returned alone.
 *
 * @return the value from the defaults table with key
 *    <code>AbstractUndoableEdit.redoText</code>, followed
 *    by a space, followed by <code>getPresentationName</code>
 *    unless <code>getPresentationName</code> is "" in which
 *    case, the defaults value is returned alone.
 * @see #getPresentationName
 */
public String getRedoPresentationName() {
    String name = getPresentationName();
    if (!"".equals(name)) {
        name = UIManager.getString("AbstractUndoableEdit.redoText") +
            " " + name;
    } else {
        name = UIManager.getString("AbstractUndoableEdit.redoText");
    }

    return name;
}
 
Example 14
Source File: AbstractUndoableEdit.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Retreives the value from the defaults table with key
 * <code>AbstractUndoableEdit.redoText</code> and returns
 * that value followed by a space, followed by
 * <code>getPresentationName</code>.
 * If <code>getPresentationName</code> returns "",
 * then the defaults value is returned alone.
 *
 * @return the value from the defaults table with key
 *    <code>AbstractUndoableEdit.redoText</code>, followed
 *    by a space, followed by <code>getPresentationName</code>
 *    unless <code>getPresentationName</code> is "" in which
 *    case, the defaults value is returned alone.
 * @see #getPresentationName
 */
public String getRedoPresentationName() {
    String name = getPresentationName();
    if (!"".equals(name)) {
        name = UIManager.getString("AbstractUndoableEdit.redoText") +
            " " + name;
    } else {
        name = UIManager.getString("AbstractUndoableEdit.redoText");
    }

    return name;
}
 
Example 15
Source File: AbstractDocument.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Provides a localized, human readable description of the redoable
 * form of this edit, e.g. for use as a Redo menu item. Typically
 * derived from getPresentationName();
 *
 * @return the description
 */
public String getRedoPresentationName() {
    return UIManager.getString("AbstractDocument.redoText") + " " +
        getPresentationName();
}
 
Example 16
Source File: AbstractDocument.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Provides a localized, human readable description of the redoable
 * form of this edit, e.g. for use as a Redo menu item. Typically
 * derived from getPresentationName();
 *
 * @return the description
 */
public String getRedoPresentationName() {
    return UIManager.getString("AbstractDocument.redoText") + " " +
        getPresentationName();
}
 
Example 17
Source File: AbstractDocument.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Provides a localized, human readable description of the redoable
 * form of this edit, e.g. for use as a Redo menu item. Typically
 * derived from getPresentationName();
 *
 * @return the description
 */
public String getRedoPresentationName() {
    return UIManager.getString("AbstractDocument.redoText") + " " +
        getPresentationName();
}
 
Example 18
Source File: AbstractDocument.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Provides a localized, human readable description of the undoable
 * form of this edit, e.g. for use as an Undo menu item. Typically
 * derived from getDescription();
 *
 * @return the description
 */
public String getUndoPresentationName() {
    return UIManager.getString("AbstractDocument.undoText") + " " +
        getPresentationName();
}
 
Example 19
Source File: AbstractDocument.java    From Java8CN with Apache License 2.0 2 votes vote down vote up
/**
 * Provides a localized, human readable description of the undoable
 * form of this edit, e.g. for use as an Undo menu item. Typically
 * derived from getDescription();
 *
 * @return the description
 */
public String getUndoPresentationName() {
    return UIManager.getString("AbstractDocument.undoText") + " " +
        getPresentationName();
}
 
Example 20
Source File: AbstractDocument.java    From openjdk-8-source with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Provides a localized, human readable description of the redoable
 * form of this edit, e.g. for use as a Redo menu item. Typically
 * derived from getPresentationName();
 *
 * @return the description
 */
public String getRedoPresentationName() {
    return UIManager.getString("AbstractDocument.redoText") + " " +
        getPresentationName();
}