@Override protected void paintComponent( Graphics g ){ Graphics2D g2 = (Graphics2D)g.create(); g2.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_ATOP, 0.4f ) ); g2.setColor( Color.BLACK ); if( orientation.isHorizontal() ) g2.fillRect( 0, 1, getWidth(), getHeight()-2 ); else g2.fillRect( 1, 0, getWidth()-2, getHeight() ); g2.dispose(); }
@Override public Dimension getPreferredSize() { if( isPreferredSizeSet() ) return super.getPreferredSize(); Dimension size = content.getPreferredSize(); if( model.getOrientation().isHorizontal() ) return new Dimension( size.width + 6 + dropIcon.getIconWidth(), size.height+2 ); else return new Dimension( size.width+2, size.height + 6 + dropIcon.getIconHeight() ); }
@Override public Dimension getPreferredSize() { if( isPreferredSizeSet() ) return super.getPreferredSize(); Dimension size = content.getPreferredSize(); if( model.getOrientation().isHorizontal() ) return new Dimension( size.width + 6 + dropIcon.getIconWidth(), size.height+2 ); else return new Dimension( size.width+2, size.height + 6 + dropIcon.getIconHeight() ); }
public Point getPopupLocation( Point click, boolean popupTrigger ){ if( popupTrigger ) return click; Rectangle icon = getIconBounds(); if( icon != null ){ if( icon.contains( click )){ if( getOrientation().isHorizontal() ) return new Point( icon.x, icon.y + icon.height ); else return new Point( icon.x + icon.width, icon.y ); } } return null; }
public void setOrientation( Orientation orientation ){ if( orientation.isHorizontal() ) separator.setOrientation( SwingConstants.VERTICAL ); else separator.setOrientation( SwingConstants.HORIZONTAL ); }
@Override public void doLayout(){ if( model.getOrientation().isHorizontal() ){ content.setBounds( 1, 1, getWidth()-5-dropIcon.getIconWidth(), getHeight()-2 ); } else{ content.setBounds( 1, 1, getWidth()-2, getHeight()-5-dropIcon.getIconHeight() ); } }
@Override protected void paintComponent( Graphics g ){ Graphics2D g2 = (Graphics2D)g.create(); g2.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_ATOP, 0.4f ) ); g2.setColor( Color.BLACK ); if( orientation.isHorizontal() ) g2.fillRect( 0, 1, getWidth(), getHeight()-2 ); else g2.fillRect( 1, 0, getWidth()-2, getHeight() ); g2.dispose(); }
@Override protected void paintComponent( Graphics g ){ g.setColor( color ); if( orientation.isHorizontal() ) { g.drawLine( 0, 3, 0, getHeight() - 4 ); } else { g.drawLine( 3, 0, getWidth() - 4, 0 ); } } }
/** * Tells a DockTitle that its preferred width should be smaller * than its preferred height * @return <code>true</code> if the title lays vertical */ public boolean isVertical(){ return !isHorizontal(); } };
public void setOrientation( Orientation orientation ){ if( orientation.isHorizontal() ) separator.setOrientation( SwingConstants.VERTICAL ); else separator.setOrientation( SwingConstants.HORIZONTAL ); }
@Override public Dimension getPreferredSize() { if( isPreferredSizeSet() ) return super.getPreferredSize(); Dimension contentSize = content.getPreferredSize(); if( model.getOrientation().isHorizontal() ) return new Dimension( (int)(0.5 * contentSize.height + contentSize.width + 1 + 1.5*dropIcon.getIconWidth()), (int)(1.5 * contentSize.height)); else return new Dimension( (int)(1.5 * contentSize.width), (int)(0.5 * contentSize.width + contentSize.height + 1 + 1.5 * dropIcon.getIconHeight()) ); }
@Override public void doLayout(){ MiniButtonContent content = getContent(); Insets insets = getMaxBorderInsets(); if( getModel().getOrientation().isHorizontal() ){ int dropWidth = dropIcon.getIconWidth(); content.setBounds( insets.left+1, insets.top, getWidth()-insets.left-2*insets.right-1-dropWidth, getHeight()-insets.top-insets.bottom ); } else{ int dropHeight = dropIcon.getIconHeight(); content.setBounds( insets.left, insets.top+1, getWidth()-insets.left-insets.right, getHeight()-insets.top-2*insets.bottom-1-dropHeight ); } }
@Override protected Insets getInnerInsets(){ Insets base = super.getInnerInsets(); if( behavior.isShowKnob() ){ if( getOrientation().isHorizontal() ){ base = new Insets( base.top, base.left + KNOB_SIZE, base.bottom, base.right ); } else{ base = new Insets( base.top + KNOB_SIZE, base.left, base.bottom, base.right ); } } return base; }
@Override protected Insets getInnerInsets(){ Insets base = super.getInnerInsets(); if( behavior.isShowKnob() ){ if( getOrientation().isHorizontal() ){ base = new Insets( base.top, base.left + KNOB_SIZE, base.bottom, base.right ); } else{ base = new Insets( base.top + KNOB_SIZE, base.left, base.bottom, base.right ); } } return base; }
public Rotation convert( Orientation orientation, DockTitle title ){ if( orientation.isHorizontal() ) { return Rotation.DEGREE_0; } else { return Rotation.DEGREE_90; } }
/** * Gets the insets that have to be applied between the border and the * content (icon, text, actions) of this title. Subclasses may use this method to * create free space in which they can paint additional items. * @return the insets, not <code>null</code> */ protected Insets getInnerInsets(){ if( getOrientation().isHorizontal() ) return DEFAULT_INSETS_HORIZONTAL; else return DEFAULT_INSETS_VERTICAL; }
public Rotation convert( Orientation orientation, DockTitle title ){ if( orientation.isHorizontal() ) { return Rotation.DEGREE_0; } else { return Rotation.DEGREE_90; } }
/** * Gets the insets that have to be applied between the border and the * content (icon, text, actions) of this title. Subclasses may use this method to * create free space in which they can paint additional items. * @return the insets, not <code>null</code> */ protected Insets getInnerInsets(){ if( getOrientation().isHorizontal() ) return DEFAULT_INSETS_HORIZONTAL; else return DEFAULT_INSETS_VERTICAL; }
@Override public void doLayout(){ if( model.getOrientation().isHorizontal() ){ content.setBounds( getHeight() / 3, getHeight() / 6, (int)(getWidth() - 1 - 1.5*dropIcon.getIconWidth()), (int)(getHeight() / 1.5)); } else{ content.setBounds( getWidth() / 3, getWidth() / 6, (int)(getWidth() / 1.5), (int)(getHeight() - 1 - 1.5*dropIcon.getIconHeight())); } }
@Override public void doLayout(){ if( model.getOrientation().isHorizontal() ){ content.setBounds( 1, 1, getWidth()-5-dropIcon.getIconWidth(), getHeight()-2 ); } else{ content.setBounds( 1, 1, getWidth()-2, getHeight()-5-dropIcon.getIconHeight() ); } }