How to make a Graphics2D object from a Graphics object?

Hallo !
Graphics g = pj.getGraphics();
Graphics2D g2 = (Graphics2D) g;I get an Exception as follows:
java.lang.ClassCastException: sun.awt.windows.WPrintGraphicsWrapper
Is there an other possibility to to make a Graphics2D Object ? Or can I repair the error on an other way?
Thank you Wolfgang

Yes JBuilder makes a reference to this line.
pj is a PrintJob.
The only lines in this method for test are
PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(p,"PrintWindow",null);
Graphics g = pj.getGraphics();
Graphics2D g2 = (Graphics2D) g;
pj.end();Exception occurred during event dispatching:
java.lang.ClassCastException: sun.awt.windows.WPrintGraphicsWrapper
Wolfgang

Similar Messages

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • How to make a jar file from a java file?

    how to make a jar file from a java file, is there any one tht can help me thank you;

    You can study this.
    http://java.sun.com/docs/books/tutorial/jar/basics/index.html

  • How to make a conference call from an iPhone

    How to make a conference call from an iPhone

    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf user manual

  • How to make a ARCH package from local folder?

    hello ARCH lovers
    I can't seem to figure out how to make a installable
    package from a folder on my desktop?
    Coming from Slackware; the procedure would be simple enough just issuing
    "makepkg /root/pkgname.txz"
    Now; how would I do the same in ARCH?
    I know about PKGBUILD, etc but there is no source or any url's
    I just need to make it into a .pkg.tar.xz
    The package is my "kernel-live-kit" for both x86 and x86_64 versions of arch
    enabling one to remaster there existing install into a livecd/usb, etc
    The kernel itself is kernel26-zen from AUR
    http://aur.archlinux.org/packages.php?ID=30330
    however; mine is quite different and also includes all components to make the livecd using modified linux-live-6.3.0
    scripts and special stuff
    The pkg includes a premade kernel with modules and full kernel source
    The resulting live media is similar to my nFluxOS builds
    http://multidistro.com/
    As I will be releasing the new four horsemen of nFluxOS today; I also made 4 Kernel pkg's for the arch and slack versions
    Those will be for x86/x86_64 versions for both arch and slackware
    I did this in lieu of creating a quartet of x86_64 versions of nFluxOS; as that would up the number of versions to 8
    and I would then have to maintain 8 distro's instead of 4.
    I made a testing version of ARCH x86_64 live
    http://www.linuxquestions.org/questions … ost4017796
    so, I really need to make the ARCH x86 and x86_64 kernel kits into installable pkg's because there are many symlinks that would get corrupted if I just tarred it and then the end user untars it and copies it somewhere it would mess up the symlinks.
    as I said, in slackware I do makepkg and it creates a script named "doinst.sh" that makes all the symlinks, etc
    so, any help appreciated!
    thanks

    You can read a simple introduction to using the ABS here.
    By the way, it's not hard. Out of all the distributions I've used, Arch Linux is the only one I've figured out how to make packages for.

  • Drawing a Graphics object on a Graphics object

    Is there anyway to draw a Graphics object on another Graphics object? I'm trying to show 2 screens, side by side, on a Canvas and I'm trying to cheat a little :-P Basically, I want to take half of one screen and half of another and put them on top of each other to form one screen.
    OR is there a way to turn a Graphics object into an Image object?

    I'm not sure if this is what you're after, but you can
    - create an offscreen image using "createImage(int width, int height)" method of a Component , then
    - obtain the graphics context of the offscreen image using "getGraphics()",
    - you can then draw onto the offscreen image using the graphics context.
    hope that helps. =)

  • How to make an app deleted from iTunes library be deleted from all the iOS devices synced with this library?

    Hello!
    I have 3 iOS devices synced with iTunes apps library (OS X 10.10.2)
    Can someone tell me how to make not only added but deleted apps be synced also? I mean I want an app deleted in iTunes library be deleted from any iOS devices synced with this library.

    But it was working some time before! What and when has changed?
    There was even a warning popup window something about "this application will be deleted from all the devices synced with this library"
    Now there's opposite message - "This application will not be deleted from any device syncing with this account". Isn't it some kind of clue that there can be conrarily circumstances - when application IS deleted from ANY device synced with this computer?

  • Help!! i dont know how to make use of token from string tokenizer :(

    Hi,
    I would like to ask how to manipulate the token that are taken from string tokenizer. For example :
    input = a b 1 f 986
    supposed output:
    a
    b
    1
    f
    986
    How to make the output look like this?
    Output = (a,b,f),(1,986)
    Below is the source code of Algebra.java
    import java.io.*;
    import java.util.*;
    * Read and print, using BufferedReader from System.in, onto System.out
    public class Algebra {
    public static void main(String[] av) {
    try {
    BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
    String inputLine;
    System.out.print("Input =");
    while ((inputLine = is.readLine()) != null) {
    System.out.println("Output="+inputLine);
    StringTokenizer st =
    new StringTokenizer(inputLine, ", |");
    while (st.hasMoreElements())
    System.out.println("Token: " + st.nextElement());
    break;
    is.close();
    } catch (IOException e) {
    System.out.println("IOException: " + e);
    Thank You

    You can modify this to serve your goal.
    BufferedReader is=null;
    try {
    is = new BufferedReader(new InputStreamReader(new FileInputStream("Data.txt")));
    StreamTokenizer st = new StreamTokenizer(is);
    int n=0,k=0,q=0;
    String[] s=new String[20];
    String[] s0=new String[10];
    while(st.nextToken() != StreamTokenizer.TT_EOF) {
            switch(st.ttype) {
              case StreamTokenizer.TT_EOL:
                s[k] = new String("EOL");k++;
                break;
              case StreamTokenizer.TT_NUMBER:
                s0[q] = Double.toString(st.nval);q++;
                break;
              case StreamTokenizer.TT_WORD:
                s[k] = st.sval; // Already a String
                 k++;
                break;
              default: // single character in ttype
                s[k] = String.valueOf((char)st.ttype); k++;
            }  //end of while
       //   Some output processing here
    }catch(IOException ioe){
       ioe.printStackTrace();
    }catch(ArrayIndexOutOfBoundsException bx){
       System.err.println(bx);
    }finally{
           try{      if(is !=null)     is.close();}catch(IOException ioe){;}
    }

  • How to make GC remove  weakReference from ReferenceHashSet

    Hi there,
    I opened and then close some GUI forms. and take heapdump file. the GUIformeditor are still in memory.
    and I used Jprobe and Heapanalyzer to check. both list ReferenceHashSet as the referrer for my GUIeditor.
    but I checke the source of org.eclipse.core.internal.runtime.referencehashset and it says A hashset whose values can be garbage collected.
    I requested a GC before I took the memory snapshot.
    could somebody shed some light into this? how to make the GC to collect those weakreference??
    Thanks a lot.

    I think you could try something like this.....
    Add with a power limit of zero and then drop the disks with a powerlimit of 11.
    alter system set ASM_POWER_LIMIT=0;
    select * from v$asm_operation;
    alter diskgroup DBFILE01_GRP
    add disk 'ORCL:DB0009', 'ORCL:DB0010', 'ORCL:DB0011', 'ORCL:DB0012';
    alter diskgroup DBFILE01_GRP drop disk DB0001, DB0002, DB0003, DB0004;
    alter diskgroup DBFILE01_GRP rebalance power 11;
    select * from v$asm_operation;

  • How to make a highlight video from a DVD?

    I want to make a highlight video from a dvd.  How do I get this dvd into iMovie?  I tried the import feature but I am getting an error stating it doesn't see any movies on the DVD.

    Video calling is a feature offered by your service provider.  You'd first have to sign up for the service then you'd need a phone that supports it.  Currently, I'm not aware of any BlackBerry phone that supports it.  The Chinese movie you saw might not have been technically accurate.  Case in point, I saw the Green Hornet movie recently and he has a car that does loads of cool things.  Turns out, if you watch the DVD extras, most of those stunts were fake. 
    - If my response has helped you, please click "Options" beside my post and mark it as solved. Clicking the "thumbs up" icon near the bottom of my response would also be appreciated.

  • How to make call on Mobile from OCCAS

    Hi all,
    how we could make call on mobile from OCCAS, what type of configuration we have to do and what type of media server required. Also indicate if there is any simulator for media server.
    Regards

    Hello,
    The normal method is to use a PSTN gateway (SIP protocol supported) to connect the OCCAS and the MSC.
    And if only peer to peer voice call, no need to use the media server.
    Regards.

  • How to make a still image from video in iMovie 10.0.3

    How do you make a still image from a video clip in iMovie 10.0.3?

    See this User Tip by AppleMan1958 -
    https://discussions.apple.com/docs/DOC-3231
    John

  • Make java.sql.Blob object from java serialized object

    I have an ImageIcon which I get from an applet. It gets passed to a servlet. Now, I want to turn the ImageIcon into a blob object so that I can insert it into a database (as/400). How do I do that?

    Hi there,
    NORMALLY this is a 2-step process:
    1.) Convert the ImageIcon into a byte-array
    2.) Write the byte-array into the database/blob
    For step 1 (this code is 'freehand'):
    =====================================
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(bos);
    oos.write(myImageIcon);
    oos.close();
    byte[] data = bos.getBytes();
    For step 2:
    ============
    This is often database specific, but normally you select a column of a record for update, get the blob-object from the resultset and start writing bytes to it.
    BUTTTTTTTT Consider this alternate approach: Assuming the image that is being sent is always small in size, you may simply chose to base-64 encode it and store the resultant string in a varchar column. When you read it back, base-64 decode it. Although the encoding/decoding may appear to be an overhead, I'll bet you it's much faster than blob-level access, both for reads and writes. It's also portable (code-wise) and you can update images through a simple UPDATE statement. In fact, if your database supports it, you could even have a default value for the column (a default image)...

  • How to make a http request from a pl/sql procedure(URGENT)

    I need to make a http request from a pl/sql procedure, can any one tell me which built-in package and which procedure/function we serve my need?
    Thanks in advance.
    Ram Prasad.

    You should use UTL_HTTP package, but before it install the JVM into DB

  • How to make an exe file from a java class file

    i know one of the java's most powerfull properties is plataform independent, but if i have done one application (with GUI) that i want to run on Win32 for example, if anyone knows how to make it please send me a message to [email protected], how i know that can be make it? because HotJava is made in Java and in Win32 is a executable

    Do a search on these forums for any of the thousands of times this question has been asked and any of the thousands of times it's been answered.

Maybe you are looking for

  • 2011 Macbook Pro Retina Blackouts and constant Auto-Reboots

    Hey guys, thanks for your time to look this through since you are my last hope before I drive 320 miles to Apple Store in Chicago with 14inches of heavy snow under my car... Here is the case: it happened today that my computer would automatically go

  • How do I search for a Folder (name) inside a folder?

    I am using FF 3.6.3, I an attempting to use FF Search to locate a specific Folder, which I placed inside another Folder. In this case, I have a Folder entitled 'Health' (no quotes), I research, and have various health-issues placed inside this folder

  • Unable to read data from the SAP marketplace

    Hi All,     These days, certain packages in my download basketball cannot be downloaded, while others can be downloaded normally.      After serveral redirecting, the SAP download manager keeps informing me that "Unable to read data from the SAP mark

  • Magic mouse disconnecting

    I bought my magic mouse a few months ago and it was working great until about 2 weeks ago, it now decides to disconnect at random times, and the green light won't come on underneath the mouse meaning i have to turn my computer on and off several time

  • Issues with ios 8.1.3

    Just wondering if anyone has experienced with issues for 8.1.3.  Specifically battery issues, etc.  The usual problems that occur when an update has been released. I am using an iPhone 6+.