类javax.swing.plaf.basic.BasicArrowButton源码实例Demo

下面列出了怎么用javax.swing.plaf.basic.BasicArrowButton的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: littleluck   文件: LuckComboBoxUI.java
/**
 * <pre>
 * 重写下拉按钮,增加焦点颜色
 *
 * Rewrite the drop-down button to increase the focus color
 * </pre>
 *
 * @return arrow button info
 */
protected JButton createArrowButton()
{
    JButton button = new LuckComboBoxButton(BasicArrowButton.SOUTH)
    {
        private static final long serialVersionUID = -7259590635997077859L;

        @Override
        public LuckBorderField getBorderField()
        {
            return LuckComboBoxUI.this;
        }

        @Override
        public JComponent getParentComp()
        {
            return LuckComboBoxUI.this.comboBox;
        }
    };

    button.setName("ComboBox.arrowButton");

    return button;
}
 
源代码2 项目: java-swing-tips   文件: MainPanel.java
private static JButton createArrowButton(int direction) {
  return new BasicArrowButton(direction) {
    @Override public void updateUI() {
      super.updateUI();
      Border buttonBorder = UIManager.getBorder("Spinner.arrowButtonBorder");
      if (buttonBorder instanceof UIResource) {
        // Wrap the border to avoid having the UIResource be replaced by
        // the ButtonUI. This is the opposite of using BorderUIResource.
        setBorder(new CompoundBorder(buttonBorder, null));
      } else {
        setBorder(buttonBorder);
      }
      setInheritsPopupMenu(true);
    }
  };
}
 
源代码3 项目: nanoleaf-desktop   文件: ModernScrollBarUI.java
@Override
protected JButton createIncreaseButton(int orientation)
{
	thumbColor = Color.GRAY;
	thumbLightShadowColor = new Color(0, 0, 0, 0);
	thumbDarkShadowColor = new Color(0, 0, 0, 0);
	thumbHighlightColor = Color.GRAY;
	trackColor = new Color(57, 57, 57);
	trackHighlightColor = Color.GRAY;
	return new BasicArrowButton(BasicArrowButton.SOUTH,
			Color.GRAY, Color.GRAY, new Color(57, 57, 57), Color.LIGHT_GRAY);
}
 
源代码4 项目: nanoleaf-desktop   文件: ModernScrollBarUI.java
@Override
protected JButton createDecreaseButton(int orientation)
{
	thumbColor = Color.GRAY;
	thumbLightShadowColor = new Color(0, 0, 0, 0);
	thumbDarkShadowColor = new Color(0, 0, 0, 0);
	thumbHighlightColor = Color.GRAY;
	trackColor = new Color(57, 57, 57);
	trackHighlightColor = Color.GRAY;
	return new BasicArrowButton(BasicArrowButton.SOUTH,
			Color.GRAY, Color.GRAY, new Color(57, 57, 57), Color.LIGHT_GRAY);
}
 
源代码5 项目: sldeditor   文件: ArrowIcon.java
/**
 * Instantiates a new arrow icon.
 *
 * @param iconSize the icon size
 * @param direction the direction
 * @param isEnabled the is enabled
 */
public ArrowIcon(int iconSize, int direction, boolean isEnabled) {
    this.size = iconSize / 2;
    this.iconSize = iconSize;
    this.direction = direction;
    this.isEnabled = isEnabled;
    iconRenderer = new BasicArrowButton(direction);
}
 
源代码6 项目: ChatGameFontificator   文件: ArrowIcon.java
public ArrowIcon(int iconSize, int direction, boolean isEnabled)
{
    this.size = iconSize / 2;
    this.iconSize = iconSize;
    this.direction = direction;
    this.isEnabled = isEnabled;
    iconRenderer = new BasicArrowButton(direction);
}
 
源代码7 项目: java-swing-tips   文件: MainPanel.java
@Override protected JButton createArrowButton() {
  JButton button = super.createArrowButton();
  if (button instanceof BasicArrowButton) {
    ((BasicArrowButton) button).setDirection(SwingConstants.EAST);
  }
  return button;
}
 
源代码8 项目: swing_library   文件: SidebarSection.java
public void expand() {
		sideBarOwner.setCurrentSection(this);
		
		arrowPanel.changeDirection(BasicArrowButton.SOUTH);
		arrowPanel.updateUI();
		
		calculatedHeight = -1;
		calculatedHeight = sideBarOwner.getSize().height;
		
		System.out.println("sidebarSection.contentPane.getHeight() " + contentPane.getHeight());
		
		if (this.sideBarOwner.animate) {
			SidebarAnimation anim = new SidebarAnimation(this, 200); // ANIMATION BIT
			
			anim.setStartValue(minComponentHeight);
			anim.setEndValue(calculatedHeight);
			anim.start();
		} else {
			if (sideBarOwner.thisMode == SideBarMode.INNER_LEVEL) {
				calculatedHeight = 1000;
				Dimension d = new Dimension(Integer.MAX_VALUE, calculatedHeight);
				setMaximumSize(d);
				sideBarOwner.setPreferredSize(d);
				contentPane.setVisible(true);
				revalidate();
			} else {
				setMaximumSize(new Dimension(Integer.MAX_VALUE, calculatedHeight));
				contentPane.setVisible(true);
				revalidate();
			}
//			printDimensions();
		}
	}
 
源代码9 项目: swing_library   文件: SidebarSection.java
public void collapse(boolean animate) {
		// remove reference
		if (sideBarOwner.getCurrentSection() == SidebarSection.this)
			sideBarOwner.setCurrentSection(null);
		
		arrowPanel.changeDirection(BasicArrowButton.EAST);
		arrowPanel.updateUI();
		
		if (animate && this.sideBarOwner.animate) {
			SidebarAnimation anim = new SidebarAnimation(this, 200); // ANIMATION BIT
			anim.setStartValue(calculatedHeight);
			anim.setEndValue(minComponentHeight);
			anim.start();
		} else {
			if (sideBarOwner.thisMode == SideBarMode.INNER_LEVEL) {
				setMaximumSize(new Dimension(Integer.MAX_VALUE, titlePanel.getPreferredSize().height));
				contentPane.setVisible(false);
				revalidate();
//				printDimensions();
			} else {
				setMaximumSize(new Dimension(Integer.MAX_VALUE, titlePanel.getPreferredSize().height));
				contentPane.setVisible(false);
				revalidate();
//				printDimensions();
			}
		}
	}
 
源代码10 项目: consulo   文件: DarculaSpinnerUI.java
protected void paintArrowButton(Graphics g, BasicArrowButton button, @MagicConstant(intValues = {SwingConstants.NORTH, SwingConstants.SOUTH}) int direction) {
  Insets i = spinner.getInsets();
  int x = (button.getWidth() - i.right - ARROW_WIDTH.get()) / 2;
  int y = direction == SwingConstants.NORTH ? button.getHeight() - JBUIScale.scale(2) : JBUIScale.scale(2);

  button.paintTriangle(g, x, y, 0, direction, spinner.isEnabled());
}
 
源代码11 项目: consulo   文件: ModernComboBoxUI.java
@Override
protected JButton createArrowButton() {
  final Color bg = myComboBox.getBackground();
  final Color fg = myComboBox.getForeground();
  JButton button = new BasicArrowButton(SwingConstants.SOUTH, bg, fg, fg, fg) {

    @Override
    public void paint(Graphics g) {
      Color borderColor = ModernUIUtil.getBorderColor(myComboBox);
      GraphicsConfig config = new GraphicsConfig(g);

      final int w = getWidth();
      final int h = getHeight();
      g.setColor(UIUtil.getControlColor());
      g.fillRect(0, 0, w, h - JBUI.scale(2));
      g.setColor(myComboBox.isEnabled() ? getForeground() : borderColor);
      GraphicsUtil.setupAAPainting(g);
      g.drawLine(JBUI.scale(3), JBUI.scale(7), JBUI.scale(7), JBUI.scale(11));
      g.drawLine(JBUI.scale(7), JBUI.scale(11), JBUI.scale(11), JBUI.scale(7));
      config.restore();
    }

    @Override
    public Dimension getPreferredSize() {
      int size = getFont().getSize() + JBUI.scale(4);
      if (size % 2 == 1) size += JBUI.scale(1);
      return new DimensionUIResource(size, size);
    }
  };
  button.setBorder(BorderFactory.createEmptyBorder());
  button.setOpaque(false);
  return button;
}
 
源代码12 项目: atdl4j   文件: SwingSpinnerWidget.java
private void doButtonsLayout(JPanel buttonPanel) {
  buttonPanel.setBorder(BorderFactory.createLoweredBevelBorder());
  GridBagConstraints gc = new GridBagConstraints();
  gc.gridx=0;
  buttonUp = new BasicArrowButtonFixedSize(BasicArrowButton.NORTH);
  buttonDown = new BasicArrowButtonFixedSize(BasicArrowButton.SOUTH);
  buttonPanel.add(buttonUp, gc);
  buttonPanel.add(buttonDown, gc);
}
 
源代码13 项目: settlers-remake   文件: SettlersComboboxUi.java
@Override
protected JButton createArrowButton() {
	JButton button = new ScrollbarUiButton(BasicArrowButton.SOUTH, UIDefaults.ARROW_COLOR);
	button.setName("ComboBox.arrowButton");
	return button;
}
 
源代码14 项目: swing_library   文件: SidebarSection.java
/**
	 * Construct a new sidebar section with the specified owner and model. 
	 * 
	 * @param owner - SideBar
	 * @param model
	 */
	public SidebarSection(SideBar owner, 
			JComponent titleComponent, 
			JComponent component, Icon icon) {
		
		if (owner.thisMode == SideBar.SideBarMode.INNER_LEVEL)
			minComponentHeight = 30;
		else
			minComponentHeight = 40;
		
		
		this.contentPane = component;
		
		sideBarOwner = owner;
		
		titlePanel = new JPanel();
		titlePanel.addMouseListener(new MouseAdapter() {
			public void mouseReleased(MouseEvent e) {
				
				if (SidebarSection.this != sideBarOwner.getCurrentSection()) {
					if (sideBarOwner.getCurrentSection() != null)
						sideBarOwner.getCurrentSection().collapse(true);
					
					expand(); //expand this!
				}
				else {
					collapse(true);
				}
			}
		});

		//absolute layout
//		setLayout(null);
		setLayout(new BorderLayout());
		
		add(titlePanel, BorderLayout.NORTH);

		titlePanel.setLayout(new BorderLayout());
		titlePanel.setPreferredSize(new Dimension(this.getPreferredSize().width, minComponentHeight));
		titlePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
		
		arrowPanel = new ArrowPanel(BasicArrowButton.EAST);
		arrowPanel.setPreferredSize(new Dimension(40, 40));
		
		
		if (sideBarOwner.showArrow)
			//add into tab panel the arrow and labels.
			titlePanel.add(arrowPanel, BorderLayout.EAST);
		
		
		titlePanel.add(new JLabel(icon), BorderLayout.WEST);
		
		titleComponent.setBorder(new CompoundBorder(BorderFactory.createEmptyBorder(2, 8, 2, 2), titleComponent.getBorder()));
		titlePanel.add(titleComponent);

//		this.setMinimumSize(new Dimension(minComponentWidth, minComponentHeight));
//		component.setPreferredSize(new Dimension(0,0));
		
		add(component, BorderLayout.CENTER);
		
		revalidate();
	}
 
源代码15 项目: Darcula   文件: DarculaComboBoxUI.java
protected JButton createArrowButton() {
  final Color bg = myComboBox.getBackground();
  final Color fg = myComboBox.getForeground();
  JButton button = new BasicArrowButton(SwingConstants.SOUTH, bg, fg, fg, fg) {

    @Override
    public void paint(Graphics g2) {
      final Graphics2D g = (Graphics2D)g2;
      final GraphicsConfig config = new GraphicsConfig(g);

      final int w = getWidth();
      final int h = getHeight();
      if (!isTableCellEditor(myComboBox)) {
        g.setColor(getArrowButtonFillColor(UIUtil.getControlColor()));
        g.fillRect(0, 0, w, h);
      }
      g.setColor(comboBox.isEnabled() ? new DoubleColor(Gray._255, getForeground()) : new DoubleColor(Gray._255, getForeground().darker()));
      g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
      g.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
      final int xU = w / 4;
      final int yU = h / 4;
      final Path2D.Double path = new Path2D.Double();
      g.translate(2, 0);
      path.moveTo(xU + 1, yU + 2);
      path.lineTo(3 * xU + 1, yU + 2);
      path.lineTo(2 * xU + 1, 3 * yU);
      path.lineTo(xU + 1, yU + 2);
      path.closePath();
      g.fill(path);
      g.translate(-2, 0);
      if (!isTableCellEditor(myComboBox)) {
        g.setColor(getArrowButtonFillColor(getBorderColor()));
        g.drawLine(0, -1, 0, h);
      }
      config.restore();
    }

    @Override
    public Dimension getPreferredSize() {
      int size = getFont().getSize() + 4;
      if (size%2==1) size++;
      return new DimensionUIResource(size, size);
    }
  };
  button.setBorder(BorderFactory.createEmptyBorder());
  button.setOpaque(false);
  return button;
}
 
源代码16 项目: pdfxtk   文件: PageSpinner.java
/**
 * Constructor method for a PageSpinner with default value displayed "0 / 0"
 */
public PageSpinner() {
	
	//Default values of the spinner
	currentPageNo = 0;
	maxPageNo = 0;
	
	display = new JLabel(currentPageNo + " / " + maxPageNo);
	
	previous = new BasicArrowButton(BasicArrowButton.WEST);
	
	next = new BasicArrowButton(BasicArrowButton.EAST);
	
	//Arrange JPanel child components
	add(previous);
	
	add(Box.createRigidArea(new Dimension(7, 0)));
	
	add(display);
	
	add(Box.createRigidArea(new Dimension(7, 0)));
	
	add(next);
}
 
源代码17 项目: pdfxtk   文件: PageSpinner.java
/**
 * Getter method for the left previous arrow button
 * 
 * @return The left previous arrow button
 */
public BasicArrowButton getPreviousButton() {
	
	return previous;
}
 
源代码18 项目: pdfxtk   文件: PageSpinner.java
/**
 * Getter method for the right next arrow button
 * 
 * @return The right next arrow button
 */
public BasicArrowButton getNextButton() {
	
	return next;
}
 
 类所在包
 类方法
 同包方法