本文整理汇总了Java中org.pushingpixels.substance.api.SubstanceLookAndFeel.isCurrentLookAndFeel方法的典型用法代码示例。如果您正苦于以下问题:Java SubstanceLookAndFeel.isCurrentLookAndFeel方法的具体用法?Java SubstanceLookAndFeel.isCurrentLookAndFeel怎么用?Java SubstanceLookAndFeel.isCurrentLookAndFeel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pushingpixels.substance.api.SubstanceLookAndFeel
的用法示例。
在下文中一共展示了SubstanceLookAndFeel.isCurrentLookAndFeel方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
@Override
public void update(Graphics g, JComponent c) {
if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
return;
if (toPaintBackground(c)) {
BackgroundPaintingUtils.update(g, c, false);
}
super.paint(g, c);
}
示例2: update
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
@Override
public void update(Graphics g, JComponent c) {
// failsafe for LAF change
if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
return;
this.paint(g, c);
}
示例3: update
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
@Override
public void update(Graphics g, JComponent c) {
if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
return;
// fix for issue 244 - paint the entire root pane so that it
// picks the correct watermark
if (SubstanceCoreUtilities.isOpaque(c)) {
BackgroundPaintingUtils.update(g, c, false);
}
super.paint(g, c);
}
示例4: isInside
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
@Override
public boolean isInside(MouseEvent me) {
if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) {
return false;
}
Shape contour = SubstanceOutlineUtilities.getBaseOutline(
this.textField, 2.0f * SubstanceSizeUtils
.getClassicButtonCornerRadius(SubstanceSizeUtils
.getComponentFontSize(this.textField)), null);
return contour.contains(me.getPoint());
}
示例5: isInside
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
@Override
public boolean isInside(MouseEvent me) {
if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) {
return false;
}
SubstanceButtonShaper shaper = ClassicButtonShaper.INSTANCE;
if (shaper == null)
return false;
Shape contour = SubstanceOutlineUtilities.getBaseOutline(this.comboBox,
SubstanceSizeUtils
.getClassicButtonCornerRadius(SubstanceSizeUtils
.getComponentFontSize(this.comboBox)), null);
return contour.contains(me.getPoint());
}
示例6: onTimelineEvent
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
void onTimelineEvent() {
// get the button and check if it wasn't GC'd
JButton jButton = this.buttonRef.get();
if (jButton == null) {
return;
}
if (!jButton.isDisplayable()) {
timeline.abort();
return;
}
if (RootPaneDefaultButtonTracker.hasGlassPane(jButton
.getTopLevelAncestor()))
return;
if (!isPulsating(jButton)) {
// has since lost its default status
RootPaneDefaultButtonTracker tracker = trackers.get(jButton);
tracker.stopTimer();
tracker.buttonRef.clear();
trackers.remove(jButton);
} else {
if (!RootPaneDefaultButtonTracker.isInFocusedWindow(jButton
.getTopLevelAncestor())) {
// && (!isAttentionDrawingCloseButton(jButton))) {
// no focus in button window - will restore original (not
// animated) painting
RootPaneDefaultButtonTracker.update(jButton);
} else {
// check if it's enabled
if (!jButton.isEnabled()) {
if (timeline.getState() != TimelineState.SUSPENDED) {
timeline.suspend();
}
} else {
if (timeline.getState() == TimelineState.SUSPENDED) {
timeline.resume();
}
}
// if (jButton.isEnabled()) {
// // increment cycle count for pulsating buttons.
// long oldCycle = cycles.get(jButton);
// if (oldCycle == 20) {
// oldCycle = isAttentionDrawingCloseButton(jButton) ? -80
// : 0;
// }
// cycles.put(jButton, oldCycle + 1);
// } else {
// // revert to 0 if it's not enabled
// if (cycles.get(jButton) != 0) {
// cycles.put(jButton, (long) 0);
// }
// }
}
}
// maybe LAF has changed
if (SubstanceLookAndFeel.isCurrentLookAndFeel())
jButton.repaint();
}
示例7: updateBackground
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
/**
* Updates background of the specified button.
*
* @param g
* Graphic context.
* @param button
* Button to update.
*/
public void updateBackground(Graphics g, AbstractButton button) {
// failsafe for LAF change
if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
return;
if (SubstanceCoreUtilities.isButtonNeverPainted(button))
return;
int width = button.getWidth();
int height = button.getHeight();
int y = 0;
if (SubstanceCoreUtilities.isScrollButton(button)
|| SubstanceCoreUtilities.isSpinnerButton(button)) {
Sideable sideable = (Sideable) button;
PairwiseButtonBackgroundDelegate.updatePairwiseBackground(g,
button, width, height, sideable.getSide(), false);
return;
}
SubstanceFillPainter fillPainter = SubstanceCoreUtilities
.getFillPainter(button);
SubstanceButtonShaper shaper = SubstanceCoreUtilities
.getButtonShaper(button);
SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
.getBorderPainter(button);
BufferedImage bgImage = getFullAlphaBackground(button, button
.getModel(), shaper, fillPainter, borderPainter, width, height);
TransitionAwareUI transitionAwareUI = (TransitionAwareUI) button
.getUI();
StateTransitionTracker stateTransitionTracker = transitionAwareUI
.getTransitionTracker();
StateTransitionTracker.ModelStateInfo modelStateInfo = stateTransitionTracker
.getModelStateInfo();
Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
.getStateContributionMap();
// Two special cases here:
// 1. Button has flat appearance.
// 2. Button is disabled.
// For both cases, we need to set custom translucency.
boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(button);
boolean isSpecial = isFlat || !button.isEnabled();
float extraAlpha = 1.0f;
if (isSpecial) {
if (isFlat) {
// Special handling of flat buttons
extraAlpha = 0.0f;
for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
.entrySet()) {
ComponentState activeState = activeEntry.getKey();
if (activeState.isDisabled())
continue;
if (activeState == ComponentState.ENABLED)
continue;
extraAlpha += activeEntry.getValue().getContribution();
}
} else {
if (!button.isEnabled()) {
extraAlpha = SubstanceColorSchemeUtilities.getAlpha(button,
modelStateInfo.getCurrModelState());
}
}
}
if (extraAlpha > 0.0f) {
Graphics2D graphics = (Graphics2D) g.create();
graphics.setComposite(LafWidgetUtilities.getAlphaComposite(button,
extraAlpha, g));
graphics.drawImage(bgImage, 0, y, null);
graphics.dispose();
}
}
示例8: updateBackground
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
/**
* Updates background of the specified button.
*
* @param g
* Graphic context.
* @param button
* Button to update.
*/
public void updateBackground(Graphics g, JComboBox combo,
ButtonModel comboModel) {
// failsafe for LAF change
if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
return;
int width = combo.getWidth();
int height = combo.getHeight();
int y = 0;
SubstanceFillPainter fillPainter = SubstanceCoreUtilities
.getFillPainter(combo);
SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
.getBorderPainter(combo);
BufferedImage bgImage = getFullAlphaBackground(combo, comboModel,
fillPainter, borderPainter, width, height);
TransitionAwareUI transitionAwareUI = (TransitionAwareUI) combo.getUI();
StateTransitionTracker stateTransitionTracker = transitionAwareUI
.getTransitionTracker();
StateTransitionTracker.ModelStateInfo modelStateInfo = stateTransitionTracker
.getModelStateInfo();
Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
.getStateContributionMap();
// Two special cases here:
// 1. Combobox has flat appearance.
// 2. Combobox is disabled.
// For both cases, we need to set custom translucency.
boolean isFlat = SubstanceCoreUtilities.hasFlatAppearance(combo, false);
boolean isSpecial = isFlat || !combo.isEnabled();
float extraAlpha = 1.0f;
if (isSpecial) {
if (isFlat) {
// Special handling of flat combos
extraAlpha = 0.0f;
for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
.entrySet()) {
ComponentState activeState = activeEntry.getKey();
if (activeState.isDisabled())
continue;
if (activeState == ComponentState.ENABLED)
continue;
extraAlpha += activeEntry.getValue().getContribution();
}
} else {
if (!combo.isEnabled()) {
extraAlpha = SubstanceColorSchemeUtilities.getAlpha(combo,
modelStateInfo.getCurrModelState());
}
}
}
if (extraAlpha > 0.0f) {
Graphics2D graphics = (Graphics2D) g.create();
graphics.setComposite(LafWidgetUtilities.getAlphaComposite(combo,
extraAlpha, g));
graphics.drawImage(bgImage, 0, y, null);
graphics.dispose();
}
}
示例9: paint
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
@Override
public void paint(Graphics g, JComponent c) {
if (!SubstanceLookAndFeel.isCurrentLookAndFeel())
return;
final AbstractButton b = (AbstractButton) c;
if (b instanceof JButton) {
JButton jb = (JButton) b;
if (RootPaneDefaultButtonTracker.isPulsating(jb)) {
RootPaneDefaultButtonTracker.update(jb);
}
}
FontMetrics fm = g.getFontMetrics();
Insets i = c.getInsets();
viewRect.x = i.left;
viewRect.y = i.top;
viewRect.width = b.getWidth() - (i.right + viewRect.x);
viewRect.height = b.getHeight() - (i.bottom + viewRect.y);
textRect.x = textRect.y = textRect.width = textRect.height = 0;
iconRect.x = iconRect.y = iconRect.width = iconRect.height = 0;
Font f = c.getFont();
// layout the text and icon
String text = SwingUtilities.layoutCompoundLabel(c, fm, b.getText(), b
.getIcon(), b.getVerticalAlignment(), b
.getHorizontalAlignment(), b.getVerticalTextPosition(), b
.getHorizontalTextPosition(), viewRect, iconRect, textRect, b
.getText() == null ? 0 : b.getIconTextGap());
Graphics2D g2d = (Graphics2D) g.create();
View v = (View) c.getClientProperty(BasicHTML.propertyKey);
g2d.setFont(f);
this.delegate.updateBackground(g2d, b);
if (v != null) {
v.paint(g2d, textRect);
} else {
this.paintButtonText(g2d, b, textRect, text);
}
// Paint the Icon
if (b.getIcon() != null) {
paintIcon(g2d, c, iconRect);
}
if (b.isFocusPainted()) {
SubstanceCoreUtilities.paintFocus(g, b, b, this, null, textRect,
1.0f, SubstanceSizeUtils
.getFocusRingPadding(SubstanceSizeUtils
.getComponentFontSize(b)));
}
// g2d.setColor(Color.red);
// g2d.draw(iconRect);
// g2d.draw(viewRect);
// g2d.draw(textRect);
// if (isPartOfCompositeControl) {
// g.drawImage(offscreen, 0, 0, null);
// }
}
示例10: contains
import org.pushingpixels.substance.api.SubstanceLookAndFeel; //导入方法依赖的package包/类
/**
* Returns <code>true</code> if the specified <i>x,y </i> location is
* contained within the look and feel's defined shape of the specified
* component. <code>x</code> and <code>y</code> are defined to be relative
* to the coordinate system of the specified component.
*
* @param button
* the component where the <i>x,y </i> location is being queried;
* @param x
* the <i>x </i> coordinate of the point
* @param y
* the <i>y </i> coordinate of the point
* @return <code>true</code> if the specified <i>x,y </i> location is
* contained within the look and feel's defined shape of the
* specified component, <code>false</code> otherwise.
*/
public static boolean contains(AbstractButton button, int x, int y) {
// failsafe for LAF change
if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) {
return false;
}
SubstanceButtonShaper shaper = SubstanceCoreUtilities
.getButtonShaper(button);
if (shaper == null)
return false;
Shape contour = shaper.getButtonOutline(button, null,
button.getWidth(), button.getHeight(), false);
return contour.contains(x, y);
}