First off let me say that I am very new to java so this is really simple but I have this date object and I made an actionlistener method but it won't let me use the object in there. How do I make it so that I can access in the method?
jp = new JPanel();
jta = new JTextArea(100, 100);
jta.setPreferredSize(new Dimension(460,420));
jta.setLineWrap(true);
jta.setWrapStyleWord(true);
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Date date = new Date();
jb = new JButton("Tommorow");
jl = new JLabel();
jf = new JFrame();
jf.setBackground(Color.BLUE);
jl.setText(dateFormat.format(date));
add(jl, BorderLayout.NORTH);
add(jp);
jp.add(jb, BorderLayout.EAST);
add(jta);
jb.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
jta.setText("");
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, 1);
date = cal.getTime();
}