mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-16 07:16:27 -04:00
Refactor IconedItem
This commit is contained in:
parent
e1b6c18017
commit
13e227851f
@ -229,8 +229,8 @@ public final class LeftPaneController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showUpdate() {
|
public void showUpdate() {
|
||||||
launcherSettingsItem.setText(i18n("update.found"));
|
launcherSettingsItem.getLabel().setText(i18n("update.found"));
|
||||||
launcherSettingsItem.setTextFill(Color.RED);
|
launcherSettingsItem.getLabel().setTextFill(Color.RED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkedModpack = false;
|
private boolean checkedModpack = false;
|
||||||
|
@ -21,18 +21,25 @@ import javafx.geometry.Pos;
|
|||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.paint.Paint;
|
|
||||||
|
|
||||||
public class IconedItem extends RipplerContainer {
|
public class IconedItem extends RipplerContainer {
|
||||||
|
|
||||||
|
private Label label;
|
||||||
|
|
||||||
public IconedItem(Node icon, String text) {
|
public IconedItem(Node icon, String text) {
|
||||||
super(createHBox(icon, text));
|
this(icon);
|
||||||
|
label.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HBox createHBox(Node icon, String text) {
|
public IconedItem(Node icon) {
|
||||||
|
super(createHBox(icon));
|
||||||
|
label = ((Label) lookup("#label"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static HBox createHBox(Node icon) {
|
||||||
HBox hBox = new HBox();
|
HBox hBox = new HBox();
|
||||||
icon.setMouseTransparent(true);
|
icon.setMouseTransparent(true);
|
||||||
Label textLabel = new Label(text);
|
Label textLabel = new Label();
|
||||||
textLabel.setId("label");
|
textLabel.setId("label");
|
||||||
textLabel.setAlignment(Pos.CENTER);
|
textLabel.setAlignment(Pos.CENTER);
|
||||||
textLabel.setMouseTransparent(true);
|
textLabel.setMouseTransparent(true);
|
||||||
@ -42,11 +49,7 @@ public class IconedItem extends RipplerContainer {
|
|||||||
return hBox;
|
return hBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String text) {
|
public Label getLabel() {
|
||||||
((Label) lookup("#label")).setText(text);
|
return label;
|
||||||
}
|
|
||||||
|
|
||||||
public void setTextFill(Paint paint) {
|
|
||||||
((Label) lookup("#label")).setTextFill(paint);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user