Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

problem while trying to make an applet

  Asked By: Jesse    Date: May 28    Category: Java    Views: 677
  

I have run in to a problem while trying to make an applet where you
can draw. I have it so you can drag the mouse and leave your drawing
line, however, it will dissappear when any other action in the applet
is made. For example, I can make one line but if I perform an action
that requires the applet to call "repaint()" the line with vanish!
This is preventing me from changing line color and size. I was
wondering if anyone here would have any advice for me.

Share: 

 

7 Answers Found

 
Answer #1    Answered By: Mario Ryan     Answered On: May 28

Where are you keeping the internal representation of your line? When
you draw  your line  the first time, you have to keep an internal
representation of the line. When you "repaint()" you call  a routine
which redraws that line on your canvas based upon your internal
representation.

 
Answer #2    Answered By: Garry Sanchez     Answered On: May 28

Does anyone know that how to call  the Notepad Editor in my Java
Program. Basically, I have a output file in HTML formet and Now, I
would like to create a button and when user hit the button Notepad or
Visual Dev should pop up.
Right now I am looking in this link
java.sun.com/.../PropertyEditor.html .
This link talk about PropertyEditor function. So, can you please let
me know if that is the right approch to start it. I would be really
appriciated.

 
Answer #3    Answered By: Chung Tran     Answered On: May 28

You may use the
the exec() method os the Runtime class then pass is the name of the
shell( system command ) something like:

try
{
Process proc = Runtime.getRuntime().exec("Notepad.exe");
BufferedReader br = new BufferedReader(new InputStreamReader
(proc.getInputStream()));
String line;
while ((line = br.readLine) != null)
{ /* do something with output */ }
int returnValue = proc.waitFor();
br.close();
}
catch (Exception e) // should probably be a bunch of catch
statements here...
{ /* do something with exception */ }


This is similar to System("Notepad.exe"); statement in C.
I have never actually compiled this code but think you got the idea.

 
Answer #4    Answered By: Salvador Alexander     Answered On: May 28

if u wants to open a note pad just follow it
Runtime, Process class of the java gives such facility , after that write
command,
p.exec("notepad");
where p is the object of class Process.

 
Answer #5    Answered By: Andrew Bryant     Answered On: May 28

In FTPClient class listFiles() method is not returning list of files
it doesnot give any compiletime error but on execution gives null
pointer exception.

Actually i want to manipulate files based on their size.

piece of code is:

FTPFile files[] = ftc.listFiles();
for(int i=0;i<files.length;i++)
{
FTPFile file = files[i];
System.out.println("File Size:"+file.getSize());
if((name.endsWith("."))||(name.endsWith(".."))){}
else{
if(name.indexOf(".")!=-1)
{
if(name.endsWith(type))
{
if(files[i].getSize()<size)
FileOutputStream fos = new FileOutputStream(new File
("c:\\download\\",name));
ftc.retrieveFile(name,fos);
}
}
}
}




 
Answer #6    Answered By: Becky Baker     Answered On: May 28

You might want to declare and initialise files[] first and then use it. That way
we can make  sure there was a memory allocation. I guess thats the problem  in ur
case

 
Answer #7    Answered By: Stacie Martin     Answered On: May 28

When trying to install Java V. 1.5 update 6, I rec'd the following
error message: Error applying transforms. Verify that the specified
transform paths are valid.

 
Didn't find what you were looking for? Find more on problem while trying to make an applet Or get search suggestion and latest updates.




Tagged: