Skip to content

Commit d65ca33

Browse files
tobiasdiezSiedlerchr
authored andcommitted
Fix display of radio buttons (#4411)
Previously, unchecked radio buttons were not displayed.
1 parent 3d8570b commit d65ca33

File tree

2 files changed

+96
-45
lines changed

2 files changed

+96
-45
lines changed

src/main/java/org/jabref/gui/Base.css

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,32 @@
391391
}
392392

393393
.check-box > .box > .mark {
394-
-fx-background-color: white;
394+
-fx-background-color: -fx-control-inner-background;
395395
-fx-padding: 0.2em 0.2em 0.2em 0.2em;
396396
-fx-shape: "M6.61 11.89L3.5 8.78 2.44 9.84 6.61 14l8.95-8.95L14.5 4z";
397397
-fx-stroke-width: 5;
398398
}
399399

400+
.radio-button > .radio {
401+
-fx-background-radius: 1.0em; /* large value to make sure this remains circular */
402+
-fx-padding: 0.35em; /* padding from outside edge to the inner dot */
403+
-fx-background-color: rgba(0, 0, 0, 0.54), -fx-control-inner-background;
404+
-fx-background-insets: 0, 2px;
405+
}
406+
407+
.radio-button:selected > .radio {
408+
-fx-background-color: -jr-checked, -fx-background;
409+
}
410+
411+
.radio-button > .radio > .dot {
412+
-fx-padding: 0.25em; /* radius of the inner dot when selected */
413+
-fx-background-insets: 0;
414+
}
415+
416+
.radio-button:selected > .radio > .dot {
417+
-fx-background-color: -jr-checked;
418+
}
419+
400420
.menu-bar {
401421
-fx-background-color: -jr-menu-background;
402422
-fx-background-insets: 0;

src/main/java/org/jabref/styletester/StyleTester.fxml

Lines changed: 75 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -28,147 +28,178 @@
2828
<?import javafx.scene.control.ToggleGroup?>
2929
<?import javafx.scene.input.KeyCodeCombination?>
3030
<?import javafx.scene.layout.AnchorPane?>
31+
<?import javafx.scene.layout.ColumnConstraints?>
3132
<?import javafx.scene.layout.FlowPane?>
3233
<?import javafx.scene.layout.GridPane?>
3334
<?import javafx.scene.layout.HBox?>
35+
<?import javafx.scene.layout.RowConstraints?>
3436
<?import javafx.scene.layout.VBox?>
3537
<?import org.jabref.gui.icon.JabRefIconView?>
36-
<AnchorPane xmlns:fx="http://javafx.com/fxml/1" prefHeight="600.0" prefWidth="900.0"
37-
xmlns="http://javafx.com/javafx/8.0.121" fx:controller="org.jabref.styletester.StyleTesterView">
38+
39+
<AnchorPane prefHeight="600.0" prefWidth="900.0" xmlns="http://javafx.com/javafx/8.0.121"
40+
xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.styletester.StyleTesterView">
3841
<TabPane AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
3942
AnchorPane.topAnchor="0.0">
4043
<Tab text="Buttons">
41-
<GridPane vgap="16" hgap="32" style="-fx-padding: 20 30 20 30;">
42-
<Label GridPane.rowIndex="0" GridPane.columnIndex="0" GridPane.columnSpan="6">Normal buttons:</Label>
43-
<Button text="Normal" GridPane.rowIndex="1" GridPane.columnIndex="0">
44+
<GridPane hgap="32" style="-fx-padding: 20 30 20 30;" vgap="16">
45+
<Label GridPane.columnIndex="0" GridPane.columnSpan="6" GridPane.rowIndex="0">Normal buttons:</Label>
46+
<Button text="Normal" GridPane.columnIndex="0" GridPane.rowIndex="1">
4447
<graphic>
4548
<JabRefIconView glyph="ADD_NOBOX"/>
4649
</graphic>
4750
</Button>
48-
<Button text="Hover" fx:id="normalButtonHover" GridPane.rowIndex="1" GridPane.columnIndex="1">
51+
<Button fx:id="normalButtonHover" text="Hover" GridPane.columnIndex="1" GridPane.rowIndex="1">
4952
<graphic>
5053
<JabRefIconView glyph="ADD_NOBOX"/>
5154
</graphic>
5255
</Button>
53-
<Button text="Pressed" fx:id="normalButtonPressed" GridPane.rowIndex="1" GridPane.columnIndex="2">
56+
<Button fx:id="normalButtonPressed" text="Pressed" GridPane.columnIndex="2" GridPane.rowIndex="1">
5457
<graphic>
5558
<JabRefIconView glyph="ADD_NOBOX"/>
5659
</graphic>
5760
</Button>
58-
<Button text="Focused" fx:id="normalButtonFocused" GridPane.rowIndex="1" GridPane.columnIndex="3">
61+
<Button fx:id="normalButtonFocused" text="Focused" GridPane.columnIndex="3" GridPane.rowIndex="1">
5962
<graphic>
6063
<JabRefIconView glyph="ADD_NOBOX"/>
6164
</graphic>
6265
</Button>
63-
<Button disable="true" text="Disabled" GridPane.rowIndex="1" GridPane.columnIndex="4">
66+
<Button disable="true" text="Disabled" GridPane.columnIndex="4" GridPane.rowIndex="1">
6467
<graphic>
6568
<JabRefIconView glyph="ADD_NOBOX"/>
6669
</graphic>
6770
</Button>
68-
<Button defaultButton="true" text="Default" GridPane.rowIndex="1" GridPane.columnIndex="5">
71+
<Button defaultButton="true" text="Default" GridPane.columnIndex="5" GridPane.rowIndex="1">
6972
<graphic>
7073
<JabRefIconView glyph="ADD_NOBOX"/>
7174
</graphic>
7275
</Button>
73-
<Button cancelButton="true" text="Cancel" GridPane.rowIndex="1" GridPane.columnIndex="6">
76+
<Button cancelButton="true" text="Cancel" GridPane.columnIndex="6" GridPane.rowIndex="1">
7477
<graphic>
7578
<JabRefIconView glyph="ADD_NOBOX"/>
7679
</graphic>
7780
</Button>
78-
<Label GridPane.rowIndex="2" GridPane.columnIndex="0" GridPane.columnSpan="6">Text buttons:</Label>
79-
<Button text="Normal" styleClass="text-button" GridPane.rowIndex="3" GridPane.columnIndex="0">
81+
<Label GridPane.columnIndex="0" GridPane.columnSpan="6" GridPane.rowIndex="2">Text buttons:</Label>
82+
<Button styleClass="text-button" text="Normal" GridPane.columnIndex="0" GridPane.rowIndex="3">
8083
<graphic>
8184
<JabRefIconView glyph="ADD_NOBOX"/>
8285
</graphic>
8386
</Button>
84-
<Button text="Hover" fx:id="textButtonHover" styleClass="text-button" GridPane.rowIndex="3"
85-
GridPane.columnIndex="1">
87+
<Button fx:id="textButtonHover" styleClass="text-button" text="Hover" GridPane.columnIndex="1"
88+
GridPane.rowIndex="3">
8689
<graphic>
8790
<JabRefIconView glyph="ADD_NOBOX"/>
8891
</graphic>
8992
</Button>
90-
<Button text="Pressed" fx:id="textButtonPressed" styleClass="text-button" GridPane.rowIndex="3"
91-
GridPane.columnIndex="2">
93+
<Button fx:id="textButtonPressed" styleClass="text-button" text="Pressed" GridPane.columnIndex="2"
94+
GridPane.rowIndex="3">
9295
<graphic>
9396
<JabRefIconView glyph="ADD_NOBOX"/>
9497
</graphic>
9598
</Button>
96-
<Button text="Focused" fx:id="textButtonFocused" styleClass="text-button" GridPane.rowIndex="3"
97-
GridPane.columnIndex="3">
99+
<Button fx:id="textButtonFocused" styleClass="text-button" text="Focused" GridPane.columnIndex="3"
100+
GridPane.rowIndex="3">
98101
<graphic>
99102
<JabRefIconView glyph="ADD_NOBOX"/>
100103
</graphic>
101104
</Button>
102-
<Button disable="true" text="Disabled" styleClass="text-button" GridPane.rowIndex="3"
103-
GridPane.columnIndex="4">
105+
<Button disable="true" styleClass="text-button" text="Disabled" GridPane.columnIndex="4"
106+
GridPane.rowIndex="3">
104107
<graphic>
105108
<JabRefIconView glyph="ADD_NOBOX"/>
106109
</graphic>
107110
</Button>
108-
<Button defaultButton="true" text="Default" styleClass="text-button" GridPane.rowIndex="3"
109-
GridPane.columnIndex="5">
111+
<Button defaultButton="true" styleClass="text-button" text="Default" GridPane.columnIndex="5"
112+
GridPane.rowIndex="3">
110113
<graphic>
111114
<JabRefIconView glyph="ADD_NOBOX"/>
112115
</graphic>
113116
</Button>
114-
<Button cancelButton="true" text="Cancel" styleClass="text-button" GridPane.rowIndex="3"
115-
GridPane.columnIndex="6">
117+
<Button cancelButton="true" styleClass="text-button" text="Cancel" GridPane.columnIndex="6"
118+
GridPane.rowIndex="3">
116119
<graphic>
117120
<JabRefIconView glyph="ADD_NOBOX"/>
118121
</graphic>
119122
</Button>
120-
<Label GridPane.rowIndex="4" GridPane.columnIndex="0" GridPane.columnSpan="6">Contained buttons:</Label>
121-
<Button text="Normal" styleClass="contained-button" GridPane.rowIndex="5" GridPane.columnIndex="0">
123+
<Label GridPane.columnIndex="0" GridPane.columnSpan="6" GridPane.rowIndex="4">Contained buttons:</Label>
124+
<Button styleClass="contained-button" text="Normal" GridPane.columnIndex="0" GridPane.rowIndex="5">
122125
<graphic>
123126
<JabRefIconView glyph="ADD_NOBOX"/>
124127
</graphic>
125128
</Button>
126-
<Button text="Hover" fx:id="containedButtonHover" styleClass="contained-button" GridPane.rowIndex="5"
127-
GridPane.columnIndex="1">
129+
<Button fx:id="containedButtonHover" styleClass="contained-button" text="Hover" GridPane.columnIndex="1"
130+
GridPane.rowIndex="5">
128131
<graphic>
129132
<JabRefIconView glyph="ADD_NOBOX"/>
130133
</graphic>
131134
</Button>
132-
<Button text="Pressed" fx:id="containedButtonPressed" styleClass="contained-button"
133-
GridPane.rowIndex="5" GridPane.columnIndex="2">
135+
<Button fx:id="containedButtonPressed" styleClass="contained-button" text="Pressed"
136+
GridPane.columnIndex="2" GridPane.rowIndex="5">
134137
<graphic>
135138
<JabRefIconView glyph="ADD_NOBOX"/>
136139
</graphic>
137140
</Button>
138-
<Button text="Focused" fx:id="containedButtonFocused" styleClass="contained-button"
139-
GridPane.rowIndex="5" GridPane.columnIndex="3">
141+
<Button fx:id="containedButtonFocused" styleClass="contained-button" text="Focused"
142+
GridPane.columnIndex="3" GridPane.rowIndex="5">
140143
<graphic>
141144
<JabRefIconView glyph="ADD_NOBOX"/>
142145
</graphic>
143146
</Button>
144-
<Button disable="true" text="Disabled" styleClass="contained-button" GridPane.rowIndex="5"
145-
GridPane.columnIndex="4">
147+
<Button disable="true" styleClass="contained-button" text="Disabled" GridPane.columnIndex="4"
148+
GridPane.rowIndex="5">
146149
<graphic>
147150
<JabRefIconView glyph="ADD_NOBOX"/>
148151
</graphic>
149152
</Button>
150-
<Button defaultButton="true" text="Default" styleClass="contained-button" GridPane.rowIndex="5"
151-
GridPane.columnIndex="5">
153+
<Button defaultButton="true" styleClass="contained-button" text="Default" GridPane.columnIndex="5"
154+
GridPane.rowIndex="5">
152155
<graphic>
153156
<JabRefIconView glyph="ADD_NOBOX"/>
154157
</graphic>
155158
</Button>
156-
<Button cancelButton="true" text="Cancel" styleClass="contained-button" GridPane.rowIndex="5"
157-
GridPane.columnIndex="6">
159+
<Button cancelButton="true" styleClass="contained-button" text="Cancel" GridPane.columnIndex="6"
160+
GridPane.rowIndex="5">
158161
<graphic>
159162
<JabRefIconView glyph="ADD_NOBOX"/>
160163
</graphic>
161164
</Button>
165+
<columnConstraints>
166+
<ColumnConstraints/>
167+
<ColumnConstraints/>
168+
<ColumnConstraints/>
169+
<ColumnConstraints/>
170+
<ColumnConstraints/>
171+
<ColumnConstraints/>
172+
<ColumnConstraints/>
173+
</columnConstraints>
174+
<rowConstraints>
175+
<RowConstraints/>
176+
<RowConstraints/>
177+
<RowConstraints/>
178+
<RowConstraints/>
179+
<RowConstraints/>
180+
<RowConstraints/>
181+
</rowConstraints>
162182
</GridPane>
163183
</Tab>
164184
<Tab text="Switches">
165-
<VBox style="-fx-padding: 1em" spacing="10">
185+
<VBox spacing="10" style="-fx-padding: 1em">
166186
<Label text="Checkboxes"/>
167-
<VBox style="-fx-padding: 0em 0em 0em 1em" spacing="15">
187+
<VBox spacing="15" style="-fx-padding: 0em 0em 0em 1em">
168188
<CheckBox text="Unchecked"/>
169-
<CheckBox text="Checked" selected="true"/>
170-
<CheckBox text="Unchecked disabled" disable="true"/>
171-
<CheckBox text="Checked disabled" disable="true" selected="true"/>
189+
<CheckBox selected="true" text="Checked"/>
190+
<CheckBox disable="true" text="Unchecked disabled"/>
191+
<CheckBox disable="true" selected="true" text="Checked disabled"/>
192+
</VBox>
193+
<Label text="Radio-Buttons">
194+
<VBox.margin>
195+
<Insets top="20.0"/>
196+
</VBox.margin>
197+
</Label>
198+
<VBox spacing="15" style="-fx-padding: 0em 0em 0em 1em">
199+
<RadioButton text="Unchecked"/>
200+
<RadioButton selected="true" text="Checked"/>
201+
<RadioButton disable="true" text="Unchecked disabled"/>
202+
<RadioButton disable="true" selected="true" text="Checked disabled"/>
172203
</VBox>
173204
</VBox>
174205
</Tab>

0 commit comments

Comments
 (0)