1
0
Fork 0
mirror of https://gitlab.com/kauron/jstudy synced 2024-06-26 13:33:02 +02: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.scene.Parent;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.stage.FileChooser;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.*;
import java.util.List;
public class Controller implements Initializable {
@FXML
@ -65,6 +70,7 @@ public class Controller implements Initializable {
dialog.getEditor().setPromptText("Table name");
dialog.setTitle("Creating 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.showAndWait();
dialog.setResultConverter(value -> value.getButtonData().equals(ButtonBar.ButtonData.OK_DONE) ? value.getText() : "");
@ -152,4 +158,15 @@ public class Controller implements Initializable {
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,65 +4,82 @@
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.input.KeyCodeCombination?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.*?>
<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>
<TabPane fx:id="tabPane" focusTraversable="false" minHeight="400.0" minWidth="600.0" tabMinWidth="100.0" BorderPane.alignment="CENTER">
<tabs>
<Tab closable="false" text="Welcome">
<content>
<VBox alignment="CENTER" spacing="15.0">
<HBox alignment="CENTER" spacing="25.0">
<children>
<Button alignment="TOP_LEFT" onAction="#onNewAction" prefWidth="150.0" text="_New table">
<graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<VBox alignment="CENTER" spacing="15.0">
<children>
<Button alignment="TOP_LEFT" onAction="#onNewAction" prefHeight="40.0" prefWidth="150.0" text="_New table">
<graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/File.png" />
</image>
</ImageView>
</graphic>
<tooltip>
<Tooltip text="Create new empty table" />
</tooltip>
</Button>
<Button alignment="TOP_LEFT" onAction="#onLoadAction" prefHeight="40.0" prefWidth="150.0" text="_Load file">
<graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/Open%20Folder.png" />
</image>
</ImageView>
</graphic>
<tooltip>
<Tooltip text="Open an existing table from a file" />
</tooltip>
</Button>
<Button alignment="TOP_LEFT" layoutX="260.0" layoutY="187.0" onAction="#onImportAction" prefHeight="40.0" prefWidth="150.0" text="_Import data">
<graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/Download.png" />
</image>
</ImageView>
</graphic>
<tooltip>
<Tooltip text="Import data from other table-based software" />
</tooltip>
</Button>
<Button alignment="TOP_LEFT" layoutX="260.0" layoutY="208.0" onAction="#onSettingsAction" prefHeight="40.0" prefWidth="150.0" text="_Settings">
<graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/Settings.png" />
</image>
</ImageView>
</graphic>
<tooltip>
<Tooltip text="Change the settings" />
</tooltip>
</Button>
</children>
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>
</VBox>
<VBox alignment="CENTER" spacing="15.0">
<children>
<ImageView fitHeight="150.0" fitWidth="150.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/File.png" />
<Image url="@../img/icon2.png" />
</image>
</ImageView>
</graphic>
<tooltip>
<Tooltip text="Create new empty table" />
</tooltip></Button>
<Button alignment="TOP_LEFT" onAction="#onLoadAction" prefWidth="150.0" text="_Load file">
<graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/Open%20Folder.png" />
</image>
</ImageView>
</graphic>
<tooltip>
<Tooltip text="Open an existing table from a file" />
</tooltip></Button>
<Button alignment="TOP_LEFT" layoutX="260.0" layoutY="187.0" onAction="#onImportAction" prefWidth="150.0" text="_Import data">
<graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/Download.png" />
</image>
</ImageView>
</graphic>
<tooltip>
<Tooltip text="Import data from other table-based software" />
</tooltip></Button>
<Button alignment="TOP_LEFT" layoutX="260.0" layoutY="208.0" onAction="#onSettingsAction" prefWidth="150.0" text="_Settings">
<graphic>
<ImageView fitHeight="30.0" fitWidth="30.0" pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../img/Settings.png" />
</image>
</ImageView>
</graphic>
<tooltip>
<Tooltip text="Change the settings" />
</tooltip></Button>
<Button mnemonicParsing="false" onAction="#onAboutAction" prefHeight="40.0" prefWidth="150.0" text="About" />
</children>
</VBox>
</children>
<padding>
<Insets bottom="15.0" left="15.0" right="15.0" top="15.0" />
</padding>
</VBox>
</HBox>
</content>
</Tab>
</tabs>