javax.swing.plaf.basic.BasicArrowButton Java Examples
The following examples show how to use
javax.swing.plaf.basic.BasicArrowButton.
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: LuckComboBoxUI.java From littleluck with Apache License 2.0 | 6 votes |
/** * <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; }
Example #2
Source File: MainPanel.java From java-swing-tips with MIT License | 6 votes |
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); } }; }
Example #3
Source File: ModernScrollBarUI.java From nanoleaf-desktop with MIT License | 5 votes |
@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); }
Example #4
Source File: SwingSpinnerWidget.java From atdl4j with MIT License | 5 votes |
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); }
Example #5
Source File: ModernComboBoxUI.java From consulo with Apache License 2.0 | 5 votes |
@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; }
Example #6
Source File: DarculaSpinnerUI.java From consulo with Apache License 2.0 | 5 votes |
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()); }
Example #7
Source File: SidebarSection.java From swing_library with MIT License | 5 votes |
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(); } } }
Example #8
Source File: SidebarSection.java From swing_library with MIT License | 5 votes |
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(); } }
Example #9
Source File: MainPanel.java From java-swing-tips with MIT License | 5 votes |
@Override protected JButton createArrowButton() { JButton button = super.createArrowButton(); if (button instanceof BasicArrowButton) { ((BasicArrowButton) button).setDirection(SwingConstants.EAST); } return button; }
Example #10
Source File: ArrowIcon.java From ChatGameFontificator with The Unlicense | 5 votes |
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); }
Example #11
Source File: ArrowIcon.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * 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); }
Example #12
Source File: ModernScrollBarUI.java From nanoleaf-desktop with MIT License | 5 votes |
@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); }
Example #13
Source File: SidebarSection.java From swing_library with MIT License | 4 votes |
/** * 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(); }
Example #14
Source File: SettlersComboboxUi.java From settlers-remake with MIT License | 4 votes |
@Override protected JButton createArrowButton() { JButton button = new ScrollbarUiButton(BasicArrowButton.SOUTH, UIDefaults.ARROW_COLOR); button.setName("ComboBox.arrowButton"); return button; }
Example #15
Source File: DarculaComboBoxUI.java From Darcula with Apache License 2.0 | 4 votes |
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; }
Example #16
Source File: PageSpinner.java From pdfxtk with Apache License 2.0 | 4 votes |
/** * 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); }
Example #17
Source File: PageSpinner.java From pdfxtk with Apache License 2.0 | 2 votes |
/** * Getter method for the left previous arrow button * * @return The left previous arrow button */ public BasicArrowButton getPreviousButton() { return previous; }
Example #18
Source File: PageSpinner.java From pdfxtk with Apache License 2.0 | 2 votes |
/** * Getter method for the right next arrow button * * @return The right next arrow button */ public BasicArrowButton getNextButton() { return next; }