Textfelder mit Schleife deklarieren?

Status
Nicht offen für weitere Antworten.

manuche

Bekanntes Mitglied
Hallo!
Ich habe in meinem Programm 81 Textfelder deklariert... wie ihr euch vllt denken könnt sieht das unschön aus und ist viel schreib arbeit!
Gibt es eine Möglichkeit die TextFelder per Schleife zu deklariern?

ich dachte da an sowas:
Code:
for(x = 1; x <= 81; x++){
  private TextField (textField + x) = new TextField();
}

...was allerdings nicht funktionert -.-
 

thomator

Bekanntes Mitglied
nee, so kann das wirklich nicht gehen...
Was soll denn mit den Textfeldern gemacht werden? Die Informationen, die Du hier zur Verfügung stellst, sind bissi mau. Grundsätzlich geht das schon, allerdings kannst Du nicht den Namen von Feldern/Variablen einfach über irgendeinen String zusammenbasteln.
Aber die Informationen über das, was Du mit den Textfeldern anstellen willst, reichen hier nicht aus, um Dir wirklich was fundiertes zu sagen.

EDIT: @growler: na ganz so rigeros würd ich das nicht sagen. Beispiel: in der Schleife die Felder initialisieren und mit dem String als Referenz in einen Hashtable schießen...
 

Kim Stebel

Bekanntes Mitglied
:noe: growler, was erzählst du denn da? Noch nie was von Arrays gehört?

@thomator: also für mich war es genau genug, um mal folgendes vorzuschlagen.

Code:
TextField[] textFields = new TextField[81];
for(int i = 0; i <81;i++)
{
    textFields[i] = new TextField();
}
 

manuche

Bekanntes Mitglied
was braucht ihr denn für infos?
also die textfelder werden im mom in der klasse deklariert so wie klassenvariablen und in einer methode werden sie dann initialisiert...:

Code:
public class Sudokusolver extends Frame {
  privat TextField textField1 = new TextField();
  ...
  privat TextField textField81 = new TextField();
  ...
  
  public methode(String title) {
    ...
    textField1.setBounds(10, 10, 25, 25);
    textField1.setText("");
    cp.add(textField1);
    ... //es folgen Methoden in denen auf die Textfelder zurück gegriffen wird (setText, getText, setColor...)
  }
}
 

thomator

Bekanntes Mitglied
@Kim: na Beispielsweise, ob auf die Felder noch zugegriffen werden muss. Wenn ein Listener alles übernimmt, was das Textfeld machen soll, wird evtl. gar keine Referenz auf das Textfeld mehr benötigt. Dann kann man sich die referenzierende Collection sparen. Und ein reiner Array reicht evtl nicht, wenn namensindiziert zugegriffen werden soll. Wäre ja möglich, wegen Validierungs-Mechanismen oder so...
Klar reicht das gesagte, um einen Vorschlag wie Deinen zu unterbreiten, aber ob damit ansatzweise die Anforderungen abdeckbar sind, das steht in den Sternen, gell? :lol:
 

Leroy42

Top Contributor
LOL! Edit: @ Kim Steber
Keine schlechte Idee, aber geht leider nicht:

In deiner erweiterten foreach-Schleife, bekommt die
Variable tf lediglich eine Kopie der Referenz
auf die Array-Elemente zugewiesen. Aus diesem Grund
änderst du durch die Zuweisung ausschließlich die
lokale Kopie und nicht die echten Array-Elemente.
:cool:
 

Kim Stebel

Bekanntes Mitglied
@ manuche: du verstehst es falsch, es geht, und zwar so oder so ähnlich, wie ich es geschrieben habe(nach dem edit)
kommt eben, wie thomator bereits erwähnte, auf die genauen Anforderungen an, aber im Prinzip geht es.
 

manuche

Bekanntes Mitglied
@kim: also wie es bereits gepostet hat gehts iwie nicht... der compiler sagt mir illegal start of expression bei for und noch nen paar andere fehler!
 

Leroy42

Top Contributor
Kim Stebel hat gesagt.:
@ leroy: bereits korrigiert
Und das klammheimlich! Schäm dich! ( :cool: )

Und mit genaue Anforderungen ist gemeint,
ob die Textfelder semantisch zusammengehören.

Beispiel:

TextFields für Name, Vorname, Geschlecht, Anzahl der Freundinnen, Alk-Verbrauch pro Woche,
letztes Urlaubsland, ...

die somit keine Gemeinsamkeiten aufweisen,
in einem Array (Map,...) zusammenzufassen
macht wenig Sinn.

Anders rum:

Willst du ein Schachbrett aus 8*8 JButtons basteln,
dann schreit das förmlich nach einem Array.
 

Kim Stebel

Bekanntes Mitglied
@ manuche: nimm die version NACH dem edit, also
Code:
TextField[] textFields = new TextField[81]; 
for(int i = 0; i <81;i++) 
{ 
    textFields[i] = new TextField(); 
}
 

Leroy42

Top Contributor
Aber dann: Sicher macht es da Sinn.

Aber Kim Stebels (geändertes) Teilprogramm sollte,
so wie es jetzt dasteht, funktionieren. Poste doch mal
deinen Code und die Fehlermeldung(en)
 

manuche

Bekanntes Mitglied
ich hab die version vor dem edit ja nichmal mitbekommen xD
also ich hab die nach dem edit benutzt aber es funzt nich... kann es damit zusammenhängen dass das privat fehlt?
also oben hab ich ja schematisch den aufbau des programm gepostet!
 

Kim Stebel

Bekanntes Mitglied
@manuche: code posten! hört sich so an als hättest du den code direkt in die klasse kopiert, statt in eine methode. evtl musst du halt die erste zeile(evtl mit private davor) in die klasse schreiben und den rest in eine methode, zum beispiel in einen konstruktor
 

manuche

Bekanntes Mitglied
Na ich probiere den Vorschlag von Kim:
Code:
TextField[] textFields = new TextField[81];
for(int i = 0; i < 81; i++){
  textFields[i] = new TextField();
}

aber als fehlermeldung kommt:
illegal start of typ bei for -> for(int i = 0; i < 81; i++){
identifier expected nachm zweiten i -> for (int i = 0; i <= 81; i++){
identifier expected bei i++ -> for (int i = 0; i <= 81; i++){
 

growler

Mitglied
klar kenn ich arrays aber die sind statisch, dann nimm lieber gleich einen Vector sonst hast du nachher probleme wenn du ein neues Element hinzufügen willst.

mfg growler
 

manuche

Bekanntes Mitglied
Code:
import java.awt.*;
import java.awt.event.*;
import java.lang.String;

public class Sudokusolver extends Frame {
  // Anfang Variablen
  /*private TextField textField1 = new TextField();
  private TextField textField2 = new TextField();
  private TextField textField3 = new TextField();
  private TextField textField4 = new TextField();
  private TextField textField5 = new TextField();
  private TextField textField6 = new TextField();
  private TextField textField7 = new TextField();
  private TextField textField8 = new TextField();
  private TextField textField9 = new TextField();
  private TextField textField10 = new TextField();
  private TextField textField11 = new TextField();
  private TextField textField12 = new TextField();
  private TextField textField13 = new TextField();
  private TextField textField14 = new TextField();
  private TextField textField15 = new TextField();
  private TextField textField16 = new TextField();
  private TextField textField17 = new TextField();
  private TextField textField18 = new TextField();
  private TextField textField19 = new TextField();
  private TextField textField20 = new TextField();
  private TextField textField21 = new TextField();
  private TextField textField22 = new TextField();
  private TextField textField23 = new TextField();
  private TextField textField24 = new TextField();
  private TextField textField25 = new TextField();
  private TextField textField26 = new TextField();
  private TextField textField27 = new TextField();
  private TextField textField28 = new TextField();
  private TextField textField29 = new TextField();
  private TextField textField30 = new TextField();
  private TextField textField31 = new TextField();
  private TextField textField32 = new TextField();
  private TextField textField33 = new TextField();
  private TextField textField34 = new TextField();
  private TextField textField35 = new TextField();
  private TextField textField36 = new TextField(); 
  private TextField textField37 = new TextField();
  private TextField textField38 = new TextField();
  private TextField textField39 = new TextField();
  private TextField textField40 = new TextField();
  private TextField textField41 = new TextField();
  private TextField textField42 = new TextField();
  private TextField textField43 = new TextField();
  private TextField textField44 = new TextField();
  private TextField textField45 = new TextField();
  private TextField textField46 = new TextField();
  private TextField textField47 = new TextField();
  private TextField textField48 = new TextField();
  private TextField textField49 = new TextField();
  private TextField textField50 = new TextField();
  private TextField textField51 = new TextField();
  private TextField textField52 = new TextField();
  private TextField textField53 = new TextField();
  private TextField textField54 = new TextField();
  private TextField textField55 = new TextField();
  private TextField textField56 = new TextField();
  private TextField textField57 = new TextField();
  private TextField textField58 = new TextField();
  private TextField textField59 = new TextField();
  private TextField textField60 = new TextField();
  private TextField textField61 = new TextField();
  private TextField textField62 = new TextField();
  private TextField textField63 = new TextField();
  private TextField textField64 = new TextField();
  private TextField textField65 = new TextField();
  private TextField textField66 = new TextField();
  private TextField textField67 = new TextField();
  private TextField textField68 = new TextField();
  private TextField textField69 = new TextField();
  private TextField textField70 = new TextField();
  private TextField textField71 = new TextField();
  private TextField textField72 = new TextField();
  private TextField textField73 = new TextField();
  private TextField textField74 = new TextField();
  private TextField textField75 = new TextField();
  private TextField textField76 = new TextField();
  private TextField textField77 = new TextField();
  private TextField textField78 = new TextField();
  private TextField textField79 = new TextField();
  private TextField textField80 = new TextField();
  private TextField textField81 = new TextField(); */  versuch ich durch folgendes zu ersetzen:
  
  TextField[] textFields = new TextField[81];
  for (int i = 0; i <= 81; i++){
    textFields[i] = new TextField();
  }
  
  private Button button1 = new Button();
  private Button button2 = new Button();
  private Button button3 = new Button();
  
  private TextField [][] matrix = {{textField1, textField2, textField3, textField4, textField5, textField6, textField7, textField8, textField9},
                                   {textField10, textField11, textField12, textField13, textField14, textField15, textField16, textField17, textField18},
                                   {textField19, textField20, textField21, textField22, textField23, textField24, textField25, textField26, textField27},
                                   {textField28, textField29, textField30, textField31, textField32, textField33, textField34, textField35, textField36},
                                   {textField37, textField38, textField39, textField40, textField41, textField42, textField43, textField44, textField45},
                                   {textField46, textField47, textField48, textField49, textField50, textField51, textField52, textField53, textField54},
                                   {textField55, textField56, textField57, textField58, textField59, textField60, textField61, textField62, textField63},
                                   {textField64, textField65, textField66, textField67, textField68, textField69, textField70, textField71, textField72},
                                   {textField73, textField74, textField75, textField76, textField77, textField78, textField79, textField80, textField81},
                                  };
  private String[][] vTab = new String[9][9];
  private boolean aenderung;
  private boolean aenderung2;
  
  // Ende Variablen

  public Sudokusolver(String title) {
    // Frame-Initialisierung
    super(title);
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent evt) { System.exit(0); }
    });
    int frameWidth = 400;
    int frameHeight = 320;
    setSize(frameWidth, frameHeight);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (d.width - getSize().width) / 2;
    int y = (d.height - getSize().height) / 2 ;
    setLocation(x, y);
    Panel cp = new Panel(null);
    add(cp);
    // Anfang Komponenten

    textField1.setBounds(10, 10, 25, 25);
    textField1.setText("");
    cp.add(textField1);
    textField2.setBounds(40, 10, 25, 25);
    textField2.setText("");
    cp.add(textField2);
    textField3.setBounds(70, 10, 25, 25);
    textField3.setText("");
    cp.add(textField3);
    textField4.setBounds(100, 10, 25, 25);
    textField4.setText("");
    cp.add(textField4);
    textField5.setBounds(130, 10, 25, 25);
    textField5.setText("");
    cp.add(textField5);
    textField6.setBounds(160, 10, 25, 25);
    textField6.setText("");
    cp.add(textField6);
    textField7.setBounds(190, 10, 25, 25);
    textField7.setText("");
    cp.add(textField7);
    textField8.setBounds(220, 10, 25, 25);
    textField8.setText("");
    cp.add(textField8);
    textField9.setBounds(250, 10, 25, 25);
    textField9.setText("");
    cp.add(textField9);
    textField10.setBounds(10, 40, 25, 25);
    textField10.setText("");
    cp.add(textField10);
    textField11.setBounds(40, 40, 25, 25);
    textField11.setText("");
    cp.add(textField11);
    textField12.setBounds(70, 40, 25, 25);
    textField12.setText("");
    cp.add(textField12);
    textField13.setBounds(100, 40, 25, 25);
    textField13.setText("");
    cp.add(textField13);
    textField14.setBounds(130, 40, 25, 25);
    textField14.setText("");
    cp.add(textField14);
    textField15.setBounds(160, 40, 25, 25);
    textField15.setText("");
    cp.add(textField15);
    textField16.setBounds(190, 40, 25, 25);
    textField16.setText("");
    cp.add(textField16);
    textField17.setBounds(220, 40, 25, 25);
    textField17.setText("");
    cp.add(textField17);
    textField18.setBounds(250, 40, 25, 25);
    textField18.setText("");
    cp.add(textField18);
    textField19.setBounds(10, 70, 25, 25);
    textField19.setText("");
    cp.add(textField19);
    textField20.setBounds(40, 70, 25, 25);
    textField20.setText("");
    cp.add(textField20);
    textField21.setBounds(70, 70, 25, 25);
    textField21.setText("");
    cp.add(textField21);
    textField22.setBounds(100, 70, 25, 25);
    textField22.setText("");
    cp.add(textField22);
    textField23.setBounds(130, 70, 25, 25);
    textField23.setText("");
    cp.add(textField23);
    textField24.setBounds(160, 70, 25, 25);
    textField24.setText("");
    cp.add(textField24);
    textField25.setBounds(190, 70, 25, 25);
    textField25.setText("");
    cp.add(textField25);
    textField26.setBounds(220, 70, 25, 25);
    textField26.setText("");
    cp.add(textField26);
    textField27.setBounds(250, 70, 25, 25);
    textField27.setText("");
    cp.add(textField27);
    textField28.setBounds(10, 100, 25, 25);
    textField28.setText("");
    cp.add(textField28);
    textField29.setBounds(40, 100, 25, 25);
    textField29.setText("");
    cp.add(textField29);
    textField30.setBounds(70, 100, 25, 25);
    textField30.setText("");
    cp.add(textField30);
    textField31.setBounds(100, 100, 25, 25);
    textField31.setText("");
    cp.add(textField31);
    textField32.setBounds(130, 100, 25, 25);
    textField32.setText("");
    cp.add(textField32);
    textField33.setBounds(160, 100, 25, 25);
    textField33.setText("");
    cp.add(textField33);
    textField34.setBounds(190, 100, 25, 25);
    textField34.setText("");
    cp.add(textField34);
    textField35.setBounds(220, 100, 25, 25);
    textField35.setText("");
    cp.add(textField35);
    textField36.setBounds(250, 100, 25, 25);
    textField36.setText("");
    cp.add(textField36);    
    textField37.setBounds(10, 130, 25, 25);
    textField37.setText("");
    cp.add(textField37);
    textField38.setBounds(40, 130, 25, 25);
    textField38.setText("");
    cp.add(textField38);
    textField39.setBounds(70, 130, 25, 25);
    textField39.setText("");
    cp.add(textField39);
    textField40.setBounds(100, 130, 25, 25);
    textField40.setText("");
    cp.add(textField40);
    textField41.setBounds(130, 130, 25, 25);
    textField41.setText("");
    cp.add(textField41);
    textField42.setBounds(160, 130, 25, 25);
    textField42.setText("");
    cp.add(textField42);
    textField43.setBounds(190, 130, 25, 25);
    textField43.setText("");
    cp.add(textField43);
    textField44.setBounds(220, 130, 25, 25);
    textField44.setText("");
    cp.add(textField44);
    textField45.setBounds(250, 130, 25, 25);
    textField45.setText("");
    cp.add(textField45);
    textField46.setBounds(10, 160, 25, 25);
    textField46.setText("");
    cp.add(textField46);
    textField47.setBounds(40, 160, 25, 25);
    textField47.setText("");
    cp.add(textField47);
    textField48.setBounds(70, 160, 25, 25);
    textField48.setText("");
    cp.add(textField48);
    textField49.setBounds(100, 160, 25, 25);
    textField49.setText("");
    cp.add(textField49);
    textField50.setBounds(130, 160, 25, 25);
    textField50.setText("");
    cp.add(textField50);
    textField51.setBounds(160, 160, 25, 25);
    textField51.setText("");
    cp.add(textField51);
    textField52.setBounds(190, 160, 25, 25);
    textField52.setText("");
    cp.add(textField52);
    textField53.setBounds(220, 160, 25, 25);
    textField53.setText("");
    cp.add(textField53);
    textField54.setBounds(250, 160, 25, 25);
    textField54.setText("");
    cp.add(textField54);
    textField55.setBounds(10, 190, 25, 25);
    textField55.setText("");
    cp.add(textField55);
    textField56.setBounds(40, 190, 25, 25);
    textField56.setText("");
    cp.add(textField56);
    textField57.setBounds(70, 190, 25, 25);
    textField57.setText("");
    cp.add(textField57);
    textField58.setBounds(100, 190, 25, 25);
    textField58.setText("");
    cp.add(textField58);
    textField59.setBounds(130, 190, 25, 25);
    textField59.setText("");
    cp.add(textField59);
    textField60.setBounds(160, 190, 25, 25);
    textField60.setText("");
    cp.add(textField60);
    textField61.setBounds(190, 190, 25, 25);
    textField61.setText("");
    cp.add(textField61);
    textField62.setBounds(220, 190, 25, 25);
    textField62.setText("");
    cp.add(textField62);
    textField63.setBounds(250, 190, 25, 25);
    textField63.setText("");
    cp.add(textField63);
    textField64.setBounds(10, 220, 25, 25);
    textField64.setText("");
    cp.add(textField64);
    textField65.setBounds(40, 220, 25, 25);
    textField65.setText("");
    cp.add(textField65);
    textField66.setBounds(70, 220, 25, 25);
    textField66.setText("");
    cp.add(textField66);
    textField67.setBounds(100, 220, 25, 25);
    textField67.setText("");
    cp.add(textField67);
    textField68.setBounds(130, 220, 25, 25);
    textField68.setText("");
    cp.add(textField68);
    textField69.setBounds(160, 220, 25, 25);
    textField69.setText("");
    cp.add(textField69);
    textField70.setBounds(190, 220, 25, 25);
    textField70.setText("");
    cp.add(textField70);
    textField71.setBounds(220, 220, 25, 25);
    textField71.setText("");
    cp.add(textField71);
    textField72.setBounds(250, 220, 25, 25);
    textField72.setText("");
    cp.add(textField72);  
    textField73.setBounds(10, 250, 25, 25);
    textField73.setText("");
    cp.add(textField73);
    textField74.setBounds(40, 250, 25, 25);
    textField74.setText("");
    cp.add(textField74);
    textField75.setBounds(70, 250, 25, 25);
    textField75.setText("");
    cp.add(textField75);
    textField76.setBounds(100, 250, 25, 25);
    textField76.setText("");
    cp.add(textField76);
    textField77.setBounds(130, 250, 25, 25);
    textField77.setText("");
    cp.add(textField77);
    textField78.setBounds(160, 250, 25, 25);
    textField78.setText("");
    cp.add(textField78);
    textField79.setBounds(190, 250, 25, 25);
    textField79.setText("");
    cp.add(textField79);
    textField80.setBounds(220, 250, 25, 25);
    textField80.setText("");
    cp.add(textField80);
    textField81.setBounds(250, 250, 25, 25);
    textField81.setText("");
    cp.add(textField81);
    
    button1.setBounds(288, 232, 100, 25);
    button1.setLabel("Exit");
    cp.add(button1);
    button1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        button1ActionPerformed(evt);
      }
    });

    button2.setBounds(288, 8, 100, 25);
    button2.setLabel("Löse");
    cp.add(button2);
    button2.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        button2ActionPerformed(evt);
      }
    });

    button3.setBounds(288, 48, 100, 25);
    button3.setLabel("Clear");
    cp.add(button3);
    button3.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        button3ActionPerformed(evt);
      }
    });

    // Ende Komponenten

    setResizable(false);
    setVisible(true);
  }

  // Anfang Ereignisprozeduren
  public void button1ActionPerformed(ActionEvent evt) {
    System.exit(1);
  }

  public void button2ActionPerformed(ActionEvent evt) {
    fuellen ();
    ausschlussEZ();
    fillMatrix();

  }
  
  public void fuellen(){
    String text = new String();
    //Füllen leerer Zellen:
    for (int a = 0; a <= 8; a++){
      for (int b = 0; b <= 8; b++){
        text = matrix[a][b].getText();
        if (text.equals("")){
          matrix[a][b].setText("X");
          matrix[a][b].setBackground(Color.yellow);
          vTab[a][b] = "123456789";
        }else{
          vTab[a][b] = text;
          matrix[a][b].setBackground(Color.green);
        }
        matrix[a][b].setEditable(false);
      }
    }
  }
  
  public boolean ausschlussEZ(){
    String text = new String();
    String aktzahl = new String();
    String kontrolle = new String();
    
    do{
      aenderung = false;  
      //Ausschluss eindeutiger Zahlen:
      for (int x = 0; x <= 8; x++){
        for (int y = 0; y <=8; y++){
          aktzahl = vTab[x][y];
          int zahl = Integer.valueOf(aktzahl).intValue(); 
          if (zahl <= 9){

            //Ausschluss Spalte:
            for (int z = 0; z <= 8; z++){
              text = vTab[z][y];
              if (!text.equals(aktzahl)){
                kontrolle = text;
                text = text.replace(aktzahl, "");
                vTab[z][y] = text;
                if (!kontrolle.equals(text)){
                  aenderung = true;
                }
              }
            }
            
            //Ausschluss Zeile:
            for (int z = 0; z <= 8; z++){
              text = vTab[x][z];
              if (!text.equals(aktzahl)){
                kontrolle = text;
                text = text.replace(aktzahl, "");
                vTab[x][z] = text;
                if (!kontrolle.equals(text)){
                  aenderung = true;
                }
              }
            
            }
          }
        }
      }
      text = "";
    }while(aenderung);
    return aenderung;
  }
  
  public void fillMatrix(){
    String text = new String();
    for (int x = 0; x <= 8; x++){
      for (int y = 0; y <= 8; y++){
        text = vTab[x][y];
        int zahl = Integer.valueOf(text).intValue(); 
        if (zahl <= 9){
          matrix[x][y].setText(text);
        }else{
          matrix[x][y].setBackground(Color.red);
        }
      }
    }
  }
  public void button3ActionPerformed(ActionEvent evt) {

    for (int a = 0; a <= 8; a++){
      for (int b = 0; b <= 8; b++){
        matrix[a][b].setText("");
        matrix[a][b].setEditable(true);
        matrix[a][b].setBackground(Color.white);
      }
    }
  }
  // Ende Ereignisprozeduren

  public static void main(String[] args) {
    new Sudokusolver("Sudokusolver");
  }
}
 

Leroy42

Top Contributor
Ach, du ahnst es nicht! :shock: :noe:

Nimm deine gesamten Textfields erst mal raus (brauchst du
eh nicht mehr) und poste Code mit nur dem Textfield-Array.

Warum packst du die Textfelder nicht einfach in ein GridLayout?

P.S.
Code:
    textField70.setBounds(190, 220, 25, 25); 
    textField70.setText(""); 
    cp.add(textField70); 
    textField71.setBounds(220, 220, 25, 25); 
    textField71.setText("");
Wie hast du eigentlich die Koordinaten herausbekommen?
Händisch für 81 TextFields? ???:L
 

manuche

Bekanntes Mitglied
Sage nichts... war eine Sau arbeit ;)
Ich weiss das es umständlich ist aber ich hatte keine Idee wie ichs sonst machen soll! Deswegen wende ich mich ja an euch...
GridLayout... wie denn? :D

Code:
import java.awt.*; 
import java.awt.event.*; 
import java.lang.String; 

public class Sudokusolver extends Frame { 
  // Anfang Variablen 
  
  TextField[] textFields = new TextField[81]; 
  for (int i = 0; i < 81; i++){ 
    textFields[i] = new TextField(); 
  } 
  
  private Button button1 = new Button(); 
  private Button button2 = new Button(); 
  private Button button3 = new Button(); 
  
  private TextField [][] matrix = {{textField1, textField2, textField3, textField4, textField5, textField6, textField7, textField8, textField9}, 
                                   {textField10, textField11, textField12, textField13, textField14, textField15, textField16, textField17, textField18}, 
                                   {textField19, textField20, textField21, textField22, textField23, textField24, textField25, textField26, textField27}, 
                                   {textField28, textField29, textField30, textField31, textField32, textField33, textField34, textField35, textField36}, 
                                   {textField37, textField38, textField39, textField40, textField41, textField42, textField43, textField44, textField45}, 
                                   {textField46, textField47, textField48, textField49, textField50, textField51, textField52, textField53, textField54}, 
                                   {textField55, textField56, textField57, textField58, textField59, textField60, textField61, textField62, textField63}, 
                                   {textField64, textField65, textField66, textField67, textField68, textField69, textField70, textField71, textField72}, 
                                   {textField73, textField74, textField75, textField76, textField77, textField78, textField79, textField80, textField81}, 
                                  }; 
  private String[][] vTab = new String[9][9]; 
  private boolean aenderung; 
  private boolean aenderung2; 
  
  // Ende Variablen 

  public Sudokusolver(String title) { 
    // Frame-Initialisierung 
    super(title); 
    addWindowListener(new WindowAdapter() { 
      public void windowClosing(WindowEvent evt) { System.exit(0); } 
    }); 
    int frameWidth = 400; 
    int frameHeight = 320; 
    setSize(frameWidth, frameHeight); 
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); 
    int x = (d.width - getSize().width) / 2; 
    int y = (d.height - getSize().height) / 2 ; 
    setLocation(x, y); 
    Panel cp = new Panel(null); 
    add(cp); 
    // Anfang Komponenten 

    textField1.setBounds(10, 10, 25, 25); 
    textField1.setText(""); 
    cp.add(textField1); 
    textField2.setBounds(40, 10, 25, 25); 
    textField2.setText(""); 
    cp.add(textField2); 
    textField3.setBounds(70, 10, 25, 25); 
    textField3.setText(""); 
    cp.add(textField3); 
    textField4.setBounds(100, 10, 25, 25); 
    textField4.setText(""); 
    cp.add(textField4); 
    textField5.setBounds(130, 10, 25, 25); 
    textField5.setText(""); 
    cp.add(textField5); 
    textField6.setBounds(160, 10, 25, 25); 
    textField6.setText(""); 
    cp.add(textField6); 
    textField7.setBounds(190, 10, 25, 25); 
    textField7.setText(""); 
    cp.add(textField7); 
    textField8.setBounds(220, 10, 25, 25); 
    textField8.setText(""); 
    cp.add(textField8); 
    textField9.setBounds(250, 10, 25, 25); 
    textField9.setText(""); 
    cp.add(textField9); 
    textField10.setBounds(10, 40, 25, 25); 
    textField10.setText(""); 
    cp.add(textField10); 
    textField11.setBounds(40, 40, 25, 25); 
    textField11.setText(""); 
    cp.add(textField11); 
    textField12.setBounds(70, 40, 25, 25); 
    textField12.setText(""); 
    cp.add(textField12); 
    textField13.setBounds(100, 40, 25, 25); 
    textField13.setText(""); 
    cp.add(textField13); 
    textField14.setBounds(130, 40, 25, 25); 
    textField14.setText(""); 
    cp.add(textField14); 
    textField15.setBounds(160, 40, 25, 25); 
    textField15.setText(""); 
    cp.add(textField15); 
    textField16.setBounds(190, 40, 25, 25); 
    textField16.setText(""); 
    cp.add(textField16); 
    textField17.setBounds(220, 40, 25, 25); 
    textField17.setText(""); 
    cp.add(textField17); 
    textField18.setBounds(250, 40, 25, 25); 
    textField18.setText(""); 
    cp.add(textField18); 
    textField19.setBounds(10, 70, 25, 25); 
    textField19.setText(""); 
    cp.add(textField19); 
    textField20.setBounds(40, 70, 25, 25); 
    textField20.setText(""); 
    cp.add(textField20); 
    textField21.setBounds(70, 70, 25, 25); 
    textField21.setText(""); 
    cp.add(textField21); 
    textField22.setBounds(100, 70, 25, 25); 
    textField22.setText(""); 
    cp.add(textField22); 
    textField23.setBounds(130, 70, 25, 25); 
    textField23.setText(""); 
    cp.add(textField23); 
    textField24.setBounds(160, 70, 25, 25); 
    textField24.setText(""); 
    cp.add(textField24); 
    textField25.setBounds(190, 70, 25, 25); 
    textField25.setText(""); 
    cp.add(textField25); 
    textField26.setBounds(220, 70, 25, 25); 
    textField26.setText(""); 
    cp.add(textField26); 
    textField27.setBounds(250, 70, 25, 25); 
    textField27.setText(""); 
    cp.add(textField27); 
    textField28.setBounds(10, 100, 25, 25); 
    textField28.setText(""); 
    cp.add(textField28); 
    textField29.setBounds(40, 100, 25, 25); 
    textField29.setText(""); 
    cp.add(textField29); 
    textField30.setBounds(70, 100, 25, 25); 
    textField30.setText(""); 
    cp.add(textField30); 
    textField31.setBounds(100, 100, 25, 25); 
    textField31.setText(""); 
    cp.add(textField31); 
    textField32.setBounds(130, 100, 25, 25); 
    textField32.setText(""); 
    cp.add(textField32); 
    textField33.setBounds(160, 100, 25, 25); 
    textField33.setText(""); 
    cp.add(textField33); 
    textField34.setBounds(190, 100, 25, 25); 
    textField34.setText(""); 
    cp.add(textField34); 
    textField35.setBounds(220, 100, 25, 25); 
    textField35.setText(""); 
    cp.add(textField35); 
    textField36.setBounds(250, 100, 25, 25); 
    textField36.setText(""); 
    cp.add(textField36);    
    textField37.setBounds(10, 130, 25, 25); 
    textField37.setText(""); 
    cp.add(textField37); 
    textField38.setBounds(40, 130, 25, 25); 
    textField38.setText(""); 
    cp.add(textField38); 
    textField39.setBounds(70, 130, 25, 25); 
    textField39.setText(""); 
    cp.add(textField39); 
    textField40.setBounds(100, 130, 25, 25); 
    textField40.setText(""); 
    cp.add(textField40); 
    textField41.setBounds(130, 130, 25, 25); 
    textField41.setText(""); 
    cp.add(textField41); 
    textField42.setBounds(160, 130, 25, 25); 
    textField42.setText(""); 
    cp.add(textField42); 
    textField43.setBounds(190, 130, 25, 25); 
    textField43.setText(""); 
    cp.add(textField43); 
    textField44.setBounds(220, 130, 25, 25); 
    textField44.setText(""); 
    cp.add(textField44); 
    textField45.setBounds(250, 130, 25, 25); 
    textField45.setText(""); 
    cp.add(textField45); 
    textField46.setBounds(10, 160, 25, 25); 
    textField46.setText(""); 
    cp.add(textField46); 
    textField47.setBounds(40, 160, 25, 25); 
    textField47.setText(""); 
    cp.add(textField47); 
    textField48.setBounds(70, 160, 25, 25); 
    textField48.setText(""); 
    cp.add(textField48); 
    textField49.setBounds(100, 160, 25, 25); 
    textField49.setText(""); 
    cp.add(textField49); 
    textField50.setBounds(130, 160, 25, 25); 
    textField50.setText(""); 
    cp.add(textField50); 
    textField51.setBounds(160, 160, 25, 25); 
    textField51.setText(""); 
    cp.add(textField51); 
    textField52.setBounds(190, 160, 25, 25); 
    textField52.setText(""); 
    cp.add(textField52); 
    textField53.setBounds(220, 160, 25, 25); 
    textField53.setText(""); 
    cp.add(textField53); 
    textField54.setBounds(250, 160, 25, 25); 
    textField54.setText(""); 
    cp.add(textField54); 
    textField55.setBounds(10, 190, 25, 25); 
    textField55.setText(""); 
    cp.add(textField55); 
    textField56.setBounds(40, 190, 25, 25); 
    textField56.setText(""); 
    cp.add(textField56); 
    textField57.setBounds(70, 190, 25, 25); 
    textField57.setText(""); 
    cp.add(textField57); 
    textField58.setBounds(100, 190, 25, 25); 
    textField58.setText(""); 
    cp.add(textField58); 
    textField59.setBounds(130, 190, 25, 25); 
    textField59.setText(""); 
    cp.add(textField59); 
    textField60.setBounds(160, 190, 25, 25); 
    textField60.setText(""); 
    cp.add(textField60); 
    textField61.setBounds(190, 190, 25, 25); 
    textField61.setText(""); 
    cp.add(textField61); 
    textField62.setBounds(220, 190, 25, 25); 
    textField62.setText(""); 
    cp.add(textField62); 
    textField63.setBounds(250, 190, 25, 25); 
    textField63.setText(""); 
    cp.add(textField63); 
    textField64.setBounds(10, 220, 25, 25); 
    textField64.setText(""); 
    cp.add(textField64); 
    textField65.setBounds(40, 220, 25, 25); 
    textField65.setText(""); 
    cp.add(textField65); 
    textField66.setBounds(70, 220, 25, 25); 
    textField66.setText(""); 
    cp.add(textField66); 
    textField67.setBounds(100, 220, 25, 25); 
    textField67.setText(""); 
    cp.add(textField67); 
    textField68.setBounds(130, 220, 25, 25); 
    textField68.setText(""); 
    cp.add(textField68); 
    textField69.setBounds(160, 220, 25, 25); 
    textField69.setText(""); 
    cp.add(textField69); 
    textField70.setBounds(190, 220, 25, 25); 
    textField70.setText(""); 
    cp.add(textField70); 
    textField71.setBounds(220, 220, 25, 25); 
    textField71.setText(""); 
    cp.add(textField71); 
    textField72.setBounds(250, 220, 25, 25); 
    textField72.setText(""); 
    cp.add(textField72);  
    textField73.setBounds(10, 250, 25, 25); 
    textField73.setText(""); 
    cp.add(textField73); 
    textField74.setBounds(40, 250, 25, 25); 
    textField74.setText(""); 
    cp.add(textField74); 
    textField75.setBounds(70, 250, 25, 25); 
    textField75.setText(""); 
    cp.add(textField75); 
    textField76.setBounds(100, 250, 25, 25); 
    textField76.setText(""); 
    cp.add(textField76); 
    textField77.setBounds(130, 250, 25, 25); 
    textField77.setText(""); 
    cp.add(textField77); 
    textField78.setBounds(160, 250, 25, 25); 
    textField78.setText(""); 
    cp.add(textField78); 
    textField79.setBounds(190, 250, 25, 25); 
    textField79.setText(""); 
    cp.add(textField79); 
    textField80.setBounds(220, 250, 25, 25); 
    textField80.setText(""); 
    cp.add(textField80); 
    textField81.setBounds(250, 250, 25, 25); 
    textField81.setText(""); 
    cp.add(textField81); 
    
    button1.setBounds(288, 232, 100, 25); 
    button1.setLabel("Exit"); 
    cp.add(button1); 
    button1.addActionListener(new ActionListener() { 
      public void actionPerformed(ActionEvent evt) { 
        button1ActionPerformed(evt); 
      } 
    }); 

    button2.setBounds(288, 8, 100, 25); 
    button2.setLabel("Löse"); 
    cp.add(button2); 
    button2.addActionListener(new ActionListener() { 
      public void actionPerformed(ActionEvent evt) { 
        button2ActionPerformed(evt); 
      } 
    }); 

    button3.setBounds(288, 48, 100, 25); 
    button3.setLabel("Clear"); 
    cp.add(button3); 
    button3.addActionListener(new ActionListener() { 
      public void actionPerformed(ActionEvent evt) { 
        button3ActionPerformed(evt); 
      } 
    }); 

    // Ende Komponenten 

    setResizable(false); 
    setVisible(true); 
  } 

  // Anfang Ereignisprozeduren 
  public void button1ActionPerformed(ActionEvent evt) { 
    System.exit(1); 
  } 

  public void button2ActionPerformed(ActionEvent evt) { 
    fuellen (); 
    ausschlussEZ(); 
    fillMatrix(); 

  } 
  
  public void fuellen(){ 
    String text = new String(); 
    //Füllen leerer Zellen: 
    for (int a = 0; a <= 8; a++){ 
      for (int b = 0; b <= 8; b++){ 
        text = matrix[a][b].getText(); 
        if (text.equals("")){ 
          matrix[a][b].setText("X"); 
          matrix[a][b].setBackground(Color.yellow); 
          vTab[a][b] = "123456789"; 
        }else{ 
          vTab[a][b] = text; 
          matrix[a][b].setBackground(Color.green); 
        } 
        matrix[a][b].setEditable(false); 
      } 
    } 
  } 
  
  public boolean ausschlussEZ(){ 
    String text = new String(); 
    String aktzahl = new String(); 
    String kontrolle = new String(); 
    
    do{ 
      aenderung = false;  
      //Ausschluss eindeutiger Zahlen: 
      for (int x = 0; x <= 8; x++){ 
        for (int y = 0; y <=8; y++){ 
          aktzahl = vTab[x][y]; 
          int zahl = Integer.valueOf(aktzahl).intValue(); 
          if (zahl <= 9){ 

            //Ausschluss Spalte: 
            for (int z = 0; z <= 8; z++){ 
              text = vTab[z][y]; 
              if (!text.equals(aktzahl)){ 
                kontrolle = text; 
                text = text.replace(aktzahl, ""); 
                vTab[z][y] = text; 
                if (!kontrolle.equals(text)){ 
                  aenderung = true; 
                } 
              } 
            } 
            
            //Ausschluss Zeile: 
            for (int z = 0; z <= 8; z++){ 
              text = vTab[x][z]; 
              if (!text.equals(aktzahl)){ 
                kontrolle = text; 
                text = text.replace(aktzahl, ""); 
                vTab[x][z] = text; 
                if (!kontrolle.equals(text)){ 
                  aenderung = true; 
                } 
              } 
            
            } 
          } 
        } 
      } 
      text = ""; 
    }while(aenderung); 
    return aenderung; 
  } 
  
  public void fillMatrix(){ 
    String text = new String(); 
    for (int x = 0; x <= 8; x++){ 
      for (int y = 0; y <= 8; y++){ 
        text = vTab[x][y]; 
        int zahl = Integer.valueOf(text).intValue(); 
        if (zahl <= 9){ 
          matrix[x][y].setText(text); 
        }else{ 
          matrix[x][y].setBackground(Color.red); 
        } 
      } 
    } 
  } 
  public void button3ActionPerformed(ActionEvent evt) { 

    for (int a = 0; a <= 8; a++){ 
      for (int b = 0; b <= 8; b++){ 
        matrix[a][b].setText(""); 
        matrix[a][b].setEditable(true); 
        matrix[a][b].setBackground(Color.white); 
      } 
    } 
  } 
  // Ende Ereignisprozeduren 

  public static void main(String[] args) { 
    new Sudokusolver("Sudokusolver"); 
  } 
}
so recht? ;)
 

Leroy42

Top Contributor
Code:
  final int SUD = 9;
  JPanel sodokuPanel = new JPanel(new GridLayout(SUD, SUD));
  TextField[] textFields = new TextField[SUD*SUD]; 
  for (int i = 0; i < textFields.length; i++){ 
    sudokuPanel.add(textFields[i] = new TextField()); 
  }
 

Marco13

Top Contributor
Weil alles außer der Deklaration in einer Methode stehen muss. Da die TextFields sowieso in einer "matrix" liegen sollen, kannst du sie auch gleich nur da rein packen.
Code:
import java.awt.*;
import java.awt.event.*;
import java.lang.String;

public class Sudokusolver extends Frame {
  // Anfang Variablen

  TextField[][] matrix = new TextField[9][9];

  private Button button1 = new Button();
  private Button button2 = new Button();
  private Button button3 = new Button();

  private String[][] vTab = new String[9][9];
  private boolean aenderung;
  private boolean aenderung2;

  // Ende Variablen

  public Sudokusolver(String title) {
    // Frame-Initialisierung
    super(title);
    addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent evt) { System.exit(0); }
    });
    int frameWidth = 400;
    int frameHeight = 320;
    setSize(frameWidth, frameHeight);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    int x = (d.width - getSize().width) / 2;
    int y = (d.height - getSize().height) / 2 ;
    setLocation(x, y);
    Panel cp = new Panel(new BorderLayout());
    add(cp);
    // Anfang Komponenten

    Panel p = new Panel();
    p.setLayout(new GridLayout(9,9));
    for (int i = 0; i < 9; i++)
    {
      for (int j = 0; j < 9; j++)
      {
        matrix[i][j] = new TextField();
        p.add(matrix[i][j]);
      }
    }
    cp.add(p, BorderLayout.CENTER);

    p = new Panel();
    p.setLayout(new GridLayout(1,0));

    button1.setBounds(288, 232, 100, 25);
    button1.setLabel("Exit");
    p.add(button1);
    button1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        button1ActionPerformed(evt);
      }
    });

    button2.setBounds(288, 8, 100, 25);
    button2.setLabel("Löse");
    p.add(button2);
    button2.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        button2ActionPerformed(evt);
      }
    });

    button3.setBounds(288, 48, 100, 25);
    button3.setLabel("Clear");
    p.add(button3);
    button3.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent evt) {
        button3ActionPerformed(evt);
      }
    });
    cp.add(p, BorderLayout.SOUTH);

    // Ende Komponenten

    setResizable(false);
    setVisible(true);
  }

  // Anfang Ereignisprozeduren
  public void button1ActionPerformed(ActionEvent evt) {
    System.exit(1);
  }

  public void button2ActionPerformed(ActionEvent evt) {
    fuellen ();
    ausschlussEZ();
    fillMatrix();

  }

  public void fuellen(){
    String text = new String();
    //Füllen leerer Zellen:
    for (int a = 0; a <= 8; a++){
      for (int b = 0; b <= 8; b++){
        text = matrix[a][b].getText();
        if (text.equals("")){
          matrix[a][b].setText("X");
          matrix[a][b].setBackground(Color.yellow);
          vTab[a][b] = "123456789";
        }else{
          vTab[a][b] = text;
          matrix[a][b].setBackground(Color.green);
        }
        matrix[a][b].setEditable(false);
      }
    }
  }

  public boolean ausschlussEZ(){
    String text = new String();
    String aktzahl = new String();
    String kontrolle = new String();

    do{
      aenderung = false;
      //Ausschluss eindeutiger Zahlen:
      for (int x = 0; x <= 8; x++){
        for (int y = 0; y <=8; y++){
          aktzahl = vTab[x][y];
          int zahl = Integer.valueOf(aktzahl).intValue();
          if (zahl <= 9){

            //Ausschluss Spalte:
            for (int z = 0; z <= 8; z++){
              text = vTab[z][y];
              if (!text.equals(aktzahl)){
                kontrolle = text;
                text = text.replace(aktzahl, "");
                vTab[z][y] = text;
                if (!kontrolle.equals(text)){
                  aenderung = true;
                }
              }
            }

            //Ausschluss Zeile:
            for (int z = 0; z <= 8; z++){
              text = vTab[x][z];
              if (!text.equals(aktzahl)){
                kontrolle = text;
                text = text.replace(aktzahl, "");
                vTab[x][z] = text;
                if (!kontrolle.equals(text)){
                  aenderung = true;
                }
              }

            }
          }
        }
      }
      text = "";
    }while(aenderung);
    return aenderung;
  }

  public void fillMatrix(){
    String text = new String();
    for (int x = 0; x <= 8; x++){
      for (int y = 0; y <= 8; y++){
        text = vTab[x][y];
        int zahl = Integer.valueOf(text).intValue();
        if (zahl <= 9){
          matrix[x][y].setText(text);
        }else{
          matrix[x][y].setBackground(Color.red);
        }
      }
    }
  }
  public void button3ActionPerformed(ActionEvent evt) {

    for (int a = 0; a <= 8; a++){
      for (int b = 0; b <= 8; b++){
        matrix[a][b].setText("");
        matrix[a][b].setEditable(true);
        matrix[a][b].setBackground(Color.white);
      }
    }
  }
  // Ende Ereignisprozeduren

  public static void main(String[] args) {
    new Sudokusolver("Sudokusolver");
  }
}
 

manuche

Bekanntes Mitglied
Super die Variante funktioniert jetzt!
Problem dabei ist nur, dass jetzt mein gesamtes Verständis seitens der Quellcodeaufbaus hinüber sind!
Das gesamte Layout ist hinüber und ich hab keinen Ansatz wie ich das mit dieser Lösung wieder grade biegen kann... xD
Aber Danke für den den Lösungsvorschlag! Jetzt klapp zumindest das deklarieren!!!
Gruß manuche
 
Status
Nicht offen für weitere Antworten.
Ähnliche Java Themen
  Titel Forum Antworten Datum
S gleichzeitiges Ansprechen vieler Textfelder Java Basics - Anfänger-Themen 2
T Wenn JFrame Textfelder Hintergrund Grün dann... (if) Java Basics - Anfänger-Themen 3
I Double.ParseDouble 2 Textfelder Java Basics - Anfänger-Themen 1
P Textfelder Java Basics - Anfänger-Themen 3
Jinnai4 Mehrere Textfelder überprüfen Java Basics - Anfänger-Themen 16
P Textfelder in Variablen speichern Java Basics - Anfänger-Themen 13
P JavaFX Textfelder geben immer null zurück Java Basics - Anfänger-Themen 8
N CaretListener: leere Textfelder = Button sperren Java Basics - Anfänger-Themen 11
N Problem bei Zugriff auf Textfelder Java Basics - Anfänger-Themen 6
A Ausgabe von Schleifenergebnissen in Textfelder Java Basics - Anfänger-Themen 9
U Dynmische Textfelder erstellen Java Basics - Anfänger-Themen 8
U Kreis um Textfelder zeichnen Java Basics - Anfänger-Themen 4
M Beim Start Methode laden die Textfelder füllt Java Basics - Anfänger-Themen 5
B 2 Textfelder Enter Taste Java Basics - Anfänger-Themen 3
S List angaben in textfelder Java Basics - Anfänger-Themen 7
M Feld übergeben & dann Werte in TextFelder schreiben Java Basics - Anfänger-Themen 4
N Frage zu Listener für Textfelder Java Basics - Anfänger-Themen 5
T Textfelder und ComboBoxen anderst anordnen? Java Basics - Anfänger-Themen 4
Antoras mit ActionListener/Methodenaufruf Textfelder zeichnen Java Basics - Anfänger-Themen 4
D Erstellte Textfelder in Applet mit Tab - Taste anspringen Java Basics - Anfänger-Themen 3
G Mehrere Textfelder zusammenfassen Java Basics - Anfänger-Themen 4
P Auf Textfelder einer anderen Klasse zugreifen? Java Basics - Anfänger-Themen 2
M Zugriff auf Textfelder über Referenzen? Java Basics - Anfänger-Themen 3
H Textfelder Java Basics - Anfänger-Themen 12
G Rahmen um 5 Textfelder Java Basics - Anfänger-Themen 4
G Anzahl Textfelder zur Laufzeit verändern. Java Basics - Anfänger-Themen 4
DeeDee0815 JRadioButton, actionPerformed und Textfelder Java Basics - Anfänger-Themen 2
P Anordnung Textfelder untereinander? Java Basics - Anfänger-Themen 16
E Textfelder vergrößern Java Basics - Anfänger-Themen 11
C Textfelder auslesen Java Basics - Anfänger-Themen 3
G Änderungen in TextFelder feststellen Java Basics - Anfänger-Themen 4
G textfelder lassen sich nicht anwählen Java Basics - Anfänger-Themen 10
J Hintergrundfarbe für Textfelder Java Basics - Anfänger-Themen 4
M TextFelder synchronisieren Java Basics - Anfänger-Themen 14
D Suche ActionListener und Formatierung für Textfelder Java Basics - Anfänger-Themen 4
M Textfelder aus Array verändern Java Basics - Anfänger-Themen 3
M Viele Textfelder auslesen Java Basics - Anfänger-Themen 3
J Zuviele Textfelder und Labels Java Basics - Anfänger-Themen 2
N "On-The-Fly"-Textfelder Java Basics - Anfänger-Themen 2
G "dynamisch" Textfelder erzeugen Java Basics - Anfänger-Themen 4
M While-Schleife mit Wartezeit Java Basics - Anfänger-Themen 15
T Ich brauche eine Schleife die eine beliebige Zahl so lange durch 10 teilt bis zur Null Java Basics - Anfänger-Themen 5
DrahtEck Schleife soll wieder da anfangen wo ich es möchte ! Java Basics - Anfänger-Themen 17
Finn_lol Fehlermeldung bei Schleife mit Array Java Basics - Anfänger-Themen 4
Ranger229 Endless loop in while Schleife Java Basics - Anfänger-Themen 3
MaZ Quadrat Schleife(Pyramide) Java Basics - Anfänger-Themen 9
M Datentypen While-Schleife eine Java Methode erstellen Java Basics - Anfänger-Themen 3
P Wie kann diese Schleife beenden Java Basics - Anfänger-Themen 1
T float soll durch schleife die größte mögliche Zahl herausfinden, Ausgabe ist aber "Infinity" Java Basics - Anfänger-Themen 1
T Variable in Schleife deklarieren, Speicherplatz, Garbage Collector Java Basics - Anfänger-Themen 10
Ostkreuz While Schleife neustarten Java Basics - Anfänger-Themen 20
S Verschachtelte for-Schleife Java Basics - Anfänger-Themen 2
M Problem bei verschachtelter for-Schleife bei zweidimensionalen Arrays Java Basics - Anfänger-Themen 3
laxla123 Verschachtelte If-Else Schleife Java Basics - Anfänger-Themen 21
S Erste Schritte do-while Schleife Münzwurf Java Basics - Anfänger-Themen 1
S while Schleife Taschenrechner Java Basics - Anfänger-Themen 1
P Best Practice While loop schleife Java Basics - Anfänger-Themen 5
ohneInformatik; For Schleife. Was macht dieser Code?? Java Basics - Anfänger-Themen 5
I For Schleife Summe berechnen Java Basics - Anfänger-Themen 13
A Erste Schritte Aufgabe mit while Schleife Java Basics - Anfänger-Themen 11
R do while Schleife Verständnisfrage Java Basics - Anfänger-Themen 2
Say Fehlenden Code finden in einer while-Schleife? Java Basics - Anfänger-Themen 11
N Warum Springt iterator nur in der Schleife weiter Java Basics - Anfänger-Themen 9
J for Schleife kleinste Zufallszahl finden Java Basics - Anfänger-Themen 25
A Return in While Schleife Java Basics - Anfänger-Themen 6
M Erste Schritte While Schleife / Ausgabe von buchstabe & ASCII Wert Java Basics - Anfänger-Themen 4
J do..while Schleife Java Basics - Anfänger-Themen 14
J Java To String Methode, Array mit For-Schleife Java Basics - Anfänger-Themen 2
S Textausgabe in einer For-Schleife Java Basics - Anfänger-Themen 12
B Automatisierte Ausgabe (Schleife, If-Abfrage?) Java Basics - Anfänger-Themen 24
C 2D Array Ausgabe mit for-Schleife i,j Java Basics - Anfänger-Themen 4
T Mit jedem Wert in der for-Schleife weiter arbeiten Java Basics - Anfänger-Themen 3
berserkerdq2 Warum muss man manchmal in der RUnmethode sleep in eine schleife tun? Java Basics - Anfänger-Themen 9
F for-Schleife halbiert Durchläufe ungewollt Java Basics - Anfänger-Themen 6
ravenz Schleife mit for über String Array „zahlen“und prüfen ob Wert „a“ oder „b“ oder „c“ entspricht (mittels || ) Java Basics - Anfänger-Themen 4
Bugs Bunny Fehlerhafte Berechnung beim erneuten Durchlaufen der Schleife Java Basics - Anfänger-Themen 5
J Methoden iterator for-schleife (hasNext() ) Java Basics - Anfänger-Themen 7
S Was macht ++ ohne Schleife? Java Basics - Anfänger-Themen 4
LFB In einer For-Schleife alles in einer Zeile ausgeben Java Basics - Anfänger-Themen 14
Neuling47 for schleife Java Basics - Anfänger-Themen 6
M Variable in einer Schleife initialisieren Java Basics - Anfänger-Themen 46
B Zuweisungen und Methodenaufrufe in Bedingung der while Schleife? Java Basics - Anfänger-Themen 2
JavaBeginner22 Würfeln bis 6 while Schleife Java Basics - Anfänger-Themen 13
D EinMalEins mithilfe einer for-Schleife und Array Java Basics - Anfänger-Themen 1
xanxk Problem For-Schleife mit Charakter Java Basics - Anfänger-Themen 2
W Schleife und einmal variable++ zu viel Java Basics - Anfänger-Themen 20
sgtcoopa Array übergeben Schleife Java Basics - Anfänger-Themen 0
T Mäxchenspiel mit Schleife Java Basics - Anfänger-Themen 3
D try/catch-Block bei for-Schleife Java Basics - Anfänger-Themen 14
D Hilfe bei einer Aufgabe mit for-Schleife Java Basics - Anfänger-Themen 6
J Schleife Problem Java Basics - Anfänger-Themen 2
X Hilfe beim Übertragen in eine For-Schleife Java Basics - Anfänger-Themen 1
L while Schleife mit 2 Bedingung endet nicht Java Basics - Anfänger-Themen 3
stormyark 4 Bit in einer for-schleife funktioniert nicht Java Basics - Anfänger-Themen 3
M ArrayList mit einer Schleife befüllen Java Basics - Anfänger-Themen 2
K Schleife berechnet kein Ergebnis (Vererbung) Java Basics - Anfänger-Themen 6
S Sentinel-Schleife Java Basics - Anfänger-Themen 0
D Array mit while-schleife Java Basics - Anfänger-Themen 12
Kiki01 Wie würde eine geeignete Schleife aussehen, die die relative Häufigkeit für jeden Charakter in einem Text bestimmt? Java Basics - Anfänger-Themen 3
P9cman Vokal Zähler mit switch case und for-Schleife Java Basics - Anfänger-Themen 4

Ähnliche Java Themen

Neue Themen


Oben