English 中文(简体)
在 JavaFX 2. 1 按钮图像未显示
原标题:In JavaFX 2.1 button image is not shown
  • 时间:2012-05-28 06:50:04
  •  标签:
  • javafx-2

JavaFX 2. 1 :

我带图像的按钮在 JavaFX 2. 0 中运作良好。 升级为 JavaFX 2. 2. 1, 图像消失了 。

这是代码:

Button aButton = new Button("Test");
String iconPath = "/com/abc/res/toolbar/Help.gif";
Image aIcon = new Image(
    getClass().getResourceAsStream(iconPath), 18, 18, false, false);
aButton.setGraphic(new ImageView(aIcon));

这在 JavaFX 2. 0 下有效。 在 JavaFX 2. 1. 1 下不起作用。 要显示图形, 我必须删除调整大小的函数 。

Image aIcon = new Image(getClass().getResourceAsStream(iconPath));

有什么建议吗?

最佳回答

重新缩放图像时未显示的按钮图形似乎是一个回归 - 以修复它, 以 < a href=" http://javafx-jira.kenai.com" rel=“ no follow” > http://javafx-jira.kenai.com 及其样本代码和图像。

作为工作翻转,在不调整图像大小的情况下在构建器中装入图像,并通过 imageView.fitWidth imageView.fitHeight 将已装入图像重新缩放为 Imagiew

问题回答

暂无回答




相关问题
Tutorial/Blog for GroovyFx

I need links for blog, tutorials that covers GroovyFx. I have tried searching it on google, i m not getting any useful tutorials. I need a full coverage of GroovyFx from top to bottom! Thanks in ...

Adding JFXPanel to a JFrame. Why is it not working?

I am trying to add a JFXPanel to my JFrame. I am using Netbeans and Netbeans Swing GUI Builder. When I run it I do not get any errors and the JFrame is created successfully but the JFXPanel with the ...

what is yaml file in java and use of it?

i saw some site like this http://jyaml.sourceforge.net/ for yaml in java. but i can t to use of that. how can i use form yaml files? if is it possible to use it in javafx 2.0? thanks.

javaFX 2.0 how to select files aka FileChooser

I m trying out the new JavaFx 2.0 beta release but cannot find anyway of selecting files using a dialog box like JfileChooser. Any ideas on how to do this? Thanks

How to wrap a swing component in a javaFX 2.0 application

The ability to wrap a swing component in a javaFX application seems to have vanished from javaFX 2: javafx.ext.swing.SwingComponent is not there any more in javaFX 2 beta API. Is there still a ...

Does JavaFX 2.0 run on Google App Engine?

As I just read about the release of JavaFX 2.0 beta and the NetBeans 7.0 plugin in the article JavaFX: The Resurrection (Java FX 2.0 Released), is there information available if it runs on Google App ...

热门标签