这与这几乎是同一个问题,但有一个细微的差别。我还开始看到从Java8u45开始的ProgressIndicator
控件周围的边框,但当我选择“用户代理”样式表到里海时,我看到它们仅为。它看起来糟透了,但我很喜欢里海样式表,而且现在不愿意改变它。下面是一些说明问题的代码。显然,您必须取消注释以查看问题。
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.control.ProgressIndicator;
import javafx.stage.Stage;
import javafx.geometry.Insets;
public class ProgressIndicatorWithBorder extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
// this.setUserAgentStylesheet(Application.STYLESHEET_CASPIAN);
ProgressIndicator pi = new ProgressIndicator();
BorderPane borderPane = new BorderPane();
borderPane.setCenter(pi);
borderPane.setMargin(pi, new Insets(12));
Scene scene = new Scene(borderPane, 640, 480);
primaryStage.setScene(scene);
primaryStage.show();
}
}
发布于 2015-06-23 16:55:41
假设
正如提问者没有提到的那样,可以通过两种方式使用ProgressIndicator:
问题
这个问题只与inderminate状态有关,因为它的旋转器的ProgressIndicator样式似乎与它的旋转器的Datepicker样式相冲突。因此,JavaFX开发人员选择了制作Java 8u40中的Bugfix。这是对modena.css进行的,因为它是JavaFX的默认CSS。
但在您的情况下,您希望使用旧风格的caspian.css。所以你必须用同样的方式来做,就像他们做的一样,这里。
凯文·拉什福斯( JavaFX成员之一)对这种行为做了两张截图:
进步-坏影响因素
进步-好的
解决方案
创建自己的样式表文件。我给我的pibug.css打了电话。将其设置在ProgressIndicator上,因为它是样式表。这不会覆盖caspian.css中已经设置的其他默认值。
pibug.css
.progress-indicator:indeterminate > .spinner {
-fx-background-color: transparent;
-fx-background-insets: 0;
-fx-background-radius: 0;
}
但是,这还不是全部,如果您想让您的数据报童与caspian.css很好地工作,您需要在您的数据采集器上设置以下样式:
dpbug.css
.date-picker-popup > * > .spinner {
-fx-spacing: 0.25em; /* 3 */
-fx-alignment: CENTER;
-fx-fill-height: false;
-fx-background-color: transparent; /* this line was added */
}
发布于 2015-06-23 22:32:13
我们必须从modena.css
复制这个部分
.progress-indicator:indeterminate > .spinner {
/** Applying to undo styling from .spinner, reported in RT-37965 */
-fx-background-color: transparent;
-fx-background-insets: 0;
-fx-background-radius: 0;
}
它不需要修改。
(注:NwDX的答案很有用,因为它让我指向正确的方向,所以我试着把这个事实编辑成他的答案。但我的编辑被拒绝了,因为它偏离了原来答案的意图。)
https://stackoverflow.com/questions/31008410
复制相似问题