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 static void drawStringUnderlineCharAt( JComponent c, Graphics g, String text, int underlinedIndex, int x, int y) { Graphics2D g2D = (Graphics2D) g; Object savedRenderingHint = null; if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) { savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING); g2D.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, AbstractLookAndFeel.getTheme().getTextAntiAliasingHint()); } if (getJavaVersion() >= 1.6) { try { Class swingUtilities2Class = Class.forName("sun.swing.SwingUtilities2"); Class classParams[] = { JComponent.class, Graphics.class, String.class, Integer.TYPE, Integer.TYPE, Integer.TYPE }; Method m = swingUtilities2Class.getMethod("drawStringUnderlineCharAt", classParams); Object methodParams[] = { c, g, text, new Integer(underlinedIndex), new Integer(x), new Integer(y) }; m.invoke(null, methodParams); } catch (Exception ex) { BasicGraphicsUtils.drawString(g, text, underlinedIndex, x, y); } } else if (getJavaVersion() >= 1.4) { BasicGraphicsUtils.drawStringUnderlineCharAt(g, text, underlinedIndex, x, y); } else { BasicGraphicsUtils.drawString(g, text, underlinedIndex, x, y); } if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) { g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint); } }
protected void paintBackground(Graphics g) { int draggedColumn = -1; if ((header != null) && (header.getTable() != null) && header.getDraggedColumn() != null) { draggedColumn = header.getColumnModel().getColumnIndex(header.getDraggedColumn().getIdentifier()); } int w = getWidth(); int h = getHeight(); if ((table != null) && table.isEnabled() && (col == rolloverCol || col == draggedColumn)) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getRolloverColors(), 0, 0, w, h); if (drawRolloverBar()) { g.setColor(AbstractLookAndFeel.getFocusColor()); g.drawLine(0, 0, w - 1, 0); g.drawLine(0, 1, w - 1, 1); g.drawLine(0, 2, w - 1, 2); } } else if (drawAllwaysActive() || JTattooUtilities.isFrameActive(header)) { if (header.getBackground() instanceof ColorUIResource) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getColHeaderColors(), 0, 0, w, h); } else { g.setColor(header.getBackground()); g.fillRect(0, 0, w, h); } } else { if (header.getBackground() instanceof ColorUIResource) { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getInActiveColors(), 0, 0, w, h); } else { g.setColor(header.getBackground()); g.fillRect(0, 0, w, h); } } }
public void paintBorder(Graphics g) { if (isActive()) { g.setColor(ColorHelper.darker(AbstractLookAndFeel.getWindowBorderColor(), 10)); } else { g.setColor(ColorHelper.darker(AbstractLookAndFeel.getWindowInactiveBorderColor(), 10)); } g.drawLine(0, getHeight() - 1, getWidth(), getHeight() - 1); }
public void paintPalette(Graphics g) { if (JTattooUtilities.isFrameActive(this)) { g.setColor(AbstractLookAndFeel.getWindowTitleBackgroundColor()); } else { g.setColor(AbstractLookAndFeel.getWindowInactiveTitleBackgroundColor()); } g.fillRect(0, 0, getWidth(), getHeight()); }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (JTattooUtilities.isFrameActive((JComponent) c)) { g.setColor(AbstractLookAndFeel.getWindowBorderColor()); } else { g.setColor(AbstractLookAndFeel.getWindowInactiveBorderColor()); } g.drawRect(x, y, w - 1, h - 1); }
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Color hiColor = ColorHelper.brighter(AbstractLookAndFeel.getTheme().getFocusFrameColor(), 60); Color loColor = AbstractLookAndFeel.getTheme().getFocusFrameColor(); g.setColor(loColor); g.drawRect(x, y, width - 1, height - 1); g.setColor(hiColor); g.drawRect(x + 1, y + 1, width - 3, height - 3); }
public void paintBackground(Graphics g) { if (isActive()) { g.setColor(AbstractLookAndFeel.getWindowTitleBackgroundColor()); } else { g.setColor(AbstractLookAndFeel.getWindowInactiveTitleBackgroundColor()); } g.fillRect(0, 0, getWidth(), getHeight()); }
protected void paintBackground(Graphics g) { g.setColor(getComponent().getBackground()); if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) { if (getComponent().hasFocus() && getComponent().isEditable()) { g.setColor(AbstractLookAndFeel.getTheme().getFocusBackgroundColor()); } } g.fillRect(0, 0, getComponent().getWidth(), getComponent().getHeight()); }
public int getIconHeight() { if (AbstractLookAndFeel.getTheme().isSmallFontSize()) { return 14; } else if (AbstractLookAndFeel.getTheme().isMediumFontSize()) { return 16; } else { return 18; } }
protected Color[] getThumbColors() { if (isRollover || isDragging) { return AbstractLookAndFeel.getTheme().getRolloverColors(); } else if (!JTattooUtilities.isActive(scrollbar)) { return AbstractLookAndFeel.getTheme().getInActiveColors(); } else { return AbstractLookAndFeel.getTheme().getThumbColors(); } }
/** * Gets the desktop icon border. * * @return the desktop icon border */ public static Border getDesktopIconBorder() { if (desktopIconBorder == null) { desktopIconBorder = new BorderUIResource.CompoundBorderUIResource( new LineBorder(AbstractLookAndFeel.getWindowBorderColor(), 1), new MatteBorder(2, 2, 1, 2, AbstractLookAndFeel.getWindowBorderColor())); } return desktopIconBorder; }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Color logoColor = AbstractLookAndFeel.getMenuSelectionBackgroundColor(); Color borderColorLo = AbstractLookAndFeel.getFrameColor(); Color borderColorHi = ColorHelper.brighter(AbstractLookAndFeel.getMenuSelectionBackgroundColor(), 40); g.setColor(logoColor); if (JTattooUtilities.isLeftToRight(c)) { int dx = getBorderInsets(c).left; g.fillRect(x, y, dx - 1, h - 1); paintLogo(c, g, x, y, w, h); // - highlight g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40)); g.drawLine(x + dx, y + 1, x + w - 2, y + 1); g.setColor(borderColorHi); g.drawLine(x + 1, y, x + 1, y + h - 2); // - outer frame g.setColor(borderColorLo); if (isMenuBarPopup(c)) { // top g.drawLine(x + dx - 1, y, x + w, y); // left g.drawLine(x, y, x, y + h - 1); // bottom g.drawLine(x, y + h - 1, x + w, y + h - 1); // right g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); } else { g.drawRect(x, y, w - 1, h - 1); } // - logo separator g.drawLine(x + dx - 1, y + 1, x + dx - 1, y + h - 1); } else { int dx = getBorderInsets(c).right; g.fillRect(x + w - dx, y, dx, h - 1); paintLogo(c, g, x, y, w, h); // - highlight g.setColor(ColorHelper.brighter(AbstractLookAndFeel.getMenuBackgroundColor(), 40)); g.drawLine(x + 1, y + 1, x + w - dx - 1, y + 1); g.drawLine(x + 1, y + 1, x + 1, y + h - 2); // - outer frame g.setColor(borderColorLo); if (isMenuBarPopup(c)) { // top g.drawLine(x, y, x + w - dx, y); // left g.drawLine(x, y, x, y + h - 1); // bottom g.drawLine(x, y + h - 1, x + w, y + h - 1); // right g.drawLine(x + w - 1, y, x + w - 1, y + h - 1); } else { g.drawRect(x, y, w - 1, h - 1); } // - logo separator g.drawLine(x + w - dx, y + 1, x + w - dx, y + h - 1); } }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { Graphics2D g2D = (Graphics2D) g; Composite savedComposite = g2D.getComposite(); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f); g2D.setComposite(alpha); Color cHi = AbstractLookAndFeel.getTheme().getControlHighlightColor(); Color cLo = AbstractLookAndFeel.getTheme().getControlShadowColor(); JTattooUtilities.draw3DBorder(g, cHi, cLo, x, y, w, h); g2D.setComposite(savedComposite); }
public int getIconWidth() { int w; if (AbstractLookAndFeel.getTheme().isSmallFontSize()) { w = 14; } else if (AbstractLookAndFeel.getTheme().isMediumFontSize()) { w = 16; } else { w = 18; } return w + GAP; }
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) { int w = c.getWidth(); int h = c.getHeight(); if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { JTattooUtilities.fillVerGradient( g, AbstractLookAndFeel.getTheme().getTrackColors(), 0, 0, w, h); } else { JTattooUtilities.fillHorGradient( g, AbstractLookAndFeel.getTheme().getTrackColors(), 0, 0, w, h); } }
public static Icon getTreeCollapsedIcon() { if (treeCollapsedIcon == null) { if (AbstractLookAndFeel.getTheme().isSmallFontSize()) { treeCollapsedIcon = new LazyImageIcon("hifi/icons/small/tree_collapsed_9x9.png"); } else if (AbstractLookAndFeel.getTheme().isMediumFontSize()) { treeCollapsedIcon = new LazyImageIcon("hifi/icons/medium/tree_collapsed_11x11.png"); } else { treeCollapsedIcon = new LazyImageIcon("hifi/icons/large/tree_collapsed_14x14.png"); } } return treeCollapsedIcon; }
public static Icon getDownArrowIcon() { if (downArrowIcon == null) { if (AbstractLookAndFeel.getTheme().isSmallFontSize()) { downArrowIcon = new LazyImageIcon("hifi/icons/small/arrow_down_7x6.png"); } else if (AbstractLookAndFeel.getTheme().isMediumFontSize()) { downArrowIcon = new LazyImageIcon("hifi/icons/medium/arrow_down_9x8.png"); } else { downArrowIcon = new LazyImageIcon("hifi/icons/large/arrow_down_11x10.png"); } } return downArrowIcon; }
public static Icon getRightArrowIcon() { if (rightArrowIcon == null) { if (AbstractLookAndFeel.getTheme().isSmallFontSize()) { rightArrowIcon = new LazyImageIcon("hifi/icons/small/arrow_right_6x7.png"); } else if (AbstractLookAndFeel.getTheme().isMediumFontSize()) { rightArrowIcon = new LazyImageIcon("hifi/icons/medium/arrow_right_8x9.png"); } else { rightArrowIcon = new LazyImageIcon("hifi/icons/large/arrow_right_10x11.png"); } } return rightArrowIcon; }
public void paintText(Graphics g, int x, int y, String title) { x += paintIcon(g, x, y); Graphics2D g2D = (Graphics2D) g; Color fc = AbstractLookAndFeel.getWindowTitleForegroundColor(); if (fc.equals(Color.white)) { Color bc = AbstractLookAndFeel.getWindowTitleColorDark(); g2D.setColor(bc); JTattooUtilities.drawString(rootPane, g, title, x - 1, y - 1); g2D.setColor(ColorHelper.darker(bc, 30)); JTattooUtilities.drawString(rootPane, g, title, x + 1, y + 1); } g.setColor(fc); JTattooUtilities.drawString(rootPane, g, title, x, y); }
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { AbstractButton button = (AbstractButton) c; Graphics2D g2D = (Graphics2D) g; Color frameColor = AbstractLookAndFeel.getTheme().getFrameColor(); if (!JTattooUtilities.isFrameActive(button)) { frameColor = ColorHelper.brighter(frameColor, 40); } if (AbstractLookAndFeel.getTheme().doDrawSquareButtons()) { g2D.setColor(Color.white); g2D.drawRect(x, y, w - 1, h - 1); if (button.getRootPane() != null && button.equals(button.getRootPane().getDefaultButton()) && !button.hasFocus()) { g2D.setColor(ColorHelper.darker(frameColor, 20)); g2D.drawRect(x, y, w - 1, h - 2); if (!button.getModel().isRollover()) { g2D.setColor(defaultColorHi); g2D.drawRect(x + 1, y + 1, w - 3, h - 4); g2D.setColor(defaultColorLo); g2D.drawRect(x + 2, y + 2, w - 5, h - 6); } } else { g2D.setColor(frameColor); g2D.drawRect(x, y, w - 2, h - 2); } } else { Object savedRederingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (button.getRootPane() != null && button.equals(button.getRootPane().getDefaultButton())) { if (!button.getModel().isRollover()) { g2D.setColor(defaultColorHi); g2D.drawRoundRect(x + 1, y + 1, w - 4, h - 2, 6, 6); g2D.setColor(defaultColorLo); g2D.drawRoundRect(x + 2, y + 2, w - 6, h - 6, 6, 6); } } g2D.setColor(Color.white); g2D.drawRoundRect(x, y, w - 1, h - 1, 6, 6); g2D.setColor(frameColor); g2D.drawRoundRect(x, y, w - 2, h - 2, 6, 6); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRederingHint); } }
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()); } }
protected void paintSafely(Graphics g) { Graphics2D g2D = (Graphics2D) g; Object savedRenderingHint = null; if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) { savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING); g2D.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, AbstractLookAndFeel.getTheme().getTextAntiAliasingHint()); } super.paintSafely(g); if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) { g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint); } }
public static Icon getCloseIcon() { if (closeIcon == null) { if (AbstractLookAndFeel.getTheme().isMacStyleWindowDecorationOn()) { closeIcon = new MacCloseIcon(); } else { Color iconColor = AbstractLookAndFeel.getTheme().getWindowIconColor(); Color iconShadowColor = AbstractLookAndFeel.getTheme().getWindowIconShadowColor(); Color iconRolloverColor = AbstractLookAndFeel.getTheme().getWindowIconRolloverColor(); closeIcon = new BaseIcons.CloseSymbol( iconColor, iconShadowColor, iconRolloverColor, new Insets(-1, -1, 0, 0)); } } return closeIcon; }
public MyRenderComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { super(); this.table = table; this.col = col; if (value != null) { setText(value.toString()); } else { setText(""); } setOpaque(false); setFont(UIManager.getFont("TableHeader.font")); setForeground(UIManager.getColor("TableHeader.foreground")); setHorizontalAlignment(JLabel.CENTER); setHorizontalTextPosition(SwingConstants.LEADING); setBorder(UIManager.getBorder("TableHeader.cellBorder")); if ((JTattooUtilities.getJavaVersion() >= 1.6) && (UIManager.getLookAndFeel() instanceof AbstractLookAndFeel)) { RowSorter rowSorter = table == null ? null : table.getRowSorter(); List keyList = rowSorter == null ? null : rowSorter.getSortKeys(); if ((keyList != null) && (keyList.size() > 0)) { RowSorter.SortKey sortKey = (RowSorter.SortKey) keyList.get(0); if (sortKey.getColumn() == table.convertColumnIndexToModel(col)) { AbstractIconFactory iconFactory = ((AbstractLookAndFeel) UIManager.getLookAndFeel()).getIconFactory(); if (sortKey.getSortOrder().equals(SortOrder.ASCENDING)) { setIcon(iconFactory.getUpArrowIcon()); } else if (sortKey.getSortOrder().equals(SortOrder.DESCENDING)) { setIcon(iconFactory.getDownArrowIcon()); } } } } gv = ColorHelper.getGrayValue(AbstractLookAndFeel.getTheme().getRolloverColor()); }
protected void installListeners() { super.installListeners(); if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) { focusListener = new FocusListener() { public void focusGained(FocusEvent e) { if (getComponent() != null) { orgBorder = getComponent().getBorder(); LookAndFeel laf = UIManager.getLookAndFeel(); if (laf instanceof AbstractLookAndFeel && orgBorder instanceof UIResource) { Border focusBorder = ((AbstractLookAndFeel) laf).getBorderFactory().getFocusFrameBorder(); getComponent().setBorder(focusBorder); } getComponent().invalidate(); getComponent().repaint(); } } public void focusLost(FocusEvent e) { if (getComponent() != null) { if (orgBorder instanceof UIResource) { getComponent().setBorder(orgBorder); getComponent().invalidate(); getComponent().repaint(); } } } }; getComponent().addFocusListener(focusListener); } }
public void paintThumb(Graphics g) { Icon icon = null; if (slider.getOrientation() == JSlider.HORIZONTAL) { if (isRollover && slider.isEnabled()) { icon = getThumbHorIconRollover(); } else { icon = getThumbHorIcon(); } } else { if (isRollover && slider.isEnabled()) { icon = getThumbVerIconRollover(); } else { icon = getThumbVerIcon(); } } Graphics2D g2D = (Graphics2D) g; Composite savedComposite = g2D.getComposite(); if (!slider.isEnabled()) { g.setColor(AbstractLookAndFeel.getBackgroundColor()); g.fillRect(thumbRect.x + 1, thumbRect.y + 1, thumbRect.width - 2, thumbRect.height - 2); AlphaComposite alpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f); g2D.setComposite(alpha); } icon.paintIcon(null, g, thumbRect.x, thumbRect.y); g2D.setComposite(savedComposite); }
protected Color getGapColor(int tabIndex) { if (tabIndex == tabPane.getSelectedIndex()) { Color colors[] = AbstractLookAndFeel.getTheme().getDefaultColors(); return colors[colors.length - 1]; } return super.getGapColor(tabIndex); }
protected void paintFocus( Graphics g, AbstractButton b, Rectangle viewRect, Rectangle textRect, Rectangle iconRect) { Graphics2D g2D = (Graphics2D) g; int width = b.getWidth(); int height = b.getHeight(); if (((width < 64) || (height < 16)) && ((b.getText() == null) || b.getText().length() == 0)) { g.setColor(AbstractLookAndFeel.getFocusColor()); BasicGraphicsUtils.drawDashedRect(g, 4, 3, width - 8, height - 6); } else { Object savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_ANTIALIASING); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setColor(AbstractLookAndFeel.getFocusColor()); int d = b.getHeight() - 4; g2D.drawRoundRect(2, 2, b.getWidth() - 5, b.getHeight() - 5, d, d); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, savedRenderingHint); } }
/** * Gets the progress bar border. * * @return the progress bar border */ public static Border getProgressBarBorder() { if (progressBarBorder == null) { progressBarBorder = BorderFactory.createLineBorder( ColorHelper.darker(AbstractLookAndFeel.getBackgroundColor(), 30)); } return progressBarBorder; }