package edu.govschool.govchat.gui;

// We need to import our socket package
import edu.govschool.govchat.socket.*;
// JavaFX imports
import javafx.application.*;
import javafx.geometry.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.*;

/**
 * GUI for the GovChat server.
 * Most of the actual work is handled with <code>GCServerSocket</code>, this
 * provides us with a GUI to work with this socket and the entire server in
 * general.
 * @author Mr. Davis
 */
public class GCServer extends Application
{
    // Our GUI initially is very spartan, consisting of a large text area to
    // display messages sent and received, a entry field to enter messages, a
    // connect button and a send button. At first, we just connect using the
    // default host and port, localhost and 2000, so we don't need any elements
    // to input a custom host and port yet.
    private TextArea msgArea;
    private TextField entryField;
    private Button sendBtn;
    private Button connectBtn;
    
    // Since this is the server GUI, we need a server socket!
    private GCServerSocket serverSocket;
    
    // Some flags to represent several states our application can be in
    private boolean socketClosed = true;
    private boolean tryingToConnect = false;
    
    public static void main(String[] args)
    {
        launch(args);
    }
    
    @Override
    public void start(Stage primaryStage)
    {
        
    }
}
@@ -1449,32 +1449,1537 @@
 aryStage)%0A    %7B%0A
+        // Initialize the GUI elements%0A        msgArea = new TextArea();%0A        entryField = new TextField();%0A        sendBtn = new Button(%22Send%22);%0A        connectBtn = new Button(%22Connect to localhost%22);%0A        %0A        // Set some options for our GUI elements%0A        msgArea.setEditable(false); // Our messages should be read-only%0A        msgArea.setPrefColumnCount(20);%0A        msgArea.setPrefRowCount(20); // 20rows x 20characters big%0A        msgArea.setWrapText(true); // Our text will wrap if it's too big%0A        entryField.setPrefColumnCount(20); // Entry field is 20 characters wide%0A        entryField.setPromptText(%22Enter a message%22);%0A        %0A        // Set our event handlers%0A        sendBtn.setOnAction(e -%3E sendBtn_click());%0A        connectBtn.setOnAction(e -%3E connectBtn_click());%0A        %0A        // Organize our GUI%0A        HBox entryPane = new HBox(10, entryField, sendBtn);%0A        VBox pane = new VBox(10, msgArea, entryPane, connectBtn);%0A        pane.setAlignment(Pos.CENTER);%0A        %0A        // Display our GUI%0A        Scene scene = new Scene(pane);%0A        primaryStage.setScene(scene);%0A        %0A        // Set our window options%0A        primaryStage.setTitle(%22GovChat Server%22);%0A        primaryStage.setOnCloseRequest(e -%3E %7B%0A            tryingToConnect = false;%0A            if (serverSocket != null) serverSocket.shutdown();%0A        %7D);%0A        primaryStage.show();%0A    %7D%0A    %0A    private void sendBtn_click()%0A    %7B%0A        %0A    %7D%0A    %0A    private void connectBtn_click()%0A    %7B%0A
         %0A    %7D%0A%7D

Implement GCServer GUI. For now, the buttons perform no actions and no sockets are connected