idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
37,300 | public static String getSizeVariant ( JComponent c ) { String sizeVariant = System . getProperty ( "JComponent.sizeVariant" ) ; String componentSizeVariant = ( String ) c . getClientProperty ( "JComponent.sizeVariant" ) ; if ( componentSizeVariant != null ) { sizeVariant = componentSizeVariant ; } return sizeVariant ; } | Gets the size variant that is applicable for the given component . |
37,301 | static String parsePrefix ( String key ) { if ( key == null ) return null ; boolean inquotes = false ; for ( int i = 0 ; i < key . length ( ) ; i ++ ) { char c = key . charAt ( i ) ; if ( c == '"' ) { inquotes = ! inquotes ; } else if ( ( c == '[' || c == '.' ) && ! inquotes ) { return key . substring ( 0 , i ) ; } } return null ; } | Internal method to parse a style prefix . |
37,302 | static void uninitialize ( ) { AppContext ctx = AppContext . getAppContext ( ) ; PropertyChangeListener pcl = ( PropertyChangeListener ) ctx . get ( "SeaGlassStyle.defaults.pcl" ) ; if ( pcl != null ) { UIManager . getDefaults ( ) . removePropertyChangeListener ( pcl ) ; UIManager . getLookAndFeelDefaults ( ) . removePropertyChangeListener ( pcl ) ; } ctx . put ( "SeaGlassStyle.defaults" , null ) ; } | Called by SeaGlassLookAndFeel when the look and feel is being uninstalled . Performs general cleanup of any app - context specific data . |
37,303 | private void validate ( ) { if ( values != null ) return ; values = new Values ( ) ; final AppContext ctx = AppContext . getAppContext ( ) ; Map < String , TreeMap < String , Object > > compiledDefaults = ( Map < String , TreeMap < String , Object > > ) ctx . get ( "SeaGlassStyle.defaults" ) ; if ( compiledDefaults == null ) { compiledDefaults = new HashMap < String , TreeMap < String , Object > > ( ) ; compileDefaults ( compiledDefaults , UIManager . getDefaults ( ) ) ; UIDefaults lafDefaults = UIManager . getLookAndFeelDefaults ( ) ; compileDefaults ( compiledDefaults , lafDefaults ) ; PropertyChangeListener pcl = ( PropertyChangeListener ) ctx . get ( "SeaGlassStyle.defaults.pcl" ) ; if ( pcl == null ) { pcl = new DefaultsListener ( ) ; UIManager . getDefaults ( ) . addPropertyChangeListener ( pcl ) ; UIManager . getLookAndFeelDefaults ( ) . addPropertyChangeListener ( pcl ) ; ctx . put ( "SeaGlassStyle.defaults.pcl" , pcl ) ; } ctx . put ( "SeaGlassStyle.defaults" , compiledDefaults ) ; } TreeMap < String , Object > defaults = compiledDefaults . get ( prefix ) ; if ( defaults == null ) { defaults = new TreeMap < String , Object > ( ) ; } if ( component != null ) { Object o = component . getClientProperty ( "SeaGlass.Overrides" ) ; if ( o instanceof UIDefaults ) { Object i = component . getClientProperty ( "SeaGlass.Overrides.InheritDefaults" ) ; boolean inherit = i instanceof Boolean ? ( Boolean ) i : true ; UIDefaults d = ( UIDefaults ) o ; TreeMap < String , Object > map = new TreeMap < String , Object > ( ) ; for ( Object obj : d . keySet ( ) ) { if ( obj instanceof String ) { String key = ( String ) obj ; if ( key . startsWith ( prefix ) ) { map . put ( key , d . get ( key ) ) ; } } } if ( inherit ) { defaults . putAll ( map ) ; } else { defaults = map ; } } } init ( values , defaults ) ; } | Pulls data out of UIDefaults if it has not done so already and sets up the internal state . |
37,304 | private SeaGlassPainter getPainter ( TreeMap < String , Object > defaults , String key ) { Object p = defaults . get ( key ) ; if ( p instanceof UIDefaults . LazyValue ) { p = ( ( UIDefaults . LazyValue ) p ) . createValue ( UIManager . getDefaults ( ) ) ; } return ( p instanceof SeaGlassPainter ? ( SeaGlassPainter ) p : null ) ; } | Determine the painter given the defaults and a key . |
37,305 | public Insets getInsets ( SynthContext ctx , Insets in ) { if ( in == null ) { in = new Insets ( 0 , 0 , 0 , 0 ) ; } Values v = getValues ( ctx ) ; if ( v . contentMargins == null ) { in . bottom = in . top = in . left = in . right = 0 ; return in ; } else { in . bottom = v . contentMargins . bottom ; in . top = v . contentMargins . top ; in . left = v . contentMargins . left ; in . right = v . contentMargins . right ; String scaleKey = SeaGlassStyle . getSizeVariant ( ctx . getComponent ( ) ) ; if ( scaleKey != null ) { if ( LARGE_KEY . equals ( scaleKey ) ) { in . bottom *= LARGE_SCALE ; in . top *= LARGE_SCALE ; in . left *= LARGE_SCALE ; in . right *= LARGE_SCALE ; } else if ( SMALL_KEY . equals ( scaleKey ) ) { in . bottom *= SMALL_SCALE ; in . top *= SMALL_SCALE ; in . left *= SMALL_SCALE ; in . right *= SMALL_SCALE ; } else if ( MINI_KEY . equals ( scaleKey ) ) { in . bottom *= MINI_SCALE ; in . top *= MINI_SCALE ; in . left *= MINI_SCALE ; in . right *= MINI_SCALE ; } } return in ; } } | Returns the Insets that are used to calculate sizing information . |
37,306 | public boolean isOpaque ( SynthContext ctx ) { if ( "Table.cellRenderer" . equals ( ctx . getComponent ( ) . getName ( ) ) ) { return true ; } Boolean opaque = ( Boolean ) get ( ctx , "opaque" ) ; return opaque == null ? false : opaque ; } | Returns true if the region is opaque . |
37,307 | public Object get ( SynthContext ctx , Object key ) { Values v = getValues ( ctx ) ; String fullKey = key . toString ( ) ; String partialKey = fullKey . substring ( fullKey . indexOf ( "." ) + 1 ) ; Object obj = null ; int xstate = getExtendedState ( ctx , v ) ; tmpKey . init ( partialKey , xstate ) ; obj = v . cache . get ( tmpKey ) ; boolean wasInCache = obj != null ; if ( ! wasInCache ) { RuntimeState s = null ; int [ ] lastIndex = new int [ ] { - 1 } ; while ( obj == null && ( s = getNextState ( v . states , lastIndex , xstate ) ) != null ) { obj = s . defaults . get ( partialKey ) ; } if ( obj == null && v . defaults != null ) { obj = v . defaults . get ( partialKey ) ; } if ( obj == null ) obj = UIManager . get ( fullKey ) ; if ( obj == null && partialKey . equals ( "focusInputMap" ) ) { obj = super . get ( ctx , fullKey ) ; } v . cache . put ( new CacheKey ( partialKey , xstate ) , obj == null ? NULL : obj ) ; } return obj == NULL ? null : obj ; } | Getter for a region specific style property . |
37,308 | private void paintButton ( Graphics2D g , JComponent c , int width , int height ) { g . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; Shape s = createButtonPath ( CornerSize . BORDER , 0 , 2 , width - 2 , height - 4 ) ; g . setPaint ( getComboBoxButtonBorderPaint ( s , type ) ) ; g . fill ( s ) ; s = createButtonPath ( CornerSize . INTERIOR , 1 , 3 , width - 4 , height - 6 ) ; g . setPaint ( getComboBoxButtonInteriorPaint ( s , type ) ) ; g . fill ( s ) ; } | Paint the button shape . |
37,309 | public Image getImage ( GraphicsConfiguration config , int w , int h , Object ... args ) { lock . readLock ( ) . lock ( ) ; try { PixelCountSoftReference ref = map . get ( hash ( config , w , h , args ) ) ; if ( ref != null && ref . equals ( config , w , h , args ) ) { return ref . get ( ) ; } else { return null ; } } finally { lock . readLock ( ) . unlock ( ) ; } } | Get the cached image for given keys |
37,310 | public boolean setImage ( Image image , GraphicsConfiguration config , int w , int h , Object ... args ) { if ( ! isImageCachable ( w , h ) ) return false ; int hash = hash ( config , w , h , args ) ; lock . writeLock ( ) . lock ( ) ; try { PixelCountSoftReference ref = map . get ( hash ) ; if ( ref != null && ref . get ( ) == image ) { return true ; } if ( ref != null ) { currentPixelCount -= ref . pixelCount ; map . remove ( hash ) ; } int newPixelCount = image . getWidth ( null ) * image . getHeight ( null ) ; currentPixelCount += newPixelCount ; if ( currentPixelCount > maxPixelCount ) { while ( ( ref = ( PixelCountSoftReference ) referenceQueue . poll ( ) ) != null ) { map . remove ( ref . hash ) ; currentPixelCount -= ref . pixelCount ; } } if ( currentPixelCount > maxPixelCount ) { Iterator < Map . Entry < Integer , PixelCountSoftReference > > mapIter = map . entrySet ( ) . iterator ( ) ; while ( ( currentPixelCount > maxPixelCount ) && mapIter . hasNext ( ) ) { Map . Entry < Integer , PixelCountSoftReference > entry = mapIter . next ( ) ; mapIter . remove ( ) ; Image img = entry . getValue ( ) . get ( ) ; if ( img != null ) img . flush ( ) ; currentPixelCount -= entry . getValue ( ) . pixelCount ; } } map . put ( hash , new PixelCountSoftReference ( image , referenceQueue , newPixelCount , hash , config , w , h , args ) ) ; return true ; } finally { lock . writeLock ( ) . unlock ( ) ; } } | Sets the cached image for the specified constraints . |
37,311 | private int hash ( GraphicsConfiguration config , int w , int h , Object ... args ) { int hash ; hash = ( config != null ? config . hashCode ( ) : 0 ) ; hash = 31 * hash + w ; hash = 31 * hash + h ; hash = 31 * hash + Arrays . deepHashCode ( args ) ; return hash ; } | Create a unique hash from all the input . |
37,312 | private int mapDirection ( boolean isLeft ) { if ( isLeft ) { if ( splitPane . getOrientation ( ) == JSplitPane . HORIZONTAL_SPLIT ) { return SwingConstants . WEST ; } return SwingConstants . NORTH ; } if ( splitPane . getOrientation ( ) == JSplitPane . HORIZONTAL_SPLIT ) { return SwingConstants . EAST ; } return SwingConstants . SOUTH ; } | Convert the orientation of the pane into compass points based on the pane orientation and the left - right orientation of the containter . |
37,313 | protected JButton createRightOneTouchButton ( ) { SeaGlassArrowButton b = new SeaGlassArrowButton ( SwingConstants . NORTH ) ; int oneTouchSize = lookupOneTouchSize ( ) ; b . setName ( "SplitPaneDivider.rightOneTouchButton" ) ; b . setMinimumSize ( new Dimension ( oneTouchSize , oneTouchSize ) ) ; b . setCursor ( Cursor . getPredefinedCursor ( splitPane . getOrientation ( ) == JSplitPane . HORIZONTAL_SPLIT ? Cursor . E_RESIZE_CURSOR : Cursor . S_RESIZE_CURSOR ) ) ; b . setFocusPainted ( false ) ; b . setBorderPainted ( false ) ; b . setRequestFocusEnabled ( false ) ; b . setDirection ( mapDirection ( false ) ) ; return b ; } | Creates and return an instance of JButton that can be used to collapse the right component in the split pane . |
37,314 | static void clearImage ( BufferedImage img ) { Graphics2D g2 = img . createGraphics ( ) ; g2 . setComposite ( AlphaComposite . Clear ) ; g2 . fillRect ( 0 , 0 , img . getWidth ( ) , img . getHeight ( ) ) ; g2 . dispose ( ) ; } | Clear a transparent image to 100% transparent |
37,315 | static BufferedImage gaussianBlur ( BufferedImage src , BufferedImage dst , int radius ) { int width = src . getWidth ( ) ; int height = src . getHeight ( ) ; if ( dst == null || dst . getWidth ( ) != width || dst . getHeight ( ) != height || src . getType ( ) != dst . getType ( ) ) { dst = createColorModelCompatibleImage ( src ) ; } float [ ] kernel = createGaussianKernel ( radius ) ; if ( src . getType ( ) == BufferedImage . TYPE_INT_ARGB ) { int [ ] srcPixels = new int [ width * height ] ; int [ ] dstPixels = new int [ width * height ] ; getPixels ( src , 0 , 0 , width , height , srcPixels ) ; blur ( srcPixels , dstPixels , width , height , kernel , radius ) ; blur ( dstPixels , srcPixels , height , width , kernel , radius ) ; setPixels ( dst , 0 , 0 , width , height , srcPixels ) ; } else if ( src . getType ( ) == BufferedImage . TYPE_BYTE_GRAY ) { byte [ ] srcPixels = new byte [ width * height ] ; byte [ ] dstPixels = new byte [ width * height ] ; getPixels ( src , 0 , 0 , width , height , srcPixels ) ; blur ( srcPixels , dstPixels , width , height , kernel , radius ) ; blur ( dstPixels , srcPixels , height , width , kernel , radius ) ; setPixels ( dst , 0 , 0 , width , height , srcPixels ) ; } else { throw new IllegalArgumentException ( "EffectUtils.gaussianBlur() src image is not a supported type, type=[" + src . getType ( ) + "]" ) ; } return dst ; } | Apply Gaussian Blur to Image |
37,316 | protected static float [ ] createGaussianKernel ( int radius ) { if ( radius < 1 ) { throw new IllegalArgumentException ( "Radius must be >= 1" ) ; } float [ ] data = new float [ radius * 2 + 1 ] ; float sigma = radius / 3.0f ; float twoSigmaSquare = 2.0f * sigma * sigma ; float sigmaRoot = ( float ) Math . sqrt ( twoSigmaSquare * Math . PI ) ; float total = 0.0f ; for ( int i = - radius ; i <= radius ; i ++ ) { float distance = i * i ; int index = i + radius ; data [ index ] = ( float ) Math . exp ( - distance / twoSigmaSquare ) / sigmaRoot ; total += data [ index ] ; } for ( int i = 0 ; i < data . length ; i ++ ) { data [ i ] /= total ; } return data ; } | Create a Gaussian kernel for the transformation . |
37,317 | private Shape createCheckMark ( int x , int y , int size ) { int markSize = ( int ) ( size * SIZE_MULTIPLIER + 0.5 ) ; int markX = x + ( int ) ( size * X_MULTIPLIER + 0.5 ) ; int markY = y + ( int ) ( size * Y_MULTIPLIER + 0.5 ) ; return shapeGenerator . createCheckMark ( markX , markY , markSize , markSize ) ; } | Create the check mark shape . |
37,318 | public Paint getCheckBoxBulletPaint ( Shape s , CommonControlState type ) { return createCheckMarkGradient ( s , getCheckBoxBulletColors ( type ) ) ; } | Create the paint for the check mark . |
37,319 | private TwoColors getCheckBoxBulletColors ( CommonControlState type ) { switch ( type ) { case DISABLED : case DISABLED_SELECTED : return buttonbulletDisabled ; case ENABLED : case PRESSED : case SELECTED : case PRESSED_SELECTED : return buttonBulletEnabled ; } return null ; } | Get the colors to use for the check mark . |
37,320 | private int getComponentState ( JComponent c ) { if ( frame != null ) { if ( frame . isSelected ( ) ) { return SELECTED ; } } return SeaGlassLookAndFeel . getComponentState ( c ) ; } | Get the state for the component . |
37,321 | private void installTitlePane ( ) { installDefaults ( ) ; installListeners ( ) ; createActions ( ) ; enableActions ( ) ; createActionMap ( ) ; setLayout ( createLayout ( ) ) ; assembleSystemMenu ( ) ; createButtons ( ) ; addSubComponents ( ) ; } | Install the UI and listeners for the title pane . |
37,322 | private void addSubComponents ( ) { menuButton . setName ( "InternalFrameTitlePane.menuButton" ) ; iconButton . setName ( "InternalFrameTitlePane.iconifyButton" ) ; maxButton . setName ( "InternalFrameTitlePane.maximizeButton" ) ; closeButton . setName ( "InternalFrameTitlePane.closeButton" ) ; add ( menuButton ) ; add ( iconButton ) ; add ( maxButton ) ; add ( closeButton ) ; } | Add the button subcomponents to the title pane . |
37,323 | private void createActions ( ) { maximizeAction = new MaximizeAction ( ) ; iconifyAction = new IconifyAction ( ) ; closeAction = new CloseAction ( ) ; restoreAction = new RestoreAction ( ) ; moveAction = new MoveAction ( ) ; sizeAction = new SizeAction ( ) ; } | Create the actions for the buttons . |
37,324 | ActionMap createActionMap ( ) { ActionMap map = new ActionMapUIResource ( ) ; map . put ( "showSystemMenu" , new ShowSystemMenuAction ( true ) ) ; map . put ( "hideSystemMenu" , new ShowSystemMenuAction ( false ) ) ; return map ; } | Create the action map for the system menu . |
37,325 | public void uninstallDefaults ( ) { SeaGlassContext context = getContext ( this , ENABLED ) ; style . uninstallDefaults ( context ) ; context . dispose ( ) ; style = null ; JInternalFrame . JDesktopIcon di = frame . getDesktopIcon ( ) ; if ( di != null && di . getComponentPopupMenu ( ) == systemPopupMenu ) { di . setComponentPopupMenu ( null ) ; } } | Uninstall the defaults . |
37,326 | private void createButtons ( ) { iconButton = new NoFocusButton ( "InternalFrameTitlePane.iconifyButtonAccessibleName" ) ; iconButton . addActionListener ( iconifyAction ) ; if ( iconButtonToolTip != null && iconButtonToolTip . length ( ) != 0 ) { iconButton . setToolTipText ( iconButtonToolTip ) ; } maxButton = new NoFocusButton ( "InternalFrameTitlePane.maximizeButtonAccessibleName" ) ; maxButton . addActionListener ( maximizeAction ) ; closeButton = new NoFocusButton ( "InternalFrameTitlePane.closeButtonAccessibleName" ) ; closeButton . addActionListener ( closeAction ) ; if ( closeButtonToolTip != null && closeButtonToolTip . length ( ) != 0 ) { closeButton . setToolTipText ( closeButtonToolTip ) ; } setButtonTooltips ( ) ; } | Create the buttons and add action listeners . |
37,327 | private void setButtonTooltips ( ) { if ( frame . isIcon ( ) ) { if ( restoreButtonToolTip != null && restoreButtonToolTip . length ( ) != 0 ) { iconButton . setToolTipText ( restoreButtonToolTip ) ; } if ( maxButtonToolTip != null && maxButtonToolTip . length ( ) != 0 ) { maxButton . setToolTipText ( maxButtonToolTip ) ; } } else if ( frame . isMaximum ( ) ) { if ( iconButtonToolTip != null && iconButtonToolTip . length ( ) != 0 ) { iconButton . setToolTipText ( iconButtonToolTip ) ; } if ( restoreButtonToolTip != null && restoreButtonToolTip . length ( ) != 0 ) { maxButton . setToolTipText ( restoreButtonToolTip ) ; } } else { if ( iconButtonToolTip != null && iconButtonToolTip . length ( ) != 0 ) { iconButton . setToolTipText ( iconButtonToolTip ) ; } if ( maxButtonToolTip != null && maxButtonToolTip . length ( ) != 0 ) { maxButton . setToolTipText ( maxButtonToolTip ) ; } } } | Set the buttons tooltip text . |
37,328 | private void assembleSystemMenu ( ) { systemPopupMenu = new JPopupMenuUIResource ( ) ; addSystemMenuItems ( systemPopupMenu ) ; enableActions ( ) ; menuButton = new NoFocusButton ( "InternalFrameTitlePane.menuButtonAccessibleName" ) ; updateMenuIcon ( ) ; menuButton . addMouseListener ( new MouseAdapter ( ) { public void mousePressed ( MouseEvent e ) { try { frame . setSelected ( true ) ; } catch ( PropertyVetoException pve ) { } showSystemMenu ( ) ; } } ) ; JPopupMenu p = frame . getComponentPopupMenu ( ) ; if ( p == null || p instanceof UIResource ) { frame . setComponentPopupMenu ( systemPopupMenu ) ; } if ( frame . getDesktopIcon ( ) != null ) { p = frame . getDesktopIcon ( ) . getComponentPopupMenu ( ) ; if ( p == null || p instanceof UIResource ) { frame . getDesktopIcon ( ) . setComponentPopupMenu ( systemPopupMenu ) ; } } setInheritsPopupMenu ( true ) ; } | Create the system menu . |
37,329 | private void addSystemMenuItems ( JPopupMenu menu ) { JMenuItem mi = ( JMenuItem ) menu . add ( restoreAction ) ; mi . setMnemonic ( 'R' ) ; mi = ( JMenuItem ) menu . add ( moveAction ) ; mi . setMnemonic ( 'M' ) ; mi = ( JMenuItem ) menu . add ( sizeAction ) ; mi . setMnemonic ( 'S' ) ; mi = ( JMenuItem ) menu . add ( iconifyAction ) ; mi . setMnemonic ( 'n' ) ; mi = ( JMenuItem ) menu . add ( maximizeAction ) ; mi . setMnemonic ( 'x' ) ; menu . add ( new JSeparator ( ) ) ; mi = ( JMenuItem ) menu . add ( closeAction ) ; mi . setMnemonic ( 'C' ) ; } | Add the items to the system menu . |
37,330 | private LayoutManager createLayout ( ) { SeaGlassContext context = getContext ( this ) ; LayoutManager lm = ( LayoutManager ) style . get ( context , "InternalFrameTitlePane.titlePaneLayout" ) ; context . dispose ( ) ; return ( lm != null ) ? lm : new SeaGlassTitlePaneLayout ( ) ; } | Create the layout manager for the title pane . |
37,331 | protected void postClosingEvent ( JInternalFrame frame ) { InternalFrameEvent e = new InternalFrameEvent ( frame , InternalFrameEvent . INTERNAL_FRAME_CLOSING ) ; if ( JInternalFrame . class . getClassLoader ( ) == null ) { try { Toolkit . getDefaultToolkit ( ) . getSystemEventQueue ( ) . postEvent ( e ) ; return ; } catch ( SecurityException se ) { } } frame . dispatchEvent ( e ) ; } | Post a WINDOW_CLOSING - like event to the frame so that it can be treated like a regular Frame . |
37,332 | public void fill ( Graphics2D g , Shape s ) { Rectangle bounds = s . getBounds ( ) ; int width = bounds . width ; int height = bounds . height ; BufferedImage bimage = Effect . createBufferedImage ( width , height , true ) ; Graphics2D gbi = bimage . createGraphics ( ) ; gbi . setColor ( Color . BLACK ) ; gbi . fill ( s ) ; g . drawImage ( applyEffect ( bimage , null , width , height ) , 0 , 0 , null ) ; } | Paint the effect based around a solid shape in the graphics supplied . |
37,333 | protected static BufferedImage createBufferedImage ( int width , int height , boolean hasAlpha ) { BufferedImage bimage = null ; GraphicsEnvironment ge = GraphicsEnvironment . getLocalGraphicsEnvironment ( ) ; try { int transparency = Transparency . OPAQUE ; if ( hasAlpha ) { transparency = Transparency . TRANSLUCENT ; } GraphicsDevice gs = ge . getDefaultScreenDevice ( ) ; GraphicsConfiguration gc = gs . getDefaultConfiguration ( ) ; bimage = gc . createCompatibleImage ( width , height , transparency ) ; } catch ( HeadlessException e ) { } if ( bimage == null ) { int type = BufferedImage . TYPE_INT_RGB ; if ( hasAlpha ) { type = BufferedImage . TYPE_INT_ARGB ; } bimage = new BufferedImage ( width , height , type ) ; } return bimage ; } | Create a buffered image of the given width and height compatible with the alpha requirement . |
37,334 | protected static BufferedImage toBufferedImage ( Image image ) { if ( image instanceof BufferedImage ) { return ( BufferedImage ) image ; } image = new ImageIcon ( image ) . getImage ( ) ; boolean hasAlpha = hasAlpha ( image ) ; BufferedImage bimage = null ; GraphicsEnvironment ge = GraphicsEnvironment . getLocalGraphicsEnvironment ( ) ; try { int transparency = Transparency . OPAQUE ; if ( hasAlpha ) { transparency = Transparency . BITMASK ; } GraphicsDevice gs = ge . getDefaultScreenDevice ( ) ; GraphicsConfiguration gc = gs . getDefaultConfiguration ( ) ; bimage = gc . createCompatibleImage ( image . getWidth ( null ) , image . getHeight ( null ) , transparency ) ; } catch ( HeadlessException e ) { } if ( bimage == null ) { int type = BufferedImage . TYPE_INT_RGB ; if ( hasAlpha ) { type = BufferedImage . TYPE_INT_ARGB ; } bimage = new BufferedImage ( image . getWidth ( null ) , image . getHeight ( null ) , type ) ; } Graphics g = bimage . createGraphics ( ) ; g . drawImage ( image , 0 , 0 , null ) ; g . dispose ( ) ; return bimage ; } | This method returns a buffered image with the contents of an image |
37,335 | public void paintEnabled ( Graphics2D g , JComponent c , int width , int height ) { paint ( g , c , width , height , enabledBorder , enabledCorner , enabledInterior ) ; } | Paint the enabled state of the button foreground . |
37,336 | public void paintHover ( Graphics2D g , JComponent c , int width , int height ) { paint ( g , c , width , height , hoverBorder , hoverCorner , hoverInterior ) ; } | Paint the mouse - over state of the button foreground . |
37,337 | public void paintPressed ( Graphics2D g , JComponent c , int width , int height ) { paint ( g , c , width , height , pressedBorder , pressedCorner , pressedInterior ) ; } | Paint the pressed state of the button foreground . |
37,338 | private void paintMinimizeEnabled ( Graphics2D g , JComponent c , int width , int height ) { iconifyPainter . paintEnabled ( g , c , width , height ) ; } | Paint the foreground minimized button enabled state . |
37,339 | private void paintMinimizeHover ( Graphics2D g , JComponent c , int width , int height ) { iconifyPainter . paintHover ( g , c , width , height ) ; } | Paint the foreground minimized button mouse - over state . |
37,340 | private void paintMinimizePressed ( Graphics2D g , JComponent c , int width , int height ) { iconifyPainter . paintPressed ( g , c , width , height ) ; } | Paint the foreground minimize button pressed state . |
37,341 | private void paintRestoreEnabled ( Graphics2D g , JComponent c , int width , int height ) { restorePainter . paintEnabled ( g , c , width , height ) ; } | Paint the foreground restore button enabled state . |
37,342 | private void paintRestoreHover ( Graphics2D g , JComponent c , int width , int height ) { restorePainter . paintHover ( g , c , width , height ) ; } | Paint the foreground restore button mouse - over state . |
37,343 | private void paintRestorePressed ( Graphics2D g , JComponent c , int width , int height ) { restorePainter . paintPressed ( g , c , width , height ) ; } | Paint the foreground restore button pressed state . |
37,344 | private CommonControlState getButtonType ( Which state ) { switch ( state ) { case BACKGROUND_DISABLED : return CommonControlState . DISABLED ; case BACKGROUND_ENABLED : return CommonControlState . ENABLED ; case BACKGROUND_ENABLED_FOCUSED : return CommonControlState . ENABLED ; case BACKGROUND_PRESSED : return CommonControlState . PRESSED ; case BACKGROUND_ENABLED_SORTED : return CommonControlState . ENABLED ; case BACKGROUND_ENABLED_FOCUSED_SORTED : return CommonControlState . ENABLED ; case BACKGROUND_DISABLED_SORTED : return CommonControlState . DISABLED ; } return null ; } | Get the common state from the specific state . |
37,345 | private void updateSearchStyle ( JTextComponent c , SeaGlassContext context , String prefix ) { searchIconWidth = 0 ; Object o = style . get ( context , prefix + ".searchIconWidth" ) ; if ( o != null && o instanceof Integer ) { searchIconWidth = ( Integer ) o ; } popupIconWidth = 0 ; o = style . get ( context , prefix + ".popupIconWidth" ) ; if ( o != null && o instanceof Integer ) { popupIconWidth = ( Integer ) o ; } cancelIconWidth = 0 ; o = style . get ( context , prefix + ".cancelIconWidth" ) ; if ( o != null && o instanceof Integer ) { cancelIconWidth = ( Integer ) o ; } searchLeftInnerMargin = 0 ; o = style . get ( context , prefix + ".searchLeftInnerMargin" ) ; if ( o != null && o instanceof Integer ) { searchLeftInnerMargin = ( Integer ) o ; } searchRightInnerMargin = 0 ; o = style . get ( context , prefix + ".searchRightInnerMargin" ) ; if ( o != null && o instanceof Integer ) { searchRightInnerMargin = ( Integer ) o ; } placeholderColor = Color . GRAY ; o = style . get ( context , "placeholderTextColor" ) ; if ( o != null && o instanceof Color ) { placeholderColor = ( Color ) o ; } Border border = c . getBorder ( ) ; if ( border == null || border instanceof UIResource && ! ( border instanceof TextFieldBorder ) ) { c . setBorder ( createTextFieldBorder ( context ) ) ; } if ( isSearchField . isInState ( c ) ) { o = c . getClientProperty ( "JTextField.Search.PlaceholderText" ) ; if ( o != null && o instanceof String ) { placeholderText = ( String ) o ; } else if ( placeholderText != null ) { placeholderText = null ; } o = c . getClientProperty ( "JTextField.Search.FindAction" ) ; if ( o != null && o instanceof ActionListener ) { if ( findAction == null ) { findAction = ( ActionListener ) o ; } } o = c . getClientProperty ( "JTextField.Search.FindPopup" ) ; if ( o != null && o instanceof JPopupMenu ) { if ( findPopup == null ) { findPopup = ( JPopupMenu ) o ; } } o = c . getClientProperty ( "JTextField.Search.CancelAction" ) ; if ( o != null && o instanceof ActionListener ) { if ( cancelAction == null ) { cancelAction = ( ActionListener ) o ; } } installMouseListeners ( ) ; } else { placeholderText = null ; if ( findAction != null ) { findAction = null ; } if ( findPopup != null ) { findPopup = null ; } if ( cancelAction != null ) { cancelAction = null ; } uninstallMouseListeners ( ) ; } } | Sea Glass code to support the search JTextField . variant . |
37,346 | static void updateStyle ( JTextComponent c , SeaGlassContext context , String prefix ) { SeaGlassStyle style = ( SeaGlassStyle ) context . getStyle ( ) ; Color color = c . getCaretColor ( ) ; if ( color == null || color instanceof UIResource ) { c . setCaretColor ( ( Color ) style . get ( context , prefix + ".caretForeground" ) ) ; } Color fg = c . getForeground ( ) ; if ( fg == null || fg instanceof UIResource ) { fg = style . getColorForState ( context , ColorType . TEXT_FOREGROUND ) ; if ( fg != null ) { c . setForeground ( fg ) ; } } Object ar = style . get ( context , prefix + ".caretAspectRatio" ) ; if ( ar instanceof Number ) { c . putClientProperty ( "caretAspectRatio" , ar ) ; } context . setComponentState ( SELECTED | FOCUSED ) ; Color s = c . getSelectionColor ( ) ; if ( s == null || s instanceof UIResource ) { c . setSelectionColor ( style . getColor ( context , ColorType . TEXT_BACKGROUND ) ) ; } Color sfg = c . getSelectedTextColor ( ) ; if ( sfg == null || sfg instanceof UIResource ) { c . setSelectedTextColor ( style . getColor ( context , ColorType . TEXT_FOREGROUND ) ) ; } context . setComponentState ( DISABLED ) ; Color dfg = c . getDisabledTextColor ( ) ; if ( dfg == null || dfg instanceof UIResource ) { c . setDisabledTextColor ( style . getColor ( context , ColorType . TEXT_FOREGROUND ) ) ; } Insets margin = c . getMargin ( ) ; if ( margin == null || margin instanceof UIResource ) { margin = ( Insets ) style . get ( context , prefix + ".margin" ) ; if ( margin == null ) { margin = SeaGlassLookAndFeel . EMPTY_UIRESOURCE_INSETS ; } c . setMargin ( margin ) ; } Caret caret = c . getCaret ( ) ; if ( caret instanceof UIResource ) { Object o = style . get ( context , prefix + ".caretBlinkRate" ) ; if ( o != null && o instanceof Integer ) { Integer rate = ( Integer ) o ; caret . setBlinkRate ( rate . intValue ( ) ) ; } } } | Private method to update styles . |
37,347 | private String getPlaceholderText ( Graphics g , int availTextWidth ) { JTextComponent c = getComponent ( ) ; FontMetrics fm = SwingUtilities2 . getFontMetrics ( c , g ) ; return SwingUtilities2 . clipStringIfNecessary ( c , fm , placeholderText , availTextWidth ) ; } | Get the placeholder text clipped if necessary . |
37,348 | public Shape createRectangle ( final int x , final int y , final int w , final int h ) { return createRoundRectangleInternal ( x , y , w , h , 0 , CornerStyle . SQUARE , CornerStyle . SQUARE , CornerStyle . SQUARE , CornerStyle . SQUARE ) ; } | Return a path for a rectangle with square corners . |
37,349 | public Shape createRoundRectangle ( final int x , final int y , final int w , final int h , final CornerSize size ) { return createRoundRectangle ( x , y , w , h , size , CornerStyle . ROUNDED , CornerStyle . ROUNDED , CornerStyle . ROUNDED , CornerStyle . ROUNDED ) ; } | Return a path for a rectangle with rounded corners . |
37,350 | public Shape createCheckMark ( final int x , final int y , final int w , final int h ) { double xf = w / 12.0 ; double hf = h / 12.0 ; path . reset ( ) ; path . moveTo ( x , y + 7.0 * hf ) ; path . lineTo ( x + 2.0 * xf , y + 7.0 * hf ) ; path . lineTo ( x + 4.75 * xf , y + 10.0 * hf ) ; path . lineTo ( x + 9.0 * xf , y ) ; path . lineTo ( x + 11.0 * xf , y ) ; path . lineTo ( x + 5.0 * xf , y + 12.0 * hf ) ; path . closePath ( ) ; return path ; } | Return a path for a check mark . |
37,351 | public Shape createArrowLeft ( final double x , final double y , final double w , final double h ) { path . reset ( ) ; path . moveTo ( x + w , y ) ; path . lineTo ( x , y + h / 2.0 ) ; path . lineTo ( x + w , y + h ) ; path . closePath ( ) ; return path ; } | Return a path for an arrow pointing to the left . |
37,352 | public Shape createProgressBarIndeterminatePattern ( int x , int y , int w , int h ) { final double wHalf = w / 2.0 ; final double xOffset = 5 ; path . reset ( ) ; path . moveTo ( xOffset , 0 ) ; path . lineTo ( xOffset + wHalf , 0 ) ; path . curveTo ( xOffset + wHalf - 5 , h / 2 - 4 , xOffset + wHalf + 5 , h / 2 + 4 , xOffset + wHalf , h ) ; path . lineTo ( xOffset , h ) ; path . curveTo ( xOffset + 5 , h / 2 + 4 , xOffset - 5 , h / 2 - 4 , xOffset , 0 ) ; path . closePath ( ) ; return path ; } | Return a path for the patterned portion of an indeterminate progress bar . |
37,353 | public Shape createInternalDropShadowRounded ( final int x , final int y , final int w , final int h ) { final double radius = h / 2 ; final int right = x + w ; final double bottom = y + radius ; path . reset ( ) ; path . moveTo ( x , bottom ) ; path . quadTo ( x , y , x + radius , y ) ; path . lineTo ( right - radius , y ) ; path . quadTo ( right , y , right , bottom ) ; path . lineTo ( right - 1 , bottom ) ; path . quadTo ( right - 2 , y + 2 , right - radius - 1 , y + 2 ) ; path . lineTo ( x + radius + 1 , y + 2 ) ; path . quadTo ( x + 2 , y + 2 , x + 1 , bottom ) ; path . closePath ( ) ; return path ; } | Return a path for a rounded internal drop shadow . This is used for progress bar tracks and search fields . |
37,354 | public Shape createFillableFocusRectangle ( int x , int y , int w , int h ) { final int left = x ; final int top = y ; final int right = x + w ; final int bottom = y + h ; path . reset ( ) ; path . moveTo ( left , top ) ; path . lineTo ( left , bottom ) ; path . lineTo ( right , bottom ) ; path . lineTo ( right , top ) ; final float offset = 1.4f ; final float left2 = left + offset ; final float top2 = top + offset ; final float right2 = right - offset ; final float bottom2 = bottom - offset ; path . lineTo ( right2 , top ) ; path . lineTo ( right2 , bottom2 ) ; path . lineTo ( left2 , bottom2 ) ; path . lineTo ( left2 , top2 ) ; path . lineTo ( right2 , top2 ) ; path . lineTo ( right2 , top ) ; path . closePath ( ) ; return path ; } | Return a path for a focus rectangle . |
37,355 | public Shape createBullet ( int x , int y , int diameter ) { return createEllipseInternal ( x , y , diameter , diameter ) ; } | Return a path for a simple bullet . |
37,356 | public Shape createRadioButton ( int x , int y , int diameter ) { return createEllipseInternal ( x , y , diameter , diameter ) ; } | Return a path for a radio button s concentric sections . |
37,357 | public Shape createSliderThumbContinuous ( final int x , final int y , final int diameter ) { return createEllipseInternal ( x , y , diameter , diameter ) ; } | Return a path for a continuous slider thumb s concentric sections . |
37,358 | public Shape createSliderThumbDiscrete ( final int x , final int y , final int w , final int h , final CornerSize size ) { final double topArc = size . getRadius ( w , h ) ; final double bottomArcH = size == CornerSize . INTERIOR ? 0 : 1 ; final double bottomArcW = 3 ; path . reset ( ) ; path . moveTo ( x , y + topArc ) ; path . quadTo ( x , y , x + topArc , y ) ; path . lineTo ( x + w - topArc , y ) ; path . quadTo ( x + w , y , x + w , y + topArc ) ; path . lineTo ( x + w , y + h / 2.0 ) ; path . quadTo ( x + w - bottomArcW , y + h - bottomArcH , x + w / 2.0 , y + h ) ; path . quadTo ( x + bottomArcW , y + h - bottomArcH , x , y + h / 2.0 ) ; path . closePath ( ) ; return path ; } | Return a path for a discrete slider thumb s concentric sections . |
37,359 | public Shape createTabCloseIcon ( int x , int y , int w , int h ) { final double xMid = x + w / 2.0 ; final double yMid = y + h / 2.0 ; path . reset ( ) ; final double xOffsetL = w / 2.0 ; final double xOffsetS = w / 2.0 - 1 ; final double yOffsetL = h / 2.0 ; final double yOffsetS = h / 2.0 - 1 ; final double offsetC = 1 ; path . moveTo ( xMid , yMid - offsetC ) ; path . lineTo ( xMid + xOffsetS , yMid - yOffsetL ) ; path . lineTo ( yMid + xOffsetL , yMid - yOffsetS ) ; path . lineTo ( xMid + offsetC , yMid ) ; path . lineTo ( xMid + xOffsetL , yMid + yOffsetS ) ; path . lineTo ( xMid + xOffsetS , yMid + yOffsetL ) ; path . lineTo ( xMid , yMid + offsetC ) ; path . lineTo ( xMid - xOffsetS , yMid + yOffsetL ) ; path . lineTo ( xMid - xOffsetL , yMid + yOffsetS ) ; path . lineTo ( xMid - offsetC , yMid ) ; path . lineTo ( xMid - xOffsetL , yMid - yOffsetS ) ; path . lineTo ( xMid - xOffsetS , yMid - yOffsetL ) ; path . closePath ( ) ; return path ; } | Return a path for a cancel icon . This is a circle with a punched out x in it . |
37,360 | public Shape createScrollCap ( int x , int y , int w , int h ) { path . reset ( ) ; path . moveTo ( x , y ) ; path . lineTo ( x , y + h ) ; path . lineTo ( x + w , y + h ) ; addScrollGapPath ( x , y , w , h , true ) ; path . closePath ( ) ; return path ; } | Return a path for a scroll bar cap . This is used when the buttons are placed together at the opposite end of the scroll bar . |
37,361 | public Shape createScrollButtonTogetherDecrease ( int x , int y , int w , int h ) { path . reset ( ) ; path . moveTo ( x + w , y ) ; path . lineTo ( x + w , y + h ) ; path . lineTo ( x , y + h ) ; addScrollGapPath ( x , y , w , h , false ) ; path . closePath ( ) ; return path ; } | Return a path for a scroll bar decrease button . This is used when the buttons are placed together at one end of the scroll bar . |
37,362 | public Shape createScrollButtonTogetherIncrease ( int x , int y , int w , int h ) { return createRectangle ( x , y , w , h ) ; } | Return a path for a scroll bar increase button . This is used when the buttons are placed together at one end of the scroll bar . |
37,363 | private void addScrollGapPath ( int x , int y , int w , int h , boolean isAtLeft ) { final double hHalf = h / 2.0 ; final double wFull = isAtLeft ? w : 0 ; final double wHalfOff = isAtLeft ? w - hHalf : hHalf ; path . quadTo ( x + wHalfOff , y + h , x + wHalfOff , y + hHalf ) ; path . quadTo ( x + wHalfOff , y , x + wFull , y ) ; } | Adds a hemispherical section to the current path . This is used to create the gap in a scroll bar button or cap into which the scroll bar thumb will fit . |
37,364 | private Shape createEllipseInternal ( int x , int y , int w , int h ) { ellipse . setFrame ( x , y , w , h ) ; return ellipse ; } | Return a path for an ellipse . |
37,365 | private int getComponentState ( JComponent c ) { if ( rootParent != null ) { if ( isParentSelected ( ) ) { return SELECTED ; } } return SeaGlassLookAndFeel . getComponentState ( c ) ; } | Compute the state for the title pane . |
37,366 | private boolean isParentSelected ( ) { if ( rootParent instanceof JFrame ) { return ( ( JFrame ) rootParent ) . isActive ( ) ; } else if ( rootParent instanceof JDialog ) { return ( ( JDialog ) rootParent ) . isActive ( ) ; } else { return true ; } } | Determine if the title pane s parent is active . |
37,367 | private boolean isParentLeftToRight ( ) { if ( rootParent instanceof JFrame ) { return SeaGlassLookAndFeel . isLeftToRight ( ( JFrame ) rootParent ) ; } else if ( rootParent instanceof JDialog ) { return SeaGlassLookAndFeel . isLeftToRight ( ( JDialog ) rootParent ) ; } else { return false ; } } | Is the parent window laid out left - to - right? |
37,368 | private void addParentPropertyChangeListener ( PropertyChangeListener listener ) { if ( rootParent instanceof JFrame ) { ( ( JFrame ) rootParent ) . addPropertyChangeListener ( listener ) ; } else if ( rootParent instanceof JDialog ) { ( ( JDialog ) rootParent ) . addPropertyChangeListener ( listener ) ; } rootPane . addPropertyChangeListener ( listener ) ; } | Add a property change listener to the root pane . |
37,369 | private void removeParentPropertyChangeListener ( PropertyChangeListener listener ) { if ( rootParent instanceof JFrame ) { ( ( JFrame ) rootParent ) . removePropertyChangeListener ( listener ) ; } else if ( rootParent instanceof JDialog ) { ( ( JDialog ) rootParent ) . removePropertyChangeListener ( listener ) ; } } | Remove the property change listener from the root pane . |
37,370 | private void installDefaults ( ) { setFont ( UIManager . getFont ( "InternalFrame.titleFont" ) ) ; closeButtonToolTip = UIManager . getString ( "InternalFrame.closeButtonToolTip" ) ; iconButtonToolTip = UIManager . getString ( "InternalFrame.iconButtonToolTip" ) ; restoreButtonToolTip = UIManager . getString ( "InternalFrame.restoreButtonToolTip" ) ; maxButtonToolTip = UIManager . getString ( "InternalFrame.maxButtonToolTip" ) ; updateStyle ( this ) ; } | Install the defaults and update the Synth Style . |
37,371 | private void updateStyle ( JComponent c ) { SeaGlassContext context = getContext ( this , ENABLED ) ; SynthStyle oldStyle = style ; style = SeaGlassLookAndFeel . updateSeaglassStyle ( context , this ) ; if ( style != oldStyle ) { titleSpacing = style . getInt ( context , "InternalFrameTitlePane.titleSpacing" , 2 ) ; } context . dispose ( ) ; } | Update the Synth Style . |
37,372 | private void setButtonTooltips ( ) { if ( isParentIcon ( ) ) { if ( restoreButtonToolTip != null && restoreButtonToolTip . length ( ) != 0 ) { iconButton . setToolTipText ( restoreButtonToolTip ) ; } if ( maxButtonToolTip != null && maxButtonToolTip . length ( ) != 0 ) { maxButton . setToolTipText ( maxButtonToolTip ) ; } } else if ( isParentMaximum ( ) ) { if ( iconButtonToolTip != null && iconButtonToolTip . length ( ) != 0 ) { iconButton . setToolTipText ( iconButtonToolTip ) ; } if ( restoreButtonToolTip != null && restoreButtonToolTip . length ( ) != 0 ) { maxButton . setToolTipText ( restoreButtonToolTip ) ; } } else { if ( iconButtonToolTip != null && iconButtonToolTip . length ( ) != 0 ) { iconButton . setToolTipText ( iconButtonToolTip ) ; } if ( maxButtonToolTip != null && maxButtonToolTip . length ( ) != 0 ) { maxButton . setToolTipText ( maxButtonToolTip ) ; } } } | Set the tooltips for the buttons . |
37,373 | private String getTitle ( ) { if ( rootParent instanceof JFrame ) { return ( ( JFrame ) rootParent ) . getTitle ( ) ; } else if ( rootParent instanceof JDialog ) { return ( ( JDialog ) rootParent ) . getTitle ( ) ; } return null ; } | Returns the String to display as the title . |
37,374 | private Insets getParentInsets ( ) { if ( rootParent instanceof JApplet ) { return ( ( JApplet ) rootParent ) . getInsets ( ) ; } return ( ( Window ) rootParent ) . getInsets ( ) ; } | Get the parent insets . |
37,375 | private String getTitle ( String text , FontMetrics fm , int availTextWidth ) { return SwingUtilities2 . clipStringIfNecessary ( rootPane , fm , text , availTextWidth ) ; } | Get the title text clipped if necessary . |
37,376 | public void updateStyle ( AbstractButton b ) { SeaGlassContext context = getContext ( b , SynthConstants . ENABLED ) ; SynthStyle oldStyle = style ; style = SeaGlassLookAndFeel . updateStyle ( context , this ) ; if ( style != oldStyle ) { if ( b . getMargin ( ) == null || ( b . getMargin ( ) instanceof UIResource ) ) { Insets margin = ( Insets ) style . get ( context , getPropertyPrefix ( ) + "margin" ) ; if ( margin == null ) { margin = SeaGlassLookAndFeel . EMPTY_UIRESOURCE_INSETS ; } b . setMargin ( margin ) ; } Object value = style . get ( context , getPropertyPrefix ( ) + "iconTextGap" ) ; if ( value != null ) { LookAndFeel . installProperty ( b , "iconTextGap" , value ) ; } value = style . get ( context , getPropertyPrefix ( ) + "contentAreaFilled" ) ; LookAndFeel . installProperty ( b , "contentAreaFilled" , value != null ? value : Boolean . TRUE ) ; value = b . getClientProperty ( APPLE_PREFIX + "buttonType" ) ; if ( value != null ) { if ( "segmented" . equals ( value ) ) { b . setMargin ( SeaGlassLookAndFeel . EMPTY_UIRESOURCE_INSETS ) ; } } if ( oldStyle != null ) { uninstallKeyboardActions ( b ) ; installKeyboardActions ( b ) ; } } context . dispose ( ) ; } | Update the style of the button . |
37,377 | protected void paint ( SeaGlassContext context , Graphics g ) { AbstractButton b = ( AbstractButton ) context . getComponent ( ) ; g . setColor ( context . getStyle ( ) . getColor ( context , ColorType . TEXT_FOREGROUND ) ) ; g . setFont ( style . getFont ( context ) ) ; context . getStyle ( ) . getGraphicsUtils ( context ) . paintText ( context , g , b . getText ( ) , getIcon ( b ) , b . getHorizontalAlignment ( ) , b . getVerticalAlignment ( ) , b . getHorizontalTextPosition ( ) , b . getVerticalTextPosition ( ) , b . getIconTextGap ( ) , b . getDisplayedMnemonicIndex ( ) , getTextShiftOffset ( context ) ) ; } | Paint the button . |
37,378 | void paintBackground ( SeaGlassContext context , Graphics g , JComponent c ) { if ( ( ( AbstractButton ) c ) . isContentAreaFilled ( ) ) { context . getPainter ( ) . paintButtonBackground ( context , g , 0 , 0 , c . getWidth ( ) , c . getHeight ( ) ) ; } } | Paint the button background . |
37,379 | protected Icon getDefaultIcon ( AbstractButton b ) { SeaGlassContext context = getContext ( b ) ; Icon icon = context . getStyle ( ) . getIcon ( context , getPropertyPrefix ( ) + "icon" ) ; context . dispose ( ) ; return icon ; } | Returns the default icon . This should NOT callback to the JComponent . |
37,380 | protected Icon getIcon ( AbstractButton b ) { Icon icon = b . getIcon ( ) ; ButtonModel model = b . getModel ( ) ; if ( ! model . isEnabled ( ) ) { icon = getSynthDisabledIcon ( b , icon ) ; } else if ( model . isPressed ( ) && model . isArmed ( ) ) { icon = getPressedIcon ( b , getSelectedIcon ( b , icon ) ) ; } else if ( b . isRolloverEnabled ( ) && model . isRollover ( ) ) { icon = getRolloverIcon ( b , getSelectedIcon ( b , icon ) ) ; } else if ( model . isSelected ( ) ) { icon = getSelectedIcon ( b , icon ) ; } else { icon = getEnabledIcon ( b , icon ) ; } if ( icon == null ) { return getDefaultIcon ( b ) ; } return icon ; } | Returns the Icon to use in painting the button . |
37,381 | protected void paint ( SynthContext context , Graphics g ) { SeaGlassContext accContext = getContext ( menuItem , Region . MENU_ITEM_ACCELERATOR ) ; String prefix = getPropertyPrefix ( ) ; Icon checkIcon = style . getIcon ( context , prefix + ".checkIcon" ) ; Icon arrowIcon = style . getIcon ( context , prefix + ".arrowIcon" ) ; SeaGlassGraphicsUtils . paint ( context , accContext , g , checkIcon , arrowIcon , acceleratorDelimiter , defaultTextIconGap , getPropertyPrefix ( ) ) ; accContext . dispose ( ) ; } | Paints the specified component . This implementation does nothing . |
37,382 | private void paint ( SeaGlassPainter p , SynthContext ctx , Graphics g , int x , int y , int w , int h , AffineTransform transform ) { if ( p != null ) { if ( g instanceof Graphics2D ) { Graphics2D gfx = ( Graphics2D ) g ; if ( transform != null ) { gfx . transform ( transform ) ; } gfx . translate ( x , y ) ; p . paint ( gfx , ctx . getComponent ( ) , w , h ) ; gfx . translate ( - x , - y ) ; if ( transform != null ) { try { gfx . transform ( transform . createInverse ( ) ) ; } catch ( NoninvertibleTransformException e ) { e . printStackTrace ( ) ; } } } else { BufferedImage img = new BufferedImage ( w , h , BufferedImage . TYPE_INT_ARGB ) ; Graphics2D gfx = img . createGraphics ( ) ; if ( transform != null ) { gfx . transform ( transform ) ; } p . paint ( gfx , ctx . getComponent ( ) , w , h ) ; gfx . dispose ( ) ; g . drawImage ( img , x , y , null ) ; img = null ; } } } | Paint the provided painter using the provided transform at the specified position and size . Handles if g is a non 2D Graphics by painting via a BufferedImage . |
37,383 | private void paintForeground ( SynthContext ctx , Graphics g , int x , int y , int w , int h , AffineTransform transform ) { SeaGlassPainter foregroundPainter = style . getForegroundPainter ( ctx ) ; if ( foregroundPainter != null ) { paint ( foregroundPainter , ctx , g , x , y , w , h , transform ) ; } } | Paint the object s foreground . |
37,384 | private void paintBorder ( SynthContext ctx , Graphics g , int x , int y , int w , int h , AffineTransform transform ) { SeaGlassPainter borderPainter = style . getBorderPainter ( ctx ) ; if ( borderPainter != null ) { paint ( borderPainter , ctx , g , x , y , w , h , transform ) ; } } | Paint the object s border . |
37,385 | public void paintSearchButtonForeground ( SynthContext context , Graphics g , int x , int y , int w , int h ) { paintForeground ( context , g , x , y , w , h , null ) ; } | Paints the foreground of a search field button . This method is responsible for drawing a graphical representation of a find or cancel button . |
37,386 | public void paintSeparatorForeground ( SynthContext context , Graphics g , int x , int y , int w , int h , int orientation ) { paintForeground ( context , g , x , y , w , h , orientation ) ; } | Paints the foreground of a separator . |
37,387 | public void paintSliderThumbBackground ( SynthContext context , Graphics g , int x , int y , int w , int h , int orientation ) { if ( context . getComponent ( ) . getClientProperty ( "Slider.paintThumbArrowShape" ) == Boolean . TRUE ) { if ( orientation == JSlider . HORIZONTAL ) { orientation = JSlider . VERTICAL ; } else { orientation = JSlider . HORIZONTAL ; } paintBackground ( context , g , x , y , w , h , orientation ) ; } else { paintBackground ( context , g , x , y , w , h , orientation ) ; } } | Paints the background of the thumb of a slider . |
37,388 | public void paintSplitPaneDividerBackground ( SynthContext context , Graphics g , int x , int y , int w , int h , int orientation ) { if ( orientation == JSplitPane . HORIZONTAL_SPLIT ) { AffineTransform transform = new AffineTransform ( ) ; transform . scale ( - 1 , 1 ) ; transform . rotate ( Math . toRadians ( 90 ) ) ; paintBackground ( context , g , y , x , h , w , transform ) ; } else { paintBackground ( context , g , x , y , w , h , null ) ; } } | Paints the background of the divider of a split pane . This implementation invokes the method of the same name without the orientation . |
37,389 | public void paintSplitPaneDividerForeground ( SynthContext context , Graphics g , int x , int y , int w , int h , int orientation ) { paintForeground ( context , g , x , y , w , h , null ) ; } | Paints the foreground of the divider of a split pane . |
37,390 | public void paintSplitPaneDragDivider ( SynthContext context , Graphics g , int x , int y , int w , int h , int orientation ) { paintBackground ( context , g , x , y , w , h , null ) ; } | Paints the divider when the user is dragging the divider of a split pane . |
37,391 | public void paintTabbedPaneBorder ( SynthContext context , Graphics g , int x , int y , int w , int h ) { paintBorder ( context , g , x , y , w , h , null ) ; } | Paints the border of a tabbed pane . |
37,392 | public void paintTabbedPaneTabAreaBackground ( SynthContext context , Graphics g , int x , int y , int w , int h ) { paintBackground ( context , g , x , y , w , h , null ) ; } | Paints the background of the area behind the tabs of a tabbed pane . |
37,393 | public void paintTabbedPaneTabAreaBackground ( SynthContext context , Graphics g , int x , int y , int w , int h , int orientation ) { if ( orientation == JTabbedPane . LEFT ) { AffineTransform transform = new AffineTransform ( ) ; transform . scale ( - 1 , 1 ) ; transform . rotate ( Math . toRadians ( 90 ) ) ; paintBackground ( context , g , y , x , h , w , transform ) ; } else if ( orientation == JTabbedPane . RIGHT ) { AffineTransform transform = new AffineTransform ( ) ; transform . rotate ( Math . toRadians ( 90 ) ) ; transform . translate ( 0 , - ( x + w ) ) ; paintBackground ( context , g , y , 0 , h , w , transform ) ; } else if ( orientation == JTabbedPane . BOTTOM ) { AffineTransform transform = new AffineTransform ( ) ; transform . translate ( x , y ) ; paintBackground ( context , g , 0 , 0 , w , h , transform ) ; } else { paintBackground ( context , g , x , y , w , h , null ) ; } } | Paints the background of the area behind the tabs of a tabbed pane . This implementation invokes the method of the same name without the orientation . |
37,394 | public void paintTabbedPaneTabBackground ( SynthContext context , Graphics g , int x , int y , int w , int h , int tabIndex ) { paintBackground ( context , g , x , y , w , h , null ) ; } | Paints the background of a tab of a tabbed pane . |
37,395 | public void paintTabbedPaneTabBorder ( SynthContext context , Graphics g , int x , int y , int w , int h , int tabIndex , int orientation ) { paintBorder ( context , g , x , y , w , h , null ) ; } | Paints the border of a tab of a tabbed pane . This implementation invokes the method of the same name without the orientation . |
37,396 | private void paintForegroundDisabled ( Graphics2D g , int width , int height ) { Shape s = decodeArrowPath ( width , height ) ; g . setPaint ( disabledColor ) ; g . fill ( s ) ; } | Paint the arrow in disabled state . |
37,397 | private void paintForegroundEnabled ( Graphics2D g , int width , int height ) { Shape s = decodeArrowPath ( width , height ) ; g . setPaint ( enabledColor ) ; g . fill ( s ) ; } | Paint the arrow in enabled state . |
37,398 | private void paintForegroundPressed ( Graphics2D g , int width , int height ) { Shape s = decodeArrowPath ( width , height ) ; g . setPaint ( pressedColor ) ; g . fill ( s ) ; } | Paint the arrow in pressed state . |
37,399 | private Shape decodeArrowPath ( int width , int height ) { return shapeGenerator . createArrowLeft ( width * 0.2 , height * 0.2 , width * 0.6 , height * 0.6 ) ; } | Create the arrow path . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.