本文整理汇总了Java中javafx.scene.effect.Effect类的典型用法代码示例。如果您正苦于以下问题:Java Effect类的具体用法?Java Effect怎么用?Java Effect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Effect类属于javafx.scene.effect包,在下文中一共展示了Effect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setInputEffect
import javafx.scene.effect.Effect; //导入依赖的package包/类
protected Effect setInputEffect(Effect a, Effect b)
{
// I don't know a better way to chain effects, it's missing in FX
// https://bugs.openjdk.java.net/browse/JDK-8091895
// perhaps try Blend:
// https://community.oracle.com/thread/2337194?tstart=0
if(b instanceof GaussianBlur)
{
((GaussianBlur)b).setInput(a);
}
else if(b instanceof ColorAdjust)
{
((ColorAdjust)b).setInput(a);
}
else
{
throw new Error("todo: does " + b + " have setInput()?");
}
return b;
}
示例2: initFactories
import javafx.scene.effect.Effect; //导入依赖的package包/类
private void initFactories() {
textFactory = new Factory() {
public Node create(final Effect e) {
Group group = new Group();
final Canvas canvas = new Canvas(110, 110);
GraphicsContext gc = canvas.getGraphicsContext2D();
gc.setEffect(e);
gc.setFill(Color.RED);
gc.setFont(new Font(36));
gc.fillText("B_Blur", 5, 30);
group.getChildren().add(canvas);
return group;
}
};
}
示例3: start
import javafx.scene.effect.Effect; //导入依赖的package包/类
@Override
public void start(Stage palco) throws Exception {
final Effect r = new Reflection();
final VBox raiz = new VBox(30);
final HBox hbTopo = new HBox(5);
final TextField txtNome = new TextField();
final Button btnAcao = new Button("Enviar");
final Label lblMensagem = new Label();
raiz.setTranslateX(10);
raiz.setTranslateY(10);
lblMensagem.setText("Digite seu nome e clique no botão");
hbTopo.getChildren().addAll(txtNome, btnAcao);
raiz.getChildren().addAll(hbTopo, lblMensagem);
lblMensagem.setEffect(r);
Scene cena = new Scene(raiz, 250, 100);
palco.setTitle("Aplicação usando código Java");
palco.setScene(cena);
palco.show();
btnAcao.setOnAction(e -> lblMensagem.setText("Olá, " + txtNome.getText() + ", bem vindo!"));
}
示例4: createTargetButton
import javafx.scene.effect.Effect; //导入依赖的package包/类
private void createTargetButton() {
target = (StackPane) lookup("#targetAnchor");
Image image = IconFactory.getTargetIcon();
ImageView targetIcon = new ImageView(image);
targetIcon.setClip(new ImageView(image));
ColorAdjust monochrome = new ColorAdjust();
monochrome.setSaturation(-1.0);
Blend red = new Blend(BlendMode.MULTIPLY, monochrome,
new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), Color.RED));
Blend green = new Blend(BlendMode.MULTIPLY, monochrome,
new ColorInput(0, 0, targetIcon.getImage().getWidth(), targetIcon.getImage().getHeight(), new Color(0, 1, 0, 0.5)));
targetButton = targetIcon;
targetIcon.effectProperty().bind(Bindings.when(targetButton.hoverProperty()).then((Effect) green).otherwise((Effect) red));
targetButton.setId("target_button");
hideTargetMarker();
target.getChildren().add(targetButton);
}
示例5: refreshSisSceneLook
import javafx.scene.effect.Effect; //导入依赖的package包/类
private void refreshSisSceneLook(String primarySisSceneName, boolean isSelected) {
if (primarySisSceneName != null) {
if (getItem() != null) {
Effect effect = null;
String style;
Color finalColor;
boolean isPrimary = primarySisSceneName
.equals(getItem().getElementInfo().getName());
// if (isSelected) {
// effect = shadowForSelected;
// } else {
// effect = null;
// }
if (isPrimary) {
style = "-fx-font-weight: bold;";
finalColor = Color.HOTPINK;
} else {
style = "-fx-font-weight: normal;";
finalColor = CuteColor.GENTLEPINK;
}
applySisSceneLook(effect, style, finalColor);
}
}
}
示例6: setSepiaTone
import javafx.scene.effect.Effect; //导入依赖的package包/类
/**
* @param sepiaToneLevel
*/
@SuppressWarnings("unused")
public void setSepiaTone(double sepiaToneLevel) {
// For some reason in some computers setting the SepiaTone effect hide the pane.
if(true) {
return;
}
Effect effect = getEffect();
if(effect == null) {
setEffect(new SepiaTone(sepiaToneLevel));
}
else if(effect instanceof SepiaTone) {
((SepiaTone) effect).setLevel(sepiaToneLevel);
}
}
示例7: Digit
import javafx.scene.effect.Effect; //导入依赖的package包/类
public Digit(Color onColor, Color offColor, Effect onEffect, Effect offEffect) {
this.onColor = onColor;
this.offColor = offColor;
this.onEffect = onEffect;
this.offEffect = offEffect;
getChildren().addAll(polygons);
getTransforms().add(new Shear(-0.1,0));
showNumber(0);
}
示例8: addEffect
import javafx.scene.effect.Effect; //导入依赖的package包/类
public void addEffect(Effect x)
{
if(effect == null)
{
effect = x;
}
else
{
effect = setInputEffect(effect, x);
}
}
示例9: create
import javafx.scene.effect.Effect; //导入依赖的package包/类
public NodeAndBindee create() {
final Effect effect = new DropShadow();
Rectangle rect = new Rectangle(100,100,100,100)
{{
setFill(Color.LIGHTGREEN);
setStroke(Color.DARKGREEN);
setArcHeight(20);
setArcWidth(30);
setEffect(effect);
}};
return new NodeAndBindee(rect, effect);
}
示例10: generate
import javafx.scene.effect.Effect; //导入依赖的package包/类
public static TestAction[] generate(Effect effect, boolean isLCDWork){
return new TestAction[] {
new EffectTestAction(),
new EffectTestAction(effect, isLCDWork),
new EffectTestAction()
};
}
示例11: applyFontColor
import javafx.scene.effect.Effect; //导入依赖的package包/类
private static void applyFontColor(ImageView image, Color color) {
ColorAdjust monochrome = new ColorAdjust();
monochrome.setSaturation(-1.0);
Effect colorInput = new ColorInput(0, 0, image.getImage().getWidth(), image.getImage().getHeight(), color);
Blend blend = new Blend(BlendMode.MULTIPLY, new ImageInput(image.getImage()), colorInput);
image.setClip(new ImageView(image.getImage()));
image.setEffect(blend);
image.setCache(true);
}
示例12: applySisSceneLook
import javafx.scene.effect.Effect; //导入依赖的package包/类
private void applySisSceneLook(Effect effect, String style, Color finalColor) {
if (!getStyle().equals(style))
setStyle(style);
if (videoCameraGraphic.getEffect() == null
|| !videoCameraGraphic.getEffect().equals(effect))
videoCameraGraphic.setEffect(effect);
if (!finalColor.equals(videoCameraGraphic.getFill()))
videoCameraGraphic.setFill(finalColor);
}
示例13: conceptDragStarted
import javafx.scene.effect.Effect; //导入依赖的package包/类
protected synchronized void conceptDragStarted()
{
logger.debug("Drag Started");
// There is a bug in javafx with comboboxs - it seems to fire dragStarted events twice.
// http://javafx-jira.kenai.com/browse/RT-28778
if ((System.currentTimeMillis() - dragStartedAt.get()) < 2000)
{
logger.debug("Ignoring duplicate drag started event");
return;
}
if (dragStartedAt.get() > 0)
{
logger.warn("Unclosed drag event is still active while another was started! Cleaning up...");
conceptDragCompleted();
}
dragStartedAt.set(System.currentTimeMillis());
for (Node n : codeDropTargets)
{
Effect existing = n.getEffect();
if (existing != null)
{
existingEffect.put(n, existing);
}
n.setEffect(FxUtils.lightGreenDropShadow);
}
timedDragCancel = Utility.schedule(() ->
{
if (dragStartedAt.get() > 0)
{
logger.warn("Unclosed drag event is still active 10 seconds after starting! Cleaning up...");
Platform.runLater(() -> {conceptDragCompleted();});
}
}, 10, TimeUnit.SECONDS);
}
示例14: getHaloEffect
import javafx.scene.effect.Effect; //导入依赖的package包/类
private Effect getHaloEffect(double zoomLevel) {
double minZoomLevel = 0.2;
if (zoomLevel <= minZoomLevel)
return null;
double alpha = (zoomLevel - minZoomLevel) * 2.5;
double limitedAlpha = Math.max(0, Math.min(1, alpha));
Color color = new Color(0.9, 0.9, 0.9, limitedAlpha);
return new DropShadow(20, 7, 7, color);
}
示例15: getDropShadow
import javafx.scene.effect.Effect; //导入依赖的package包/类
/**
* Build the drop shadow.
*
* @return the drop shadow effect
*/
private Effect getDropShadow() {
return DropShadowBuilder.create()
.offsetX(0)
.offsetY(5)
.color(MTColors.BEAN_SHADOW.get())
.blurType(BlurType.GAUSSIAN)
.radius(5)
.spread(0.1)
.build();
}