createImage() always returns null

1999-02-14 Thread Manfred Bartz


I want to create an off-screen image in a Swing application.
The program compiles without errors, but createImage() always 
returns null. 

The only examples from the tutorial that contain createImage() are
applets (not swing applications) and seem to work fine.

For verification, I included the relevant code snippet (as shown
below) in a swing application example from the tutorial -- same 
result.

Am I missing something???  or is that a swing bug?
I am using jdk117_v1a, swing-1.1.1-beta1

--8><

// extracted from ".../tutorial/ui/swingComponents/example-swing/"
public class ScrollDemo extends JPanel 
{
:
:
public ScrollDemo() 
{
:
:
//
Image offScrImage = createImage(100,100);
if (offScrImage == null)
System.err.println("createImage() returns null!");

JPanel offScrPanel2 = new JPanel();
Image offScrImage2 = offScrPanel2.createImage(100,100);
if (offScrImage2 == null)
System.err.println("createImage() returns null!");
//
:
:
}
}

--8><

$ java ScrollDemo
createImage() returns null!
createImage() returns null!

--8><

Any feedback appreciated
-- 
Manfred 



Re: createImage() always returns null

1999-02-14 Thread Chris Huebsch

Hello,

is the Panel already visible?

If not, then show() it before getting a Image!


greetings


Chris

Manfred Bartz wrote:
> 
> I want to create an off-screen image in a Swing application.
> The program compiles without errors, but createImage() always
> returns null.
> 
> The only examples from the tutorial that contain createImage() are
> applets (not swing applications) and seem to work fine.
> 
> For verification, I included the relevant code snippet (as shown
> below) in a swing application example from the tutorial -- same
> result.
> 
> Am I missing something???  or is that a swing bug?
> I am using jdk117_v1a, swing-1.1.1-beta1

...

> 
> Any feedback appreciated
> --
> Manfred

-- 
public class chu extends ChrisHübsch implements TUChemnitz {
  String  email= "mailto:[EMAIL PROTECTED]";
  String  SMSMail  = "mailto:[EMAIL PROTECTED]?Subject=SMS: info";
  URL homepage = new URL("http://www.tu-chemnitz.de/~chu/");
  Talktalkto   = new Talk("[EMAIL PROTECTED]");
  Integer ePlus= new Integer(4628555);
}



Problem : can't find class

1999-02-14 Thread Vinay Pai

Hello,

 I am having the following problem when I try to execute a java program ,
says :
can't find class test
This happens although the file test.class and test.java are in the same
directory from where I am executing java. I am however able to compile java
programs without any problems. Also I can run servlets through the browser.
 The classpath variable is as follows :

CLASSPATH=/usr/local/java/lib/classes.zip:/usr/local/java/jsdk/lib/jsdk.jar

I am using Red Hat Linux 5.0 and jdk1.1.5.


I know its some silly problem but unable to figure it out.



Quote of the day ...
**


When Depression strikes think of five good things of your immediate
condition




Re: Problem : can't find class

1999-02-14 Thread Chris Huebsch

Hello,

try adding a "." to the classpath.

CLASSPATH=.:/usr/local/java/lib/classes.zip:/usr/local/java/jsdk/lib/jsdk.jar

Chris

Vinay Pai wrote:
> 
> Hello,
> 
>  I am having the following problem when I try to execute a java program ,
> says :
> can't find class test
...
>  The classpath variable is as follows :
> 
> CLASSPATH=/usr/local/java/lib/classes.zip:/usr/local/java/jsdk/lib/jsdk.jar
> 
> I am using Red Hat Linux 5.0 and jdk1.1.5.
-- 
public class chu extends ChrisHübsch implements TUChemnitz {
  String  email= "mailto:[EMAIL PROTECTED]";
  String  SMSMail  = "mailto:[EMAIL PROTECTED]?Subject=SMS: info";
  URL homepage = new URL("http://www.tu-chemnitz.de/~chu/");
  Talktalkto   = new Talk("[EMAIL PROTECTED]");
  Integer ePlus= new Integer(4628555);
}



Re: Problem : can't find class

1999-02-14 Thread Christopher Rowan

Common mistake.

You need to have . (current directory) in your PATH.

See the  leading dot on the example below:

CLASSPATH=.:/usr/local/java/lib/classes.zip:/usr/local/java/jsdk/lib/jsdk.jar

Vinay Pai wrote:
> 
> Hello,
> 
>  I am having the following problem when I try to execute a java program ,
> says :
> can't find class test
> This happens although the file test.class and test.java are in the same
> directory from where I am executing java. I am however able to compile java
> programs without any problems. Also I can run servlets through the browser.
>  The classpath variable is as follows :
> 
> CLASSPATH=/usr/local/java/lib/classes.zip:/usr/local/java/jsdk/lib/jsdk.jar



Re: createImage() always returns null

1999-02-14 Thread David Wall

Chris wrote:
>is the Panel already visible?
>
>If not, then show() it before getting a Image!


Or just do an addNotify() before...this gets the peers started



Automated C to Java conversion

1999-02-14 Thread Bernd Kreimeier


I am looking for a Linux tool to generate Java source 
from C. I am aware of C2J/C2J++. What I need would 
have to be used repeatedly - the code will be 
maintained in C. Changing the C code once to match 
converters restrictions is feasible.

Any recommendations? Commercial products included?


  b.



java programming

1999-02-14 Thread alexander lang

Hi all.

Does anyone know if one is allowed to initialize static final variables 
within the "try" clause of a static initializer block?

(eg.
static final int x;
static{
  try
{
   x = 5;
}
catch(exception e)
   {...and so on ..}
)

I am working on a software project which has code like this. I am 
getting compile - time error messages which state that I am NOT allowed 
to fo this.   Are there some tricks one can use to "trick" the compiler.  
I am assuming that the code previously worked(?).  I am using 
jdk1.1.5-glibc.

Any assistance would be high ly appreciated.

Thank YOU!

__
Get Your Private, Free Email at http://www.hotmail.com



Mailing List

1999-02-14 Thread Jazzmother

I would like to be taken off your mailing list.



Re: java programming

1999-02-14 Thread Daniel W. Dulitz x108

alexander lang writes:
> Does anyone know if one is allowed to initialize static final variables 
> within the "try" clause of a static initializer block?
> 
> (eg.
>   static final int x;
>   static{
> try
>   {
>  x = 5;
>   }
>   catch(exception e)
>  {...and so on ..}
> )
> 
> I am working on a software project which has code like this. I am 
> getting compile - time error messages which state that I am NOT allowed 
> to fo this.   Are there some tricks one can use to "trick" the compiler.  
> I am assuming that the code previously worked(?).  I am using 
> jdk1.1.5-glibc.

Final variables must be assigned along all possible execution paths of
the constructor or static initializer block.  (Another way of saying
this is that there must not be a way to get through the constructor or 
static initializer block without assigning to the final variable.)

Thus, if you assign to the final variable in the try section, you must
also assign it in the catch section.

I haven't looked in the spec to see what happens if a final variable
is assigned a value multiple times.  I would imagine that its value is 
the last value assigned.  If this turns out to be a problem, you can
always do:

static final int x;
static {
int xx;

try {
xx = 5;
...
} catch (...) {
xx = 4;
}
x = xx;
}

Best,
daniel dulitz

Valley Technologies Peak Performance Real-Time DSP
State College, PA



Re: java programming

1999-02-14 Thread Moses DeJong

On Sun, 14 Feb 1999, alexander lang wrote:

> Hi all.
> 
> Does anyone know if one is allowed to initialize static final variables 
> within the "try" clause of a static initializer block?
> 
> (eg.
>   static final int x;
>   static{
> try
>   {
>  x = 5;
>   }
>   catch(exception e)
>  {...and so on ..}
> )
> 
> I am working on a software project which has code like this. I am 
> getting compile - time error messages which state that I am NOT allowed 
> to fo this.   Are there some tricks one can use to "trick" the compiler.  
> I am assuming that the code previously worked(?).  I am using 
> jdk1.1.5-glibc.
> 
> Any assistance would be high ly appreciated.
> 
> Thank YOU!
> 
> __
> Get Your Private, Free Email at http://www.hotmail.com
> 


Hello,

I do not think that would be allowed. I just tried to compile this class
with the JDK 1.2 compiler and the jikes compiler and they do not accept it.

public class TryInStaticInit {

static final boolean cond;

static {
try
{
cond = true;
}
catch(Exception e) {
// do nothing
}
}
}




with javac from JDK 1.2


TryInStaticInit.java:3: Blank final variable 'cond' may not have been initialized. It 
must be assigned a value in an initializer, or in every constructor.
static final boolean cond;
 ^




with jikes


Found 1 semantic error and issued 2 warnings compiling "TryInStaticInit.java":

 3. static final boolean cond;
 <-->
*** Error[116]: A blank class final variable must be initialized in a static 
initializer block. It is assumed to be initialized


10. catch(Exception e) {
  <->
*** Caution[ 186]: This catch block may be unreachable because there is no exception 
whose type is assignable to "java/lang/Exception" that can be thrown during execution 
of the body of the try block




I hope that helps
Mo DeJong
dejong at cs.umn.edu



simple imput from command line

1999-02-14 Thread cobra




Hope I'm not 
disturbing too much, probably I'm off topic but I'd need a simple way to imput a 
number (integer) from keyboard  while a program is running in Java (JINI) 

I'd need a 
translation for basic : INPUT "AGE";A
 
I'm able to do it from command line arg but not inside a 
program
 
IF my question is too silly please ignore it.
 
 echo.java


Mailing List

1999-02-14 Thread Jazzmother

I would like to be removed from your mailing list.



simple imput from command line

1999-02-14 Thread cobra





Hope I'm not 
disturbing too much, probably I'm off topic but I'd need a simple way to imput a 
number (integer) from keyboard  while a program is running in Java (JINI) 

I'd need a 
translation for basic : INPUT "AGE";A
 
I'm able to do it from command line arg but not inside a 
program
 
IF my question is too silly please ignore it.
 
 echo (1).java


Re: simple imput from command line

1999-02-14 Thread Daniel W. Dulitz x108

cobra writes:
> IF my question is too silly please ignore it.

Well, you sent it twice.  It's pretty silly, and it's off topic, but
now I'm worried that if everyone ignores it you'll keep sending it.

> I'd need a translation for basic : INPUT "AGE";A

import java.io.*;

public int getIntegerFromStandardInput ()
throws IOException, NumberFormatException {
final LineNumberReader lnr = new LineNumberReader
(new InputStreamReader (System.in), 1);
return (Integer.parseInt (lnr.readLine ()));
}

Please buy and read an introductory book on Java.

Best,
daniel dulitz



CLASSPATH variable too large ?

1999-02-14 Thread Ken A Redergard

I have a large amount of .jar files in the library directory, and that
leads to a very large CLASSPATH variable. 

The seems that java (java version "1.1.7") won't accept the
classpath when it reaches a certain amount of characters. I currently have
331 characters in the path, and when I run a .class file java reports that
the class can't be found. If I set the classpath to a much smaller amount
of characters the program runs...

Any suggestions on how to solve this problem (except from decompressing
all the .jar files in the library directory) ?

With regards,
Ken A. Redergård
http://www.colargol.tihlde.hist.no/~kenr



Re: CLASSPATH variable too large ?

1999-02-14 Thread Moses DeJong

On Mon, 15 Feb 1999, Ken A Redergard wrote:

> I have a large amount of .jar files in the library directory, and that
> leads to a very large CLASSPATH variable. 
> 
> The seems that java (java version "1.1.7") won't accept the
> classpath when it reaches a certain amount of characters. I currently have
> 331 characters in the path, and when I run a .class file java reports that
> the class can't be found. If I set the classpath to a much smaller amount
> of characters the program runs...
> 
> Any suggestions on how to solve this problem (except from decompressing
> all the .jar files in the library directory) ?
> 
> With regards,
> Ken A. Redergård
> http://www.colargol.tihlde.hist.no/~kenr
> 

You could try to use the -classpath argument to java. That should not
be constrained by the max size for env vars. You would need a startup
script otherwise you would have to type them all in every time you
ran the java (yuk!).

mo dejong
dejong at cs.umn.edu



Re: Mailing List

1999-02-14 Thread JONATHAN HEMINGWAY





> I would like to be taken off your mailing list.



Como estas?

1999-02-14 Thread sdcdc dcsdsfc

http://salman.nu/ministerio/

__
Get Your Private, Free Email at http://www.hotmail.com