-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
70 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
package filereader; | ||
|
||
import javafx.scene.layout.GridPane; | ||
import javafx.scene.layout.BorderPane; | ||
|
||
public class MainPane extends GridPane { | ||
TextFilePane textPane; | ||
public class MainPane extends BorderPane { | ||
private static TextFilePane textPane; | ||
private static MainToolbar mainToolbar; | ||
|
||
MainPane() { | ||
MainToolbar mainToolbar = new MainToolbar(); | ||
mainToolbar = new MainToolbar(); | ||
textPane = new TextFilePane(); | ||
add(mainToolbar, 0, 0); | ||
add(textPane, 0, 1); | ||
} | ||
|
||
/** | ||
* @param textPane the textPane to set | ||
*/ | ||
public void setTextPane(TextFilePane textPane) { | ||
this.textPane = textPane; | ||
setTop(mainToolbar); | ||
setCenter(textPane); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
package filereader; | ||
|
||
import javafx.scene.control.TextArea; | ||
import javafx.scene.layout.BorderPane; | ||
import javafx.scene.text.Text; | ||
|
||
public class TextFilePane extends BorderPane { | ||
private static Text outputArea; | ||
private static TextArea outputArea; | ||
|
||
TextFilePane() { | ||
outputArea = new Text(); | ||
outputArea.setFont(Utils.font); | ||
outputArea = new TextArea(); | ||
|
||
setCenter(outputArea); | ||
} | ||
|
||
/** | ||
* @return the output TextArea | ||
*/ | ||
public static Text getOutputArea() { | ||
public static TextArea getOutputArea() { | ||
return outputArea; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package filereader; | ||
|
||
import java.io.File; | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
import java.util.Scanner; | ||
|
||
import javafx.scene.text.Font; | ||
|
||
public class TextFileUtils { | ||
private static File currentFile; | ||
|
||
private TextFileUtils() {} | ||
|
||
public static String readFile(File file, int length) throws IOException { | ||
char[] contents = new char[length]; | ||
FileReader reader = new FileReader(file); | ||
reader.read(contents); | ||
reader.close(); | ||
return new String(contents); | ||
} | ||
|
||
public static void readFileLines(File file) throws IOException { | ||
TextFilePane.getOutputArea().setText(""); | ||
Scanner reader = new Scanner(file); | ||
while (reader.hasNext()) { | ||
TextFilePane.getOutputArea().setText(TextFilePane.getOutputArea().getText() + reader.nextLine() + "\n"); | ||
} | ||
reader.close(); | ||
} | ||
|
||
public static File getCurrentFile() { | ||
return currentFile; | ||
} | ||
|
||
public static void setCurrentFile(File file) { | ||
currentFile = file; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.