Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 22nd, 2002, 01:15 PM
xlunareclipsex xlunareclipsex is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 5 xlunareclipsex User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to xlunareclipsex
Angry Java app w/textfield & image problems

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

Reply With Quote
  #2  
Old July 23rd, 2002, 06:46 AM
dejavu dejavu is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Finland
Posts: 0 dejavu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I think the problem is here:

Code:
JPanel panel = JPanel();


You should create new instance of the JPanel class using it's constructor:

Code:
JPanel panel = new JPanel();


Check out the JPanel class from URL.

Something what is deprecated doesn't exist anymore in new releases of API-packages, although it has been part of the API-package. In this case, DataInputStream's readLine()-method is deprecated since JDK 1.1.

To fix out this problem, replace

Code:
DataInputStream imagesIn = new DataInputStream(new FileInputStream(myImages));


with

Code:
BufferedReader imagesIn = new BufferedReader(new InputStreamReader(new FileInputStream(myImages)));

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Java app w/textfield & image problems


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway