/** * Simple constructor. * * @param trackableUI * Object that is queried for mouse events. * @param model * Surrogate model for tracking control status. */ public RolloverControlListener(TransitionAwareUI trackableUI, ButtonModel model) { this.trackableUI = trackableUI; this.model = model; this.isMouseInside = false; this.stateTransitionTracker = trackableUI.getTransitionTracker(); }
/** * Simple constructor. * * @param trackableUI * Object that is queried for mouse events. * @param model * Surrogate model for tracking control status. */ public RolloverControlListener(TransitionAwareUI trackableUI, ButtonModel model) { this.trackableUI = trackableUI; this.model = model; this.isMouseInside = false; this.stateTransitionTracker = trackableUI.getTransitionTracker(); }
/** * Simple constructor. * * @param trackableUI * Object that is queried for mouse events. * @param model * Surrogate model for tracking control status. */ public RolloverTextControlListener(JComponent component, TransitionAwareUI trackableUI, ButtonModel model) { this.component = component; this.trackableUI = trackableUI; this.model = model; this.isMouseInside = false; this.stateTransitionTracker = this.trackableUI.getTransitionTracker(); }
/** * Simple constructor. * * @param trackableUI * Object that is queried for mouse events. * @param model * Surrogate model for tracking control status. */ public RolloverTextControlListener(JComponent component, TransitionAwareUI trackableUI, ButtonModel model) { this.component = component; this.trackableUI = trackableUI; this.model = model; this.isMouseInside = false; this.stateTransitionTracker = this.trackableUI.getTransitionTracker(); }
public void paintIcon(Component c, Graphics g, int x, int y) { if (!(g instanceof Graphics2D)) { return; } JSlider slider = (JSlider) c; TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider .getUI(); StateTransitionTracker stateTransitionTracker = transitionAwareUI .getTransitionTracker(); Icon iconToDraw = getIcon(slider, stateTransitionTracker); iconToDraw.paintIcon(c, g, x, y); }
public void paintIcon(Component c, Graphics g, int x, int y) { if (!(g instanceof Graphics2D)) { return; } JSlider slider = (JSlider) c; TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider .getUI(); StateTransitionTracker stateTransitionTracker = transitionAwareUI .getTransitionTracker(); Icon iconToDraw = getIcon(slider, stateTransitionTracker); iconToDraw.paintIcon(c, g, x, y); }
public void paintIcon(Component c, Graphics g, int x, int y) { if (!(g instanceof Graphics2D)) { return; } JSlider slider = (JSlider) c; TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider .getUI(); StateTransitionTracker stateTransitionTracker = transitionAwareUI .getTransitionTracker(); Icon iconToDraw = getIcon(slider, stateTransitionTracker); iconToDraw.paintIcon(c, g, x, y); }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (!(g instanceof Graphics2D)) { return; } JSlider slider = (JSlider) c; TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider .getUI(); StateTransitionTracker stateTransitionTracker = transitionAwareUI .getTransitionTracker(); Icon iconToDraw = getIcon(slider, stateTransitionTracker); iconToDraw.paintIcon(c, g, x, y); }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (!(g instanceof Graphics2D)) { return; } JSlider slider = (JSlider) c; TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider .getUI(); StateTransitionTracker stateTransitionTracker = transitionAwareUI .getTransitionTracker(); Icon iconToDraw = getIcon(slider, stateTransitionTracker); iconToDraw.paintIcon(c, g, x, y); }
@Override public void paintIcon(Component c, Graphics g, int x, int y) { if (!(g instanceof Graphics2D)) { return; } JSlider slider = (JSlider) c; TransitionAwareUI transitionAwareUI = (TransitionAwareUI) slider .getUI(); StateTransitionTracker stateTransitionTracker = transitionAwareUI .getTransitionTracker(); Icon iconToDraw = getIcon(slider, stateTransitionTracker); iconToDraw.paintIcon(c, g, x, y); }
@Override public void paintFocus(Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Graphics2D graphics, Shape focusShape, Rectangle textRect, int extraPadding) { if (textRect == null) return; int fontSize = SubstanceSizeUtils .getComponentFontSize(mainComp); float dashLength = getDashLength(fontSize); float dashGap = getDashGap(fontSize); float dashPhase = (dashLength + dashGap) * (1.0f - transitionAwareUI.getTransitionTracker() .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); graphics.translate(textRect.x - 1, textRect.y); graphics.drawLine(0, textRect.height - 1, textRect.width, textRect.height - 1); graphics.dispose(); }
@Override public void paintFocus(Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Graphics2D graphics, Shape focusShape, Rectangle textRect, int extraPadding) { if (textRect == null) return; int fontSize = SubstanceSizeUtils .getComponentFontSize(mainComp); float dashLength = getDashLength(fontSize); float dashGap = getDashGap(fontSize); float dashPhase = (dashLength + dashGap) * (1.0f - transitionAwareUI.getTransitionTracker() .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); graphics.translate(textRect.x - 1, textRect.y); graphics.drawLine(0, textRect.height - 1, textRect.width, textRect.height - 1); graphics.dispose(); }
@Override public void paintFocus(Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Graphics2D graphics, Shape focusShape, Rectangle textRect, int extraPadding) { if (textRect == null) return; if ((textRect.width == 0) || (textRect.height == 0)) return; int fontSize = SubstanceSizeUtils .getComponentFontSize(mainComp); float dashLength = getDashLength(fontSize); float dashGap = getDashGap(fontSize); float dashPhase = (dashLength + dashGap) * (1.0f - transitionAwareUI.getTransitionTracker() .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); int delta = ((mainComp instanceof JComboBox) || (mainComp instanceof JSpinner)) ? 0 : 1; GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline( textRect.width + 2 * delta, textRect.height, SubstanceSizeUtils .getClassicButtonCornerRadius(fontSize), null); graphics.translate(textRect.x - delta, textRect.y); graphics.draw(contour); }
@Override public void paintFocus(Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Graphics2D graphics, Shape focusShape, Rectangle textRect, int extraPadding) { if (textRect == null) return; if ((textRect.width == 0) || (textRect.height == 0)) return; int fontSize = SubstanceSizeUtils .getComponentFontSize(mainComp); float dashLength = getDashLength(fontSize); float dashGap = getDashGap(fontSize); float dashPhase = (dashLength + dashGap) * (1.0f - transitionAwareUI.getTransitionTracker() .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); int delta = ((mainComp instanceof JComboBox) || (mainComp instanceof JSpinner)) ? 0 : 1; GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline( textRect.width + 2 * delta, textRect.height, SubstanceSizeUtils .getClassicButtonCornerRadius(fontSize), null); graphics.translate(textRect.x - delta, textRect.y); graphics.draw(contour); }
/** * Returns the scroll button state. * * @param scrollButton * Scroll button. * @return Scroll button state. */ protected ComponentState getState(JButton scrollButton) { if (scrollButton == null) return null; ComponentState result = ((TransitionAwareUI) scrollButton.getUI()) .getTransitionTracker().getModelStateInfo().getCurrModelState(); if ((result == ComponentState.ENABLED) && SubstanceCoreUtilities.hasFlatAppearance(this.scrollbar, false)) { result = null; } if (SubstanceCoreUtilities.isButtonNeverPainted(scrollButton)) { result = null; } return result; }
/** * Returns the scroll button state. * * @param scrollButton * Scroll button. * @return Scroll button state. */ protected ComponentState getState(JButton scrollButton) { if (scrollButton == null) return null; ComponentState result = ((TransitionAwareUI) scrollButton.getUI()) .getTransitionTracker().getModelStateInfo().getCurrModelState(); if ((result == ComponentState.ENABLED) && SubstanceCoreUtilities.hasFlatAppearance(this.scrollbar, false)) { result = null; } if (SubstanceCoreUtilities.isButtonNeverPainted(scrollButton)) { result = null; } return result; }
public static Color getTextBackgroundFillColor(JComponent comp) { Color backgroundFillColor = SubstanceColorUtilities .getBackgroundFillColor(comp); JTextComponent componentForTransitions = SubstanceCoreUtilities .getTextComponentForTransitions(comp); if (componentForTransitions != null) { ComponentUI ui = componentForTransitions.getUI(); if (ui instanceof TransitionAwareUI) { TransitionAwareUI trackable = (TransitionAwareUI) ui; StateTransitionTracker stateTransitionTracker = trackable .getTransitionTracker(); Color outerTextComponentBorderColor = SubstanceColorUtilities .getOuterTextComponentBorderColor(backgroundFillColor); outerTextComponentBorderColor = SubstanceColorUtilities .getInterpolatedColor(outerTextComponentBorderColor, backgroundFillColor, 0.6); float selectionStrength = stateTransitionTracker .getFacetStrength(ComponentStateFacet.SELECTION); float rolloverStrength = stateTransitionTracker .getFacetStrength(ComponentStateFacet.ROLLOVER); backgroundFillColor = SubstanceColorUtilities .getInterpolatedColor(outerTextComponentBorderColor, backgroundFillColor, Math.max( selectionStrength, rolloverStrength)); } } return backgroundFillColor; }
public static Color getTextBackgroundFillColor(JComponent comp) { Color backgroundFillColor = SubstanceColorUtilities .getBackgroundFillColor(comp); JTextComponent componentForTransitions = SubstanceCoreUtilities .getTextComponentForTransitions(comp); if (componentForTransitions != null) { ComponentUI ui = componentForTransitions.getUI(); if (ui instanceof TransitionAwareUI) { TransitionAwareUI trackable = (TransitionAwareUI) ui; StateTransitionTracker stateTransitionTracker = trackable .getTransitionTracker(); Color outerTextComponentBorderColor = SubstanceColorUtilities .getOuterTextComponentBorderColor(backgroundFillColor); outerTextComponentBorderColor = SubstanceColorUtilities .getInterpolatedColor(outerTextComponentBorderColor, backgroundFillColor, 0.6); float selectionStrength = stateTransitionTracker .getFacetStrength(ComponentStateFacet.SELECTION); float rolloverStrength = stateTransitionTracker .getFacetStrength(ComponentStateFacet.ROLLOVER); backgroundFillColor = SubstanceColorUtilities .getInterpolatedColor(outerTextComponentBorderColor, backgroundFillColor, Math.max( selectionStrength, rolloverStrength)); } } return backgroundFillColor; }
.getUI(); StateTransitionTracker stateTransitionTracker = transitionAwareUI .getTransitionTracker();
.getUI(); StateTransitionTracker stateTransitionTracker = transitionAwareUI .getTransitionTracker();