Java Code Examples for org.jdesktop.swingx.JXTaskPane#getWidth()
The following examples show how to use
org.jdesktop.swingx.JXTaskPane#getWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlatTaskPaneUI.java From FlatLaf with Apache License 2.0 | 6 votes |
@Override protected void paintTitleBackground( JXTaskPane group, Graphics g ) { int width = group.getWidth(); int height = getTitleHeight( group ) ; float arc = UIScale.scale( (float) roundHeight ); float lineWidth = UIScale.scale( 1f ); // paint background g.setColor( group.isSpecial() ? specialTitleBackground : titleBackgroundGradientStart ); ((Graphics2D)g).fill( FlatUIUtils.createRoundRectanglePath( lineWidth, lineWidth, width - (lineWidth * 2), height - (lineWidth * 2), arc - lineWidth, arc - lineWidth, 0, 0 ) ); // paint border if( borderColor != null ) { g.setColor( borderColor ); ((Graphics2D)g).fill( FlatUIUtils.createRoundRectangle( 0, 0, width, height, lineWidth, arc, arc, 0, 0 ) ); } }
Example 2
Source File: DarkTaskPaneUI.java From darklaf with MIT License | 5 votes |
@Override protected void paintTitleBackground(final JXTaskPane group, final Graphics g2) { Graphics2D g = (Graphics2D) g2; int w = group.getWidth(); int h = group.getHeight(); if (group.isSpecial()) { g.setColor(specialTitleBackground); } else { g.setColor(titleBackgroundGradientStart); } if (isCollapsed()) { PaintUtil.fillRoundRect(g, 0, 0, w, h, getRoundHeight()); g.setColor(borderColor); PaintUtil.paintLineBorder(g, 0, 0, w, h, getRoundHeight()); } else { Rectangle clip = g.getClip().getBounds(); g.setClip(0, 0, w, h / 2 + 1); PaintUtil.fillRoundRect(g, 0, 0, w, h, getRoundHeight()); g.setClip(0, h / 2, w, h / 2); g.fillRect(0, 0, w, h); g.setColor(borderColor); g.setClip(0, 0, w, h / 2); PaintUtil.paintLineBorder(g, 0, 0, w, h, getRoundHeight()); g.setClip(0, h / 2, w, h / 2); PaintUtil.drawRect(g, 0, 0, w, h, 1); g.setClip(clip); } }
Example 3
Source File: FlatTaskPaneUI.java From FlatLaf with Apache License 2.0 | 5 votes |
@Override protected void paintChevronControls( JXTaskPane group, Graphics g, int x, int y, int width, int height ) { Graphics2D g2 = (Graphics2D) g; // scale chevron size float cw = scale( 6f ); float ch = scale( 3f ); // create arrow shape int direction = group.isCollapsed() ? SwingConstants.SOUTH : SwingConstants.NORTH; Shape arrowShape = FlatArrowButton.createArrowShape( direction, true, cw, ch ); // fix position of controls x = group.getComponentOrientation().isLeftToRight() ? (group.getWidth() - width - y) : y; // compute chevron position int cx = (int) (x + width / 2 - cw / 2); int cy = (int) (y + (height / 2 - ch)); float offset = ch + UIScale.scale( 1f ); // set stroke with scaled width g2.setStroke( new BasicStroke( scale( 1f ) ) ); // paint g2.translate( cx, cy ); g2.draw( arrowShape ); g2.translate( 0, offset ); g2.draw( arrowShape ); g2.translate( -cx, -(cy + offset) ); }
Example 4
Source File: FlatTaskPaneUI.java From FlatLaf with Apache License 2.0 | 5 votes |
@Override protected void paintTitle( JXTaskPane group, Graphics g, Color textColor, int x, int y, int width, int height ) { // scale title position int titleX = UIScale.scale( 3 ); int titleWidth = group.getWidth() - getTitleHeight(group) - titleX; if( !group.getComponentOrientation().isLeftToRight() ) { // right-to-left titleX = group.getWidth() - titleX - titleWidth; } super.paintTitle( group, g, textColor, titleX, y, titleWidth, height ); }