回答編集履歴
2
糞リニューアルマークダウン崩れ修正
answer
CHANGED
@@ -1,35 +1,33 @@
|
|
1
|
-
JavaFXは詳しくないので頓珍漢なことをしているかもしれません。
|
1
|
+
JavaFXは詳しくないので頓珍漢なことをしているかもしれません。
|
2
|
-
|
2
|
+
|
3
|
-
[java - How can I style the ProgressBar component in JavaFX - Stack Overflow](https://stackoverflow.com/questions/19417246/how-can-i-style-the-progressbar-component-in-javafx/19418709)
|
3
|
+
[java - How can I style the ProgressBar component in JavaFX - Stack Overflow](https://stackoverflow.com/questions/19417246/how-can-i-style-the-progressbar-component-in-javafx/19418709)
|
4
|
-
|
4
|
+
|
5
|
-
`ProgressBar`の中の`Track`の背景を変える必要があるようです。
|
5
|
+
`ProgressBar`の中の`Track`の背景を変える必要があるようです。
|
6
|
-
もともとはグラデーション等で凝った色になっています。
|
6
|
+
もともとはグラデーション等で凝った色になっています。
|
7
|
-
ちゃんとやる方法もありそうですが、面倒なので`transparent`にしてしまいます。
|
7
|
+
ちゃんとやる方法もありそうですが、面倒なので`transparent`にしてしまいます。
|
8
|
-
`transparent`にすると枠ももろもろ透明になってしまうので、~~通常のProgressBarをダミーで一番下に置きました^^;~~一番下になるのを普通のにします。
|
8
|
+
`transparent`にすると枠ももろもろ透明になってしまうので、 ~~通常のProgressBarをダミーで一番下に置きました^^;~~ 一番下になるのを普通のにします。
|
9
|
-
|
9
|
+
|
10
|
-
sample.fxml
|
10
|
+
```xml:sample.fxml
|
11
|
-
```fxml
|
12
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
11
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
13
|
-
|
12
|
+
|
14
|
-
<?import javafx.scene.control.ProgressBar?>
|
13
|
+
<?import javafx.scene.control.ProgressBar?>
|
15
|
-
<?import javafx.scene.layout.Pane?>
|
14
|
+
<?import javafx.scene.layout.Pane?>
|
16
|
-
|
15
|
+
|
17
|
-
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0"
|
16
|
+
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0"
|
18
|
-
prefWidth="600.0" stylesheets="@sample.css" xmlns="http://javafx.com/javafx/11.0.1"
|
17
|
+
prefWidth="600.0" stylesheets="@sample.css" xmlns="http://javafx.com/javafx/11.0.1"
|
19
|
-
xmlns:fx="http://javafx.com/fxml/1">
|
18
|
+
xmlns:fx="http://javafx.com/fxml/1">
|
20
|
-
<children>
|
19
|
+
<children>
|
21
|
-
<ProgressBar layoutX="14.0" layoutY="14.0" prefWidth="200.0" progress="0.8"
|
20
|
+
<ProgressBar layoutX="14.0" layoutY="14.0" prefWidth="200.0" progress="0.8"
|
22
|
-
style="-fx-accent: red;"/>
|
21
|
+
style="-fx-accent: red;"/>
|
23
|
-
<ProgressBar layoutX="14.0" layoutY="14.0" prefWidth="200.0" progress="0.5"
|
22
|
+
<ProgressBar layoutX="14.0" layoutY="14.0" prefWidth="200.0" progress="0.5"
|
24
|
-
styleClass="transparent-progress-bar"/>
|
23
|
+
styleClass="transparent-progress-bar"/>
|
25
|
-
</children>
|
24
|
+
</children>
|
26
|
-
</Pane>
|
25
|
+
</Pane>
|
27
|
-
```
|
26
|
+
```
|
28
|
-
|
27
|
+
|
29
|
-
sample.css
|
28
|
+
```css:sample.css
|
30
|
-
```css
|
31
|
-
.transparent-progress-bar > .track {
|
29
|
+
.transparent-progress-bar > .track {
|
32
|
-
-fx-background-color: transparent;
|
30
|
+
-fx-background-color: transparent;
|
33
|
-
}
|
31
|
+
}
|
34
|
-
```
|
32
|
+
```
|
35
33
|

|
1
いらんかった
answer
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
`ProgressBar`の中の`Track`の背景を変える必要があるようです。
|
6
6
|
もともとはグラデーション等で凝った色になっています。
|
7
7
|
ちゃんとやる方法もありそうですが、面倒なので`transparent`にしてしまいます。
|
8
|
-
`transparent`にすると枠ももろもろ透明になってしまうので、通常の
|
8
|
+
`transparent`にすると枠ももろもろ透明になってしまうので、~~通常のProgressBarをダミーで一番下に置きました^^;~~一番下になるのを普通のにします。
|
9
9
|
|
10
10
|
sample.fxml
|
11
11
|
```fxml
|
@@ -18,9 +18,8 @@
|
|
18
18
|
prefWidth="600.0" stylesheets="@sample.css" xmlns="http://javafx.com/javafx/11.0.1"
|
19
19
|
xmlns:fx="http://javafx.com/fxml/1">
|
20
20
|
<children>
|
21
|
-
<ProgressBar fx:id="dummy" layoutX="14.0" layoutY="14.0" prefWidth="200.0" progress="0"/>
|
22
21
|
<ProgressBar layoutX="14.0" layoutY="14.0" prefWidth="200.0" progress="0.8"
|
23
|
-
style="-fx-accent: red;"
|
22
|
+
style="-fx-accent: red;"/>
|
24
23
|
<ProgressBar layoutX="14.0" layoutY="14.0" prefWidth="200.0" progress="0.5"
|
25
24
|
styleClass="transparent-progress-bar"/>
|
26
25
|
</children>
|