mirror of https://github.com/LucaBongiorni/Ratty
Sogomn
9 years ago
6 changed files with 146 additions and 14 deletions
-
30Ratty/res/gui.fxml
-
7Ratty/res/language/language_de.properties
-
7Ratty/res/language/language_en.properties
-
0Ratty/res/test.css
-
81Ratty/src/de/sogomn/rat/server/gui/RattyGuiFx.java
-
35Ratty/src/de/sogomn/rat/server/gui/ServerClient.java
@ -0,0 +1,30 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
|
||||
|
<?import javafx.scene.control.*?> |
||||
|
<?import java.lang.*?> |
||||
|
<?import javafx.scene.layout.*?> |
||||
|
|
||||
|
<BorderPane fx:id="pane" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> |
||||
|
<bottom> |
||||
|
<HBox fx:id="bottom" BorderPane.alignment="CENTER"> |
||||
|
<children> |
||||
|
<Button fx:id="builder" mnemonicParsing="false" text="%button.build" /> |
||||
|
</children> |
||||
|
</HBox> |
||||
|
</bottom> |
||||
|
<center> |
||||
|
<TableView fx:id="table" editable="true" BorderPane.alignment="CENTER"> |
||||
|
<columns> |
||||
|
<TableColumn editable="false" prefWidth="75.0" text="%column.name" /> |
||||
|
<TableColumn editable="false" prefWidth="75.0" text="%column.address" /> |
||||
|
<TableColumn editable="false" prefWidth="75.0" text="%column.os" /> |
||||
|
<TableColumn editable="false" prefWidth="75.0" text="%column.version" /> |
||||
|
<TableColumn editable="false" prefWidth="75.0" text="%column.desktop" /> |
||||
|
<TableColumn editable="false" prefWidth="75.0" text="%column.voice" /> |
||||
|
</columns> |
||||
|
<columnResizePolicy> |
||||
|
<TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> |
||||
|
</columnResizePolicy> |
||||
|
</TableView> |
||||
|
</center> |
||||
|
</BorderPane> |
@ -0,0 +1,7 @@ |
|||||
|
column.name=Name |
||||
|
column.address=Addresse |
||||
|
column.os=OS |
||||
|
column.version=Version |
||||
|
column.desktop=Desktopstream |
||||
|
column.voice=Mikrofonstream |
||||
|
button.build=Clientbuilder |
@ -0,0 +1,7 @@ |
|||||
|
column.name=Name |
||||
|
column.address=Address |
||||
|
column.os=OS |
||||
|
column.version=Version |
||||
|
column.desktop=Streaming desktop |
||||
|
column.voice=Streaming voice |
||||
|
button.build=Client builder |
@ -0,0 +1,81 @@ |
|||||
|
package de.sogomn.rat.server.gui; |
||||
|
|
||||
|
import java.io.IOException; |
||||
|
import java.io.InputStream; |
||||
|
import java.util.Locale; |
||||
|
import java.util.ResourceBundle; |
||||
|
|
||||
|
import javafx.application.Application; |
||||
|
import javafx.collections.ObservableList; |
||||
|
import javafx.fxml.FXML; |
||||
|
import javafx.fxml.FXMLLoader; |
||||
|
import javafx.scene.Parent; |
||||
|
import javafx.scene.Scene; |
||||
|
import javafx.scene.control.Button; |
||||
|
import javafx.scene.control.TableView; |
||||
|
import javafx.scene.layout.BorderPane; |
||||
|
import javafx.scene.layout.HBox; |
||||
|
import javafx.stage.Stage; |
||||
|
import de.sogomn.rat.Ratty; |
||||
|
|
||||
|
public final class RattyGuiFx extends Application { |
||||
|
|
||||
|
@FXML |
||||
|
private BorderPane pane; |
||||
|
|
||||
|
@FXML |
||||
|
private TableView<ServerClient> table; |
||||
|
|
||||
|
@FXML |
||||
|
private HBox bottom; |
||||
|
|
||||
|
@FXML |
||||
|
private Button builder; |
||||
|
|
||||
|
private static final String TITLE = "Ratty"; |
||||
|
private static final String CSS_PATH = "/test.css"; |
||||
|
private static final String FXML_PATH = "/gui.fxml"; |
||||
|
private static final String LANGUAGE_BASE = "language.language"; |
||||
|
|
||||
|
public RattyGuiFx() { |
||||
|
//... |
||||
|
} |
||||
|
|
||||
|
private Parent loadContent(final String path, final ResourceBundle bundle) { |
||||
|
final FXMLLoader loader = new FXMLLoader(); |
||||
|
|
||||
|
loader.setResources(bundle); |
||||
|
|
||||
|
try { |
||||
|
final InputStream in = Ratty.class.getResourceAsStream(path); |
||||
|
final Parent content = loader.load(in); |
||||
|
|
||||
|
return content; |
||||
|
} catch (final IOException ex) { |
||||
|
ex.printStackTrace(); |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void start(final Stage primaryStage) throws Exception { |
||||
|
final ResourceBundle bundle = ResourceBundle.getBundle(LANGUAGE_BASE, Locale.ENGLISH); |
||||
|
final Parent content = loadContent(FXML_PATH, bundle); |
||||
|
final Scene scene = new Scene(content); |
||||
|
final ObservableList<String> styleSheets = scene.getStylesheets(); |
||||
|
|
||||
|
styleSheets.add(CSS_PATH); |
||||
|
|
||||
|
primaryStage.setTitle(TITLE); |
||||
|
primaryStage.setScene(scene); |
||||
|
primaryStage.show(); |
||||
|
|
||||
|
System.out.println(builder); |
||||
|
} |
||||
|
|
||||
|
public static void main(final String[] args) { |
||||
|
RattyGuiFx.launch(args); |
||||
|
} |
||||
|
|
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue