Hi there -
I'm trying to develop a regular Java program that has a window with a textfield and an image. When the user types something in the textbox, it is stored and then a new image replaces the old one.
I'm having issues with just getting the text field on:
a snippet of code:
import javax.swing.*;
import javax.swing.border.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class TryIO extends JFrame implements ActionListener
{
static JFrame aWindow = new JFrame("This is the Window Title");
public TryIO()
{
Container content = getContentPane();
JPanel panel = JPanel();
JTextField textField = new JTextField("Default input", 20);
panel.add(textField);
content.add(panel, "test");
}
and then when i use JDK to compile i get:
TryIO.java:16: cannot resolve symbol
symbol : method JPanel ()
location: class TryIO
JPanel panel = JPanel();
plus i'm using the:
DataInputStream imagesIn = new DataInputStream(new FileInputStream(myImages));
images[index] = imagesIn.readLine();
and when that compiles I get:
java.io.DataInputStream has been deprecated.
What does that mean and does anyone know how I can get my app to work?
- A
