@Override public void paint(Graphics g, JComponent c) { Graphics2D g2 = (Graphics2D) g; AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); initShape(b); // ContentArea g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (model.isArmed()) { g2.setColor(ac); g2.fill(shape); } else if (b.isRolloverEnabled() && model.isRollover()) { paintFocusAndRollover(g2, c, rc); } else if (b.hasFocus()) { paintFocusAndRollover(g2, c, fc); } else { g2.setColor(c.getBackground()); g2.fill(shape); } // Border g2.setPaint(c.getForeground()); g2.draw(shape); g2.setColor(c.getBackground()); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); super.paint(g2, c); }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { JMenuItem b = (JMenuItem) c; ButtonModel model = b.getModel(); g.translate(x, y); if (c.getParent() instanceof JMenuBar) { if (model.isArmed() || model.isSelected()) { g.setColor(MetalLookAndFeel.getControlDarkShadow()); g.drawLine(0, 0, w - 2, 0); g.drawLine(0, 0, 0, h - 1); g.drawLine(w - 2, 2, w - 2, h - 1); g.setColor(MetalLookAndFeel.getPrimaryControlHighlight()); g.drawLine(w - 1, 1, w - 1, h - 1); g.setColor(MetalLookAndFeel.getMenuBackground()); g.drawLine(w - 1, 0, w - 1, 0); } } else { if (model.isArmed() || (c instanceof JMenu && model.isSelected())) { g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow()); g.drawLine(0, 0, w - 1, 0); g.setColor(MetalLookAndFeel.getPrimaryControlHighlight()); g.drawLine(0, h - 1, w - 1, h - 1); } else { g.setColor(MetalLookAndFeel.getPrimaryControlHighlight()); g.drawLine(0, 0, 0, h - 1); } } g.translate(-x, -y); }
/** Returns the current state of the passed in <code>AbstractButton</code>. */ private int getComponentState(JComponent c) { int state = ENABLED; if (!c.isEnabled()) { state = DISABLED; } AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); if (model.isPressed()) { if (model.isArmed()) { state = PRESSED; } else { state = MOUSE_OVER; } } if (model.isRollover()) { state |= MOUSE_OVER; } if (model.isSelected()) { state |= SELECTED; } if (c.isFocusOwner() && button.isFocusPainted()) { state |= FOCUSED; } if ((c instanceof JButton) && ((JButton) c).isDefaultButton()) { state |= DEFAULT; } return state; }
protected void paintBackground(Graphics g, JComponent c, int x, int y, int w, int h) { JMenuItem b = (JMenuItem) c; ButtonModel model = b.getModel(); if (c.getParent() instanceof JMenuBar) { if (model.isArmed() || (c instanceof JMenu && model.isSelected())) { g.setColor(AbstractLookAndFeel.getMenuSelectionBackgroundColor()); g.fillRect(x, y, w, h); } } else { if (model.isArmed() || (c instanceof JMenu && model.isSelected())) { g.setColor(AbstractLookAndFeel.getMenuSelectionBackgroundColor()); g.fillRect(x, y, w, h); } else if (!AbstractLookAndFeel.getTheme().isMenuOpaque()) { Graphics2D g2D = (Graphics2D) g; Composite composite = g2D.getComposite(); AlphaComposite alpha = AlphaComposite.getInstance( AlphaComposite.SRC_OVER, AbstractLookAndFeel.getTheme().getMenuAlpha()); g2D.setComposite(alpha); g.setColor(AbstractLookAndFeel.getMenuBackgroundColor()); g.fillRect(x, y, w, h); g2D.setComposite(composite); } else { g.setColor(AbstractLookAndFeel.getMenuBackgroundColor()); g.fillRect(x, y, w, h); } } if (menuItem.isSelected() && menuItem.isArmed()) { g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor()); } else { g.setColor(AbstractLookAndFeel.getMenuForegroundColor()); } }
public void paint(Graphics g, JComponent c) { AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); String text = layout(b, SwingUtilities2.getFontMetrics(b, g), b.getWidth(), b.getHeight()); clearTextShiftOffset(); // perform UI specific press action, e.g. Windows L&F shifts text if (model.isArmed() && model.isPressed()) { paintButtonPressed(g, b); } // Paint the Icon if (b.getIcon() != null) { paintIcon(g, c, iconRect); } if (text != null && !text.equals("")) { View v = (View) c.getClientProperty(BasicHTML.propertyKey); if (v != null) { v.paint(g, textRect); } else { paintText(g, b, textRect, text); } } if (b.isFocusPainted() && b.hasFocus()) { // paint UI specific focus paintFocus(g, b, viewRect, textRect, iconRect); } }
private void updateLook(JButton button) { ButtonModel model = button.getModel(); boolean enabled = model.isEnabled(); if (!enabled) { setLookNormal(button); return; } boolean pressed = model.isPressed(); boolean selected = model.isSelected(); if (pressed || selected) { setLookLowered(button); return; } if ((button == arrow) && popupVisible) { setLookLowered(button); return; } if (rollOver) { setLookRaised(button); return; } if (arrow.getModel().isSelected()) { setLookRaised(button); return; } setLookNormal(button); }
@Override protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect) { AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); Icon icon = b.getIcon(); Icon tmpIcon = null; Icon shadowIcon = null; boolean borderHasPressedCue = borderHasPressedCue(b); if (icon == null) { return; } if (!model.isEnabled()) { if (model.isSelected()) { tmpIcon = (Icon) b.getDisabledSelectedIcon(); } else { tmpIcon = (Icon) b.getDisabledIcon(); } } else if (model.isPressed() && model.isArmed()) { tmpIcon = (Icon) b.getPressedIcon(); if (tmpIcon != null) { // revert back to 0 offset clearTextShiftOffset(); } else if (icon != null && icon instanceof ImageIcon && !borderHasPressedCue) { // Create an icon on the fly. // Note: This is only needed for borderless buttons, which // have no other way to provide feedback about the pressed // state. tmpIcon = new ImageIcon(HalfbrightFilter.createHalfbrightImage(((ImageIcon) icon).getImage())); shadowIcon = new ImageIcon(ShadowFilter.createShadowImage(((ImageIcon) icon).getImage())); } } else if (b.isRolloverEnabled() && model.isRollover()) { if (model.isSelected()) { tmpIcon = b.getRolloverSelectedIcon(); if (tmpIcon == null) { tmpIcon = b.getSelectedIcon(); } } else { tmpIcon = (Icon) b.getRolloverIcon(); } } else if (model.isSelected()) { tmpIcon = b.getSelectedIcon(); } if (tmpIcon != null) { icon = tmpIcon; } if (model.isPressed() && model.isArmed()) { if (shadowIcon != null) { shadowIcon.paintIcon( c, g, iconRect.x + getTextShiftOffset(), iconRect.y + getTextShiftOffset() + 1); } icon.paintIcon(c, g, iconRect.x + getTextShiftOffset(), iconRect.y + getTextShiftOffset()); } else { icon.paintIcon(c, g, iconRect.x, iconRect.y); } }
protected void paintIcon(Graphics g, JComponent c, Rectangle iconRect) { AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); Icon icon = b.getIcon(); Icon tmpIcon = null; if (icon == null) { return; } Icon selectedIcon = null; /* the fallback icon should be based on the selected state */ if (model.isSelected()) { selectedIcon = (Icon) b.getSelectedIcon(); if (selectedIcon != null) { icon = selectedIcon; } } if (!model.isEnabled()) { if (model.isSelected()) { tmpIcon = (Icon) b.getDisabledSelectedIcon(); if (tmpIcon == null) { tmpIcon = selectedIcon; } } if (tmpIcon == null) { tmpIcon = (Icon) b.getDisabledIcon(); } } else if (model.isPressed() && model.isArmed()) { tmpIcon = (Icon) b.getPressedIcon(); if (tmpIcon != null) { // revert back to 0 offset clearTextShiftOffset(); } } else if (b.isRolloverEnabled() && model.isRollover()) { if (model.isSelected()) { tmpIcon = (Icon) b.getRolloverSelectedIcon(); if (tmpIcon == null) { tmpIcon = selectedIcon; } } if (tmpIcon == null) { tmpIcon = (Icon) b.getRolloverIcon(); } } if (tmpIcon != null) { icon = tmpIcon; } if (model.isPressed() && model.isArmed()) { icon.paintIcon(c, g, iconRect.x + getTextShiftOffset(), iconRect.y + getTextShiftOffset()); } else { icon.paintIcon(c, g, iconRect.x, iconRect.y); } }
@Override @SuppressWarnings("unchecked") public void paintIcon(final Component c, final Graphics g, final int x, final int y) { JCheckBox cb = (JCheckBox) c; javax.swing.ButtonModel model = cb.getModel(); if (ThemeManager.isLookAndFeelNimbus()) { icon.paintIcon(c, g, x, y); if (c.hasFocus()) { nimbusFocusBorder.paintBorder(g, x, y, iconWidth, iconHeight); } drawIndeterminateNimbusLine(g, x, y); } else { if (model.isEnabled()) { if (model.isPressed() && model.isArmed()) { g.setColor(MetalLookAndFeel.getControlShadow()); g.fillRect(x, y, iconWidth - 1, iconHeight - 1); drawPressed3DBorder(g, x, y, iconWidth, iconHeight); } else { drawFlush3DBorder(g, x, y, iconWidth, iconHeight); } g.setColor(MetalLookAndFeel.getControlInfo()); } else { g.setColor(MetalLookAndFeel.getControlShadow()); g.drawRect(x, y, iconWidth - 1, iconHeight - 1); } drawIndeterminateLine(g, x, y); } }
/** * Method which renders the text of the current button. * * <p> * * @param g Graphics context * @param b Current button to render * @param textRect Bounding rectangle to render the text. * @param text String to render * @since 1.4 */ @Override protected void paintText(Graphics g, AbstractButton b, Rectangle textRect, String text) { ButtonModel model = b.getModel(); FontMetrics fm = g.getFontMetrics(); int mnemonicIndex = Methods.invokeGetter(b, "getDisplayedMnemonicIndex", -1); boolean borderHasPressedCue = borderHasPressedCue(b); /* Draw the Text */ if (model.isPressed() && model.isArmed() && !borderHasPressedCue) { g.setColor(new Color(0xa0000000, true)); QuaquaUtilities.drawStringUnderlineCharAt( g, text, mnemonicIndex, textRect.x + getTextShiftOffset(), textRect.y + fm.getAscent() + getTextShiftOffset() + 1); } if (model.isEnabled()) { /** * paint the text normally */ g.setColor(b.getForeground()); } else { Color c = UIManager.getColor(getPropertyPrefix() + "disabledForeground"); g.setColor((c != null) ? c : b.getForeground()); } QuaquaUtilities.drawStringUnderlineCharAt( g, text, mnemonicIndex, textRect.x + getTextShiftOffset(), textRect.y + fm.getAscent() + getTextShiftOffset()); }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { JMenuItem b = (JMenuItem) c; ButtonModel model = b.getModel(); Color borderColorLo = AbstractLookAndFeel.getFrameColor(); Color borderColorHi = ColorHelper.brighter(AbstractLookAndFeel.getMenuSelectionBackgroundColor(), 40); if (c.getParent() instanceof JMenuBar) { if (model.isArmed() || model.isSelected()) { g.setColor(borderColorLo); g.drawLine(x, y, x + w - 1, y); g.drawLine(x, y, x, y + h - 1); g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); g.setColor(borderColorHi); g.drawLine(x + 1, y + 1, x + w - 2, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 1); } } else { if (model.isArmed() || (c instanceof JMenu && model.isSelected())) { g.setColor(borderColorLo); g.drawLine(x, y, x + w - 1, y); g.drawLine(x, y + h - 1, x + w - 1, y + h - 1); g.setColor(borderColorHi); g.drawLine(x, y + 1, x + w - 2, y + 1); } } }
public void paintComponent(Graphics g) { if (m.isPressed()) { t = colorCount - 1; g.setColor(pressed[t]); g.fillRect(0, 0, getSize().width - 1, getSize().height - 1); g.setColor(border[t]); } else { g.setColor(rollOver[t]); g.fillRect(0, 0, getSize().width - 1, getSize().height - 1); g.setColor(border[t]); if (m.isRollover()) { if (t < colorCount - 1 && !fadeIn.isRunning()) { fadeOut.stop(); fadeIn.start(); } } else { if (t > 0 && !fadeOut.isRunning()) { fadeIn.stop(); fadeOut.start(); } } } super.paintComponent(g); }
protected void paintText(Graphics g, JComponent com, Rectangle rect, String s) { JButtonLinkA bn = (JButtonLinkA) com; ButtonModel bnModel = bn.getModel(); Color color = bn.getForeground(); Object obj = null; if (bnModel.isEnabled()) { if (bnModel.isPressed()) bn.setForeground(bn.getActiveLinkColor()); else if (bn.isLinkVisited()) bn.setForeground(bn.getVisitedLinkColor()); else bn.setForeground(bn.getLinkColor()); } else { if (bn.getDisabledLinkColor() != null) bn.setForeground(bn.getDisabledLinkColor()); } super.paintText(g, com, rect, s); int behaviour = bn.getLinkBehavior(); boolean drawLine = false; if (behaviour == JButtonLinkA.HOVER_UNDERLINE) { if (bnModel.isRollover()) drawLine = true; } else if (behaviour == JButtonLinkA.ALWAYS_UNDERLINE || behaviour == JButtonLinkA.SYSTEM_DEFAULT) drawLine = true; if (!drawLine) return; FontMetrics fm = g.getFontMetrics(); int x = rect.x + getTextShiftOffset(); int y = (rect.y + fm.getAscent() + fm.getDescent() + getTextShiftOffset()) - 1; if (bnModel.isEnabled()) { g.setColor(bn.getForeground()); g.drawLine(x, y, (x + rect.width) - 1, y); } else { g.setColor(bn.getBackground().brighter()); g.drawLine(x, y, (x + rect.width) - 1, y); } }
/** * As of Java 2 platform v 1.4 this method should not be used or overriden. Use the paintText * method which takes the AbstractButton argument. */ protected void paintText(Graphics g, JComponent c, Rectangle textRect, String text) { AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); FontMetrics fm = SwingUtilities2.getFontMetrics(c, g); int mnemonicIndex = b.getDisplayedMnemonicIndex(); /* Draw the Text */ if (model.isEnabled()) { /** * paint the text normally */ g.setColor(b.getForeground()); SwingUtilities2.drawStringUnderlineCharAt( c, g, text, mnemonicIndex, textRect.x + getTextShiftOffset(), textRect.y + fm.getAscent() + getTextShiftOffset()); } else { /** * paint the text disabled ** */ g.setColor(b.getBackground().brighter()); SwingUtilities2.drawStringUnderlineCharAt( c, g, text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent()); g.setColor(b.getBackground().darker()); SwingUtilities2.drawStringUnderlineCharAt( c, g, text, mnemonicIndex, textRect.x - 1, textRect.y + fm.getAscent() - 1); } }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { AbstractButton abstractButton = (AbstractButton) c; ButtonModel buttonModel = abstractButton.getModel(); int w = getIconWidth(); int h = getIconHeight(); if (g instanceof Graphics2D) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh); float s = SizeHelper.getMinimalStrockWidth(); g2.setStroke(new BasicStroke(s)); } g.setColor(Color.WHITE); g.fillOval(x, y, w - 1, h - 1); if (buttonModel.isEnabled()) { g.setColor(Color.BLACK); } else { g.setColor(Color.GRAY); } g.drawOval(x, y, w - 1, h - 1); if (buttonModel.isSelected()) { int dx = (int) Math.round(0.25 * w); int dy = (int) Math.round(0.25 * h); g.fillOval(x + dx, y + dy, w - 2 * dx, h - 2 * dy); } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (MetalLookAndFeel.usingOcean()) { paintOceanBorder(c, g, x, y, w, h); return; } AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); if (model.isEnabled()) { boolean isPressed = model.isPressed() && model.isArmed(); boolean isDefault = (button instanceof JButton && ((JButton) button).isDefaultButton()); if (isPressed && isDefault) { MetalUtils.drawDefaultButtonPressedBorder(g, x, y, w, h); } else if (isPressed) { MetalUtils.drawPressed3DBorder(g, x, y, w, h); } else if (isDefault) { MetalUtils.drawDefaultButtonBorder(g, x, y, w, h, false); } else { MetalUtils.drawButtonBorder(g, x, y, w, h, false); } } else { // disabled state MetalUtils.drawDisabledBorder(g, x, y, w - 1, h - 1); } }
/** * Instantiates a new manual edit panel. * * @param manualEdit the manual edit */ public ManualEditPanel(ManualEdit manualEdit) { _manualEdit = manualEdit; initComponents(); _requestButtonModel = interceptRequestCheckBox.getModel(); _requestButtonModel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { boolean enabled = interceptRequestCheckBox.isSelected(); interceptIncludeRegexTextField.setEnabled(isEnabled() && enabled); interceptExcludeRegexTextField.setEnabled(isEnabled() && enabled); interceptMethodList.setEnabled(isEnabled() && enabled); _manualEdit.setInterceptRequest(enabled); } }); _responseButtonModel = interceptResponseCheckBox.getModel(); _responseButtonModel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { boolean enabled = interceptResponseCheckBox.isSelected(); interceptResponseTextField.setEnabled(isEnabled() && enabled); _manualEdit.setInterceptResponse(enabled); } }); configure(); interceptMethodList.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { interceptMethodListValueChanged(evt); } }); _manualEdit.setUI(this); }
@Override protected void paintText( final Graphics g, final JComponent c, final Rectangle textRect, final String text) { final AbstractButton b = (AbstractButton) c; final ButtonModel model = b.getModel(); final FontMetrics fm = SwingUtils.getFontMetrics(c, g); final int mnemonicIndex = b.getDisplayedMnemonicIndex(); // Drawing text if (model.isEnabled()) { // Normal text g.setColor(b.getForeground()); SwingUtils.drawStringUnderlineCharAt( g, text, mnemonicIndex, textRect.x + getTextShiftOffset(), textRect.y + fm.getAscent() + getTextShiftOffset()); } else { // Disabled text g.setColor(b.getBackground().brighter()); SwingUtils.drawStringUnderlineCharAt( g, text, mnemonicIndex, textRect.x, textRect.y + fm.getAscent()); g.setColor(b.getBackground().darker()); SwingUtils.drawStringUnderlineCharAt( g, text, mnemonicIndex, textRect.x - 1, textRect.y + fm.getAscent() - 1); } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { AbstractButton b = (AbstractButton) c; ButtonModel model = b.getModel(); if (model.isRollover() && !(model.isPressed() && !model.isArmed())) { super.paintBorder(c, g, x, y, w, h); } }
public void paintIcon(Component c, Graphics g, int x, int y) { ButtonModel model = ((AbstractButton) c).getModel(); if (model.isPressed() && model.isArmed()) { pressed.paintIcon(c, g, x, y); } else { super.paintIcon(c, g, x, y); } }
/* * (non-Javadoc) * * @see * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent * ) */ @Override public void actionPerformed(ActionEvent e) { AbstractButton src = (AbstractButton) e.getSource(); ButtonModel model = src.getModel(); model.setArmed(false); model.setPressed(false); model.setRollover(false); model.setSelected(false); }
/** Returns the amount to shift the text/icon when painting. */ private int getTextShiftOffset(SynthContext state) { AbstractButton button = (AbstractButton) state.getComponent(); ButtonModel model = button.getModel(); if (model.isArmed() && model.isPressed() && button.getPressedIcon() == null) { return state.getStyle().getInt(state, getPropertyPrefix() + "textShiftOffset", 0); } return 0; }
private void resetButtonStatus() { for (JButton b : Arrays.asList(deleteButton, copyButton)) { ButtonModel m = b.getModel(); m.setRollover(false); m.setArmed(false); m.setPressed(false); m.setSelected(false); } }
@Override public void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y) { if (c instanceof javax.swing.AbstractButton) { javax.swing.AbstractButton button = (javax.swing.AbstractButton) c; javax.swing.ButtonModel buttonModel = button.getModel(); javax.swing.Icon icon = buttonModel.isSelected() ? this.selectedIcon : this.unselectedIcon; icon.paintIcon(c, g, x, y); } else { g.setColor(java.awt.Color.RED); g.fillRect(x, y, c.getWidth(), c.getHeight()); } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { AbstractButton button = (AbstractButton) c; ButtonModel model = button.getModel(); Color frameColor = AbstractLookAndFeel.getToolbarBackgroundColor(); Color frameHiColor = ColorHelper.brighter(frameColor, 10); Color frameLoColor = ColorHelper.darker(frameColor, 30); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x, y, w, h); if ((model.isPressed() && model.isArmed()) || model.isSelected()) { JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h); } else { JTattooUtilities.draw3DBorder(g, frameLoColor, frameHiColor, x, y, w, h); JTattooUtilities.draw3DBorder(g, frameHiColor, frameLoColor, x + 1, y + 1, w - 2, h - 2); } }
@Override public void mousePressed(MouseEvent e) { Object o = e.getSource(); if (o instanceof TableCellEditor) { actionPerformed(null); } else if (o instanceof JButton) { // DEBUG: view button click -> control key down + edit button(same cell) press -> remain // selection color ButtonModel m = ((JButton) e.getComponent()).getModel(); if (m.isPressed() && table.isRowSelected(table.getEditingRow()) && e.isControlDown()) { setBackground(table.getBackground()); } } }
private void setState(Boolean state) { if (state == null) { other.setArmed(true); setPressed(true); setSelected(false); } else if (state.booleanValue() == Boolean.FALSE) { other.setArmed(false); setPressed(false); setSelected(false); } else if (state.booleanValue() == Boolean.TRUE) { other.setArmed(false); setPressed(false); setSelected(true); } }
public void paintBackground(Graphics g, JMenuItem menuItem, Color bgColor) { ButtonModel model = menuItem.getModel(); int menuWidth = menuItem.getWidth(); int menuHeight = menuItem.getHeight(); PlastikColorTheme colorTheme = PlastikLookAndFeel.getTheme().getColorTheme(); Color oldColor = g.getColor(); Color background = colorTheme.getColor( menuItem.getBackground(), PlastikColorTheme.MENU_ITEM | PlastikColorTheme.BACKGROUND); g.setColor(background); g.fillRect(0, 0, menuWidth, menuHeight); if (model.isArmed() || (menuItem instanceof JMenu && model.isSelected())) { Color top = colorTheme.getColor( PlastikColorTheme.MENU_ITEM | PlastikColorTheme.BACKGROUND | PlastikColorTheme.ROLLOVER | PlastikColorTheme.BRIGHTER); Color topGradient = colorTheme.getColor( PlastikColorTheme.MENU_ITEM | PlastikColorTheme.BACKGROUND | PlastikColorTheme.ROLLOVER | PlastikColorTheme.BRIGHTER_GRADIENT); Color bottomGradient = colorTheme.getColor( PlastikColorTheme.MENU_ITEM | PlastikColorTheme.BACKGROUND | PlastikColorTheme.ROLLOVER | PlastikColorTheme.DARKER_GRADIENT); Color bottom = colorTheme.getColor( PlastikColorTheme.MENU_ITEM | PlastikColorTheme.BACKGROUND | PlastikColorTheme.ROLLOVER | PlastikColorTheme.DARKER); g.setColor(top); g.drawLine(0, 0, menuWidth - 1, 0); Gradients.drawBoxGradient(g, 0, 1, menuWidth, menuHeight - 2, topGradient, bottomGradient); g.setColor(bottom); g.drawLine(0, menuHeight - 1, menuWidth - 1, menuHeight - 1); } g.setColor(oldColor); }
protected void paintComponent(Graphics maing) { ButtonModel buttonModel = getModel(); Graphics2D g = (Graphics2D) maing.create(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (buttonModel.isRollover()) { if (buttonModel.isPressed()) { g.drawImage(img3, 0, 0, getWidth(), getHeight(), null); } else g.drawImage(img2, 0, 0, getWidth(), getHeight(), null); } else g.drawImage(img1, 0, 0, getWidth(), getHeight(), null); if (Settings.drawTracers) { g.setColor(Color.CYAN); g.drawRect(0, 0, getWidth() - 1, getHeight() - 1); } g.dispose(); super.paintComponent(maing); }
@Override public int compare(final AddonInfoLabel o1, final AddonInfoLabel o2) { final AddonInfo info1 = o1.getAddonInfo(); final AddonInfo info2 = o2.getAddonInfo(); if (sortByDate.isSelected()) { return info1.getId() - info2.getId(); } else if (sortByName.isSelected()) { return info1.getTitle().compareTo(info2.getTitle()); } else if (sortByRating.isSelected()) { return info1.getRating() - info2.getRating(); } else if (sortByStatus.isSelected()) { return (info1.isVerified() ? 1 : 0) - (info2.isVerified() ? 1 : 0); } else { return 0; } }