Hi Eric,

Please note that the constants defined in the
javax.print.attribute.standard classes are typesafe enums, not ints.
Read the javadoc closely for these classes.  For example,
OrientationRequested.PORTRAIT is an instance of OrientationRequested.
There's no need to construct an OrientationRequested instance using its
constructor.  Simply use the enumerated value directly:
   attributeSet.add(PrintQuality.HIGH);

Also note that you don't need to cast PrintQuality.HIGH to an Attribute
as it's already spec'd to implement the Attribute interface.

Hope this clears things up.
Chris


Eric Kolotyluk wrote:
When I tried new PrintQuality(PrintQuality.HIGH); that didn't work either.

I was told that the correct way to set attributes is
attributeSet(PrintQuality.HIGH); so best I can tell, attributes aren't
what I figured.

I'm off to explore
http://java.sun.com/j2se/1.4.1/docs/guide/jps/spec/JPSTOC.fm.html

Cheers, Eric

Rob Ross wrote:

This is a basic access modifier issue. PrintQuality's [int]
constructor is
PROTECTED, so only a subclass of PrintQuality, OR another class within
the
javax.print.attribute.standard package may access that protected
constructor.

The [int] constructor for OrientationRequested  is also protected, and
you
have the same issues with it as you do with PrintQuality as above.

Rob

----- Original Message -----
From: Eric Kolotyluk <mailto:[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Sent: Wednesday, February 26, 2003 3:41 PM
Subject: [JAVA2D] Compiling Problems with Printing Attributes

Why does the compiler find a problem with this? I can't seem to use the
defined constants cut and pasted from the API web pages, or even a
literal
integer. I do this sort of thing all the time with constants? I cannot
see
any problem with the constuctors. Any help would be appreciated.

Cheers, Eric

import javax.print.attribute.*;
import javax.print.attribute.standard.*;

// much more code

       OrientationRequested orientation =
           new OrientationRequested(OrientationRequested.LANDSCAPE);

attributeSet.add((Attribute)orientation);

PrintQuality printQuality = new PrintQuality(2);

attributeSet.add((Attribute)printQuality);

// much more code

javac CinPrintFrame.java
CinPrintFrame.java:217: cannot resolve symbol
symbol  : constructor OrientationRequested
(javax.print.attribute.standard.OrientationRequested)
location: class javax.print.attribute.standard.OrientationRequested
               new OrientationRequested(OrientationRequested.LANDSCAPE);
               ^
CinPrintFrame.java:221: PrintQuality(int) has protected access in
javax.print.attribute.standard.PrintQuality
           PrintQuality printQuality = new PrintQuality(2);
                                       ^

===========================================================================

To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff JAVA2D-INTEREST".  For general help, send
email to
[EMAIL PROTECTED] and include in the body of the message "help".



=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".

-- Chris Campbell 408-276-6429 [EMAIL PROTECTED] x16429 Sun Microsystems, Java 2D USCA22-212

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to