1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-12-23 00:43:32 +01:00

Main: Icons and about button

This commit is contained in:
Carlos Galindo 2016-06-13 20:18:09 +02:00
parent 33b881a2aa
commit 76bff4c84b
Signed by: kauron
GPG key ID: 83E68706DEE119A3
3 changed files with 82 additions and 48 deletions

View file

@ -13,13 +13,18 @@ import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable; import javafx.fxml.Initializable;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.BorderPane;
import javafx.stage.FileChooser; import javafx.stage.FileChooser;
import java.awt.*;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URI;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.List;
public class Controller implements Initializable { public class Controller implements Initializable {
@FXML @FXML
@ -65,6 +70,7 @@ public class Controller implements Initializable {
dialog.getEditor().setPromptText("Table name"); dialog.getEditor().setPromptText("Table name");
dialog.setTitle("Creating new table"); dialog.setTitle("Creating new table");
dialog.setHeaderText("Please input a name for the new table"); dialog.setHeaderText("Please input a name for the new table");
dialog.setGraphic(new ImageView(new Image(Main.class.getResource("img/Edit.png").toString())));
dialog.getDialogPane().setMinWidth(250); dialog.getDialogPane().setMinWidth(250);
dialog.showAndWait(); dialog.showAndWait();
dialog.setResultConverter(value -> value.getButtonData().equals(ButtonBar.ButtonData.OK_DONE) ? value.getText() : ""); dialog.setResultConverter(value -> value.getButtonData().equals(ButtonBar.ButtonData.OK_DONE) ? value.getText() : "");
@ -152,4 +158,15 @@ public class Controller implements Initializable {
e.printStackTrace(); e.printStackTrace();
} }
} }
@FXML
protected void onAboutAction(ActionEvent event) {
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(URI.create("https://kauron.github.io/jstudy"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -4,17 +4,18 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.image.*?> <?import javafx.scene.image.*?>
<?import javafx.scene.input.KeyCodeCombination?> <?import javafx.scene.input.KeyCodeCombination?>
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.*?>
<?import javafx.scene.layout.VBox?>
<BorderPane fx:id="root" prefHeight="450.0" prefWidth="750.0" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.jstudy.controller.Controller"> <BorderPane fx:id="root" prefHeight="450.0" prefWidth="750.0" xmlns="http://javafx.com/javafx/8.0.76-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="es.kauron.jstudy.controller.Controller">
<center> <center>
<TabPane fx:id="tabPane" focusTraversable="false" minHeight="400.0" minWidth="600.0" tabMinWidth="100.0" BorderPane.alignment="CENTER"> <TabPane fx:id="tabPane" focusTraversable="false" minHeight="400.0" minWidth="600.0" tabMinWidth="100.0" BorderPane.alignment="CENTER">
<tabs> <tabs>
<Tab closable="false" text="Welcome"> <Tab closable="false" text="Welcome">
<content> <content>
<HBox alignment="CENTER" spacing="25.0">
<children>
<VBox alignment="CENTER" spacing="15.0"> <VBox alignment="CENTER" spacing="15.0">
<children> <children>
<Button alignment="TOP_LEFT" onAction="#onNewAction" prefWidth="150.0" text="_New table"> <Button alignment="TOP_LEFT" onAction="#onNewAction" prefHeight="40.0" prefWidth="150.0" text="_New table">
<graphic> <graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
@ -24,8 +25,9 @@
</graphic> </graphic>
<tooltip> <tooltip>
<Tooltip text="Create new empty table" /> <Tooltip text="Create new empty table" />
</tooltip></Button> </tooltip>
<Button alignment="TOP_LEFT" onAction="#onLoadAction" prefWidth="150.0" text="_Load file"> </Button>
<Button alignment="TOP_LEFT" onAction="#onLoadAction" prefHeight="40.0" prefWidth="150.0" text="_Load file">
<graphic> <graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
@ -35,8 +37,9 @@
</graphic> </graphic>
<tooltip> <tooltip>
<Tooltip text="Open an existing table from a file" /> <Tooltip text="Open an existing table from a file" />
</tooltip></Button> </tooltip>
<Button alignment="TOP_LEFT" layoutX="260.0" layoutY="187.0" onAction="#onImportAction" prefWidth="150.0" text="_Import data"> </Button>
<Button alignment="TOP_LEFT" layoutX="260.0" layoutY="187.0" onAction="#onImportAction" prefHeight="40.0" prefWidth="150.0" text="_Import data">
<graphic> <graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
@ -46,8 +49,9 @@
</graphic> </graphic>
<tooltip> <tooltip>
<Tooltip text="Import data from other table-based software" /> <Tooltip text="Import data from other table-based software" />
</tooltip></Button> </tooltip>
<Button alignment="TOP_LEFT" layoutX="260.0" layoutY="208.0" onAction="#onSettingsAction" prefWidth="150.0" text="_Settings"> </Button>
<Button alignment="TOP_LEFT" layoutX="260.0" layoutY="208.0" onAction="#onSettingsAction" prefHeight="40.0" prefWidth="150.0" text="_Settings">
<graphic> <graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true"> <ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image> <image>
@ -57,12 +61,25 @@
</graphic> </graphic>
<tooltip> <tooltip>
<Tooltip text="Change the settings" /> <Tooltip text="Change the settings" />
</tooltip></Button> </tooltip>
</Button>
</children> </children>
<padding> <padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" /> <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding> </padding>
</VBox> </VBox>
<VBox alignment="CENTER" spacing="15.0">
<children>
<ImageView fitHeight="150.0" fitWidth="150.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/icon2.png" />
</image>
</ImageView>
<Button mnemonicParsing="false" onAction="#onAboutAction" prefHeight="40.0" prefWidth="150.0" text="About" />
</children>
</VBox>
</children>
</HBox>
</content> </content>
</Tab> </Tab>
</tabs> </tabs>