Java Code Examples for javax.swing.UIManager#getInsets()
The following examples show how to use
javax.swing.UIManager#getInsets() .
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: ProfilerTabbedView.java From visualvm with GNU General Public License v2.0 | 6 votes |
private Rectangle offsetRect() { Rectangle rect = new Rectangle(); if (UIUtils.isNimbus()) { rect.height = 4; if (getTabPlacement() == JTabbedPane.TOP) rect.y -= rect.height; } else if (UIUtils.isGTKLookAndFeel()) { rect.height = 1; if (getTabPlacement() == JTabbedPane.TOP) rect.y -= rect.height++; } else { Insets tai = UIManager.getInsets("TabbedPane.tabAreaInsets"); // NOI18N Insets cbi = UIManager.getInsets("TabbedPane.contentBorderInsets"); // NOI18N if (tai != null && cbi != null) { if (getTabPlacement() == JTabbedPane.TOP) { rect.y -= cbi.bottom; rect.height -= rect.y; } else { rect.height = tai.bottom + cbi.bottom - 1; } } else { } } return rect; }
Example 2
Source File: AnnotationView.java From netbeans with Apache License 2.0 | 6 votes |
/** Creates a new instance of AnnotationViewBorder */ public AnnotationView(JTextComponent pane/*, List/ *<MarkProviderCreator>* / creators*/) { this.pane = pane; // Set the name to be able to check for this component when "errorStripeOnly" property // is turned on for the pane in CustomizableSideBar. setName("errorStripe"); repaintTask = WORKER.create(repaintTaskRunnable = new RepaintTask()); this.data = new AnnotationViewDataImpl(this, pane); this.scrollBar = UIManager.getInsets("Nb.Editor.ErrorStripe.ScrollBar.Insets"); // NOI18N FoldHierarchy fh = FoldHierarchy.get(pane); fh.addFoldHierarchyListener(WeakListeners.create(FoldHierarchyListener.class, this, fh)); pane.addPropertyChangeListener(WeakListeners.propertyChange(this, pane)); updateForNewDocument(); addMouseListener(this); addMouseMotionListener(this); setOpaque(true); setToolTipText(NbBundle.getMessage(AnnotationView.class,"TP_ErrorStripe")); }
Example 3
Source File: DesktopImpl.java From netbeans with Apache License 2.0 | 6 votes |
private void setViewComponent( Component component) { if (viewComponent == component) { return; } if (viewComponent != null) { desktop.remove(viewComponent); } viewComponent = component; if (viewComponent != null) { GridBagConstraints constr = new GridBagConstraints(); constr.gridx = 1; constr.gridy = 1; constr.fill = GridBagConstraints.BOTH; constr.weightx = 1; constr.weighty = 1; constr.anchor = GridBagConstraints.CENTER; Insets insets = UIManager.getInsets("nb.desktop.view.insets"); //NOI18N if( null != insets ) constr.insets = insets; desktop.add(component, constr); } layeredPane.revalidate(); layeredPane.repaint(); }
Example 4
Source File: FlatScrollBarUI.java From FlatLaf with Apache License 2.0 | 6 votes |
@Override protected void installDefaults() { super.installDefaults(); trackInsets = UIManager.getInsets( "ScrollBar.trackInsets" ); thumbInsets = UIManager.getInsets( "ScrollBar.thumbInsets" ); trackArc = UIManager.getInt( "ScrollBar.trackArc" ); thumbArc = UIManager.getInt( "ScrollBar.thumbArc" ); hoverTrackColor = UIManager.getColor( "ScrollBar.hoverTrackColor" ); hoverThumbColor = UIManager.getColor( "ScrollBar.hoverThumbColor" ); hoverThumbWithTrack = UIManager.getBoolean( "ScrollBar.hoverThumbWithTrack" ); pressedTrackColor = UIManager.getColor( "ScrollBar.pressedTrackColor" ); pressedThumbColor = UIManager.getColor( "ScrollBar.pressedThumbColor" ); pressedThumbWithTrack = UIManager.getBoolean( "ScrollBar.pressedThumbWithTrack" ); showButtons = UIManager.getBoolean( "ScrollBar.showButtons" ); arrowType = UIManager.getString( "Component.arrowType" ); buttonArrowColor = UIManager.getColor( "ScrollBar.buttonArrowColor" ); buttonDisabledArrowColor = UIManager.getColor( "ScrollBar.buttonDisabledArrowColor" ); hoverButtonBackground = UIManager.getColor( "ScrollBar.hoverButtonBackground" ); pressedButtonBackground = UIManager.getColor( "ScrollBar.pressedButtonBackground" ); }
Example 5
Source File: TabOverviewDialogWidget.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void installDefaults() { TabPreviewPainter previewPainter = TabPreviewUtilities.getTabPreviewPainter(this.jcomp); if ((previewPainter != null) && previewPainter.hasOverviewDialog(this.jcomp)) { Insets currTabAreaInsets = this.getTabAreaInsets(); if (currTabAreaInsets == null) currTabAreaInsets = UIManager.getInsets("TabbedPane.tabAreaInsets"); Insets tabAreaInsets = new Insets(currTabAreaInsets.top, SubstanceSizeUtils.getLookupButtonSize() + 2 + currTabAreaInsets.left, currTabAreaInsets.bottom, currTabAreaInsets.right); setTabAreaInsets(tabAreaInsets); this.jcomp.add(this.overviewButton); this.overviewButton.setVisible(true); this.jcomp.setComponentZOrder(this.overviewButton, 0); this.overviewButton.updateLocation(this.jcomp, tabAreaInsets); } }
Example 6
Source File: SeaGlassComboBoxUI.java From seaglass with Apache License 2.0 | 6 votes |
@Override protected void installDefaults() { // NOTE: This next line of code was added because, since squareButton in // BasicComboBoxUI is private, I need to have some way of reading it // from UIManager. // This is an incomplete solution (since it implies that squareButons, // once set, cannot be reset per state. Probably ok, but not always ok). // This line of code should be removed at the same time that // squareButton // is made protected in the super class. super.installDefaults(); // This is here instead of in updateStyle because the value for padding // needs to remain consistent with the value for padding in // BasicComboBoxUI. I wouldn't have this value here at all if not // for the fact that I cannot make "padding" protected in any way // for an update release. This *should* be fixed in Java 7 padding = UIManager.getInsets("ComboBox.padding"); updateStyle(comboBox); }
Example 7
Source File: FlatDatePickerUI.java From FlatLaf with Apache License 2.0 | 5 votes |
@Override public void installUI( JComponent c ) { // must get UI defaults here because installDefaults() is invoked after // installComponents(), which uses these values to create popup button padding = UIManager.getInsets( "ComboBox.padding" ); arrowType = UIManager.getString( "Component.arrowType" ); borderColor = UIManager.getColor( "Component.borderColor" ); disabledBorderColor = UIManager.getColor( "Component.disabledBorderColor" ); disabledBackground = UIManager.getColor( "ComboBox.disabledBackground" ); buttonBackground = UIManager.getColor( "ComboBox.buttonBackground" ); buttonArrowColor = UIManager.getColor( "ComboBox.buttonArrowColor" ); buttonDisabledArrowColor = UIManager.getColor( "ComboBox.buttonDisabledArrowColor" ); buttonHoverArrowColor = UIManager.getColor( "ComboBox.buttonHoverArrowColor" ); super.installUI( c ); LookAndFeel.installProperty( datePicker, "opaque", false ); // hack JXDatePicker.TodayPanel colors // (there is no need to uninstall these changes because only UIResources are used, // which are automatically replaced when switching LaF) JPanel linkPanel = datePicker.getLinkPanel(); if( linkPanel instanceof JXPanel && linkPanel.getClass().getName().equals( "org.jdesktop.swingx.JXDatePicker$TodayPanel" ) ) { ((JXPanel)linkPanel).setBackgroundPainter( null ); linkPanel.setBackground( UIManager.getColor( "JXMonthView.background" ) ); if( linkPanel.getComponentCount() >= 1 && linkPanel.getComponent( 0 ) instanceof JXHyperlink ) { JXHyperlink todayLink = (JXHyperlink) linkPanel.getComponent( 0 ); todayLink.setUnclickedColor( UIManager.getColor( "Hyperlink.linkColor" ) ); todayLink.setClickedColor( UIManager.getColor( "Hyperlink.visitedColor" ) ); } } }
Example 8
Source File: DataSourceWindowTabbedPane.java From visualvm with GNU General Public License v2.0 | 5 votes |
DataSourceWindowTabbedPane() { super(new BorderLayout()); tabpane = new ProfilerTabbedPane() { @Override protected void closeTab(Component component) { closeView((ViewContainer)component); } }; // tabpane.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT); // GH-52 - true would break Tab navigation tabpane.setFocusCycleRoot(false); // Clear default border for fill up the entire DataSourceWindow tabpane.setOpaque(false); if (UIManager.getLookAndFeel().getID().equals("Aqua")) { // NOI18N tabpane.setBorder(BorderFactory.createEmptyBorder(0, -11, -13, -10)); } else { tabpane.setBorder(BorderFactory.createEmptyBorder()); Insets i = UIManager.getInsets("TabbedPane.contentBorderInsets"); // NOI18N if (i != null) tabpane.setBorder(BorderFactory.createEmptyBorder(0, -i.left, -i.bottom, -i.right)); } add(tabpane, BorderLayout.CENTER); }
Example 9
Source File: FlatViewTabDisplayerUI.java From netbeans with Apache License 2.0 | 5 votes |
/** * Initialization of colors */ private static void initColors() { if (!colorsReady) { background = UIManager.getColor("ViewTab.background"); // NOI18N activeBackground = Utils.getUIColor("ViewTab.activeBackground", background); // NOI18N selectedBackground = Utils.getUIColor("ViewTab.selectedBackground", activeBackground); // NOI18N hoverBackground = UIManager.getColor("ViewTab.hoverBackground"); // NOI18N attentionBackground = UIManager.getColor("ViewTab.attentionBackground"); // NOI18N foreground = Utils.getUIColor("ViewTab.foreground", "TabbedPane.foreground"); // NOI18N activeForeground = Utils.getUIColor("ViewTab.activeForeground", foreground); // NOI18N selectedForeground = Utils.getUIColor("ViewTab.selectedForeground", activeForeground); // NOI18N hoverForeground = Utils.getUIColor("ViewTab.hoverForeground", foreground); // NOI18N attentionForeground = Utils.getUIColor("ViewTab.attentionForeground", foreground); // NOI18N underlineColor = UIManager.getColor("ViewTab.underlineColor"); // NOI18N inactiveUnderlineColor = UIManager.getColor("ViewTab.inactiveUnderlineColor"); // NOI18N tabSeparatorColor = UIManager.getColor("ViewTab.tabSeparatorColor"); // NOI18N contentBorderColor = UIManager.getColor("TabbedContainer.view.contentBorderColor"); // NOI18N tabInsets = UIManager.getInsets("ViewTab.tabInsets"); // NOI18N underlineHeight = UIManager.getInt("ViewTab.underlineHeight"); // NOI18N underlineAtTop = UIManager.getBoolean("ViewTab.underlineAtTop"); // NOI18N showTabSeparators = UIManager.getBoolean("ViewTab.showTabSeparators"); // NOI18N // scale on Java 8 and Linux tabInsets = UIScale.scale(tabInsets); underlineHeight = UIScale.scale(underlineHeight); colorsReady = true; } }
Example 10
Source File: SlidingButton.java From netbeans with Apache License 2.0 | 5 votes |
/** Create a new button representing TabData from the model. * * @param buttonData Tab data as text, icon, tooltip etc. * @param orientation horizontal/vertical orientation of the button */ public SlidingButton(TabData buttonData, int orientation) { super(buttonData.getText(), buttonData.getIcon(), false); // grab the text from client property // XXX please rewrite when API is invented - see issue #55955 Component comp = buttonData.getComponent(); if (comp instanceof JComponent) { Object slidingName = ((JComponent)comp).getClientProperty("SlidingName"); if (slidingName instanceof String) { setText((String)slidingName); } } this.orientation = orientation; data = buttonData; setFocusable(false); setRolloverEnabled(true); setIconTextGap(4); setVerticalAlignment(SwingConstants.CENTER); setHorizontalAlignment(SwingConstants.CENTER); if ("Nimbus".equals(UIManager.getLookAndFeel().getID())) { Insets insets = UIManager.getInsets("Button.contentMargins"); if (insets != null) { setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.right)); } else { setBorder(BorderFactory.createEmptyBorder(6, 14, 6, 14)); } } else if( isAqua ) { setBorder(BorderFactory.createEmptyBorder(4,10,4,10)); putClientProperty("JComponent.sizeVariant", "small"); setOpaque(false); } else { setMargin(new Insets(0,3,0,3)); } setBorderPainted(false); }
Example 11
Source File: LuckProgressBarUI.java From littleluck with Apache License 2.0 | 5 votes |
@Override public void installUI(JComponent c) { super.installUI(c); cellBarInsets = UIManager.getInsets(LuckProgressBarUIBundle.CELLBAR_INSETS); }
Example 12
Source File: FlatButtonUI.java From FlatLaf with Apache License 2.0 | 4 votes |
@Override protected void installDefaults( AbstractButton b ) { super.installDefaults( b ); if( !defaults_initialized ) { String prefix = getPropertyPrefix(); minimumWidth = UIManager.getInt( prefix + "minimumWidth" ); iconTextGap = FlatUIUtils.getUIInt( prefix + "iconTextGap", 4 ); background = UIManager.getColor( prefix + "background" ); foreground = UIManager.getColor( prefix + "foreground" ); startBackground = UIManager.getColor( prefix + "startBackground" ); endBackground = UIManager.getColor( prefix + "endBackground" ); focusedBackground = UIManager.getColor( prefix + "focusedBackground" ); hoverBackground = UIManager.getColor( prefix + "hoverBackground" ); pressedBackground = UIManager.getColor( prefix + "pressedBackground" ); disabledBackground = UIManager.getColor( prefix + "disabledBackground" ); disabledText = UIManager.getColor( prefix + "disabledText" ); if( UIManager.getBoolean( "Button.paintShadow" ) ) { shadowWidth = FlatUIUtils.getUIInt( "Button.shadowWidth", 2 ); shadowColor = UIManager.getColor( "Button.shadowColor" ); defaultShadowColor = UIManager.getColor( "Button.default.shadowColor" ); } else { shadowWidth = 0; shadowColor = null; defaultShadowColor = null; } defaultBackground = FlatUIUtils.getUIColor( "Button.default.startBackground", "Button.default.background" ); defaultEndBackground = UIManager.getColor( "Button.default.endBackground" ); defaultForeground = UIManager.getColor( "Button.default.foreground" ); defaultFocusedBackground = UIManager.getColor( "Button.default.focusedBackground" ); defaultHoverBackground = UIManager.getColor( "Button.default.hoverBackground" ); defaultPressedBackground = UIManager.getColor( "Button.default.pressedBackground" ); defaultBoldText = UIManager.getBoolean( "Button.default.boldText" ); toolbarSpacingInsets = UIManager.getInsets( "Button.toolbar.spacingInsets" ); toolbarHoverBackground = UIManager.getColor( prefix + "toolbar.hoverBackground" ); toolbarPressedBackground = UIManager.getColor( prefix + "toolbar.pressedBackground" ); helpButtonIcon = UIManager.getIcon( "HelpButton.icon" ); defaults_initialized = true; } if( startBackground != null ) { Color bg = b.getBackground(); if( bg == null || bg instanceof UIResource ) b.setBackground( startBackground ); } LookAndFeel.installProperty( b, "opaque", false ); LookAndFeel.installProperty( b, "iconTextGap", scale( iconTextGap ) ); MigLayoutVisualPadding.install( b ); }
Example 13
Source File: FlatInternalFrameUI.java From FlatLaf with Apache License 2.0 | 4 votes |
public FlatInternalFrameBorder() { super( UIManager.getInsets( "InternalFrame.borderMargins" ) ); }
Example 14
Source File: FlatListCellBorder.java From FlatLaf with Apache License 2.0 | 4 votes |
protected FlatListCellBorder() { super( UIManager.getInsets( "List.cellMargins" ), UIManager.getColor( "List.cellFocusColor" ) ); }
Example 15
Source File: FlatTableCellBorder.java From FlatLaf with Apache License 2.0 | 4 votes |
protected FlatTableCellBorder() { super( UIManager.getInsets( "Table.cellMargins" ), UIManager.getColor( "Table.cellFocusColor" ) ); }
Example 16
Source File: FlatPopupFactory.java From FlatLaf with Apache License 2.0 | 4 votes |
private Border createDropShadowBorder() { return new FlatDropShadowBorder( UIManager.getColor( "Popup.dropShadowColor" ), UIManager.getInsets( "Popup.dropShadowInsets" ), FlatUIUtils.getUIFloat( "Popup.dropShadowOpacity", 0.5f ) ); }
Example 17
Source File: FlatPopupMenuBorder.java From FlatLaf with Apache License 2.0 | 4 votes |
public FlatPopupMenuBorder() { super( UIManager.getInsets( "PopupMenu.borderInsets" ), UIManager.getColor( "PopupMenu.borderColor" ) ); }
Example 18
Source File: ProfilerTabbedView.java From visualvm with GNU General Public License v2.0 | 4 votes |
protected final ProfilerTabbedPane createTabs(int tabPlacement, int tabLayoutPolicy, boolean minimizeOuterMargin) { ProfilerTabbedPane tp = new ProfilerTabbedPane() { @Override protected void closeTab(Component component) { removeView(((TabbedPaneViewport)component).getView()); } }; // JTabbedPane tp = TabbedPaneFactory.createCloseButtonTabbedPane(); // JTabbedPane tp = new JTabbedPane(); tp.setTabPlacement(tabPlacement); tp.setTabLayoutPolicy(tabLayoutPolicy); tp.setOpaque(false); if (minimizeOuterMargin) { if (UIUtils.isAquaLookAndFeel()) { tp.setBorder(BorderFactory.createEmptyBorder(-13, -11, 0, -10)); } else if (UIUtils.isNimbusLookAndFeel()) { if (tabPlacement == JTabbedPane.TOP) tp.setBorder(BorderFactory.createEmptyBorder(-4, 0, 0, 0)); else tp.setBorder(BorderFactory.createEmptyBorder(0, 0, -4, 0)); } else { tp.setBorder(BorderFactory.createEmptyBorder()); Insets i = UIManager.getInsets("TabbedPane.contentBorderInsets"); // NOI18N int bottomOffset = 0; if (UIUtils.isMetalLookAndFeel()) { bottomOffset = -i.bottom + 1; } else if (UIUtils.isWindowsLookAndFeel()) { bottomOffset = -i.bottom; } // if (i != null) tp.setBorder(BorderFactory.createEmptyBorder(-i.top, -i.left, -i.bottom, -i.right)); if (i != null) tp.setBorder(BorderFactory.createEmptyBorder(-i.top, -i.left, bottomOffset, -i.right)); } } // Fix for Issue 115062 (CTRL-PageUp/PageDown should move between snapshot tabs) tp.getActionMap().getParent().remove("navigatePageUp"); // NOI18N tp.getActionMap().getParent().remove("navigatePageDown"); // NOI18N tp.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { if (listener != null) listener.stateChanged(e); } }); return tp; }
Example 19
Source File: FlatToolBarBorder.java From FlatLaf with Apache License 2.0 | 4 votes |
public FlatToolBarBorder() { super( UIManager.getInsets( "ToolBar.borderMargins" ) ); }
Example 20
Source File: FlatTaskPaneUI.java From FlatLaf with Apache License 2.0 | 4 votes |
@Override protected Border createContentPaneBorder() { return new FlatContentPaneBorder( UIManager.getColor( "TaskPane.borderColor" ), UIManager.getInsets( "TaskPane.contentInsets" ) ); }