Cann't I get Graphics object in JVM?

I developed a java stored procedure in which I want to generate a picture.
So I use this:
BufferedImage bufferedImage = new BufferedImage(width,height,1);
Graphics g2 = bufferedImage.createGraphics();
System.out.println(g2.toString());
I can get the bufferedImage succesfully but when running to g2.toString(), NullPointerException are thrown.
Cann't I get Graphics Object in Oracle's JVM?
How can I develop this procedure to generate a picture which have to running background at databaserver.
Need your help.
Thanks.

Hi Guoshun,
Cann't I get Graphics Object in Oracle's JVM?As far as I know, you can't. Since Oracle's JVM is certified by SUN, it has to include all of the classes in the J2SE core libraries. However (and I recall reading this in the Oracle documentation) the graphics related classes cannot be used. Sorry :-(
[But someone else may prove me wrong :-]
I don't know if this will help you, but for your information, there are some examples in the book Java Servlet Programming by Jason Hunter about servlets creating images. Perhaps it will give you some ideas:
http://www.servlets.com/jservlet2/examples/ch06/index.html
And there is also Marco Schmidt's Java Image FAQ (which may also be helpful)
Good Luck,
Avi.

Similar Messages

  • Graphics object under unix

    Hi
    I m using sun solaris and i want to create a graph using graphics object and then write on to jpg file. For the same i musing JPEGEncoder and able to do that sucessfully under win NT and also under solaris but only when that X windows is installed and that service is running.
    My concern is i want to do the above task where x windows is not installed , in such a case where will i get graphics object from and how will graph be plotted.
    Is there any work around without using 3rd party tool
    Please let me know

    look at this http://www.eteks.com/pja/en/

  • How to get name of a graphic object

    Hi all,
    i created various grids and graphic obejcts in a splitter container.
    Now i want to set focus ( cl_gui_control=>set_focus )on the graphics objects, but i dont know the control names. for the grid this is no problem, but as i created the graphics with the FM 'GFW_PRES_SHOW' i dont know their names..
    so, is there a simple way to get these object names?
    best regards
    dennis
    Message was edited by:
            Dennis Abmeier

    Hi Ralf,
    thanks for your reply!
    The container name doesnt help me, i tried already to focus the container. I think the problem is, that i have created 4 instances of different object types in the splitter container, so the focus is always on the first created instance (Layer?) in the container or the last focussed. As i write, focus the manually created instances(Grids) is no problem because i know their names.
    So what i need is the name of FM generated (Graphic) instance which lies in the splitter-container.

  • I cant get it to work! NullPointerExeption at first awt.Graphics Object

    I am writing a game with AWT having it as an applet. I intend NOT to use anything outside of Java 1.1
    For my Game i thought that i ATLEAST need the following classes:
    MainGame, Level, Unit.
    I Started writing Level. wrote a fewe methods for it such as
    drawGras(int grastype) And started to write MainGame to see if they would work together. it's is/is going to be my first Java application where i actually know what object orienting is... I have already wrote a game in Java but with out knowing what a class or what object orienting realy is(the game works rather good to) but this time i wanted to use object orienting but came up with problems =( if first posted in "New to Javaprogramming" but they couldn't help me and advice me here
    My previous post: http://forum.java.sun.com/thread.jsp?forum=54&thread=290558
    Here's my code:
    import java.awt.*;
    public class MainGame extends java.applet.Applet
         implements Runnable {
         Thread runner;
         Image ImgLevel, ImgUnit;
         public MainGame() {
              Level nr1 = new Level();
              nr1.init();
              nr1.setGround(300);
              nr1.drawGras(1);
              nr1.CalcGraphics();
              nr1.drawSky(1);
              Image ImgLevel = nr1.getLevelImage();
         public void paint(Graphics g) {
              g.drawImage(ImgLevel,0,0,this);
         public void update(Graphics g) {
              paint(g);
         public void init() {
              MainGame Game = new MainGame();
         public void stop() {
              runner = null;
              System.exit(1);
         public void start() {
              if(runner == null) {
                   runner = new Thread(this);
                   runner.start();
         void Pause(int time) {
             try {
                 Thread.sleep(time);
             } catch(InterruptedException e) {
               System.out.println(e.toString());
         public void run() {
              Thread thisThread = Thread.currentThread();
                   while(thisThread == runner) {
    class Level extends java.applet.Applet {
        Font BigText = new Font("Arial", Font.PLAIN, 36);
        Font Normal = new Font("Arial", Font.PLAIN, 14);
        Font Bold = new Font("Arial", Font.BOLD, 14);
        Graphics GrLevel;
        int pattern, sky, GroundtoWalk, Ground;
        Color BgColor = new Color(166,202,240);
        Color gras1 = new Color(0,255,0);
        Color gras2 = new Color(0,200,0);
        Color gras3 = new Color(0,100,0);
        Image ImgLevel;
        void setBgColor(int r, int g, int b) {
            BgColor = new Color(r,g,b);
        void CalcGraphics() {
            ImgLevel = createImage(800,600);
            GrLevel = ImgLevel.getGraphics();
        void setGround(int GrounD) {
            Ground = GrounD;
        void GroundToWalkADD(int addToGround) {
            GroundtoWalk = Ground + addToGround;
        void setGroundToWalk(int GrToWalk) {
            GroundtoWalk = GrToWalk;
        public void init() {
              System.out.println("Init 1"); // This was placed here when i was checking how far it got when debuging
              CalcGraphics();
              System.out.println("Init 2");
              drawGras(1);
              System.out.println("Init 3");
              repaint();
              System.out.println("Init 4");
        Image getLevelImage() {
            return ImgLevel;
        public void paint(Graphics g) {
              g.drawImage(ImgLevel,0,0,this);
        public void update(Graphics g) {
            paint(g);
        void drawGras(int pt) {
         GrLevel.setColor(BgColor);
         GrLevel.fillRect(0,0,800,600);
         switch(pt) {
              case 1:
                   GrLevel.setColor(gras1);
                   GrLevel.fillRect(0,GroundtoWalk,800,300);
                   GrLevel.setClip(0,GroundtoWalk,800,300);
                   for(int i = 0; 890>i;i=i+5) {
                        GrLevel.setColor(gras2);
                        GrLevel.drawLine(0+i,GroundtoWalk,-190+i,GroundtoWalk+300);
                   for(int i=950; 0<i; i=i-5) {
                        GrLevel.setColor(gras3);
                        GrLevel.drawLine(890-i,GroundtoWalk,1000-i,GroundtoWalk+300);
              break;
              case 2:
                   GrLevel.setColor(gras2);
                   GrLevel.fillRect(0,GroundtoWalk+5,800,300);
                   for(int i = 0; 890>i;i=i+5) {
                        GrLevel.setColor(gras3);
                        GrLevel.drawLine(0+i,GroundtoWalk,-190+i,GroundtoWalk+300);
                   for(int i=950; 0<i; i=i-5) {
                        GrLevel.setColor(gras1);
                        GrLevel.drawLine(890-i,GroundtoWalk,1000-i,GroundtoWalk+300);
              break;
              case 3:
                   GrLevel.setColor(gras3);
                   GrLevel.fillRect(0,GroundtoWalk+10,800,300);
                   for(int i = 0; 800>i; i=i+20) {
                        GrLevel.fillArc(0+i,GroundtoWalk,20,20,180,-180);
              break;
         pattern = pt;
        int getGrasPattern() {
             return pattern;
        void drawSky(int cl) {
                GrLevel.setColor(BgColor);
                GrLevel.fillRect(0,0,800,155);
                switch(cl) {
                    case 1:
                   for(int y = 0;y<7;y++) {
                   for(int x = 0;x<800;x=x+20) {
                                GrLevel.setColor(Color.white);
                                GrLevel.drawArc(x,y*20,20,20,180,180);
                                GrLevel.setColor(Color.red);
                                GrLevel.drawArc(x,y*20+4,20,20,180,180);
                                GrLevel.setColor(Color.yellow);
                                GrLevel.drawArc(x,y*20+2,20,20,180,180);
                                GrLevel.setColor(Color.green);
                                GrLevel.drawArc(x,y*20+8,20,20,180,180);
                                GrLevel.setColor(Color.blue);
                                GrLevel.drawArc(x,y*20+12,20,20,180,180);
                                GrLevel.setColor(Color.pink);
                                GrLevel.drawArc(x,y*20+16,20,20,180,180);
              break;
              case 2:
                        GrLevel.setColor(Color.gray);
              break;
         sky = cl;
         GrLevel.setFont(BigText);
         GrLevel.setColor(Color.black);
         GrLevel.fillRect(0,0,800,50);
         GrLevel.setColor(Color.white);
         GrLevel.drawString("Score Tabel - comming someday",((size().width)/2)-260, 40);
        int getSkyTyp() {
             return sky;
    }I tested running the code of class Level by puting it into Level.java and compiled it...ran it with appletviewer and it worked as it was intended to.
    But when i compiled it with MainGame... and in the HTML started MainGame.class,.....applet didn't intializeand i got the following error messege:
    Init 1
    java.lang.NullPointerException
            at Level.CalcGraphics(MainGame.java:84)
            at MainGame.<init>(MainGame.java:11)Line 82: void CalcGraphics() {
    Line 83: ImgLevel = createImage(800,600);
    Line 84: GrLevel = ImgLevel.getGraphics(); // The First awt.Graphics object
    Line 85: }
    Line 9:      public MainGame() {
    Line 10:     Level nr1 = new Level();
    Line 11:     nr1.CalcGraphics(); // calling the method above -> same error first awt.Graphics Object.
    If i change it os that "drawGras" comes first it's first awt.Graphics Line will show the same error
    Hope some one can and will help me

    As per the documentation of
    java.awt.Component.createImage(int,int):
    Creates an off-screen drawable image to be used for
    double buffering.
    Parameters:
    width - the specified width
    height - the specified height
    Returns:
    an off-screen drawable image, which can be used for
    double buffering. The return value may be null if the
    component is not displayable. This will always happen
    if GraphicsEnvironment.isHeadless() returns true.
    Since:
    JDK1.0 its not
    ImgLevel = createImage(800,600); that's making the problem but The first awt.Graphics Object in class Level, no mather which on it is =((
    >
    The key part is '...may be null if the component is
    not displayable.'
    You should put your graphics initialization code in
    start(), which will be called when your applet is
    ready to go. Before then, your applet is not
    displayable. (Also, remember to dispose() your
    graphics in your stop() method, if not sooner.)for the part writen above...I'll try to change it like you are saying.
    Thanx for your help!

  • Getting the image of a graphics object?

    Hi,
    I have a graphics object that I want to update on a thread, but i don't want to redraw everything I had on each time I update (I only want to draw new items). in my paintComponent function, I have
    public void paintComponent(Graphics g)
              Graphics2D g2 = (Graphics2D)g;
              if (bufferedImage == null)
                   bufferedImage = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
              g2.drawImage(bufferedImage, 0, 0, null);
              drawBackground(g2);
              addItem(g2);
                 g2_ = g2;
         }where drawBackground makes the constant background and addItem draws new points. The problem that I'm having is that it is only drawing new items on the graph and not adding on to the existing image. I think this is because I never set bufferedImage to the current image, but I'm not sure how to do this?
    Thanks

    demo:
    import java.awt.*;
    import java.awt.image.*;
    import javax.swing.*;
    @SuppressWarnings("serial") public class Example extends JComponent {
        private BufferedImage buffer;
            setOpaque(true);
        @Override protected void paintComponent(Graphics g) {
            int w = getWidth(), h = getHeight();
            if (buffer == null ||
                w > buffer.getWidth() || h > buffer.getHeight()) {
                buffer = getGraphicsConfiguration().createCompatibleImage(w, h);
                composeBuffer();
            g.drawImage(buffer, 0, 0, null);
        protected void composeBuffer() {
            Graphics2D g2 = buffer.createGraphics();
            g2.setColor(Color.RED);
            g2.drawLine(0, 0, buffer.getWidth(), buffer.getHeight());
            g2.dispose();
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    JComponent comp = new Example();
                    comp.setPreferredSize(new Dimension(400,300));
                    JFrame f = new JFrame();
                    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    f.add(comp);
                    f.pack();
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }

  • How to change font/ font color etc in a graphic object using JCombobox?

    Hello
    My program im writing recently is a small tiny application which can change fonts, font sizes, font colors and background color of the graphics object containing some strings. Im planning to use Jcomboboxes for all those 4 ideas in implementing those functions. Somehow it doesnt work! Any help would be grateful.
    So currently what ive done so far is that: Im using two classes to implement the whole program. One class is the main class which contains the GUI with its components (Jcomboboxes etc..) and the other class is a class extending JPanel which does all the drawing. Therefore it contains a graphics object in that class which draws the string. However what i want it to do is using jcombobox which should contain alit of all fonts available/ font sizes/ colors etc. When i scroll through the lists and click the one item i want - the graphics object properties (font sizes/ color etc) should change as a result.
    What ive gt so far is implemented the jcomboboxes in place. Problem is i cant get the font to change once selecting an item form it.
    Another problem is that to set the color of font - i need to use it with a graphics object in the paintcomponent method. In this case i dnt want to create several diff paint.. method with different property settings (font/ size/ color)
    Below is my code; perhaps you'll understand more looking at code.
    public class main...
    Color[] Colors = {Color.BLUE, Color.RED, Color.GREEN};
            ColorList = new JComboBox(Colors);
    ColorList.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ev) {
                     JComboBox cb = (JComboBox)ev.getSource();
                    Color colorType = (Color)cb.getSelectedItem();
                    drawingBoard.setBackground(colorType);
              });;1) providing the GUI is correctly implemented with components
    2) Combobox stores the colors in an array
    3) ActionListener should do following job: (but cant get it right - that is where my problem is)
    - once selected the item (color/ font size etc... as i would have similar methods for each) i want, it should pass the item into the drawingboard class (JPanel) and then this class should do the job.
    public class DrawingBoard extends JPanel {
           private String message;
           public DrawingBoard() {
                  setBackground(Color.white);
                  Font font = new Font("Serif", Font.PLAIN, fontSize);
                  setFont(font);
                  message = "";
           public void setMessage(String m) {
                message = m;
                repaint();
           public void paintComponent(Graphics g) {
                  super.paintComponent(g);
                  //setBackground(Color.RED);
                  Graphics2D g2 = (Graphics2D) g;
                  g2.setRenderingHint             
                  g2.drawString(message, 50, 50);
           public void settingFont(String font) {
                //not sure how to implement this?                          //Jcombobox should pass an item to this
                                   //it should match against all known fonts in system then set that font to the graphics
          private void settingFontSize(Graphics g, int f) {
                         //same probelm with above..              
          public void setBackgroundColor(Color c) {
               setBackground(c);
               repaint(); // still not sure if this done corretly.
          public void setFontColor(Color c) {
                    //not sure how to do this part aswell.
                   //i know a method " g.setColor(c)" exist but i need to use a graphics object - and to do that i need to pass it in (then it will cause some confusion in the main class (previous code)
           My problems have been highlighted in the comments of code above.
    Any help will be much appreciated thanks!!!

    It is the completely correct code
    I hope that's what you need
    Just put DrawingBoard into JFrame and run
    Good luck!
    public class DrawingBoard extends JPanel implements ActionListener{
         private String message = "message";
         private Font font = new Font("Serif", Font.PLAIN, 10);
         private Color color = Color.RED;
         private Color bg = Color.WHITE;
         private int size = 10;
         public DrawingBoard(){
              JComboBox cbFont = new JComboBox(GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames());
              cbFont.setActionCommand("font");
              JComboBox cbSize = new JComboBox(new Integer[]{new Integer(14), new Integer(13)});
              cbSize.setActionCommand("size");
              JComboBox cbColor = new JComboBox(new Color[]{Color.BLUE, Color.RED, Color.GREEN});
              cbColor.setActionCommand("color");
              JComboBox cbBG = new JComboBox(new Color[]{Color.BLUE, Color.RED, Color.GREEN});
              cbBG.setActionCommand("bg");
              add(cbFont);
              cbFont.addActionListener(this);
              add(cbSize);
              cbSize.addActionListener(this);
              add(cbColor);
              cbColor.addActionListener(this);
              add(cbBG);
              cbBG.addActionListener(this);
         public void setMessage(String m){
              message = m;
              repaint();
         protected void paintComponent(Graphics g){
              super.paintComponent(g);
              Graphics2D g2 = (Graphics2D)g;
              g2.setColor(bg);//set background color
              g2.fillRect(0,0, getWidth(), getHeight());          
              g2.setColor(color);//set text color
              FontRenderContext frc = g2.getFontRenderContext();
              TextLayout tl = new TextLayout(message,font,frc);//set font and message
              AffineTransform at = new AffineTransform();
              at.setToTranslation(getWidth()/2-tl.getBounds().getWidth()/2,
                        getWidth()/2 + tl.getBounds().getHeight()/2);//set text at center of panel
              g2.fill(tl.getOutline(at));
         public void actionPerformed(ActionEvent e){
              JComboBox cb = (JComboBox)e.getSource();
              if (e.getActionCommand().equals("font")){
                   font = new Font(cb.getSelectedItem().toString(), Font.PLAIN, size);
              }else if (e.getActionCommand().equals("size")){
                   size = ((Integer)cb.getSelectedItem()).intValue();
              }else if (e.getActionCommand().equals("color")){
                   color = (Color)cb.getSelectedItem();
              }else if (e.getActionCommand().equals("bg")){
                   bg = (Color)cb.getSelectedItem();
              repaint();
    }

  • Trying to move a graphics object using buttons.

    Hello, im fairly new to GUI's. Anyway I have 1 class which makes my main JFrame, then I have another 2 classes, one to draw a lil square graphics component (which iwanna move around) which is placed in the center of my main frame and then another class to draw a Buttonpanel with my buttons on which is placed at the bottom of my main frame.
    I have then made an event handling class which implements ActionListner, I am confused at how I can get the graphics object moving, and where I need to place the updateGUI() method which the actionPerformed method calls from inside the event handling class.
    I am aware you can repaint() graphics and assume this would be used, does anyone have a good example of something simular being done or could post any help or code to aid me, thanks!

    Yeah.. here's an example of custom painting on a JPanel with a box. I used a mouse as it was easier for me to setup than a nice button panel on the side.
    Anyways... it should make it pretty clear how to get everything setup, just add a button panel on the side. and use it to move the box instead of the mouse.
    -Js
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.event.MouseInputAdapter;
    public class MoveBoxAroundExample extends JFrame
         private final static int SQUARE_EDGE_LENGTH = 40;
         private JPanel panel;
         private int xPos;
         private int yPos;
         public MoveBoxAroundExample()
              this.setSize(500,500);
              this.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
              this.setContentPane(getPanel());
              xPos = 250;
              yPos = 250;
              this.setVisible(true);     
         private JPanel getPanel()
              if(panel == null)
                   panel = new JPanel()
                        public void paintComponent(Graphics g)
                             super.paintComponent(g);
                             g.setColor(Color.RED);
                             g.fillRect(xPos-(SQUARE_EDGE_LENGTH/2), yPos-(SQUARE_EDGE_LENGTH/2), SQUARE_EDGE_LENGTH, SQUARE_EDGE_LENGTH);
                   MouseInputAdapter mia = new MouseInputAdapter()
                        public void mousePressed(MouseEvent e)
                            xPos = e.getX();
                            yPos = e.getY();
                            panel.repaint();
                        public void mouseDragged(MouseEvent e)
                            xPos = e.getX();
                            yPos = e.getY();
                            panel.repaint();
                   panel.addMouseListener(mia);
                   panel.addMouseMotionListener(mia);
              return panel;
         public static void main(String args[])
              new MoveBoxAroundExample();
    }

  • Creating new graphics object from a existing one and sending it for print

    Hello,
    i have a graphics object which is big in size, I am creating a new graphics object from the existing one as given below
    //map is a graphic object
    Graphic g1 = (Graphic)map.create(x,y,width,height);
    Graphic g2 = (Graphic)map.create(x,y,width1,height1);
    Graphic g3 = (Graphic)map.create(x,y,width2,height2);
    arrayList.add(g1);
    arrayList.add(g2);
    arrayList.add(g3);
    Now I want to send the graphic object g1,g2,g3 for print in the method
    public int print (Graphics g, PageFormat pf, int idx) throws PrinterException {
    // Printable's method implementation
    if (curPageFormat != pf) {
    curPageFormat = pf;
    pages = repaginate (pf);
    if (idx >= 3)) {
    return Printable.NO_SUCH_PAGE;
    g = (Graphics) arrayList.get(idx);
    return Printable.PAGE_EXISTS;
    This is not working... what is wrong. can anybody suggest..
    I tried standardprint.java to print a object inside a scrollpane, it is not printing the entire diagram. so I am thinking of something like this.... Please let me know what to do....
    Thanks
    Serj

    The easy way to do this is create a copy using Windows Explorer.
    Open the project and go to File > Rename.
    Then you have your 2013 ready made project.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Image in a Graphics object

    Hi, I'm dealing with the Batik API for working with svg images, but I need to do some wmf imager representation too.
    This API offers a class which is able to read WMF files, giving a "WMFRecordStore", that you can use to initialize a "WMFPainter".
    Anyway, this WMFPainter class has a "paint" method which I hoped that I could use to print the wmf info in the screen but... I don't know if it can be done.
    You must pass a Graphics object to the "paint" method.
    If I want to add an image to a JLabel, as I'd do with an ImageIcon, do I have to get the current JLabel Graphics object? Will the image keep displayed when repainting? Is this a correct way of doing this?
    thanks a lot

    if you have to paint special things on a component, you have to subclass the component and override the paint (or paintComponent) method. You don't want to be getting the graphics object from a component and draw on it, it's not going to work properly.

  • How to use a Graphics Object in a JSP?

    Hello, I do not know if this is a good or a silly question. Can anyone tell me if we can use a Graphics object in a JSP. For example to draw a line or other graphics, i am planning to use the JSP. Any help is much appreciated.
    Regards,
    Navin Pathuru.

    Hi Rob or Jennifer, could you pour some light here.
    I have not done a lot of research for this, but what i want to do is below the polygon i would like to display another image object like a chart... is it possible? If so how to do it? Any help is much appreciated.
    here is the code:
    <%
    // Create image
    int width=200, height=200;
    BufferedImage image = new BufferedImage(width,
    height, BufferedImage.TYPE_INT_RGB);
    // Get drawing context
    Graphics g = image.getGraphics();
    // Fill background
    g.setColor(Color.white);
    g.fillRect(0, 0, width, height);
    // Create random polygon
    Polygon poly = new Polygon();
    Random random = new Random();
    for (int i=0; i < 5; i++) {
    poly.addPoint(random.nextInt(width),
    random.nextInt(height));
    // Fill polygon
    g.setColor(Color.cyan);
    g.fillPolygon(poly);
    // Dispose context
    g.dispose();
    // Send back image
    ServletOutputStream sos = response.getOutputStream();
    JPEGImageEncoder encoder =
    JPEGCodec.createJPEGEncoder(sos);
    encoder.encode(image);
    %>
    Regards,
    Navin Pathuru

  • How does one Float a Graphic Object with Text? (Don't want the Graphics Frame stationary)

    I now know just enough InDesign to be dangerous.  So, help me from blowing myself up.
    SITUATION:
    I desire a Callout/Quote Box to emphase a quote--to separate it from the flowing text of the manuscript.  So, I created a curved-edge rectangle (graphic object) to make the "box", then filled it with the quoted text).  All was well in the land of Adobe Novice UNTIL I deleted some text above the newly-created graphic box/quote box.  I need the graphic to flow with (stay embedded in; hold its position in) the text outside the manuscript, not say anchored to page.
    QUESTION:
    Is there a way to have a graphic object which is placed in a manuscript flow with the manuscript text, so that it "holds its position" relative to the text.  For example, if I delete a paragraph of text above the graphic object, I want the graphic object to adjust accordingly.
    ASIDE:
    I am open to any other tricks or methods others use to insert callout or quote-boxes within the flowing text of a manuscript/book.
    Thanks in advance.

    Create your callout. If you will use it often, you can actually grab it and drag it to the desktop for reuse in any Document; it becomes an InDesign Snippet (.inds).
    Copy the callout graphic, insert your text curser into the text frame where you want the callout. You've just Anchored an Object.
    This is where you want to read up on Anchored Objects. You can highlight and baseline shift the callout (often necessay for anchored objects) , change leading, apply text wrap with standoff (you would select it with the selection tool for this), all of which are way beyond what I have ever tried, but managed it in less than 3 minutes. Basically treat it as a selection of type. The challenges will be line breaks, keep with, gosh knows.
    Bob mentioned CS5.5 has more friendly features, which I am not familiar with, and are beyond quick replies.
    Work through the above at your discretion, ask more DIRECT questions as needed, and you will get help. 

  • How can I tell if a Graphics object has been disposed

    Any ideas?
    Thanks

    My goal is to find out if a graphics object has been disposed or not...
    ...but I'll play along. the application offers the user some nice graphics to amuse them, I use the Graphics object. In my endeavours, something isn't getting displayed where I expect it to, and I suspect that somewhere I'm accidentally disposing the graphics object. So, like checking for nulls, I want to debug the application and make sure the graphics context is as I expect.
    A bit of a side note, SWT will throw an exception if you try and use a "graphics" type object that has been disposed and has a method called, unsurprisingly enough, isDisposed(). Can you guess what it returns?

  • Bounding box of a Graphic object

    Hi,
    How can we obtain bounding box of the graphic object generated by fill etc.,
    i tried with "pathbbox" it will provide the exact x,y position but iam not able to get the height and width of the object.
    Regards,
    S.Sudhagar

    pathbbox gives the bounding box of the current path (subject to the limitations on curves described). I am not sure why you say you can't get width and height.

  • Get graphics of JTextPane and write into image

    Hi!
    i want to get graphics of textpane including images ,text position font and every thing in it and desiring to write in an image text should be in same alignment too.

    I'd try as follows:
    1. Create a BufferedImage.
    2. Pass the graphics object of this BufferedImage to the paint() method of the respective text pane.

  • Scroll the document window to a specified graphic object

    Hi,
    anyone knows  a way to scroll the document window to a specified graphic object?
    I've tried with F_ApiScrollToText() function, but it works only with object containing text, and a graphic object ( like a line) doesn't contain text...
    Thanks in advance.

    Hi Stemen82,
    I have dealt with this in the past and found it to be a bit complex. I've pasted below the functions I came up with to do it. Note that:
    - I'm not sure that it works in all cases. Because there is no direct FDK function to do this, you really have to monkey around with things to get it done.
    - The code I've pasted should handle both anchored frames and graphic objects, including "floating" graphics. Anchored frames are actually a bit more straightforward because you can get the text location of the anchor.
    - All the comments in the code are "notes to self." That is, I didn't write them for you   However, they should be of some use to you.
    - There may be plenty of other, better ways to do this... this is just what I slapped together to get the basic functionality to work.
    Russ
    //THIS IS REALLY ONLY GOOD FOR ONE LEVEL OF NESTING,
    // ie, one graphic in one anchored frame, in a text frame.
    // No testing or implementation for anything else at this point.
    //If you don't know whether the object is a graphic or an anchored
    //frame, you can send it as the graphic ID and the function will
    //figure it out.
    // So, either send a graphic ID as graphicId,
    // a frame ID as graphicId, or both graphic and frame IDs.
    // Don't sent just a frame ID as frameID.
    VoidT ws_SelectAndScrollToGraphic(F_ObjHandleT docId,
                                      F_ObjHandleT graphicId,
                                      F_ObjHandleT frameId)
      F_ObjHandleT aFrameId = 0,
        textFrameId,
        graphicPageId,
        currentPageId,
        tempGraphicId;
      IntT objectType,
        alreadySelected = False;
      F_TextRangeT tr;
      if(!docId || (!graphicId && !frameId)) return;
      //let's get the page. We might need it for scrolling and
      //maybe to switch to the correct page type
      graphicPageId = ws_GetPageForGraphic(docId, graphicId);
      //So far, two possibilities here, either an anchored frame somewhere in the object hierarchy or not.
      //If there is no anchored frame, we have to guess based on pages and paragraps.  If there is one,
      //we can jump to the anchor.
      //let's start by looking for an anchored frame if one was not sent
      if(graphicId && !frameId)
        objectType = F_ApiGetObjectType(docId, graphicId);
        //if we actually got an anchored frame, we will store the ID.
        if(objectType == FO_AFrame)
          aFrameId = graphicId;
        //otherwise, let's look above to see if there is an anchored frame
        else
          aFrameId = F_ApiGetId(docId, graphicId, FP_FrameParent);
          objectType = F_ApiGetObjectType(docId, aFrameId);
          if(objectType != FO_AFrame)
            aFrameId = 0;
      //at this point, if we have an anchored frame, scroll to it
      if(aFrameId)
        //let's switch to the appropriate page type, only if necessary
        //we'll do that by simply switching to the first page of that
        //type in the doc before the scroll action
        currentPageId = F_ApiGetId(FV_SessionId, docId, FP_CurrentPage);
        if(F_ApiGetObjectType(docId, graphicPageId) != F_ApiGetObjectType(docId, currentPageId))
          if(F_ApiGetObjectType(docId, graphicPageId) == FO_MasterPage)
            currentPageId = F_ApiGetId(FV_SessionId, docId, FP_FirstMasterPageInDoc);
          else if(F_ApiGetObjectType(docId, graphicPageId) == FO_RefPage)
            currentPageId = F_ApiGetId(FV_SessionId, docId, FP_FirstRefPageInDoc);
          else
            currentPageId = F_ApiGetId(FV_SessionId, docId, FP_FirstBodyPageInDoc);
          F_ApiSetId(FV_SessionId, docId, FP_CurrentPage, currentPageId);
        tr.beg = tr.end = F_ApiGetTextLoc(docId, aFrameId, FP_TextLoc);
        F_ApiScrollToText(docId, &tr);
      //if no anchored frame (ie, just a floating graphic),
      //let's finangle with some paragraphs and pages and try our
      //best. There might be a better way.
      else
        // We have the page that the graphic is on, let's at least jump
        // to that page, maybe we can get a little closer later
        F_ApiSetId(FV_SessionId, docId, FP_CurrentPage, graphicPageId);
        //get the parent frame of the graphic which is hopefully a text frame
        textFrameId = F_ApiGetId(docId, graphicId, FP_FrameParent);
        //let's see if we can find a paragraph and scroll to it.
        tr.beg.objId = tr.end.objId =
          F_ApiGetId(docId, textFrameId, FP_FirstPgf);
        F_ApiScrollToText(docId, &tr);
      //now, let's do the selection. We'll unselect everything
      //that is selected, unless our graphic is already selected.
      tempGraphicId = F_ApiGetId(FV_SessionId, docId, FP_FirstSelectedGraphicInDoc);
      while(tempGraphicId)
        if(tempGraphicId == graphicId || tempGraphicId == frameId)
          alreadySelected = True;
        else
          F_ApiSetInt(docId, tempGraphicId, FP_GraphicIsSelected, False);
        tempGraphicId = F_ApiGetId(docId, tempGraphicId, FP_NextSelectedGraphicInDoc);
      if(!alreadySelected)
        if(graphicId)
          F_ApiSetInt(docId, graphicId, FP_GraphicIsSelected, True);
        else
          F_ApiSetInt(docId, frameId, FP_GraphicIsSelected, True);
    //Returns the ID of the page that the graphic is on.
    F_ObjHandleT ws_GetPageForGraphic(F_ObjHandleT docId,
                                      F_ObjHandleT graphicId)
      F_ObjHandleT tempGraphicId = 0,
        pageId = 0;
      while(graphicId)
        tempGraphicId = graphicId;
        graphicId = F_ApiGetId(docId, graphicId, FP_FrameParent);
      if(tempGraphicId)
        pageId = F_ApiGetId(docId, tempGraphicId, FP_PageFramePage);
      return pageId;

Maybe you are looking for

  • ITunes 11 has no text!

    One of my computers is running Windows XP.  I installed iTunes 11 the other day, and there's no text anywhere. See the images for what I'm talking about. I can't really do much of anything because of this bug.   This is the computer I use for putting

  • How to load objects in web application context during oc4j startup?

    Hi How I can put some objects in application context during oc4j application startup? I'm using oracle as10g j2ee and web cache edition. Thanks

  • Settlement rule in production orders

    Hi All, Is there any report by which I can get list of production order numbers & the details of the settlement rule maintained in that order.? Regards, MHP

  • Collection class comparation

    Dear all, Could you tell me the performance benmark comparation between the collection class (List, Map, Set, Queue, and also class in java.util.concurrent package...) Could you give me when to use one class? Thank a lot for support. Best regards, VK

  • My screen goes black and computer freezes.  I know this is a software based problem.  Any suggestions?

    About a month ago I installed an Intego software package on my computer.  After it was installed my computer began to randomly freeze.  The freezing would start with the screen going black and then fans spinning up.  Closing the screen didn't help.