Java Code Examples for javax.swing.plaf.InsetsUIResource

The following examples show how to use javax.swing.plaf.InsetsUIResource. These examples are extracted from open source projects. 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
public void register(ConverterRegistry registry) {
  registry.addConverter(Dimension.class, String.class, this);
  registry.addConverter(String.class, Dimension.class, this);
  registry.addConverter(DimensionUIResource.class, String.class, this);

  registry.addConverter(Insets.class, String.class, this);
  registry.addConverter(String.class, Insets.class, this);
  registry.addConverter(InsetsUIResource.class, String.class, this);

  registry.addConverter(Point.class, String.class, this);
  registry.addConverter(String.class, Point.class, this);
  
  registry.addConverter(Rectangle.class, String.class, this);
  registry.addConverter(String.class, Rectangle.class, this);
  
  registry.addConverter(Font.class, String.class, this);
  registry.addConverter(FontUIResource.class, String.class, this);
}
 
Example 2
Source Project: MercuryTrade   Source File: AdrManagerFrame.java    License: MIT License 6 votes vote down vote up
public AdrManagerFrame(AdrProfileDescriptor selectedProfile) {
    super();
    this.processingHideEvent = false;
    this.setTitle("MercuryTrade ADR");
    this.setFocusable(true);
    this.setFocusableWindowState(true);
    this.setAlwaysOnTop(false);
    this.selectedProfile = selectedProfile;
    this.exportDialog = new AdrExportDialog(this, new ArrayList<>());
    this.iconSelectDialog = new AdrIconSelectDialog();
    this.iconSelectDialog.setLocationRelativeTo(null);
    FrameDescriptor frameDescriptor = this.framesConfig.get(this.getClass().getSimpleName());
    this.setPreferredSize(frameDescriptor.getFrameSize());
    UIManager.put("MenuItem.background", AppThemeColor.ADR_BG);
    UIManager.put("MenuItem.selectionBackground", AppThemeColor.ADR_POPUP_BG);
    UIManager.put("Menu.contentMargins", new InsetsUIResource(2, 0, 2, 0));
    UIManager.put("MenuItem.opaque", true);
    UIManager.put("ComboBox.selectionBackground", AppThemeColor.HEADER);
    UIManager.put("ComboBox.selectionForeground", AppThemeColor.ADR_POPUP_BG);
    UIManager.put("ComboBox.disabledForeground", AppThemeColor.ADR_FOOTER_BG);
}
 
Example 3
protected void initComponentDefaults(UIDefaults table) {
  super.initComponentDefaults( table );

  // I'll have to copy some of the resource definitions here, since the
  // original code in BasicLookAndFeel (from which we inherit) uses
  // getClass() to find its resources. That will fail since my
  // classloader does not have these resources.
  //
  // So, the trick is to replace getClass() with MetalLookAndFeel.class

  Object[] defaults = {
    "OptionPane.errorIcon",       LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Error.gif"),
    "OptionPane.informationIcon", LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Inform.gif"),
    "OptionPane.warningIcon",     LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Warn.gif"),
    "OptionPane.questionIcon",    LookAndFeel.makeIcon(MetalLookAndFeel.class, "icons/Question.gif"),

    "InternalFrame.icon",         LookAndFeel.makeIcon(BasicLookAndFeel.class, "icons/JavaCup.gif"),


    // Button margin slightly smaller than metal to save space
    "Button.margin", new InsetsUIResource(1, 11, 1, 11),


  };
  table.putDefaults(defaults);
}
 
Example 4
Source Project: beautyeye   Source File: BeautyEyeLookAndFeelWin.java    License: Apache License 2.0 6 votes vote down vote up
/**
	 * 因Windos LNF会在Vista及更新的操作系统(如win7)上对Windows LNF作附加设置,
	 * 以保证与Vista及更新平台的外观的一致性(如让菜单菜项高度更大等),请参见
	 * WindowsLookAndFeel.initVistaComponentDefaults(..)。
	 * <p>
	 * BeautyEye中因需要保证审美一致性(在所有win平台上)而不需要这些额外的设置,
	 * 但因该方法是private私有方法,无法进行覆盖屏蔽,所以只能在此单列方法,以便针对Vista
	 * 及更新的平台进行补救性重新设置以便与BeautyEye LNF的审核进行适配.
	 * 
	 * @see WindowsLookAndFeel.initVistaComponentDefaults(..)
	 */
	protected void initForVista()
	{
		if(WinUtils.isOnVista())
		{
			UIManager.put("CheckBoxMenuItem.margin",new InsetsUIResource(0,0,0,0));
			UIManager.put("RadioButtonMenuItem.margin",new InsetsUIResource(0,0,0,0));
			UIManager.put("Menu.margin",new InsetsUIResource(0,0,0,0));//windows lnf xp中默认是2,2,2,2
			UIManager.put("MenuItem.margin",new InsetsUIResource(0,0,0,0));//windows lnf中  xp默认是2,2,2,2
			
			UIManager.put("Menu.border",new BorderUIResource(BorderFactory.createEmptyBorder(1,3,2,3)));//javax.swing.plaf.basic.BasicBorders.MarginBorder;
			UIManager.put("MenuItem.border",new BorderUIResource(BorderFactory.createEmptyBorder(1,0,2,0)));//javax.swing.plaf.basic.BasicBorders.MarginBorder;
			UIManager.put("CheckBoxMenuItem.border",new BorderUIResource(BorderFactory.createEmptyBorder(4,2,4,2)));//javax.swing.plaf.basic.BasicBorders.MarginBorder;
			UIManager.put("RadioButtonMenuItem.border",new BorderUIResource(BorderFactory.createEmptyBorder(4,0,4,0)));//javax.swing.plaf.basic.BasicBorders.MarginBorder;		
//			UIManager.put("PopupMenu.border",new BorderUIResource(BorderFactory.createEmptyBorder(20,10,20,10)));//	
		
			UIManager.put("CheckBoxMenuItem.checkIcon"
					,new org.jb2011.lnf.beautyeye.ch9_menu.BECheckBoxMenuItemUI.CheckBoxMenuItemIcon().setUsedForVista(true));//javax.swing.plaf.basic.BasicIconFactory.CheckBoxMenuItemIcon);
			UIManager.put("RadioButtonMenuItem.checkIcon"
					,new org.jb2011.lnf.beautyeye.ch9_menu.BERadioButtonMenuItemUI.RadioButtonMenuItemIcon().setUsedForVista(true));
		}
	}
 
Example 5
Source Project: beautyeye   Source File: __UI__.java    License: Apache License 2.0 6 votes vote down vote up
/**
	 * Ui impl.
	 */
	public static void uiImpl()
	{
//		UIManager.put("CheckBox.border",new BorderUIResource(new BERoundBorder().setArcWidth(0)));
		
		UIManager.put("CheckBox.margin",new InsetsUIResource(4,3,4,3));
		UIManager.put("RadioButton.margin",new InsetsUIResource(4,3,4,3));//2, 2, 2, 2));
		
		UIManager.put("RadioButton.background",new ColorUIResource(BeautyEyeLNFHelper.commonBackgroundColor));
		UIManager.put("CheckBox.background",new ColorUIResource(BeautyEyeLNFHelper.commonBackgroundColor));
		
		UIManager.put("CheckBox.foreground",new ColorUIResource(BeautyEyeLNFHelper.commonForegroundColor));
		UIManager.put("RadioButton.foreground",new ColorUIResource(BeautyEyeLNFHelper.commonForegroundColor));
		
		UIManager.put("RadioButton.icon", new RadioButtonIcon());
		UIManager.put("CheckBox.icon", new CheckBoxIcon());

		//衬距设定
		UIManager.put("RadioButton.margin", new InsetsUIResource(1,1,1,1));//默认是2,2,2,2
		UIManager.put("CheckBox.margin", new InsetsUIResource(1,1,1,1));//默认是2,2,2,2
	}
 
Example 6
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 6 votes vote down vote up
private void defineOptionPane(UIDefaults d) {
    //Initialize OptionPane
    d.put("OptionPane.contentMargins", new InsetsUIResource(15, 15, 15, 15));
    d.put("OptionPane.opaque", Boolean.TRUE);
    d.put("OptionPane.background", getDerivedColor("control", 0, 0, 0, 0, true));
    d.put("OptionPane.buttonOrientation", new Integer(4));
    d.put("OptionPane.messageAnchor", new Integer(17));
    d.put("OptionPane.separatorPadding", new Integer(0));
    d.put("OptionPane.sameSizeButtons", Boolean.FALSE);
    d.put("OptionPane:\"OptionPane.separator\".contentMargins", new InsetsUIResource(1, 0, 0, 0));
    d.put("OptionPane:\"OptionPane.messageArea\".contentMargins", new InsetsUIResource(0, 0, 10, 0));
    d.put("OptionPane:\"OptionPane.messageArea\":\"OptionPane.label\".contentMargins", new InsetsUIResource(0, 10, 10, 10));

    d.put("OptionPane[Enabled].errorIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.OptionPanePainter", OptionPanePainter.Which.ERRORICON_ENABLED));
    d.put("OptionPane.errorIcon", new SeaGlassIcon("OptionPane", "errorIconPainter", 48, 48));
    d.put("OptionPane[Enabled].informationIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.OptionPanePainter", OptionPanePainter.Which.INFORMATIONICON_ENABLED));
    d.put("OptionPane.informationIcon", new SeaGlassIcon("OptionPane", "informationIconPainter", 48, 48));
    d.put("OptionPane[Enabled].questionIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.OptionPanePainter", OptionPanePainter.Which.QUESTIONICON_ENABLED));
    d.put("OptionPane.questionIcon", new SeaGlassIcon("OptionPane", "questionIconPainter", 48, 48));
    d.put("OptionPane[Enabled].warningIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.OptionPanePainter", OptionPanePainter.Which.WARNINGICON_ENABLED));
    d.put("OptionPane.warningIcon", new SeaGlassIcon("OptionPane", "warningIconPainter", 48, 48));
    
    // Color Chooser Dialog
    d.put("ColorChooser.swatchesDefaultRecentColor", getDerivedColor("control", 0, 0, 0, 0, true));
}
 
Example 7
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 6 votes vote down vote up
private void defineFileChooser(UIDefaults d) {
    //Initialize FileChooser
    d.put("FileChooser.contentMargins", new InsetsUIResource(10, 10, 10, 10));
    d.put("FileChooser.opaque", Boolean.TRUE);
    d.put("FileChooser.usesSingleFilePane", Boolean.TRUE);
    d.put("FileChooser[Enabled].fileIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.FileChooserPainter", FileChooserPainter.Which.FILEICON_ENABLED));
    d.put("FileChooser.fileIcon", new SeaGlassIcon("FileChooser", "fileIconPainter", 16, 16));
    d.put("FileChooser[Enabled].directoryIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.FileChooserPainter", FileChooserPainter.Which.DIRECTORYICON_ENABLED));
    d.put("FileChooser.directoryIcon", new SeaGlassIcon("FileChooser", "directoryIconPainter", 16, 16));
    d.put("FileChooser[Enabled].upFolderIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.FileChooserPainter", FileChooserPainter.Which.UPFOLDERICON_ENABLED));
    d.put("FileChooser.upFolderIcon", new SeaGlassIcon("FileChooser", "upFolderIconPainter", 16, 16));
    d.put("FileChooser[Enabled].newFolderIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.FileChooserPainter", FileChooserPainter.Which.NEWFOLDERICON_ENABLED));
    d.put("FileChooser.newFolderIcon", new SeaGlassIcon("FileChooser", "newFolderIconPainter", 16, 16));
    d.put("FileChooser[Enabled].hardDriveIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.FileChooserPainter", FileChooserPainter.Which.HARDDRIVEICON_ENABLED));
    d.put("FileChooser.hardDriveIcon", new SeaGlassIcon("FileChooser", "hardDriveIconPainter", 16, 16));
    d.put("FileChooser[Enabled].floppyDriveIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.FileChooserPainter", FileChooserPainter.Which.FLOPPYDRIVEICON_ENABLED));
    d.put("FileChooser.floppyDriveIcon", new SeaGlassIcon("FileChooser", "floppyDriveIconPainter", 16, 16));
    d.put("FileChooser[Enabled].homeFolderIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.FileChooserPainter", FileChooserPainter.Which.HOMEFOLDERICON_ENABLED));
    d.put("FileChooser.homeFolderIcon", new SeaGlassIcon("FileChooser", "homeFolderIconPainter", 16, 16));
    d.put("FileChooser[Enabled].detailsViewIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.FileChooserPainter", FileChooserPainter.Which.DETAILSVIEWICON_ENABLED));
    d.put("FileChooser.detailsViewIcon", new SeaGlassIcon("FileChooser", "detailsViewIconPainter", 16, 16));
    d.put("FileChooser[Enabled].listViewIconPainter", new LazyPainter("com.seaglasslookandfeel.painter.FileChooserPainter", FileChooserPainter.Which.LISTVIEWICON_ENABLED));
    d.put("FileChooser.listViewIcon", new SeaGlassIcon("FileChooser", "listViewIconPainter", 16, 16));
}
 
Example 8
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Initialize the internal frame close button settings.
 *
 * @param d the UI defaults map.
 */
private void defineInternalFrameCloseButtons(UIDefaults d) {
    String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.closeButton\"";
    String c = PAINTER_PREFIX + "TitlePaneCloseButtonPainter";

    // Set the multiplicity of states for the Close button.
    d.put(p + ".States", "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused");
    d.put(p + ".WindowNotFocused", new TitlePaneCloseButtonWindowNotFocusedState());
    d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));

    d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_DISABLED));
    d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_ENABLED));
    d.put(p + "[MouseOver].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_MOUSEOVER));
    d.put(p + "[Pressed].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_PRESSED));
    d.put(p + "[Enabled+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_ENABLED_WINDOWNOTFOCUSED));
    d.put(p + "[MouseOver+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_MOUSEOVER));
    d.put(p + "[Pressed+WindowNotFocused].backgroundPainter", new LazyPainter(c, TitlePaneCloseButtonPainter.Which.BACKGROUND_PRESSED_WINDOWNOTFOCUSED));

    d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 43, 18));
}
 
Example 9
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Initialize the internal frame menu button settings.
 *
 * @param d the UI defaults map.
 */
private void defineInternalFrameMenuButtons(UIDefaults d) {
    String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.menuButton\"";
    String c = PAINTER_PREFIX + "TitlePaneMenuButtonPainter";

    d.put(p + ".WindowNotFocused", new TitlePaneMenuButtonWindowNotFocusedState());
    d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));

    // Set the states for the Menu button.
    d.put(p + "[Enabled].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_ENABLED));
    d.put(p + "[Disabled].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_DISABLED));
    d.put(p + "[MouseOver].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_MOUSEOVER));
    d.put(p + "[Pressed].iconPainter", new LazyPainter(c, TitlePaneMenuButtonPainter.Which.ICON_PRESSED));
    d.put(p + "[Enabled+WindowNotFocused].iconPainter",
          new LazyPainter(c,
                          TitlePaneMenuButtonPainter.Which.ICON_ENABLED_WINDOWNOTFOCUSED));
    d.put(p + "[MouseOver+WindowNotFocused].iconPainter",
          new LazyPainter(c,
                          TitlePaneMenuButtonPainter.Which.ICON_MOUSEOVER_WINDOWNOTFOCUSED));
    d.put(p + "[Pressed+WindowNotFocused].iconPainter",
          new LazyPainter(c,
                          TitlePaneMenuButtonPainter.Which.ICON_PRESSED_WINDOWNOTFOCUSED));

    d.put(p + ".icon", new SeaGlassIcon(p, "iconPainter", 19, 18));
}
 
Example 10
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 6 votes vote down vote up
/**
     * Initialize the popup settings.
     *
     * @param d the UI defaults map.
     */
    private void definePopups(UIDefaults d) {
        d.put("seaGlassPopupBorder", new ColorUIResource(0xbbbbbb));

        d.put("popupMenuInteriorEnabled", Color.WHITE);
        // Rossi: Changed color of popup / submenus to get better contrast to bright backgrounds.
//        d.put("popupMenuBorderEnabled", new Color(0xdddddd));
        d.put("popupMenuBorderEnabled", new Color(0x5b7ea4));

        String c = PAINTER_PREFIX + "PopupMenuPainter";
        String p = "PopupMenu";

        d.put(p + ".contentMargins", new InsetsUIResource(6, 1, 6, 1));
        d.put(p + ".opaque", Boolean.TRUE);
        d.put(p + ".consumeEventOnClose", Boolean.TRUE);
        d.put(p + "[Disabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_DISABLED));
        d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, PopupMenuPainter.Which.BACKGROUND_ENABLED));

        // Initialize PopupMenuSeparator
        c = PAINTER_PREFIX + "SeparatorPainter";
        p = "PopupMenuSeparator";
        d.put(p + ".contentMargins", new InsetsUIResource(1, 0, 2, 0));
        d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED));
    }
 
Example 11
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Initialize the scroll pane UI
 * @param d
 */
private void defineScrollPane(UIDefaults d) {
    // Define ScrollPane border painters.
    String c = PAINTER_PREFIX + "ScrollPanePainter";
    String p = "ScrollPane";
    d.put(p + ".opaque", Boolean.FALSE);
    d.put(p + ".contentMargins", new InsetsUIResource(3, 3, 3, 3));
    // d.put(p + ".useChildTextComponentFocus", Boolean.TRUE);
    d.put(p + ".backgroundPainter", new LazyPainter(c, ScrollPanePainter.Which.BACKGROUND_ENABLED));
    d.put(p + "[Enabled+Focused].borderPainter", new LazyPainter(c, ScrollPanePainter.Which.BORDER_ENABLED_FOCUSED));
    d.put(p + "[Enabled].borderPainter", new LazyPainter(c, ScrollPanePainter.Which.BORDER_ENABLED));

    // Store ScrollPane Corner Component
    d.put(p + ".cornerPainter", new LazyPainter(c, ScrollPanePainter.Which.CORNER_ENABLED));
    
    //Initialize Viewport
    p = "Viewport";
    d.put(p + ".contentMargins", new InsetsUIResource(0, 0, 0, 0));
    d.put(p + ".opaque", Boolean.TRUE);
}
 
Example 12
Source Project: CodenameOne   Source File: AWTConverters.java    License: GNU General Public License v2.0 6 votes vote down vote up
public void register(ConverterRegistry registry) {
  registry.addConverter(Dimension.class, String.class, this);
  registry.addConverter(String.class, Dimension.class, this);
  registry.addConverter(DimensionUIResource.class, String.class, this);

  registry.addConverter(Insets.class, String.class, this);
  registry.addConverter(String.class, Insets.class, this);
  registry.addConverter(InsetsUIResource.class, String.class, this);

  registry.addConverter(Point.class, String.class, this);
  registry.addConverter(String.class, Point.class, this);
  
  registry.addConverter(Rectangle.class, String.class, this);
  registry.addConverter(String.class, Rectangle.class, this);
  
  registry.addConverter(Font.class, String.class, this);
  registry.addConverter(FontUIResource.class, String.class, this);
}
 
Example 13
Source Project: java-swing-tips   Source File: MainPanel.java    License: MIT License 6 votes vote down vote up
private static void createAndShowGui() {
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    Insets m = UIManager.getInsets("TextField.margin");
    UIManager.put("TextField.margin", new InsetsUIResource(m.top, m.left + 5, m.bottom, m.right));
  } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
    ex.printStackTrace();
    Toolkit.getDefaultToolkit().beep();
  }
  JFrame frame = new JFrame("@[email protected]");
  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  frame.getContentPane().add(new MainPanel());
  frame.pack();
  frame.setLocationRelativeTo(null);
  frame.setVisible(true);
}
 
Example 14
Source Project: darklaf   Source File: PropertyLoader.java    License: MIT License 5 votes vote down vote up
private static Object parseInsets(final String value,
                                  final Map<Object, Object> accumulator,
                                  final UIDefaults currentDefaults, final IconLoader iconLoader) {
    List<Integer> insets = parseList((SimpleValueMapper<Integer>) Integer::parseInt, value, accumulator,
                                     currentDefaults, iconLoader, Character.MIN_VALUE, Character.MIN_VALUE,
                                     SEPARATOR);
    return new InsetsUIResource(insets.get(0), insets.get(1), insets.get(2), insets.get(3));
}
 
Example 15
Source Project: darklaf   Source File: DarkSpinnerBorder.java    License: MIT License 5 votes vote down vote up
@Override
public Insets getBorderInsets(final Component c) {
    if (SpinnerConstants.isTreeOrTableCellEditor(c)) {
        return CellUtil.adjustEditorInsets(new InsetsUIResource(cellInsets.top, cellInsets.left,
                                                                cellInsets.bottom, cellInsets.right),
                                           c);
    }
    return new InsetsUIResource(insets.top, insets.left, insets.bottom, insets.right);
}
 
Example 16
Source Project: darklaf   Source File: DarkInternalFrameBorder.java    License: MIT License 5 votes vote down vote up
@Override
public Insets getBorderInsets(final Component c) {
    if (c instanceof JInternalFrame && ((JInternalFrame) c).isMaximum()) {
        return new InsetsUIResource(0, 0, 0, 0);
    }
    updateOpacity(c);
    return super.getBorderInsets(c);
}
 
Example 17
Source Project: darklaf   Source File: DarkButtonBorder.java    License: MIT License 5 votes vote down vote up
public Insets getBorderInsets(final Component c) {
    if (ButtonConstants.isBorderlessRectangular(c)) {
        return new InsetsUIResource(borderlessRectangularInsets.top, borderlessRectangularInsets.left,
                                    borderlessRectangularInsets.bottom, borderlessRectangularInsets.right);
    }
    boolean shadowVariant = ButtonConstants.isBorderless(c);
    int shadow = shadowVariant ? 0 : getShadowSize();
    boolean square = ButtonConstants.isSquare(c);
    Insets pad = ButtonConstants.isThin(c)
            ? square ? squareThinInsets : thinInsets
            : square ? squareInsets : insets;
    return maskInsets(new InsetsUIResource(pad.top, pad.left, pad.bottom, pad.right), c, shadow);
}
 
Example 18
Source Project: darklaf   Source File: DarkComboBoxBorder.java    License: MIT License 5 votes vote down vote up
@Override
public Insets getBorderInsets(final Component c) {
    if (ComboBoxConstants.isTreeOrTableCellEditor(c)) {
        return CellUtil.adjustEditorInsets(new InsetsUIResource(cellPadding.top, cellPadding.left,
                                                                cellPadding.bottom, cellPadding.right),
                                           c);
    }
    if (c.getComponentOrientation().isLeftToRight()) {
        return new InsetsUIResource(boxPadding.top, boxPadding.left, boxPadding.bottom, borderSize);
    } else {
        return new InsetsUIResource(boxPadding.top, borderSize, boxPadding.bottom, boxPadding.right);
    }
}
 
Example 19
Source Project: darklaf   Source File: BubbleBorder.java    License: MIT License 5 votes vote down vote up
/**
 * Create new TextBubbleBorder.
 *
 * @param color       Colour of bubble.
 * @param thickness   Line thickness of border.
 * @param radius      corner radius of border.
 * @param pointerSize size of pointer. You can set this size to 0 to achieve no pointer, but it is not desirable.
 *                    The appropriate method for this is to set using {@link BubbleBorder#setPointerSide(Alignment)}
 *                    to. {@link Alignment#CENTER}
 */
public BubbleBorder(final Color color, final int thickness,
                    final int radius, final int pointerSize) {
    this.color = color;
    this.thickness = thickness;
    this.radius = radius;
    this.pointerSize = pointerSize;
    this.pointerWidth = pointerSize;
    insets = new InsetsUIResource(0, 0, 0, 0);
    setThickness(thickness);
}
 
Example 20
Source Project: FlatLaf   Source File: UIScale.java    License: Apache License 2.0 5 votes vote down vote up
public static Insets scale( Insets insets ) {
	initialize();
	return (insets == null || scaleFactor == 1f)
		? insets
		: (insets instanceof UIResource
			? new InsetsUIResource( scale( insets.top ), scale( insets.left ), scale( insets.bottom ), scale( insets.right ) )
			: new Insets          ( scale( insets.top ), scale( insets.left ), scale( insets.bottom ), scale( insets.right ) ));
}
 
Example 21
Source Project: FlatLaf   Source File: UIDefaultsLoader.java    License: Apache License 2.0 5 votes vote down vote up
private static Insets parseInsets( String value ) {
	List<String> numbers = split( value, ',' );
	try {
		return new InsetsUIResource(
			Integer.parseInt( numbers.get( 0 ) ),
			Integer.parseInt( numbers.get( 1 ) ),
			Integer.parseInt( numbers.get( 2 ) ),
			Integer.parseInt( numbers.get( 3 ) ) );
	} catch( NumberFormatException ex ) {
		throw new IllegalArgumentException( "invalid insets '" + value + "'" );
	}
}
 
Example 22
Source Project: nanoleaf-desktop   Source File: Main.java    License: MIT License 5 votes vote down vote up
private void initUIPrefs() {
    UIManager.put("TabbedPane.contentBorderInsets",
                  new InsetsUIResource(0, 0, 0, 0));
    UIManager.put("TabbedPane.focus", new Color(162, 184, 205));
    UIManager.put("TabbedPane.darkShadow", Color.DARK_GRAY);
    UIManager.put("TabbedPane.borderHightlightColor", Color.GRAY);
    UIManager.put("TabbedPane.light", Color.LIGHT_GRAY);
    UIManager.put("TabbedPane.selected", Color.DARK_GRAY);
}
 
Example 23
Source Project: whyline   Source File: WhylineTabbedPane.java    License: MIT License 5 votes vote down vote up
public WhylineTabbedPane() {
	
	super();
	
	setUI(new WhylineTabbedPaneUI());

	setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
	setFocusable(false);
	
	// Code to respond to clicks on the close icon in a tab.
	addMouseListener(new MouseAdapter() {
		public void mousePressed(MouseEvent e) {
			int index = indexAtLocation(e.getX(), e.getY());
			if(index == getSelectedIndex()) {
				Icon icon = getIconAt(index);
				if(icon != null) {
					Rectangle bounds = getBoundsAt(index);
					int width = icon.getIconWidth();
					Object ins = UIManager.get("TabbedPane.tabInsets");
					if(ins instanceof InsetsUIResource) {
						InsetsUIResource insets = (InsetsUIResource)ins;
						if(e.getX() > bounds.getX() + insets.left  && e.getX() < bounds.getX() + width + insets.left)
							selectedTabIconPressed(index);
					}
				}
			}
		}
	});
	
}
 
Example 24
Source Project: littleluck   Source File: LuckProgressBarUIBundle.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void installOther(UIDefaults table)
{
    UIManager.put(HORIZONTALSIZE, getDimensionRes(160, 10));

    UIManager.put(VERTICALSIZE, getDimensionRes(10, 160));

    UIManager.put(CELLBAR_INSETS, new InsetsUIResource(1, 2, 1, 2));
}
 
Example 25
Source Project: littleluck   Source File: LuckRootPaneUIBundle.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void installOther(UIDefaults table)
{
    table.put(TITLEPANEL_HEIGHT, 26);
    table.put(APPLICATION_TITLE_TEXTGAP, 5);
    table.put(APPLICATION_TITLE_INSETS, new InsetsUIResource(4, 6, 0, 0));
}
 
Example 26
Source Project: cuba   Source File: NimbusTheme.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void init() {
    super.init();

    UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults();
    lafDefaults.put("Nimbus.keepAlternateRowColor", true); // deny SwingX to remove alternate row color
    lafDefaults.put("ComboBox:\"ComboBox.textField\".contentMargins", new InsetsUIResource(0, 6, 0, 6));
    lafDefaults.put("ComboBox:\"ComboBox.textField\"[Enabled].backgroundPainter", MandatoryComboBoxTextFieldPainter.backgroundEnabledPainter());
    lafDefaults.put("ComboBox:\"ComboBox.textField\"[Disabled].backgroundPainter", MandatoryComboBoxTextFieldPainter.backgroundDisabledPainter());
    lafDefaults.put("ComboBox:\"ComboBox.textField\"[Selected].backgroundPainter", MandatoryComboBoxTextFieldPainter.backgroundSelectedPainter());
}
 
Example 27
Source Project: beautyeye   Source File: __UI__.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Ui impl.
 */
public static void uiImpl()
{
	UIManager.put("Spinner.background",new ColorUIResource(BeautyEyeLNFHelper.commonBackgroundColor));
	UIManager.put("Spinner.foreground",new ColorUIResource(BeautyEyeLNFHelper.commonForegroundColor));
	UIManager.put("SpinnerUI", org.jb2011.lnf.beautyeye.ch18_spinner.BESpinnerUI.class.getName());
	
	//Spinner组件的边框
	UIManager.put("Spinner.border", new BorderUIResource(new EmptyBorder(5, 5, 10, 5)));//windows lnf中默认是3, 3, 3, 3
	//Spinner组件的2个箭头按钮的内衬距
	UIManager.put("Spinner.arrowButtonInsets", new InsetsUIResource(1,0,2,2));//windows lnf中默认是1,1,1,1
	//Spinner组件的2个箭头按钮的默认大小
	UIManager.put("Spinner.arrowButtonSize",new Dimension(17,9));//windows lnf中默认是17,9
}
 
Example 28
Source Project: beautyeye   Source File: BEButtonUI.java    License: Apache License 2.0 5 votes vote down vote up
public Insets getBorderInsets(Component c, Insets insets)       {
    insets = super.getBorderInsets(c, insets);
        
    Insets margin = null;
    if (c instanceof AbstractButton) {
        Insets m = ((AbstractButton)c).getMargin();
        // if this is a toolbar button then ignore getMargin()
        // and subtract the padding added by the constructor
        if(c.getParent() instanceof JToolBar 
           && ! (c instanceof JRadioButton)
           && ! (c instanceof JCheckBox)
           && m instanceof InsetsUIResource) {
            insets.top -= 2;
            insets.left -= 2;
            insets.bottom -= 2;
            insets.right -= 2;
        } else {
            margin = m;
        }
    } else if (c instanceof JToolBar) {
        margin = ((JToolBar)c).getMargin();
    } else if (c instanceof JTextComponent) {
        margin = ((JTextComponent)c).getMargin();
    }
    if (margin != null) {
        insets.top    = margin.top + 2;
        insets.left   = margin.left + 2;
        insets.bottom = margin.bottom + 2;
        insets.right  = margin.right + 2;
    }
    return insets;
}
 
Example 29
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Define some settings for tool tips.
 * @param d
 */
private void defineToolTips(UIDefaults d) {
    String p = "ToolTip";
    d.put("seaGlassToolTipBorder", new Color(0x5b7ea4));
    d.put(p + ".contentMargins", new InsetsUIResource(4, 4, 4, 4));
    d.put(p + ".opaque", Boolean.FALSE);
    d.put(p + ".background", new ColorUIResource(0xd5, 0xe8, 0xf7));
    d.put(p + ".backgroundPainter", new ToolTipPainter(ToolTipPainter.Which.BORDER_ENABLED));
}
 
Example 30
Source Project: seaglass   Source File: SeaGlassLookAndFeel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the desktop pane UI settings.
 *
 * @param d the UI defaults map.
 */
private void defineDesktopPanes(UIDefaults d) {
    d.put("seaGlassDesktopPane", new ColorUIResource(0x556ba6));
    String c = PAINTER_PREFIX + "DesktopPanePainter";

    String p = "DesktopPane";

    d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopPanePainter.Which.BACKGROUND_ENABLED));

    // Initialize DesktopIcon
    p = "DesktopIcon";
    c = PAINTER_PREFIX + "DesktopIconPainter";
    d.put(p + ".contentMargins", new InsetsUIResource(0, 6, 5, 4));
    d.put(p + "[Enabled].backgroundPainter", new LazyPainter(c, DesktopIconPainter.Which.BACKGROUND_ENABLED));
}