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

The following examples show how to use javax.swing.UIManager#getInt() . 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: FileChooserUI.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
protected void installStrings(JFileChooser fc) {
	super.installStrings(fc);

	Locale l = fc.getLocale();

	this.lookInLabelMnemonic = UIManager.getInt("FileChooser.lookInLabelMnemonic");
	this.lookInLabelText = UIManager.getString("FileChooser.lookInLabelText", l);
	this.saveInLabelText = UIManager.getString("FileChooser.saveInLabelText", l);

	this.fileNameLabelMnemonic = UIManager.getInt("FileChooser.fileNameLabelMnemonic");
	this.fileNameLabelText = UIManager.getString("FileChooser.fileNameLabelText", l);

	this.filesOfTypeLabelMnemonic = UIManager.getInt("FileChooser.filesOfTypeLabelMnemonic");
	this.filesOfTypeLabelText = UIManager.getString("FileChooser.filesOfTypeLabelText", l);
}
 
Example 2
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 3
Source File: WindowsInternalFrameTitlePane.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected void installDefaults() {
    super.installDefaults();

    titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
    buttonWidth     = UIManager.getInt("InternalFrame.titleButtonWidth")  - 4;
    buttonHeight    = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;

    Object obj      = UIManager.get("InternalFrame.titleButtonToolTipsOn");
    hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;


    if (XPStyle.getXP() != null) {
        // Fix for XP bug where sometimes these sizes aren't updated properly
        // Assume for now that height is correct and derive width using the
        // ratio from the uxtheme part
        buttonWidth = buttonHeight;
        Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
        if (d != null && d.width != 0 && d.height != 0) {
            buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
        }
    } else {
        buttonWidth += 2;
        selectedTitleGradientColor =
                UIManager.getColor("InternalFrame.activeTitleGradient");
        notSelectedTitleGradientColor =
                UIManager.getColor("InternalFrame.inactiveTitleGradient");
        Color activeBorderColor =
                UIManager.getColor("InternalFrame.activeBorderColor");
        setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
    }
}
 
Example 4
Source File: bug8071705.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void runActualTest(GraphicsDevice device,
                                  CountDownLatch latch,
                                  JFrame frame,
                                  boolean [] result)
{
    Rectangle screenBounds = setLocation(frame, device);
    JMenu menu = frame.getJMenuBar().getMenu(0);
    menu.doClick();

    Point location = menu.getLocationOnScreen();
    JPopupMenu pm = menu.getPopupMenu();
    Dimension pmSize = pm.getSize();

    int yOffset = UIManager.getInt("Menu.submenuPopupOffsetY");
    int height = location.y + yOffset + pmSize.height + menu.getHeight();
    int available = screenBounds.y + screenBounds.height - height;
    if (available > 0) {
        Point origin = pm.getLocationOnScreen();
        if (origin.y < location.y) {
            // growing upward, wrong!
            result[0] = false;
        } else {
            // growing downward, ok!
            result[0] = true;
        }
    } else {
        // there is no space, growing upward would be ok, so we pass
        result[0] = true;
    }
}
 
Example 5
Source File: BEMenuUI.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
protected void installDefaults() 
    {
    	super.installDefaults();
//    	if (!WindowsLookAndFeel.isClassicWindows()) 
    	{
    		menuItem.setRolloverEnabled(true);
    	}
    	
    	menuBarHeight = (Integer)UIManager.getInt("MenuBar.height");
    	Object obj      = UIManager.get("MenuBar.rolloverEnabled");
    	hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;
    }
 
Example 6
Source File: bug8071705.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void runActualTest(GraphicsDevice device,
                                  CountDownLatch latch,
                                  JFrame frame,
                                  boolean [] result)
{
    Rectangle screenBounds = setLocation(frame, device);
    JMenu menu = frame.getJMenuBar().getMenu(0);
    menu.doClick();

    Point location = menu.getLocationOnScreen();
    JPopupMenu pm = menu.getPopupMenu();
    Dimension pmSize = pm.getSize();

    int yOffset = UIManager.getInt("Menu.submenuPopupOffsetY");
    int height = location.y + yOffset + pmSize.height + menu.getHeight();
    int available = screenBounds.y + screenBounds.height - height;
    if (available > 0) {
        Point origin = pm.getLocationOnScreen();
        if (origin.y < location.y) {
            // growing upward, wrong!
            result[0] = false;
        } else {
            // growing downward, ok!
            result[0] = true;
        }
    } else {
        // there is no space, growing upward would be ok, so we pass
        result[0] = true;
    }
}
 
Example 7
Source File: WindowsInternalFrameTitlePane.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
protected void installDefaults() {
    super.installDefaults();

    titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
    buttonWidth     = UIManager.getInt("InternalFrame.titleButtonWidth")  - 4;
    buttonHeight    = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;

    Object obj      = UIManager.get("InternalFrame.titleButtonToolTipsOn");
    hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;


    if (XPStyle.getXP() != null) {
        // Fix for XP bug where sometimes these sizes aren't updated properly
        // Assume for now that height is correct and derive width using the
        // ratio from the uxtheme part
        buttonWidth = buttonHeight;
        Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
        if (d != null && d.width != 0 && d.height != 0) {
            buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
        }
    } else {
        buttonWidth += 2;
        Color activeBorderColor =
                UIManager.getColor("InternalFrame.activeBorderColor");
        setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
    }
    // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
    selectedTitleGradientColor =
            UIManager.getColor("InternalFrame.activeTitleGradient");
    notSelectedTitleGradientColor =
            UIManager.getColor("InternalFrame.inactiveTitleGradient");
}
 
Example 8
Source File: LuckRootPaneLayout.java    From littleluck with Apache License 2.0 5 votes vote down vote up
public Dimension preferredLayoutSize(Container parent)
 {
     Insets insets = parent.getInsets();

     JRootPane root = (JRootPane) parent;

     int h = 0;

     Dimension cpd = null;

     if (root.getContentPane() != null)
     {
         cpd = root.getContentPane().getPreferredSize();

if (!(root.getContentPane() instanceof LuckBackgroundPanel)
        && root.getWindowDecorationStyle() != JRootPane.NONE)
{
	h += UIManager.getInt(LuckRootPaneUIBundle.TITLEPANEL_HEIGHT);
}
     }
     else
     {
         cpd = root.getSize();
     }

     h += cpd.height;

     return getDimension(insets, cpd.width, h);
 }
 
Example 9
Source File: bug8071705.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void runActualTest(GraphicsDevice device,
                                  CountDownLatch latch,
                                  JFrame frame,
                                  boolean [] result)
{
    Rectangle screenBounds = setLocation(frame, device);
    JMenu menu = frame.getJMenuBar().getMenu(0);
    menu.doClick();

    Point location = menu.getLocationOnScreen();
    JPopupMenu pm = menu.getPopupMenu();
    Dimension pmSize = pm.getSize();

    int yOffset = UIManager.getInt("Menu.submenuPopupOffsetY");
    int height = location.y + yOffset + pmSize.height + menu.getHeight();
    int available = screenBounds.y + screenBounds.height - height;
    if (available > 0) {
        Point origin = pm.getLocationOnScreen();
        if (origin.y < location.y) {
            // growing upward, wrong!
            result[0] = false;
        } else {
            // growing downward, ok!
            result[0] = true;
        }
    } else {
        // there is no space, growing upward would be ok, so we pass
        result[0] = true;
    }
}
 
Example 10
Source File: WindowsInternalFrameTitlePane.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void installDefaults() {
    super.installDefaults();

    titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
    buttonWidth     = UIManager.getInt("InternalFrame.titleButtonWidth")  - 4;
    buttonHeight    = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;

    Object obj      = UIManager.get("InternalFrame.titleButtonToolTipsOn");
    hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;


    if (XPStyle.getXP() != null) {
        // Fix for XP bug where sometimes these sizes aren't updated properly
        // Assume for now that height is correct and derive width using the
        // ratio from the uxtheme part
        buttonWidth = buttonHeight;
        Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
        if (d != null && d.width != 0 && d.height != 0) {
            buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
        }
    } else {
        buttonWidth += 2;
        Color activeBorderColor =
                UIManager.getColor("InternalFrame.activeBorderColor");
        setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
    }
    // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
    selectedTitleGradientColor =
            UIManager.getColor("InternalFrame.activeTitleGradient");
    notSelectedTitleGradientColor =
            UIManager.getColor("InternalFrame.inactiveTitleGradient");
}
 
Example 11
Source File: FlatTextAreaUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	minimumWidth = UIManager.getInt( "Component.minimumWidth" );
	isIntelliJTheme = UIManager.getBoolean( "Component.isIntelliJTheme" );
	disabledBackground = UIManager.getColor( "TextArea.disabledBackground" );
	inactiveBackground = UIManager.getColor( "TextArea.inactiveBackground" );
}
 
Example 12
Source File: bug8071705.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void runActualTest(GraphicsDevice device,
                                  CountDownLatch latch,
                                  JFrame frame,
                                  boolean [] result)
{
    Rectangle screenBounds = setLocation(frame, device);
    JMenu menu = frame.getJMenuBar().getMenu(0);
    menu.doClick();

    Point location = menu.getLocationOnScreen();
    JPopupMenu pm = menu.getPopupMenu();
    Dimension pmSize = pm.getSize();

    int yOffset = UIManager.getInt("Menu.submenuPopupOffsetY");
    int height = location.y + yOffset + pmSize.height + menu.getHeight();
    int available = screenBounds.y + screenBounds.height - height;
    if (available > 0) {
        Point origin = pm.getLocationOnScreen();
        if (origin.y < location.y) {
            // growing upward, wrong!
            result[0] = false;
        } else {
            // growing downward, ok!
            result[0] = true;
        }
    } else {
        // there is no space, growing upward would be ok, so we pass
        result[0] = true;
    }
}
 
Example 13
Source File: WindowsInternalFrameTitlePane.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected void installDefaults() {
    super.installDefaults();

    titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
    buttonWidth     = UIManager.getInt("InternalFrame.titleButtonWidth")  - 4;
    buttonHeight    = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;

    Object obj      = UIManager.get("InternalFrame.titleButtonToolTipsOn");
    hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;


    if (XPStyle.getXP() != null) {
        // Fix for XP bug where sometimes these sizes aren't updated properly
        // Assume for now that height is correct and derive width using the
        // ratio from the uxtheme part
        buttonWidth = buttonHeight;
        Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
        if (d != null && d.width != 0 && d.height != 0) {
            buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
        }
    } else {
        buttonWidth += 2;
        selectedTitleGradientColor =
                UIManager.getColor("InternalFrame.activeTitleGradient");
        notSelectedTitleGradientColor =
                UIManager.getColor("InternalFrame.inactiveTitleGradient");
        Color activeBorderColor =
                UIManager.getColor("InternalFrame.activeBorderColor");
        setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
    }
}
 
Example 14
Source File: FlatSeparatorUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults( JSeparator s ) {
	super.installDefaults( s );

	if( !defaults_initialized ) {
		String prefix = getPropertyPrefix();
		height = UIManager.getInt( prefix + ".height" );
		stripeWidth = UIManager.getInt( prefix + ".stripeWidth" );
		stripeIndent = UIManager.getInt( prefix + ".stripeIndent" );

		defaults_initialized = true;
	}
}
 
Example 15
Source File: FlatTableHeaderUI.java    From FlatLaf with Apache License 2.0 5 votes vote down vote up
@Override
protected void installDefaults() {
	super.installDefaults();

	separatorColor = UIManager.getColor( "TableHeader.separatorColor" );
	bottomSeparatorColor = UIManager.getColor( "TableHeader.bottomSeparatorColor" );
	height = UIManager.getInt( "TableHeader.height" );
	switch( Objects.toString( UIManager.getString( "TableHeader.sortIconPosition" ), "right" ) ) {
		default:
		case "right":	sortIconPosition = SwingConstants.RIGHT; break;
		case "left":	sortIconPosition = SwingConstants.LEFT; break;
		case "top":		sortIconPosition = SwingConstants.TOP; break;
		case "bottom":	sortIconPosition = SwingConstants.BOTTOM; break;
	}
}
 
Example 16
Source File: bug8071705.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void runActualTest(GraphicsDevice device,
                                  CountDownLatch latch,
                                  JFrame frame,
                                  boolean [] result)
{
    Rectangle screenBounds = setLocation(frame, device);
    JMenu menu = frame.getJMenuBar().getMenu(0);
    menu.doClick();

    Point location = menu.getLocationOnScreen();
    JPopupMenu pm = menu.getPopupMenu();
    Dimension pmSize = pm.getSize();

    int yOffset = UIManager.getInt("Menu.submenuPopupOffsetY");
    int height = location.y + yOffset + pmSize.height + menu.getHeight();
    int available = screenBounds.y + screenBounds.height - height;
    if (available > 0) {
        Point origin = pm.getLocationOnScreen();
        if (origin.y < location.y) {
            // growing upward, wrong!
            result[0] = false;
        } else {
            // growing downward, ok!
            result[0] = true;
        }
    } else {
        // there is no space, growing upward would be ok, so we pass
        result[0] = true;
    }
}
 
Example 17
Source File: WindowsInternalFrameTitlePane.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected void installDefaults() {
    super.installDefaults();

    titlePaneHeight = UIManager.getInt("InternalFrame.titlePaneHeight");
    buttonWidth     = UIManager.getInt("InternalFrame.titleButtonWidth")  - 4;
    buttonHeight    = UIManager.getInt("InternalFrame.titleButtonHeight") - 4;

    Object obj      = UIManager.get("InternalFrame.titleButtonToolTipsOn");
    hotTrackingOn = (obj instanceof Boolean) ? (Boolean)obj : true;


    if (XPStyle.getXP() != null) {
        // Fix for XP bug where sometimes these sizes aren't updated properly
        // Assume for now that height is correct and derive width using the
        // ratio from the uxtheme part
        buttonWidth = buttonHeight;
        Dimension d = XPStyle.getPartSize(Part.WP_CLOSEBUTTON, State.NORMAL);
        if (d != null && d.width != 0 && d.height != 0) {
            buttonWidth = (int) ((float) buttonWidth * d.width / d.height);
        }
    } else {
        buttonWidth += 2;
        Color activeBorderColor =
                UIManager.getColor("InternalFrame.activeBorderColor");
        setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
    }
    // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
    selectedTitleGradientColor =
            UIManager.getColor("InternalFrame.activeTitleGradient");
    notSelectedTitleGradientColor =
            UIManager.getColor("InternalFrame.inactiveTitleGradient");
}
 
Example 18
Source File: BasicLinkButtonUI.java    From orbit-image-analysis with GNU General Public License v3.0 5 votes vote down vote up
protected void installDefaults(AbstractButton b) {
  super.installDefaults(b);

  b.setOpaque(false);
  b.setBorderPainted(false);
  b.setRolloverEnabled(true);

  dashedRectGapX = UIManager.getInt("ButtonUI.dashedRectGapX");
  dashedRectGapY = UIManager.getInt("ButtonUI.dashedRectGapY");
  dashedRectGapWidth = UIManager.getInt("ButtonUI.dashedRectGapWidth");
  dashedRectGapHeight = UIManager.getInt("ButtonUI.dashedRectGapHeight");
  focusColor = UIManager.getColor("ButtonUI.focus");

  b.setHorizontalAlignment(AbstractButton.LEFT);
}
 
Example 19
Source File: LuckTitlePanel.java    From littleluck with Apache License 2.0 4 votes vote down vote up
/**
 * @return TitlePane height
 */
public int getHeight()
{
    return UIManager.getInt(LuckRootPaneUIBundle.TITLEPANEL_HEIGHT);
}
 
Example 20
Source File: BEComboBoxUI.java    From beautyeye with Apache License 2.0 4 votes vote down vote up
/**
 * Creates the popup portion of the combo box.
 *
 * @return an instance of <code>ComboPopup</code>
 * @see ComboPopup
 */
protected ComboPopup createPopup() {
	return new BasicComboPopup( comboBox ){
		/** popupOffsetX是jb2011自定的属性,用于修正下拉框的弹出窗的X坐标 */
		private int popupOffsetX = UIManager.getInt("ComboBox.popupOffsetX");
		/** popupOffsetY是jb2011自定的属性,用于修正下拉框的弹出窗的Y坐标 */
		private int popupOffsetY = UIManager.getInt("ComboBox.popupOffsetY");
		
		//* copy from parent and modified by Jack Jiang
		/**
		 * Implementation of ComboPopup.show().
		 */
		public void show() {
			setListSelection(comboBox.getSelectedIndex());
			Point location = getPopupLocation();
			show( comboBox
					//以下x、y坐标修正代码由Jack Jiang增加
					, location.x + popupOffsetX //*~ popupOffsetX是自定属性,用于修改弹出窗的X坐标
					, location.y + popupOffsetY //*~ popupOffsetY是自定属性,用于修改弹出窗的Y坐标
			);
		}

		//* copy from parent and no modified
		/**
		 * Sets the list selection index to the selectedIndex. This 
		 * method is used to synchronize the list selection with the 
		 * combo box selection.
		 * 
		 * @param selectedIndex the index to set the list
		 */
		private void setListSelection(int selectedIndex) {
			if ( selectedIndex == -1 ) {
				list.clearSelection();
			}
			else {
				list.setSelectedIndex( selectedIndex );
				list.ensureIndexIsVisible( selectedIndex );
			}
		}

		//* copy from parent and no modified
		/**
		 * Calculates the upper left location of the Popup.
		 */
		private Point getPopupLocation() {
			Dimension popupSize = comboBox.getSize();
			Insets insets = getInsets();

			// reduce the width of the scrollpane by the insets so that the popup
			// is the same width as the combo box.
			popupSize.setSize(popupSize.width - (insets.right + insets.left), 
					getPopupHeightForRowCount( comboBox.getMaximumRowCount()));
			Rectangle popupBounds = computePopupBounds( 0, comboBox.getBounds().height,
					popupSize.width, popupSize.height);
			Dimension scrollSize = popupBounds.getSize();
			Point popupLocation = popupBounds.getLocation();

			scroller.setMaximumSize( scrollSize );
			scroller.setPreferredSize( scrollSize );
			scroller.setMinimumSize( scrollSize );

			list.revalidate();

			return popupLocation;
		}
	};
}