// REMOVE ME public static Node createIconContent() { StackPane sp = new StackPane(); BorderPane borderPane = new BorderPane(); Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY); rectangle.setStroke(Color.BLACK); borderPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight()); Rectangle recTop = new Rectangle(62, 5, Color.web("#349b00")); recTop.setStroke(Color.BLACK); Rectangle recBottom = new Rectangle(62, 14, Color.web("#349b00")); recBottom.setStroke(Color.BLACK); Rectangle recLeft = new Rectangle(20, 41, Color.TRANSPARENT); recLeft.setStroke(Color.BLACK); Rectangle recRight = new Rectangle(20, 41, Color.TRANSPARENT); recRight.setStroke(Color.BLACK); Rectangle centerRight = new Rectangle(20, 41, Color.TRANSPARENT); centerRight.setStroke(Color.BLACK); borderPane.setRight(recRight); borderPane.setTop(recTop); borderPane.setLeft(recLeft); borderPane.setBottom(recBottom); borderPane.setCenter(centerRight); sp.getChildren().addAll(rectangle, borderPane); return new Group(sp); }
/** * Das GUI besteht aus zwei wesentlichen Komponenten, einer GridPane namens entryArea und einem * TextAreaHandler, beide sind in eine BorderPane eingebettet. */ @Override protected Scene create_GUI() { // ServiceLocator und Translator werden gesetzt. ServiceLocator sl = ServiceLocator.getServiceLocator(); Translator t = sl.getTranslator(); // Die MenuBar enthält die Sprachauswahl MenuBar menuBar = new MenuBar(); menuFile = new Menu(t.getString("program.menu.file")); menuFileLanguage = new Menu(t.getString("program.menu.file.language")); menuFile.getItems().add(menuFileLanguage); for (Locale locale : sl.getLocales()) { MenuItem language = new MenuItem(locale.getLanguage()); menuFileLanguage.getItems().add(language); language.setOnAction( event -> { sl.setTranslator(new Translator(locale.getLanguage())); updateTexts(); }); } BorderPane root = new BorderPane(); root.setPrefSize(409, 219); menuBar.getMenus().addAll(menuFile); root.setTop(menuBar); /** * ______________________________________________________________________________________________ * START OF GRIDPANE !!! ENTRYAREA !!! */ // Serverentry Area GridPane entryArea = new GridPane(); entryArea.setAlignment(Pos.CENTER); root.setCenter(entryArea); Label lblIP = new Label(); lblIP.setText("IP: "); ; lblIP.setAlignment(Pos.CENTER_LEFT); entryArea.add(lblIP, 0, 0); GridPane.setMargin(lblIP, new Insets(5, 5, 0, 50)); Label lblPort = new Label(); lblPort.setText("Port: "); lblPort.setAlignment(Pos.CENTER_LEFT); entryArea.add(lblPort, 0, 1); GridPane.setMargin(lblPort, new Insets(5, 5, 0, 50)); lblHostName = new Label(); lblHostName.setAlignment(Pos.CENTER_LEFT); lblHostName.setId("lblHostName"); entryArea.add(lblHostName, 0, 2); GridPane.setMargin(lblHostName, new Insets(5, 5, 0, 50)); tfIP = new TextField(); tfIP.setId("tfIP"); tfIP.setEditable(false); entryArea.add(tfIP, 1, 0); GridPane.setMargin(tfIP, new Insets(5, 5, 0, 0)); tfPort = new TextField(); tfPort.setId("tfPort"); tfPort.setText("14000"); tfPort.setPromptText("Bitte Portnummer eingeben."); entryArea.add(tfPort, 1, 1); GridPane.setMargin(tfPort, new Insets(5, 5, 0, 0)); btnStart = new Button(); btnStart.setId("btnStart"); btnStart.setText(t.getString("button.start")); entryArea.add(btnStart, 2, 0); GridPane.setMargin(btnStart, new Insets(5, 5, 0, 50)); btnClose = new Button(); btnClose.setId("btnClose"); btnClose.setText(t.getString("button.close")); entryArea.add(btnClose, 2, 1); GridPane.setMargin(btnClose, new Insets(5, 5, 0, 50)); /** * ______________________________________________________________________________________________ * START OF !!! TEXTAREAHANDLER !!! */ textAreaHandler = new TextAreaHandler(); taLogger = textAreaHandler.getTextArea(); taLogger.setId("taLogger"); taLogger.setEditable(false); root.setBottom(taLogger); Scene scene = new Scene(root); return scene; }