idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
37,200 | protected void propertyChange ( PropertyChangeEvent evt ) { super . propertyChange ( evt ) ; String name = evt . getPropertyName ( ) ; if ( name . equals ( "foreground" ) ) { updateForeground ( ( Color ) evt . getNewValue ( ) ) ; } else if ( name . equals ( "font" ) ) { updateFont ( ( Font ) evt . getNewValue ( ) ) ; }... | This method gets called when a bound property is changed on the associated JTextComponent . This is a hook which UI implementations may change to reflect how the UI displays bound properties of JTextComponent subclasses . If the font foreground or document has changed the the appropriate property is set in the default ... |
37,201 | private void updateForeground ( Color color ) { StyledDocument doc = ( StyledDocument ) getComponent ( ) . getDocument ( ) ; Style style = doc . getStyle ( StyleContext . DEFAULT_STYLE ) ; if ( style == null ) { return ; } if ( color == null ) { style . removeAttribute ( StyleConstants . Foreground ) ; } else { StyleCo... | Update the color in the default style of the document . |
37,202 | private void updateFont ( Font font ) { StyledDocument doc = ( StyledDocument ) getComponent ( ) . getDocument ( ) ; Style style = doc . getStyle ( StyleContext . DEFAULT_STYLE ) ; if ( style == null ) { return ; } if ( font == null ) { style . removeAttribute ( StyleConstants . FontFamily ) ; style . removeAttribute (... | Update the font in the default style of the document . |
37,203 | private static Object invokeGetter ( Object obj , String methodName , Object defaultValue ) { try { Method method = obj . getClass ( ) . getMethod ( methodName , new Class [ 0 ] ) ; Object result = method . invoke ( obj , new Object [ 0 ] ) ; return result ; } catch ( NoSuchMethodException e ) { return defaultValue ; }... | Invokes the specified getter method if it exists . |
37,204 | public Paint getFrameBorderPaint ( Shape s ) { switch ( state ) { case BACKGROUND_ENABLED : return frameBorderInactive ; case BACKGROUND_ENABLED_WINDOWFOCUSED : return frameBorderActive ; } return null ; } | Get the paint for the border . |
37,205 | public Paint getFrameInteriorPaint ( Shape s , int titleHeight , int topToolBarHeight , int bottomToolBarHeight ) { return createFrameGradient ( s , titleHeight , topToolBarHeight , bottomToolBarHeight , getFrameInteriorColors ( ) ) ; } | Get the paint for the frame interior . |
37,206 | public Paint getFrameInnerHighlightPaint ( Shape s ) { switch ( state ) { case BACKGROUND_ENABLED : return frameInnerHighlightInactive ; case BACKGROUND_ENABLED_WINDOWFOCUSED : return frameInnerHighlightActive ; } return null ; } | Get the paint to paint the inner highlight with . |
37,207 | public Paint getFocusPaint ( Shape s , FocusType focusType , boolean useToolBarFocus ) { if ( focusType == FocusType . OUTER_FOCUS ) { return useToolBarFocus ? outerToolBarFocus : outerFocus ; } else { return useToolBarFocus ? innerToolBarFocus : innerFocus ; } } | Get the paint to use for a focus ring . |
37,208 | protected final Color decodeColor ( String key , float hOffset , float sOffset , float bOffset , int aOffset ) { if ( UIManager . getLookAndFeel ( ) instanceof SeaGlassLookAndFeel ) { SeaGlassLookAndFeel laf = ( SeaGlassLookAndFeel ) UIManager . getLookAndFeel ( ) ; return laf . getDerivedColor ( key , hOffset , sOffse... | Decodes and returns a color which is derived from a base color in UI defaults . |
37,209 | public static int deriveARGB ( Color color1 , Color color2 , float midPoint ) { int r = color1 . getRed ( ) + ( int ) ( ( color2 . getRed ( ) - color1 . getRed ( ) ) * midPoint + 0.5f ) ; int g = color1 . getGreen ( ) + ( int ) ( ( color2 . getGreen ( ) - color1 . getGreen ( ) ) * midPoint + 0.5f ) ; int b = color1 . g... | Derives the ARGB value for a color based on an offset between two other colors . |
37,210 | protected final LinearGradientPaint createGradient ( float x1 , float y1 , float x2 , float y2 , float [ ] midpoints , Color [ ] colors ) { if ( x1 == x2 && y1 == y2 ) { y2 += .00001f ; } return new LinearGradientPaint ( x1 , y1 , x2 , y2 , midpoints , colors ) ; } | Given parameters for creating a LinearGradientPaint this method will create and return a linear gradient paint . One primary purpose for this method is to avoid creating a LinearGradientPaint where the start and end points are equal . In such a case the end y point is slightly increased to avoid the overlap . |
37,211 | protected final RadialGradientPaint createRadialGradient ( float x , float y , float r , float [ ] midpoints , Color [ ] colors ) { if ( r == 0f ) { r = .00001f ; } return new RadialGradientPaint ( x , y , r , midpoints , colors ) ; } | Given parameters for creating a RadialGradientPaint this method will create and return a radial gradient paint . One primary purpose for this method is to avoid creating a RadialGradientPaint where the radius is non - positive . In such a case the radius is just slightly increased to avoid 0 . |
37,212 | protected Paint createVerticalGradient ( Shape s , TwoColors colors ) { Rectangle2D bounds = s . getBounds2D ( ) ; float xCenter = ( float ) bounds . getCenterX ( ) ; float yMin = ( float ) bounds . getMinY ( ) ; float yMax = ( float ) bounds . getMaxY ( ) ; return createGradient ( xCenter , yMin , xCenter , yMax , new... | Creates a simple vertical gradient using the shape for bounds and the colors for top and bottom colors . |
37,213 | protected Paint createHorizontalGradient ( Shape s , TwoColors colors ) { Rectangle2D bounds = s . getBounds2D ( ) ; float xMin = ( float ) bounds . getMinX ( ) ; float xMax = ( float ) bounds . getMaxX ( ) ; float yCenter = ( float ) bounds . getCenterY ( ) ; return createGradient ( xMin , yCenter , xMax , yCenter , n... | Creates a simple horizontal gradient using the shape for bounds and the colors for top and bottom colors . |
37,214 | protected Paint createHorizontalGradient ( Shape s , FourColors colors ) { Rectangle2D bounds = s . getBounds2D ( ) ; float x = ( float ) bounds . getX ( ) ; float y = ( float ) bounds . getY ( ) ; float w = ( float ) bounds . getWidth ( ) ; float h = ( float ) bounds . getHeight ( ) ; return createGradient ( x , ( 0.5... | Creates a simple horizontal gradient using the shape for bounds and the colors for top two middle and bottom colors . |
37,215 | protected Color desaturate ( Color color ) { float [ ] tmp = Color . RGBtoHSB ( color . getRed ( ) , color . getGreen ( ) , color . getBlue ( ) , null ) ; tmp [ 1 ] /= 3.0f ; tmp [ 2 ] = clamp ( 1.0f - ( 1.0f - tmp [ 2 ] ) / 3f ) ; return new Color ( ( Color . HSBtoRGB ( tmp [ 0 ] , tmp [ 1 ] , tmp [ 2 ] ) & 0xFFFFFF )... | Returns a new color with the saturation cut to one third the original and the brightness moved one third closer to white . |
37,216 | private void paintWithCaching ( Graphics2D g , JComponent c , int w , int h , Object [ ] extendedCacheKeys ) { VolatileImage img = getImage ( g . getDeviceConfiguration ( ) , c , w , h , extendedCacheKeys ) ; if ( img != null ) { g . drawImage ( img , 0 , 0 , null ) ; } else { paintDirectly ( g , c , w , h , extendedCa... | Paint the component using a cached image if possible . |
37,217 | private void paintDirectly ( Graphics2D g , JComponent c , int w , int h , Object [ ] extendedCacheKeys ) { g = ( Graphics2D ) g . create ( ) ; configureGraphics ( g ) ; doPaint ( g , c , w , h , extendedCacheKeys ) ; g . dispose ( ) ; } | Convenience method which creates a temporary graphics object by creating a clone of the passed in one configuring it drawing with it disposing it . These steps have to be taken to ensure that any hints set on the graphics are removed subsequent to painting . |
37,218 | private VolatileImage getImage ( GraphicsConfiguration config , JComponent c , int w , int h , Object [ ] extendedCacheKeys ) { ImageCache imageCache = ImageCache . getInstance ( ) ; VolatileImage buffer = ( VolatileImage ) imageCache . getImage ( config , w , h , this , extendedCacheKeys ) ; int renderCounter = 0 ; do... | Gets the rendered image for this painter at the requested size either from cache or create a new one |
37,219 | private void updateStyle ( JTabbedPane c ) { SeaGlassContext context = getContext ( c , ENABLED ) ; SynthStyle oldStyle = style ; style = SeaGlassLookAndFeel . updateStyle ( context , this ) ; tabPlacement = tabPane . getTabPlacement ( ) ; orientation = ControlOrientation . getOrientation ( tabPlacement == LEFT || tabP... | Update the Synth styles when something changes . |
37,220 | protected void scrollBackward ( ) { int selectedIndex = tabPane . getSelectedIndex ( ) ; if ( -- selectedIndex < 0 ) { tabPane . setSelectedIndex ( tabPane . getTabCount ( ) == 0 ? - 1 : 0 ) ; } else { tabPane . setSelectedIndex ( selectedIndex ) ; } tabPane . repaint ( ) ; } | Scroll the tab buttons backwards . |
37,221 | protected void scrollForward ( ) { int selectedIndex = tabPane . getSelectedIndex ( ) ; if ( ++ selectedIndex >= tabPane . getTabCount ( ) ) { tabPane . setSelectedIndex ( tabPane . getTabCount ( ) - 1 ) ; } else { tabPane . setSelectedIndex ( selectedIndex ) ; } tabPane . repaint ( ) ; } | Scroll the tab buttons forwards . |
37,222 | public SeaGlassContext getContext ( JComponent c , int state ) { return SeaGlassContext . getContext ( SeaGlassContext . class , c , SeaGlassLookAndFeel . getRegion ( c ) , style , state ) ; } | Create a SynthContext for the component and state . Use the default region . |
37,223 | public SeaGlassContext getContext ( JComponent c , Region subregion ) { return getContext ( c , subregion , getComponentState ( c ) ) ; } | Create a SynthContext for the component and subregion . Use the current state . |
37,224 | private SeaGlassContext getContext ( JComponent c , Region subregion , int state ) { SynthStyle style = null ; Class klass = SeaGlassContext . class ; if ( subregion == Region . TABBED_PANE_TAB ) { style = tabStyle ; } else if ( subregion == Region . TABBED_PANE_TAB_AREA ) { style = tabAreaStyle ; } else if ( subregion... | Create a SynthContext for the component subregion and state . |
37,225 | public int getCloseButtonState ( JComponent c , int tabIndex , boolean tabIsMousedOver ) { if ( ! c . isEnabled ( ) ) { return DISABLED ; } else if ( tabIndex == closeButtonArmedIndex ) { return PRESSED ; } else if ( tabIndex == closeButtonHoverIndex ) { return FOCUSED ; } else if ( tabIsMousedOver ) { return MOUSE_OVE... | Get the state for the specified tab s close button . |
37,226 | protected void paint ( SeaGlassContext context , Graphics g ) { int selectedIndex = tabPane . getSelectedIndex ( ) ; ensureCurrentLayout ( ) ; paintContentBorder ( tabContentContext , g , tabPlacement , selectedIndex ) ; paintTabArea ( g , tabPlacement , selectedIndex ) ; } | Paint the tabbed pane . |
37,227 | protected void paintTabArea ( SeaGlassContext ss , Graphics g , int tabPlacement , int selectedIndex , Rectangle tabAreaBounds ) { Rectangle clipRect = g . getClipBounds ( ) ; ss . setComponentState ( SynthConstants . ENABLED ) ; SeaGlassLookAndFeel . updateSubregion ( ss , g , tabAreaBounds ) ; ss . getPainter ( ) . p... | Paint the tab area including the tabs . |
37,228 | protected void paintTab ( SeaGlassContext ss , Graphics g , Rectangle [ ] rects , int tabIndex , Rectangle iconRect , Rectangle textRect ) { Rectangle tabRect = rects [ tabIndex ] ; int selectedIndex = tabPane . getSelectedIndex ( ) ; boolean isSelected = selectedIndex == tabIndex ; JComponent b = ss . getComponent ( )... | Paint a tab . |
37,229 | protected Rectangle paintCloseButton ( Graphics g , SynthContext tabContext , int tabIndex ) { Rectangle tabRect = new Rectangle ( rects [ tabIndex ] ) ; Rectangle bounds = getCloseButtonBounds ( tabIndex ) ; int offset = bounds . width + textIconGap ; boolean onLeft = isCloseButtonOnLeft ( ) ; if ( onLeft ) { tabRect ... | Paint the close button for a tab . |
37,230 | protected void paintScrollButtonBackground ( SeaGlassContext ss , Graphics g , JButton scrollButton ) { Rectangle tabRect = scrollButton . getBounds ( ) ; int x = tabRect . x ; int y = tabRect . y ; int height = tabRect . height ; int width = tabRect . width ; boolean flipSegments = ( orientation == ControlOrientation ... | Paint the background for a tab scroll button . |
37,231 | protected void layoutLabel ( SeaGlassContext ss , int tabPlacement , FontMetrics metrics , int tabIndex , String title , Icon icon , Rectangle tabRect , Rectangle iconRect , Rectangle textRect , boolean isSelected ) { View v = getTextViewForTab ( tabIndex ) ; if ( v != null ) { tabPane . putClientProperty ( "html" , v ... | Layout label text for a tab . |
37,232 | protected void paintText ( SeaGlassContext ss , Graphics g , int tabPlacement , Font font , FontMetrics metrics , int tabIndex , String title , Rectangle textRect , boolean isSelected ) { g . setFont ( font ) ; View v = getTextViewForTab ( tabIndex ) ; if ( v != null ) { v . paint ( g , textRect ) ; } else { int mnemIn... | Paint the label text for a tab . |
37,233 | protected void paintContentBorder ( SeaGlassContext ss , Graphics g , int tabPlacement , int selectedIndex ) { int width = tabPane . getWidth ( ) ; int height = tabPane . getHeight ( ) ; Insets insets = tabPane . getInsets ( ) ; int x = insets . left ; int y = insets . top ; int w = width - insets . right - insets . le... | Paint the content pane s border . |
37,234 | private void ensureCurrentLayout ( ) { if ( ! tabPane . isValid ( ) ) { tabPane . validate ( ) ; } if ( ! tabPane . isValid ( ) ) { TabbedPaneLayout layout = ( TabbedPaneLayout ) tabPane . getLayout ( ) ; layout . calculateLayoutInfo ( ) ; } } | Make sure we have laid out the pane with the current layout . |
37,235 | private void updateTabContext ( int index , boolean selected , boolean isMouseDown , boolean isMouseOver , boolean hasFocus ) { int state = 0 ; if ( ! tabPane . isEnabled ( ) || ! tabPane . isEnabledAt ( index ) ) { state |= SynthConstants . DISABLED ; if ( selected ) { state |= SynthConstants . SELECTED ; } } else if ... | Update the SynthContext for the tab area for a specified tab . |
37,236 | protected boolean isOverCloseButton ( int x , int y ) { if ( tabCloseButtonPlacement != CENTER ) { int tabCount = tabPane . getTabCount ( ) ; for ( int i = 0 ; i < tabCount ; i ++ ) { if ( getCloseButtonBounds ( i ) . contains ( x , y ) ) { closeButtonHoverIndex = i ; return true ; } } } closeButtonHoverIndex = - 1 ; r... | Determine whether the mouse is over a tab close button and if so set the hover index . |
37,237 | protected Rectangle getCloseButtonBounds ( int tabIndex ) { Rectangle bounds = new Rectangle ( rects [ tabIndex ] ) ; bounds . width = closeButtonSize ; bounds . height = closeButtonSize ; bounds . y += ( rects [ tabIndex ] . height - closeButtonSize - closeButtonInsets . top - closeButtonInsets . bottom ) / 2 + closeB... | Get the bounds for a tab close button . |
37,238 | protected void doClose ( int tabIndex ) { if ( tabCloseListener == null || tabCloseListener . tabAboutToBeClosed ( tabIndex ) ) { String title = tabPane . getTitleAt ( tabIndex ) ; Component component = tabPane . getComponentAt ( tabIndex ) ; tabPane . removeTabAt ( tabIndex ) ; if ( tabCloseListener != null ) { tabClo... | Called when a close tab button is pressed . |
37,239 | private void paintCheckIconDisabledAndSelected ( Graphics2D g , int width , int height ) { Shape s = shapeGenerator . createCheckMark ( 0 , 0 , width , height ) ; g . setPaint ( iconDisabledSelected ) ; g . fill ( s ) ; } | Paint the check mark in disabled state . |
37,240 | public void initialize ( ) { super . initialize ( ) ; setStyleFactory ( new SynthStyleFactory ( ) { public SynthStyle getStyle ( JComponent c , Region r ) { SynthStyle style = getSeaGlassStyle ( c , r ) ; if ( ! ( style instanceof SeaGlassStyle ) ) { style = new SeaGlassStyleWrapper ( style ) ; } return style ; } } ) ;... | Called by UIManager when this look and feel is installed . |
37,241 | public UIDefaults getDefaults ( ) { if ( uiDefaults == null ) { uiDefaults = new UIWrapper ( super . getDefaults ( ) ) ; if ( PlatformUtils . isWindows ( ) ) { WindowsKeybindings . installKeybindings ( uiDefaults ) ; } else if ( PlatformUtils . isMac ( ) ) { MacKeybindings . installKeybindings ( uiDefaults ) ; } else {... | Returns the defaults for SeaGlassLookAndFeel . |
37,242 | 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 ... | Define some settings for tool tips . |
37,243 | private void useOurUIs ( ) { for ( String uiName : UI_LIST ) { uiName = uiName + "UI" ; uiDefaults . put ( uiName , UI_PACKAGE_PREFIX + uiName ) ; } } | Use our UI delegate for the specified UI control type . |
37,244 | protected Font initializeDefaultFont ( ) { if ( defaultFont == null ) { if ( PlatformUtils . isMac ( ) ) { defaultFont = new Font ( "Lucida Grande" , Font . PLAIN , 13 ) ; } if ( defaultFont == null ) { defaultFont = new Font ( "Dialog" , Font . PLAIN , 13 ) ; } if ( defaultFont == null ) { defaultFont = new Font ( "Sa... | Initialize the default font . |
37,245 | private void defineAquaSettings ( UIDefaults d ) { try { Class < ? > lnfClass = Class . forName ( UIManager . getSystemLookAndFeelClassName ( ) , true , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; LookAndFeel aqua = ( LookAndFeel ) lnfClass . newInstance ( ) ; UIDefaults aquaDefaults = aqua . getDefaults... | Use Aqua settings for some properties if we re on a Mac . |
37,246 | private void defineArrowButtons ( UIDefaults d ) { String c = PAINTER_PREFIX + "ArrowButtonPainter" ; String p = "ArrowButton" ; d . put ( p + ".States" , "Enabled,MouseOver,Disabled,Pressed" ) ; d . put ( p + "[Disabled].foreground" , new ColorUIResource ( 0x9ba8cf ) ) ; d . put ( p + "[Enabled].foreground" , new Colo... | Initialize the arrow button settings . |
37,247 | 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 the desktop pane UI settings . |
37,248 | private void defineInternalFrameCloseButtons ( UIDefaults d ) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.closeButton\"" ; String c = PAINTER_PREFIX + "TitlePaneCloseButtonPainter" ; d . put ( p + ".States" , "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused" ) ; d . ... | Initialize the internal frame close button settings . |
37,249 | private void defineInternalFrameIconifyButtons ( UIDefaults d ) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.iconifyButton\"" ; String c = PAINTER_PREFIX + "TitlePaneIconifyButtonPainter" ; d . put ( p + ".States" , "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,WindowNotFocused,Win... | Initialize the internal frame iconify button settings . |
37,250 | private void defineInternalFrameMaximizeButton ( UIDefaults d ) { String p = "InternalFrame:InternalFrameTitlePane:\"InternalFrameTitlePane.maximizeButton\"" ; String c = PAINTER_PREFIX + "TitlePaneMaximizeButtonPainter" ; d . put ( p + ".WindowNotFocused" , new TitlePaneMaximizeButtonWindowNotFocusedState ( ) ) ; d . ... | Initialize the internal frame maximize button settings . |
37,251 | 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 + ".con... | Initialize the internal frame menu button settings . |
37,252 | private void defineLists ( UIDefaults d ) { String p = "List" ; d . put ( p + ".contentMargins" , new InsetsUIResource ( 0 , 0 , 0 , 0 ) ) ; d . put ( p + ".opaque" , Boolean . TRUE ) ; d . put ( p + ".background" , d . get ( "seaGlassLightBackground" ) ) ; d . put ( p + ".dropLineColor" , d . get ( "seaGlassFocus" ) )... | Initialize the list settings . |
37,253 | private void definePanels ( UIDefaults d ) { String p = "Panel" ; d . put ( p + ".contentMargins" , new InsetsUIResource ( 0 , 0 , 0 , 0 ) ) ; d . put ( p + ".background" , new ColorUIResource ( ( Color ) d . get ( "control" ) ) ) ; d . put ( p + ".opaque" , Boolean . TRUE ) ; } | Initialize the panel settings . |
37,254 | private void definePopups ( UIDefaults d ) { d . put ( "seaGlassPopupBorder" , new ColorUIResource ( 0xbbbbbb ) ) ; d . put ( "popupMenuInteriorEnabled" , Color . WHITE ) ; d . put ( "popupMenuBorderEnabled" , new Color ( 0x5b7ea4 ) ) ; String c = PAINTER_PREFIX + "PopupMenuPainter" ; String p = "PopupMenu" ; d . put (... | Initialize the popup settings . |
37,255 | private void defineProgressBars ( UIDefaults d ) { d . put ( "ProgressBar.contentMargins" , new InsetsUIResource ( 0 , 0 , 0 , 0 ) ) ; d . put ( "ProgressBar.States" , "Enabled,Disabled,Indeterminate,Finished" ) ; d . put ( "ProgressBar.tileWhenIndeterminate" , Boolean . TRUE ) ; d . put ( "ProgressBar.paintOutsideClip... | Initialize the progress bar settings . |
37,256 | private void defineRootPanes ( UIDefaults d ) { String c = PAINTER_PREFIX + "FrameAndRootPainter" ; String p = "RootPane" ; d . put ( p + ".States" , "Enabled,WindowFocused,NoFrame" ) ; d . put ( p + ".contentMargins" , new InsetsUIResource ( 0 , 0 , 0 , 0 ) ) ; d . put ( p + ".opaque" , Boolean . FALSE ) ; d . put ( p... | Initialize the root pane settings . |
37,257 | private void defineScrollPane ( UIDefaults d ) { 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 + ".backgroundPainter" , new LazyPainter ( c , ScrollPanePai... | Initialize the scroll pane UI |
37,258 | private void defineSeparators ( UIDefaults d ) { String c = PAINTER_PREFIX + "SeparatorPainter" ; d . put ( "Separator.contentMargins" , new InsetsUIResource ( 0 , 0 , 0 , 0 ) ) ; d . put ( "Separator[Enabled].backgroundPainter" , new LazyPainter ( c , SeparatorPainter . Which . BACKGROUND_ENABLED ) ) ; } | Initialize the separator settings . |
37,259 | private void defineSplitPanes ( UIDefaults d ) { d . put ( "splitPaneDividerBackgroundOuter" , new Color ( 0xd9d9d9 ) ) ; String p = "SplitPane" ; d . put ( p + ".contentMargins" , new InsetsUIResource ( 1 , 1 , 1 , 1 ) ) ; d . put ( p + ".States" , "Enabled,MouseOver,Pressed,Disabled,Focused,Selected,Vertical" ) ; d .... | Initialize the split pane UI settings . |
37,260 | public static Insets getPaintingInsets ( SynthContext state , Insets insets ) { if ( state . getRegion ( ) . isSubregion ( ) ) { insets = state . getStyle ( ) . getInsets ( state , insets ) ; } else { insets = state . getComponent ( ) . getInsets ( insets ) ; } return insets ; } | A convenience method to return where the foreground should be painted for the Component identified by the passed in AbstractSynthContext . |
37,261 | public static Object resolveToolbarConstraint ( JToolBar toolbar ) { if ( toolbar != null ) { Container parent = toolbar . getParent ( ) ; if ( parent != null ) { LayoutManager m = parent . getLayout ( ) ; if ( m instanceof BorderLayout ) { BorderLayout b = ( BorderLayout ) m ; Object con = b . getConstraints ( toolbar... | Package private method which returns either BorderLayout . NORTH BorderLayout . SOUTH BorderLayout . EAST or BorderLayout . WEST depending on the location of the toolbar in its parent . The toolbar might be in PAGE_START PAGE_END CENTER or some other position but will be resolved to either NORTH SOUTH EAST or WEST base... |
37,262 | public void register ( Region region , String prefix ) { if ( region == null || prefix == null ) { throw new IllegalArgumentException ( "Neither Region nor Prefix may be null" ) ; } List < LazyStyle > styles = styleMap . get ( region ) ; if ( styles == null ) { styles = new LinkedList < LazyStyle > ( ) ; styles . add (... | Registers the given region and prefix . The prefix if it contains quoted sections refers to certain named components . If there are not quoted sections then the prefix refers to a generic component type . |
37,263 | SynthStyle getSeaGlassStyle ( JComponent c , Region r ) { if ( c == null || r == null ) { throw new IllegalArgumentException ( "Neither comp nor r may be null" ) ; } List < LazyStyle > styles = styleMap . get ( r ) ; if ( styles == null || styles . size ( ) == 0 ) { return getDefaultStyle ( ) ; } LazyStyle foundStyle =... | Locate the style associated with the given region and component . This is called from SeaGlassLookAndFeel in the SynthStyleFactory implementation . |
37,264 | public static int getComponentState ( Component c ) { if ( c . isEnabled ( ) ) { if ( c . isFocusOwner ( ) ) { return SeaglassUI . ENABLED | SeaglassUI . FOCUSED ; } return SeaglassUI . ENABLED ; } return SeaglassUI . DISABLED ; } | Returns the component state for the specified component . This should only be used for Components that don t have any special state beyond that of ENABLED DISABLED or FOCUSED . For example buttons shouldn t call into this method . |
37,265 | public static void updateSubregion ( SynthContext state , Graphics g , Rectangle bounds ) { paintRegion ( state , g , bounds ) ; } | A convenience method that handles painting of the background for subregions . All SynthUI s that have subregions should invoke this method than paint the foreground . |
37,266 | private static void paintRegion ( SynthContext state , Graphics g , Rectangle bounds ) { JComponent c = state . getComponent ( ) ; SynthStyle style = state . getStyle ( ) ; int x ; int y ; int width ; int height ; if ( bounds == null ) { x = 0 ; y = 0 ; width = c . getWidth ( ) ; height = c . getHeight ( ) ; } else { x... | Paint a region . |
37,267 | public DerivedColor getDerivedColor ( String parentUin , float hOffset , float sOffset , float bOffset , int aOffset , boolean uiResource ) { return getDerivedColor ( null , parentUin , hOffset , sOffset , bOffset , aOffset , uiResource ) ; } | Get a derived color derived colors are shared instances and will be updated when its parent UIDefault color changes . |
37,268 | protected final Color getDerivedColor ( Color color1 , Color color2 , float midPoint , boolean uiResource ) { int argb = deriveARGB ( color1 , color2 , midPoint ) ; if ( uiResource ) { return new ColorUIResource ( argb ) ; } else { return new Color ( argb ) ; } } | Decodes and returns a color which is derived from an offset between two other colors . |
37,269 | private int getPadForLabel ( int i ) { Dictionary dictionary = slider . getLabelTable ( ) ; int pad = 0 ; Object o = dictionary . get ( i ) ; if ( o != null ) { Component c = ( Component ) o ; int centerX = xPositionForValue ( i ) ; int cHalfWidth = c . getPreferredSize ( ) . width / 2 ; if ( centerX - cHalfWidth < ins... | Calculates the pad for the label at the specified index . |
37,270 | public int valueForYPosition ( int yPos ) { int value ; int minValue = slider . getMinimum ( ) ; int maxValue = slider . getMaximum ( ) ; int trackTop = trackRect . y + thumbRect . height / 2 + trackBorder ; int trackBottom = trackRect . y + trackRect . height - thumbRect . height / 2 - trackBorder ; int trackLength = ... | Returns a value give a y position . If yPos is past the track at the top or the bottom it will set the value to the min or max of the slider depending if the slider is inverted or not . |
37,271 | public int valueForXPosition ( int xPos ) { int value ; int minValue = slider . getMinimum ( ) ; int maxValue = slider . getMaximum ( ) ; int trackLeft = trackRect . x + thumbRect . width / 2 + trackBorder ; int trackRight = trackRect . x + trackRect . width - thumbRect . width / 2 - trackBorder ; int trackLength = tra... | Returns a value give an x position . If xPos is past the track at the left or the right it will set the value to the min or max of the slider depending if the slider is inverted or not . |
37,272 | private boolean isPaintLineSeperators ( JComponent c ) { boolean paintLines = c instanceof JTextArea ; String globalOverride = System . getProperty ( "SeaGlass.JTextArea.drawLineSeparator" ) ; if ( globalOverride != null && globalOverride . length ( ) > 0 ) { paintLines = Boolean . valueOf ( globalOverride ) ; } Boolea... | Test if we should also paint the line seperators . |
37,273 | private void paintBorder ( Graphics2D g , JComponent c , int x , int y , int width , int height ) { boolean useToolBarColors = isInToolBar ( c ) ; Shape s ; if ( focused ) { s = shapeGenerator . createRoundRectangle ( x - 2 , y - 2 , width + 3 , height + 3 , CornerSize . OUTER_FOCUS ) ; g . setPaint ( getFocusPaint ( s... | Paint the border . |
37,274 | private int getButtonHeight ( JComponent c , int height ) { String scaleKey = SeaGlassStyle . getSizeVariant ( c ) ; int newHeight = 27 ; if ( SeaGlassStyle . NATURAL_KEY . equals ( scaleKey ) ) { return height ; } else if ( SeaGlassStyle . LARGE_KEY . equals ( scaleKey ) ) { newHeight *= SeaGlassStyle . LARGE_SCALE ; ... | Compute the new button height for drawing forcing the button into a standard height . |
37,275 | protected Shape createOuterFocus ( final SegmentType segmentType , final int x , final int y , final int w , final int h ) { switch ( segmentType ) { case FIRST : return shapeGenerator . createRoundRectangle ( x - 2 , y - 2 , w + 3 , h + 3 , CornerSize . OUTER_FOCUS , CornerStyle . ROUNDED , CornerStyle . ROUNDED , Cor... | Create the shape for the outer focus ring . Designed to be drawn rather than filled . |
37,276 | public static boolean isMac ( ) { if ( System . getProperty ( SEA_GLASS_OVERRIDE_OS_NAME ) != null ) { return System . getProperty ( SEA_GLASS_OVERRIDE_OS_NAME ) . startsWith ( "Mac OS" ) ; } return System . getProperty ( "os.name" ) . startsWith ( "Mac OS" ) ; } | True if this JVM is running on a Mac . |
37,277 | public void paintCurrentValue ( Graphics g , Rectangle bounds , boolean hasFocus ) { ListCellRenderer renderer = comboBox . getRenderer ( ) ; Component c ; c = renderer . getListCellRendererComponent ( listBox , comboBox . getSelectedItem ( ) , - 1 , false , false ) ; boolean shouldValidate = false ; if ( c instanceof ... | Paints the currently selected item . |
37,278 | protected Dimension getDefaultSize ( ) { SynthComboBoxRenderer r = new SynthComboBoxRenderer ( ) ; Dimension d = getSizeForComponent ( r . getListCellRendererComponent ( listBox , " " , - 1 , false , false ) ) ; return new Dimension ( d . width , d . height ) ; } | Return the default size of an empty display area of the combo box using the current renderer and font . |
37,279 | public void fill ( Graphics2D g , Shape s , boolean isRounded , boolean paintRightShadow ) { if ( isRounded ) { fillInternalShadowRounded ( g , s ) ; } else { fillInternalShadow ( g , s , paintRightShadow ) ; } } | Fill the shape with the internal shadow . |
37,280 | private void fillInternalShadow ( Graphics2D g , Shape s , boolean paintRightShadow ) { Rectangle bounds = s . getBounds ( ) ; int x = bounds . x ; int y = bounds . y ; int w = bounds . width ; int h = bounds . height ; s = shapeGenerator . createRectangle ( x , y , w , 2 ) ; g . setPaint ( getTopShadowGradient ( s ) )... | Fill a rectangular shadow . |
37,281 | private void fillInternalShadowRounded ( Graphics2D g , Shape s ) { g . setPaint ( getRoundedShadowGradient ( s ) ) ; g . fill ( s ) ; } | Fill a rounded shadow . |
37,282 | public Paint getRoundedShadowGradient ( Shape s ) { Rectangle r = s . getBounds ( ) ; int x = r . x + r . width / 2 ; int y1 = r . y ; float frac = 1.0f / r . height ; int y2 = r . y + r . height ; return new LinearGradientPaint ( x , y1 , x , y2 , ( new float [ ] { 0f , frac , 1f } ) , new Color [ ] { innerShadow . to... | Create the gradient for a rounded shadow . |
37,283 | public Paint getTopShadowGradient ( Shape s ) { Rectangle2D bounds = s . getBounds2D ( ) ; float minY = ( float ) bounds . getMinY ( ) ; float maxY = ( float ) bounds . getMaxY ( ) ; float midX = ( float ) bounds . getCenterX ( ) ; return new LinearGradientPaint ( midX , minY , midX , maxY , ( new float [ ] { 0f , 1f }... | Create the gradient for the top of a rectangular shadow . |
37,284 | public Paint getLeftShadowGradient ( Shape s ) { Rectangle2D bounds = s . getBounds2D ( ) ; float minX = ( float ) bounds . getMinX ( ) ; float maxX = ( float ) bounds . getMaxX ( ) ; float midY = ( float ) bounds . getCenterY ( ) ; return new LinearGradientPaint ( minX , midY , maxX , midY , ( new float [ ] { 0f , 1f ... | Create the gradient for the left of a rectangular shadow . |
37,285 | private void rederiveColor ( ) { Color src = UIManager . getColor ( uiDefaultParentName ) ; if ( src != null ) { float [ ] tmp = Color . RGBtoHSB ( src . getRed ( ) , src . getGreen ( ) , src . getBlue ( ) , null ) ; tmp [ 0 ] = clamp ( tmp [ 0 ] + hOffset ) ; tmp [ 1 ] = clamp ( tmp [ 1 ] + sOffset ) ; tmp [ 2 ] = cla... | Recalculate the derived color from the UIManager parent color and offsets |
37,286 | public TwoColors getTexturedButtonBorderColors ( CommonControlState type ) { switch ( type ) { case DISABLED : return texturedButtonBorderDisabled ; case DISABLED_SELECTED : return texturedButtonBorderDisabledSelected ; case ENABLED : return texturedButtonBorderEnabled ; case PRESSED : return texturedButtonBorderPresse... | Get the colors for the border . |
37,287 | public TwoColors getTexturedButtonInteriorColors ( CommonControlState type ) { switch ( type ) { case DISABLED : return texturedButtonInteriorDisabled ; case DISABLED_SELECTED : return texturedButtonInteriorDisabledSelected ; case ENABLED : return texturedButtonInteriorEnabled ; case PRESSED : return texturedButtonInte... | Get the colors for the interior . |
37,288 | private Paint decodeCloseGradient ( Shape s , Color top , Color bottom ) { Rectangle r = s . getBounds ( ) ; int width = r . width ; int height = r . height ; return createGradient ( r . x + width / 2 , r . y , r . x + width / 2 , r . y + height - 1 , new float [ ] { 0f , 1f } , new Color [ ] { top , bottom } ) ; } | Create the gradient for the close button . |
37,289 | private Shape decodeEdge ( int width , int height ) { path . reset ( ) ; path . moveTo ( width - 2 , 0 ) ; path . lineTo ( width - 2 , height - 4 ) ; path . lineTo ( width - 4 , height - 2 ) ; path . lineTo ( 0 , height - 2 ) ; return path ; } | Create the edge of the button . |
37,290 | private Shape decodeShadow ( int width , int height ) { path . reset ( ) ; path . moveTo ( width - 1 , 0 ) ; path . lineTo ( width - 1 , height - 4 ) ; path . lineTo ( width - 4 , height - 1 ) ; path . lineTo ( 0 , height - 1 ) ; return path ; } | Create the shadow for the button . |
37,291 | private Shape decodeMarkBorder ( int width , int height ) { int left = ( width - 3 ) / 2 - 5 ; int top = ( height - 2 ) / 2 - 5 ; path . reset ( ) ; path . moveTo ( left + 1 , top + 0 ) ; path . lineTo ( left + 3 , top + 0 ) ; path . pointAt ( left + 4 , top + 1 ) ; path . pointAt ( left + 5 , top + 2 ) ; path . pointA... | Create the shape for the mark border . |
37,292 | private Shape decodeMarkInterior ( int width , int height ) { int left = ( width - 3 ) / 2 - 5 ; int top = ( height - 2 ) / 2 - 5 ; path . reset ( ) ; path . moveTo ( left + 1 , top + 1 ) ; path . lineTo ( left + 4 , top + 1 ) ; path . lineTo ( left + 5 , top + 3 ) ; path . lineTo ( left + 7 , top + 1 ) ; path . lineTo... | Create the shape for the mark interior . |
37,293 | private void paintProgressIndicator ( SeaGlassContext context , Graphics2D g2d , int width , int height , int size , boolean isFinished ) { JProgressBar pBar = ( JProgressBar ) context . getComponent ( ) ; if ( tileWhenIndeterminate && pBar . isIndeterminate ( ) ) { double offsetFraction = ( double ) getAnimationIndex ... | Paint the actual internal progress bar . |
37,294 | private ButtonVariantPainter getButtonPainter ( JComponent c ) { Object buttonType = c . getClientProperty ( "JButton.buttonType" ) ; ButtonVariantPainter button = standard ; if ( "textured" . equals ( buttonType ) || "segmentedTextured" . equals ( buttonType ) ) { button = textured ; } return button ; } | Determine the button painter variant from the component s client property . |
37,295 | protected void paintComponent ( Graphics g ) { SeaGlassPainter painter = ( SeaGlassPainter ) UIManager . get ( "TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter" ) ; if ( painter != null ) { Graphics2D g2d = ( Graphics2D ) g ; painter . paint ( g2d , this , getWidth ( ) + 1 , getHeight ( ) ) ; } } | Paint the component using the Nimbus Table Header Background Painter |
37,296 | public static SeaGlassContext getContext ( Class type , JComponent component , Region region , SynthStyle style , int state ) { SeaGlassContext context = null ; synchronized ( contextMap ) { List instances = ( List ) contextMap . get ( type ) ; if ( instances != null ) { int size = instances . size ( ) ; if ( size > 0 ... | The method used to get a context . |
37,297 | static void releaseContext ( SeaGlassContext context ) { synchronized ( contextMap ) { List instances = ( List ) contextMap . get ( context . getClass ( ) ) ; if ( instances == null ) { instances = new ArrayList ( 5 ) ; contextMap . put ( context . getClass ( ) , instances ) ; } instances . add ( context ) ; } } | Release a context for re - use . |
37,298 | @ SuppressWarnings ( "all" ) public void reset ( JComponent component , Region region , SynthStyle style , int state ) { this . component = component ; this . region = region ; this . style = style ; this . state = state ; } | Resets the state of the Context . |
37,299 | @ SuppressWarnings ( "all" ) public SynthPainter getPainter ( ) { SynthPainter painter = getStyle ( ) . getPainter ( this ) ; if ( painter != null ) { return painter ; } return EMPTY_PAINTER ; } | Convenience method to get the Painter from the current SynthStyle . This will NEVER return null . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.