How can I make my code work in a GUI using Swing in Java?
- by Razor Shadow
I'm making a tool that does multiple things, and I'm onto the last feature for now:
You type in a date and it tells you what day of the week it would be on that date.
So I have two problems here:
I can't use I can't use arguments, it doesn't like them
On the last line, I can't use jTextArea2.setText(d0); because it doesn't like that either...
My code is here:
public static void main(String[] args) {
int d = Integer.parseInt(args[0]);
int m = Integer.parseInt(args[1]);
int y = Integer.parseInt(args[2]);
int y0 = y - (14 - m) / 12;
int x = y0 + y0/4 - y0/100 + y0/400;
int m0 = m + 12 * ((14 - m) / 12) - 2;
int d0 = (d + x + (31*m0)/12) % 7;
System.out.println("Sunday = 0\nMonday = 1\nTuesday = 2\nWednesday = 3\nThursday = 4\nFriday = 5\nSaturday = 6\nThis date is on a:");
System.out.println(d0);
Basically, this code was at first for use with the console, and now I want to implement it into a Swing GUI app.
I'm only a week into learning Java, so excuse me if the problem is obvious or easy to fix... But can anyone figure out how to work it? Thanks!