All ui methods implemented.
parent
8a9fe270b1
commit
e3606f068b
|
@ -11,16 +11,28 @@ import java.util.Scanner;
|
||||||
public class Axel {
|
public class Axel {
|
||||||
|
|
||||||
public static void main(String[] args) throws FileNotFoundException {
|
public static void main(String[] args) throws FileNotFoundException {
|
||||||
Spreadsheet spr = new Spreadsheet(10, 10);
|
|
||||||
Scanner sc = new Scanner(System.in);
|
Scanner sc = new Scanner(System.in);
|
||||||
|
System.out.println("\nAxel(ExcelFakeVon2211482): ");
|
||||||
|
System.out.print("\nTabellengröße(ReihenZwischen1-99 SpaltenZwischen1-26): ");
|
||||||
|
Spreadsheet spr = new Spreadsheet(sc.nextInt(), sc.nextInt());
|
||||||
|
String help = "n";
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
System.out.println(spr.toStringShowFormula());
|
|
||||||
System.out.println(spr);
|
System.out.println(spr);
|
||||||
|
System.out.println("\nHILFE (Für eine Anleitung.)\n");
|
||||||
|
System.out.print("KOMMANDO: ");
|
||||||
|
spr.cellInput();
|
||||||
|
|
||||||
|
|
||||||
// TODO: You might want to put "UI loop" for entering value and formulas here resp. in some UI methods.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void help(){
|
||||||
|
System.out.println("\nEinlesen: \nKOMMANDO Dateipfad Trennzeichen StartzelleObenLinks (Alles mit Leerzeichen getrennt.) e.g.:\nEINLESEN Axel/resources/zahlen.csv , A1");
|
||||||
|
System.out.println("\nSpeichern: \nKOMMANDO Dateipfad (Mit Leerzeichen getrennt.) e.g.:\nSPEICHERN Axel/resources/zahlen.csv");
|
||||||
|
System.out.println("\nFormel Tabellenansicht: \nKOMMANDO e.g.:\nFORMELN");
|
||||||
|
System.out.println("\nZellen Werte/Formeln zuweisen: \nZELLE ZUWEISUNG (Mit Leerzeichen getrennt, Zelle beginnend mit Buchstabe und Zuweisung beginnend mit =.) e.g.:\nA1 =A5+15\n" +
|
||||||
|
"\nZELLE FORMELZUWEISUNG (Formelzuweisung mit Startzelle bis Endzelle getrennt durch :.) e.g.:" +
|
||||||
|
"\nA2 =SUMME(A1:H10)\t\tA3 =PRODUKT(A1:H10)\t\tA4 =MITTELWERT(A1:H10)\t\tA5 =STABW(A1:H10) (Standartabweichung)\t\tA6 =MIN(A1:H10)\t\tA7 =MAX(A1:H10)");
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -448,18 +448,22 @@ public class Spreadsheet {
|
||||||
|
|
||||||
String input = cs.nextLine();
|
String input = cs.nextLine();
|
||||||
ArrayList<String> inputs = new ArrayList<>();
|
ArrayList<String> inputs = new ArrayList<>();
|
||||||
inputs.add(input.split(" ")[0]);
|
for(int i =0; i<input.split(" ").length; i++)
|
||||||
inputs.add(input.split(" ")[1]);
|
inputs.add(input.split(" ")[i]);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (inputs.contains("EINLESEN"))
|
if(inputs.contains("HILFE"))
|
||||||
readCsv(inputs.get(1).split(" ")[0], inputs.get(1).split(" ")[1].charAt(0), inputs.get(1).split(" ")[2]);
|
Axel.help();
|
||||||
|
else if (inputs.contains("EINLESEN"))
|
||||||
|
readCsv(inputs.get(1), inputs.get(2).charAt(0), inputs.get(3));
|
||||||
else if (inputs.contains("SPEICHERN"))
|
else if (inputs.contains("SPEICHERN"))
|
||||||
saveCsv(inputs.get(1));
|
saveCsv(inputs.get(1));
|
||||||
else if (inputs.contains("FORMELN"))
|
else if (inputs.contains("FORMELN")) {
|
||||||
System.out.println(toStringShowFormula());
|
System.out.println(toStringShowFormula());
|
||||||
else
|
System.out.println("\nEnter zum fortfahren.");
|
||||||
cells[getRow(inputs.get(0)) - 1][getCol(inputs.get(1)) - 1].setFormula(cs.next());
|
cs.nextLine();
|
||||||
|
}else
|
||||||
|
cells[getRow(inputs.get(0)) - 1][getCol(inputs.get(0)) - 1].setFormula(inputs.get(1));
|
||||||
|
|
||||||
updateSpreadsheet();
|
updateSpreadsheet();
|
||||||
} catch(ArrayIndexOutOfBoundsException a){
|
} catch(ArrayIndexOutOfBoundsException a){
|
||||||
|
@ -472,6 +476,7 @@ public class Spreadsheet {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.append(System.lineSeparator());
|
||||||
sb.append(System.lineSeparator());
|
sb.append(System.lineSeparator());
|
||||||
sb.append(" |");
|
sb.append(" |");
|
||||||
for (int i = 0; i < cells[0].length; i++) {
|
for (int i = 0; i < cells[0].length; i++) {
|
||||||
|
@ -508,6 +513,7 @@ public class Spreadsheet {
|
||||||
public String toStringShowFormula() {
|
public String toStringShowFormula() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
sb.append(System.lineSeparator());
|
||||||
sb.append(System.lineSeparator());
|
sb.append(System.lineSeparator());
|
||||||
sb.append(" |");
|
sb.append(" |");
|
||||||
for (int i = 0; i < cells[0].length; i++) {
|
for (int i = 0; i < cells[0].length; i++) {
|
||||||
|
|
Loading…
Reference in New Issue