Improve layout of UpdateTab
Tweak the margins between controls, so that it looks more balanced. Make the changelog grow vertically to fill the tab, when the window size changes.
This commit is contained in:
parent
e4eda35d02
commit
b65db45a05
|
@ -4,10 +4,12 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ctbrec.ui.CtbrecApplication.Release;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.web.WebEngine;
|
||||
import javafx.scene.web.WebView;
|
||||
|
@ -21,10 +23,13 @@ public class UpdateTab extends Tab {
|
|||
public UpdateTab(Release latest) {
|
||||
setText("Update Available");
|
||||
VBox vbox = new VBox(10);
|
||||
vbox.getChildren().add(new Label("New Version available " + latest.getVersion()));
|
||||
Label l = new Label("New Version available " + latest.getVersion());
|
||||
vbox.getChildren().add(l);
|
||||
VBox.setMargin(l, new Insets(20, 0, 0, 0));
|
||||
Button button = new Button("Download");
|
||||
button.setOnAction((e) -> DesktopIntergation.open(latest.getHtmlUrl()));
|
||||
vbox.getChildren().add(button);
|
||||
VBox.setMargin(button, new Insets(0, 0, 10, 0));
|
||||
vbox.setAlignment(Pos.CENTER);
|
||||
|
||||
browser = new WebView();
|
||||
|
@ -32,6 +37,7 @@ public class UpdateTab extends Tab {
|
|||
WebEngine webEngine = browser.getEngine();
|
||||
webEngine.load("https://raw.githubusercontent.com/0xboobface/ctbrec/master/CHANGELOG.md");
|
||||
vbox.getChildren().add(browser);
|
||||
VBox.setVgrow(browser, Priority.ALWAYS);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Couldn't load changelog", e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue