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 ) ; } } r...
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 ( ) . removeP...
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 == ...
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...
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 . co...
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 ....
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 , t...
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 ; } } ...
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 . ge...
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 Swing...
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 ( Curso...
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 = createColorModelCompatibleIm...
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 ( twoS...
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...
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 . setCo...
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 No...
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 ...
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 vo...
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 (...
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 ; } c...
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 ( ...
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 ;...
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 . getLocalGraphi...
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 CommonC...
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 ...
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 + ".caretFore...
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 , ...
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 ,...
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 ...
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 )...
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 ...
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 ...
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 + wF...
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 . a...
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 ( "Interna...
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 ) ; } ...
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 ) ...
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 ) ) {...
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 ( cont...
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 ...
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 + ".arro...
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 . pain...
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 ; } e...
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 ) )...
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 ) ) ; paintBa...
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 .