wo0zy
Erfahrenes Mitglied
hi, also ich bin dabei ein programm zu schreiben, doch leider haben sich da ein paar fehler eingeschlichen, doch ich weiß leider nich was da falsch sein soll!
ich poste mal den quelltext(als kommentare sind die zeilennummern eingefügt in denen die fehler sind) und dann auch den compiler-output
import
und hier die errormessages:
ich hoffe ihr wisst was da nich hinhaut
ich poste mal den quelltext(als kommentare sind die zeilennummern eingefügt in denen die fehler sind) und dann auch den compiler-output
import
Code:
java.awt.*;
import java.awt.Frame;
import java.awt.event.*;
import java.util.*;
public class WeekendCounter extends Frame implements ActionListener
{
Label info, count, result, space1;
TextField field;
Button button;
String res, end;
int part1, differenz;
public static void main(String[] args)
{
Frame f1 = new WeekendCounter();
f1.setSize(150,90);
f1.show();
}
public WeekendCounter()
{
super("WeekendCounter beta1,3 by wo0zy");
info = new Label("Datum:",Label.LEFT);
add(info);
field = new TextField(8);
add(field);
space1 = new Label("");
add(space1);
button = new Button("Berechnen");
add(button);
button.addActionListener(this);
count = new Label("Ergebnis:");
add(count);
result = new Label("");
add(result);
setLayout(new GridLayout(3,1));
}
public void actionPerformed(ActionEvent event)
{
if (event.getSource() == button)
{
res = field.getText();
result.setText(end);
end = (String)differenz;//61
Date now = new Date();
long nowLong = now.getTime();
String ds = res;
DateFormat df = DateFormat.getDateInstance();//67
try
{
Date d = df.parse(ds);
}
catch(ParseException pe)//73
{
System.out.println("Unable to parse " + ds);
}
while (datum1.before(datum2))//78
{
datum1.add(Calendar.Date, 1);//80
differenz++;
}
}
}
public boolean handleEvent(Event e)
{
if (e.id == Event.WINDOW_DESTROY)
System.exit(0);
return super.handleEvent(e);
}
}
und hier die errormessages:
Code:
--------------------------- Compiler Output ---------------------------
WeekendCounter.java:61: inconvertible types
found : int
required: java.lang.String
end = (String)differenz;//61
^
WeekendCounter.java:67: cannot resolve symbol
symbol : class DateFormat
location: class WeekendCounter
DateFormat df = DateFormat.getDateInstance();//67
^
WeekendCounter.java:67: cannot resolve symbol
symbol : variable DateFormat
location: class WeekendCounter
DateFormat df = DateFormat.getDateInstance();//67
^
WeekendCounter.java:73: cannot resolve symbol
symbol : class ParseException
location: class WeekendCounter
catch(ParseException pe)//73
^
WeekendCounter.java:78: cannot resolve symbol
symbol : variable datum2
location: class WeekendCounter
while (datum1.before(datum2))//78
^
WeekendCounter.java:78: cannot resolve symbol
symbol : variable datum1
location: class WeekendCounter
while (datum1.before(datum2))//78
^
WeekendCounter.java:80: cannot resolve symbol
symbol : variable Date
location: class java.util.Calendar
datum1.add(Calendar.Date, 1);//80
^
WeekendCounter.java:80: cannot resolve symbol
symbol : variable datum1
location: class WeekendCounter
datum1.add(Calendar.Date, 1);//80
^
Note: WeekendCounter.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
8 errors
ich hoffe ihr wisst was da nich hinhaut
Zuletzt bearbeitet: