Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tlee753 committed Feb 20, 2019
1 parent e2d258e commit 5be2fc6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
Binary file added release/Chess-2.1-1.8.jar
Binary file not shown.
Binary file modified release/Chess-latest-1.8.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions src/ChessApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public static void main(String[] args) {

@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("ChessViewer-2.0.fxml"));
Parent root = FXMLLoader.load(getClass().getResource("ChessViewer-2.1.fxml"));

stage.setTitle("Chess Viewer 2.0");
stage.setTitle("Chess Viewer 2.1");
stage.setScene(new Scene(root, 1200, 720));
stage.show();
}
Expand Down
18 changes: 16 additions & 2 deletions src/ChessController.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
import javafx.event.ActionEvent;

import java.awt.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -161,10 +164,21 @@ private void initializeImageViews() {
@FXML
private void openFile() throws Exception {
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Open Resource File");
fileChooser.setTitle("Open PGN File");
File file = fileChooser.showOpenDialog(new Stage());
if (file != null) {
notepadTextArea.setText("");
gameTextField.setText(file.toString());
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file))) {
String line = null;
while( (line = bufferedReader.readLine()) != null ) {
notepadTextArea.appendText(line + "\n");
}
} catch (FileNotFoundException e) {
System.out.println("hit");
} catch (IOException e) {
System.out.println("hit");
}
importGame();
}
}
Expand All @@ -182,7 +196,7 @@ private void importGame() throws Exception {
PGNReader pgnReader = new PGNReader(gameFileName);
gameImportText.setText("File " + gameFileName + " has been imported.");
theGame = pgnReader.parseGame();
notepadTextArea.setText(theGame.toString());
// notepadTextArea.setText(theGame.toString());
theGame.gotoStart();
positionTextField.setText(theGame.getPosition().getFEN());
heatMap();
Expand Down
6 changes: 3 additions & 3 deletions src/ChessViewer-2.0.fxml → src/ChessViewer-2.1.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
<Font size="12.0" />
</font>
<VBox.margin>
<Insets left="10.0" top="10.0" />
<Insets left="10.0" right="10.0" top="10.0" />
</VBox.margin>
</TextField>
<HBox>
Expand Down Expand Up @@ -574,7 +574,7 @@
</Text>
</children>
</HBox>
<TextArea fx:id="notepadTextArea" wrapText="true" VBox.vgrow="ALWAYS">
<TextArea fx:id="notepadTextArea" editable="false" wrapText="true" VBox.vgrow="ALWAYS">
<VBox.margin>
<Insets left="10.0" right="10.0" top="10.0" />
</VBox.margin>
Expand Down Expand Up @@ -602,7 +602,7 @@
</Hyperlink>
</children>
</HBox>
<Label text="Chess Viewer v2.0" textAlignment="CENTER">
<Label text="Chess Viewer v2.1" textAlignment="CENTER">
<font>
<Font size="12.0" />
</font>
Expand Down

0 comments on commit 5be2fc6

Please sign in to comment.