lundi 18 mai 2015
Fehler bei simpler additions GUI
Posted on 05:14 by verona
Hallo an alle bin der neue hier^^
Ich fanage mal gleich direkt an. Mein eingentliches Ziel ist es einen Kleinen Formelrechner mit GUI zu bauen
Wollte zum testen als erstes blos zwei Zahlen addieren, aber irgend wo hängt es total:(
könnte von euch jemand mal drüberschauen?
Fehler Meldung ist
Starter:
GUI
Contoller
Addtion
Ich fanage mal gleich direkt an. Mein eingentliches Ziel ist es einen Kleinen Formelrechner mit GUI zu bauen
Wollte zum testen als erstes blos zwei Zahlen addieren, aber irgend wo hängt es total:(
könnte von euch jemand mal drüberschauen?
Fehler Meldung ist
Java Code:
-
at gui.OGUI.setAdditionListener(OGUI.java:112)
-
at controller.Controller.addListener(Controller.java:29)
-
at controller.Controller.<init>(Controller.java:18)
-
at misc.Starter.main(Starter.java:11)
Starter:
Java Code:
-
package misc;
-
-
import controller.Controller;
-
-
public class Starter {
-
-
static Controller controller;
-
-
// TODO Auto-generated method stub
-
controller = new Controller();
-
controller.showGUI();
-
-
}
-
-
}
GUI
Java Code:
-
package gui;
-
-
import java.awt.EventQueue;
-
import java.awt.event.ActionListener;
-
-
import javax.swing.JButton;
-
import javax.swing.JFrame;
-
import javax.swing.JPanel;
-
import javax.swing.JTextField;
-
import javax.swing.border.EmptyBorder;
-
-
-
-
private static final long serialVersionUID = 1L;
-
/**
-
* Launch the application.
-
*/
-
// public static void main(String[] args) {
-
// EventQueue.invokeLater(new Runnable() {
-
// public void run() {
-
// try {
-
// OGUI frame = new OGUI();
-
// frame.setVisible(true);
-
// } catch (Exception e) {
-
// e.printStackTrace();
-
// }
-
// }
-
// });
-
// }
-
//
-
// /**
-
// * Create the frame.
-
-
public OGUI() {
-
-
super("tu_was");
-
-
Form();
-
-
-
}
-
-
-
private void Form(){
-
-
setBounds(100, 100, 450, 300);
-
setContentPane(contentPane);
-
contentPane.setLayout(null);
-
-
Tuwas.setBounds(258, 51, 117, 25);
-
contentPane.add(Tuwas);
-
-
NeuWerte.setBounds(258, 111, 117, 25);
-
contentPane.add(NeuWerte);
-
-
Awert.setBounds(12, 12, 114, 19);
-
contentPane.add(Awert);
-
Awert.setColumns(10);
-
-
Bwert.setBounds(12, 54, 114, 19);
-
contentPane.add(Bwert);
-
Bwert.setColumns(10);
-
-
ERGwert.setBounds(12, 114, 114, 19);
-
contentPane.add(ERGwert);
-
ERGwert.setColumns(10);
-
}
-
-
public void resetOGUI(){
-
-
this.Awert.setText(" ");
-
this.Bwert.setText(" ");
-
this.ERGwert.setText(" ");
-
}
-
-
-
return this.Awert.getText();
-
-
}
-
-
-
return this.Bwert.getText();
-
-
}
-
-
-
this.ERGwert.setText(erg);
-
-
}
-
-
-
-
this.Tuwas.addActionListener(l);
-
}
-
-
this.NeuWerte.addActionListener(l);
-
}
-
-
}
Contoller
Java Code:
-
package controller;
-
import formelen.Addition;
-
import gui.OGUI;
-
-
import java.awt.event.ActionEvent;
-
import java.awt.event.ActionListener;
-
-
public class Controller {
-
-
private OGUI ogui;
-
private Addition addition;
-
-
public Controller(){
-
-
this.ogui = new OGUI();
-
this.addition = new Addition();
-
-
addListener();
-
}
-
-
public void showGUI(){
-
this.ogui.setVisible(true);
-
}
-
-
-
-
private void addListener(){
-
-
this.ogui.setAdditionListener(new AdditionListener());
-
this.ogui.setResetFormListener(new ResetFormListener());
-
-
}
-
-
/
-
-
addition.additionBerechnen(aaWert, bbWert);
-
}
-
}
-
-
-
-
ogui.resetOGUI();
-
addition.zurückSetzen();
-
}
-
}
-
-
-
}
Addtion
Java Code:
-
package formelen;
-
-
public class Addition {
-
-
long x;
-
-
public Addition(){
-
-
zurückSetzen();
-
}
-
-
public void zurückSetzen(){
-
-
this.x = 0;
-
}
-
-
public void additionBerechnen(long aaWert, long bbWert){
-
-
this.x = (aaWert+bbWert);
-
-
}
-
-
public long getAddErg(){
-
return this.x;
-
}
-
-
-
-
}
Fehler bei simpler additions GUI
Categories: Fehler bei simpler additions GUI
Inscription à :
Publier les commentaires (Atom)
0 commentaires:
Enregistrer un commentaire