Drawing 2D graphics with no frame or no panel ?

Hi,
I would like to know if it is possible to draw 2D graphics directly over the OS(windows2002) ? like drawing a rectangle over the desktop without any JPanel or JFrame.
cheers,
sletourne

It is possible, I've done it ;-)
import java.awt.*;
import java.awt.event.*;
public class JustSomething implements WindowListener
     public static void main(String args[])
          new JustSomething();
     public JustSomething()
          Frame winf = new Frame();
          winf.setLocation(2000,2000);
          winf.add(new java.awt.Label("If you see this you have a mighty big screen"));
          Window win = new Window(winf);          
          win.setSize(width,height);
          winf.addWindowListener(this);
     public void windowOpened(WindowEvent windowevent){}
     public void windowClosing(WindowEvent windowevent){}
     public void windowClosed(WindowEvent windowevent){}
     public void windowIconified(WindowEvent windowevent){}
     public void windowDeiconified(WindowEvent windowevent){}
     public void windowActivated(WindowEvent windowevent){}
     public void windowDeactivated(WindowEvent windowevent){}

Similar Messages

  • Draw a square with the cursor

    i would like to draw a square with the movement of the coursor, while its left button is clicked and the cursor is over an image.
    when i leave of pushing the right button the square have to dissapear.
    if you don't understand, it's the same in windows when you click the left button and square appears.
    My question is how can i do this?
    thanks

    Not sure I completely understand the question, but maybe this will give you an idea:
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class DrawSquare extends JPanel
         Point startPoint = null;
         Point endPoint = null;
         public DrawSquare()
              setPreferredSize(new Dimension(500,500));
              MyMouseListener ml = new MyMouseListener();
              addMouseListener(ml);
              addMouseMotionListener(ml);
              setBackground(Color.white);
         public void paintComponent(Graphics g)
              // automatically called when repaint
              super.paintComponent(g);
              g.setColor(Color.black);
              if (startPoint != null && endPoint != null)
                   // draw the current dragged line
                   int x = Math.min(startPoint.x, endPoint.x);
                   int y = Math.min(startPoint.y, endPoint.y);
                   int width = Math.abs(endPoint.x - startPoint.x);
                   int height = Math.abs(endPoint.y - startPoint.y);
                   g.drawRect(x, y, width, height);
         class MyMouseListener extends MouseInputAdapter
              public void mousePressed(MouseEvent e)
                   if (SwingUtilities.isLeftMouseButton(e))
                        startPoint = e.getPoint();
                        repaint();
              public void mouseReleased(MouseEvent e)
                   if (SwingUtilities.isLeftMouseButton(e))
                        startPoint = null;
                        endPoint = null;
    //                    repaint();
              public void mouseDragged(MouseEvent e)
                   if (SwingUtilities.isLeftMouseButton(e))
                        endPoint = e.getPoint();
                        repaint();
         public static void main(String[] args)
              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
              DrawSquare d = new DrawSquare();
              frame.getContentPane().add( d );
              frame.pack();
              frame.setVisible(true);
    }

  • Drawing 2D figures with Java (currently using GTK+)

    Hello everyone :)
    I am currently working on a college project which requires me to develop a graphical interface for a text based software and to draw 2-D drawings (basically frames of buildings) by reading data stored in formatted text files.
    Earlier on, I was working using GTK+, but the fact is that my program has to work on several different PCs with different OS and hence portability is a big concern. So, I wanted to ask if I could draw good enough 2D drawings using Java? Basically, I want to know the comparison between the drawings possible by GTK+ and Java. I know that interface won't be a problem with Java :)
    Also, is the learning curve for drawing steep in Java? I am a bit pressed for time as I spent a lot of time with GTK+ and GTKMM

    Thanks for your reply, but my main purpose was to have to some sort of comparison between the capabilities of Java 2D API and GTK+/GTKMM. I don't want a detailed answer, just a brief one.

  • Drawing 2D Graphics in the center of a JPanel

    Hi,
    Below is my GUI. The basic idea is, I want this to create a neat UI on any machine with any monitor resolution settings. Because I dont really know what will be the resolution of the target machine, I do not perform a setPreferred size on any component. I have several problems here.
    1. My DiagramPanel.paintComponent method relies on the Panel's preferred size to draw a rectangle in the center of the panel. When a panel is layed out using BorderLayout, it expands it to fit the space. So is there some method I can use to know, what space the component panel is occupying (its dimension) ?
    2. Also, when the frame is maximized or resized, the DiagramPanel's dimension changes. So I want to be able to redraw the diagram in the new center position. How can I do this ?
    4. I am using the Frame size to be the screen dimension and set it to be maximized. So when I try to restore the window, it takes up the whole screen even the space including the windows taskbar. Is there someway to get the screen dimension leaving out the space for the taskbar ?
    3. I dont set the DividerLocation of the contentPane because, I want it to be set automatically based on the contents of the leftPanel. But when i print out the dividerLocation after creating the UI, it prints -1. How can I get the current divider location then ?
    import java.awt.BorderLayout;
    import java.awt.Button;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.LayoutManager;
    import java.awt.Toolkit;
    import java.awt.Graphics;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JSplitPane;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextArea;
    @SuppressWarnings("serial")
    public class MainFrame extends JFrame {
    public MainFrame() {
    createAndShowGUI();
    private void createAndShowGUI() {
    initMainFrame();
    initMenus();
    initPanels();
    initContentPane();
    setVisible(true);
    System.out.println("Divider location "+ contentPane.getDividerLocation());
    private void initMainFrame() {
    setTitle("Main Frame");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setState(JFrame.NORMAL);
    //GETS SCREEN SIZE
    Dimension screen_Dimension = Toolkit.getDefaultToolkit().getScreenSize();
    setSize(screen_Dimension.width, screen_Dimension.height);
    setExtendedState(MAXIMIZED_BOTH);
    private void initContentPane() {
    getContentPane().add(contentPane);
    contentPane.setEnabled(false); / *prevent the divider location from being moved* /
    contentPane.setLeftComponent(leftpanel);
    contentPane.setRightComponent(rightpanel);
    contentPane.setOpaque(true);
    private void initMenus() {
    exitMenu.setActionCommand(EXIT_COMMAND);
    file.add(exitMenu);
    menub.add(file);
    setJMenuBar(menub);
    private void initPanels() {
    initLeftPanel();
    initRightPanel();
    private void initLeftPanel() {
    leftpanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    leftpanel.add(new Button("Click"));
    private void initRightPanel() {
    LayoutManager border = new BorderLayout();
    rightTab.setLayout(border);
    scrollingDiagram = new JScrollPane(diagramPanel);
    diagramDescriptionPanel.setLayout(new BorderLayout());
    diagramDescriptionPanel.add(diagDescTextArea, BorderLayout.CENTER);
    rightTab.add(scrollingDiagram, BorderLayout.CENTER);
    rightTab.add(diagramDescriptionPanel, BorderLayout.SOUTH);
    rightpanel.addTab("Right Tab", rightTab);
    public static void main(String args[]) {
    try {
    new MainFrame();
    } catch (Exception e) {
    e.printStackTrace();
    System.exit(0);
    private JSplitPane contentPane = new JSplitPane();
    private JMenuBar menub = new JMenuBar();
    private JMenu file = new JMenu("File");
    private JMenuItem exitMenu = new JMenuItem("Exit");
    private JPanel leftpanel = new JPanel();
    private JTabbedPane rightpanel = new JTabbedPane();
    private JPanel rightTab = new JPanel();
    private JScrollPane scrollingDiagram;
    private DiagramPanel diagramPanel = new DiagramPanel();
    private JPanel diagramDescriptionPanel = new JPanel();
    private JTextArea diagDescTextArea = new JTextArea(18, 45);
    public static final String EXIT_COMMAND = "Exit";
    @SuppressWarnings("serial")
    class DiagramPanel extends JPanel{
    public static int RECT_WIDTH = 100;
    public static int RECT_HEIGHT = 75;
    public void paintComponent(Graphics g) {
    super.paintComponents(g);
    Coordinates centerOfPanel = getCenterCoordinates();
    g.drawRoundRect(centerOfPanel.x, centerOfPanel.y, RECT_WIDTH, RECT_HEIGHT, 10, 10);
    public Coordinates getCenterCoordinates() {
    Dimension panelDimension = getPreferredSize();
    int x = (panelDimension.width - RECT_WIDTH) / 2;
    int y = (panelDimension.width - RECT_HEIGHT) / 2;
    return new Coordinates(x,y);
    class Coordinates {
    int x;
    int y;
    Coordinates(int x, int y) {
    this.x = x;
    this.y = y;

    Hi,
    The getSize worked perfectly for me. But what I tried doing now is that, instead of just the simple centering of the rectangle, i did this
    1. When the dimension of the rectangle is smaller than the Panel.getSize(), do centering as usual
    2. else when the rectangle is bigger, say because its width was longer than Panel.getSize().getWidth(), I center the rectangle only on its Height, and set the preferred size of the Panel to (rectangle.getWidth(), panel.getSize().getHeight()). And I call revalidate, so that the scrollbars appear.
    Problem im running into now is that, once I do a setPreferredSize, everytime I use a getSize later on, i always get the same size. But what I want to see is that, when the rectangle can fit in the panel, i want it centered without any scrollbars, but when it cannot fit on the width, i want it to appear centered on height, but have a horizontal scroll bar.
    I'd be really grateful, if you could help me with this.
    Here is the code
    public void paintComponent(Graphics g) {
              super.paintComponents(g);
              Coordinates centerOfPanel = getCenterCoordinates();
              g.drawRoundRect(centerOfPanel.x, centerOfPanel.y, RECT_WIDTH, RECT_HEIGHT, 10, 10);
              //preferredSize might have changed, call revalidate
              revalidate();
    public static final int PANEL_MARGIN = 50;
    public Coordinates getCenterCoordinates() {
              setPreferredSize(null);
              Dimension panelDimension = getSize();
              Dimension myPreferredSize = new Dimension();
              if (panelDimension.width > RECT_WIDTH)
                   myPreferredSize.width = panelDimension.width;
              else
                   myPreferredSize.width = RECT_WIDTH + 2 * PANEL_MARGIN; // MARGIN on left end and right end
              if (panelDimension.height > RECT_HEIGHT)
                   myPreferredSize.height = panelDimension.height;
              else
                   myPreferredSize.height = RECT_HEIGHT + 2 * PANEL_MARGIN; // MARGIN on top and bottom
              System.out.println("Panel size is " + getSize());
              setPreferredSize(myPreferredSize);
              System.out.println("Preferred size is " + myPreferredSize);
              //center of the panel.
              int x = (myPreferredSize.width - RECT_WIDTH) / 2;
              int y = (myPreferredSize.height - RECT_HEIGHT) / 2;
              return new Coordinates(x,y);
         }

  • Move graphics with text--but not inline--in PM...??

    Hello, is there a way in PageMaker to move graphics with text but not inline? I ask because right now I see two options for graphics:
    --inline, so you cannot place the graphic exactly where you want AND the text only flows way above or below--but not next to--the graphic
    or
    --independent so you can place the graphic exactly where you want and the text DOES flow right next to the graphic, but then the graphic doesn't move with the text
    I'd like to be able to place graphics exactly where I want AND have them move with the text, like the "Move object with text" option in Word.
    thank you!
    L

    well it has been a while since i used PageMaker so i didn't realize it was "dead."
    though i'm not surprised and am kind of glad. i was hired into a new job recently
    to work on a department newsletter, and i'm trying to find a good authoring program
    within our budget. right now the newsletter is in Word but we've had a lot of problems
    with Word so i'm seeking an alternate solution. i'd like Frame but again there isn't
    enough money in the budget. i need a good option that is $500 or less...i'm trying Publisher
    now too but not enough functionality...

  • I have a graphic with a hyperlink in an Outlook email. When I open on it on my iPhone I get the option to email, save, tweet, FB, etc. The text hyerlinks in the email open properly.  Can anyone help?

    I am sending an email from Outlook.  It has a graphic with a hyperlink and it has text with hyperlinks.  When I open the email on my iphone, the text hyperlinks open properly.  The graphic hyperlink gives the options to email, tweet, FB, print, copy, etc.  Can anyone help me correct this so that the graphic links opens in the website it's linked to?  Thank you.

    Try checking the hyperlink for the image in MS Outlook.
    Select image in signature, then click "Insert Hyperlink" image to the far right of Edit signature toolbar.
    Click "Target Frame" button.
    Select "New Window", then "OK".
    After doing this, it solved my problem.

  • Project will not render with 'I-Frame only MPEG'

    Hey Adobe, I am posting this at your request.    
    I previously used to have an old Intel Core2 chip system.
    I upgraded this so that my video editing life would be faster.  I have a new motherboard, with a new intel I7-4770 @ 3.5Ghz chip. same memory (16Gb-1600), graphics card, hard disk, DVD drive, etc..
    On the Core2 system, video projects which I worked on all worked fine. I mainly use a Sony Z5 to shoot video which creates .M2T files.
    On my old system, running Premiere CC it ALL WORKED - no problems, but on the new build, it crashes EVERYTIME i try to render, with 'Error Compiling Movie - Unknown Error'
    Having spent FOUR hours on the phone to your tech supports in India, they came up with a workaround. I stress - it's a workaround, not a solution.
    They found that if i changed the sequence to be 'Custom' and then selected 'Microsoft AVI' (and any Codec, doesn't matter which) as the Preview File Format  instead of 'i-Frame Only MPEG' then yes - it renders.
    The tech told me that this was because 'M2T' files were fussy, and needed to be treated like this.
    WRONG!
    if this *needed* to be the case, then why did it work previously on my old system without any problem?
    Also, if I take a project that crashes on my desktop PC, and copy it over onto my laptop, de-activate Premiere on my desktop and activate on my laptop and run in on there .. IT RENDERS FINE, using the 'I-Frame Only MPEG' setting.
    Also, i shot some video with a Nikon D5100 which produces full HD .MOV clips, *AND THE SAME PROBLEM STILL OCCURS* when rendering on my desktop PC, and only renders when i switch the Preview File Format to be 'Microsoft AVI - so it's not related to the .M2T video file type.    
    So I can render stuff, but ultimately it's a workaround and not a solution, as when I am finished with a project, and want to archive it off I do so by exporting and choosing 'Match Sequence Settings', with with Microsoft AVI selected, it wants to therefore obviously export it as an AVI, which i do not want - I want to export it as 25mbps MPEG which is the original quality/format that it was shot at.  When i try and do this with 'i-Frame Only MPEG' selected as the sequence type - you've guessed it, Media Encoder crashes
    So.  Why does i-Frame Only MPEG work on one machine (my laptop), but on my main machine (desktop) which i want to use, it doesn't? What piece of software/codec/file am I missing?
    - i have installed from clean build of Windows
    - i have deactivated and reactived Premiere CC
    - i have uninstalled Premiere CC and reinstalled it
    - i have uninstalled all Cloud CC programs and reinstalled them
    - I have run CC cleaner too
    - I have the latest video drivers for my graphics card (it is the same graphics card that worked just fine on my old system anyway, so is not the issue)
    - I have full Windows/Admin permissions. it is not a permissions problem
    please don't suggest any of those options.  None of them work.  I need someone who understands your software and knows what i-Frame only MPEG is to be able to tell me why it isn't working on my system.  I am now past the point of anger (because i have lost several days worth of worktime - and thus money) and being upset (because it's massively frustrating when somthing that previously worked now doesn't), and am now just at the point of being bewildered that no one there can seem to tell me what is going on here, and how to solve it.
    Many thanks,
    Geoff.

    I have to put in my 2 cents...and first of all I'm sorry things are happening that are not FANTASTIC results... etc... but there may be ways to make things better... but this stuff is complicated and extremely computer intensive ( math stuff with cpu and ram and stuff ) .. so the platform is very critical to best results.. not just the software.
    There's books on compression and how that stuff works ( lossless or not ) and it's all about changes from frame to frame and how to best make file size smaller while keeping every single pixel perfect in each frame... and this is unfortunately not standardized on planet earth. Different companies make up what they can to sell cameras and recording medium and so on..  there are some standards ( for broadcast and movies etc ) cause at some point some groups have to deal with delivery to PEOPLE to watch stuff.. and have decent quality to watch...
    In general this is very complicated and full of problems cause there is no single work flow , and probably never will be .
    What Jeff is talking about ( I think ) is that during the process of a computer program interpreting images ( frame by frame ) those pixels that have not changed a lot are described in a line of code by the software that says, " This stuff has not changed much if at all ".  Some stuff from one frame to the next one DID change a lot ( someone walking or someone running.. the running changes more fast ) .. and so lines of code say ,  " this stuff changed a LOT "....
    During the process of the software to determine what changed and how MUCH changed.. is complicated.. cause the program basically looks at frame A and then Frame F and notes the changes of pixels... and THEN ( as if that wasn't complicated enough ) the program then goes BACK  to frame A and then ahead to frame J ... so now it has expanded it's look at what changes have occurred...
    Now the ' CODEC " ( the specific codec used by the program you are running , like CC or avid or FCP ) is going to make it's best GUESS as to what really changed that matters the MOST to the image...so you basically get a nice image from A to J ..... but it is now compressed and taking up less room on your hard drive and ram etc....cause it is interpreting the image changes... and so on...
    So if you had every single frame without any guess work and no compression to save space cause those pixels did not change between A and J .... you would have HUGE FILES .... and no benefit in terms of being able to edit anything on a little home desktop computer... even if you have a really powerful one.. it is not going to be good enough to do that stuff....
    It would be unfair to say that adobe isn't doing the best they can to accomodate all the camera manufacturers " codecs " and give the best results they can , with a million different computer platforms and hardware out there you can buy off the shelf ....
    The I frames and B frames and other frames have to do with the " guessing game " of changes in pixels, changes with every " action " in those ranges of frames, and is very complicated... but there are books about it and what standards exist can be researched and studied if you're into that stuff....
    I am an idiot about this stuff but the main thing is dont give up.. and just try to be patient when things dont work out like you thought they would, and figure out what is going on so you can make things work the way you want...
    and good luck !

  • Draw animated circle with brush tool in Flash

    Hello all,
    I need to make a circle with a brush tool so that it looks like a child draws it. If I make a dot with the brush tool on the first frame and a circle on the 15th frame and then create shape tween between those frames it looks stupid, like the circle grows itself.
    Is there any possibility of making such a thing except for drawing it per frame?
    Thanks
    Julia  

    I'm just asking what is the method to draw a circle with a brush that you can see it animated - I mean the process of drawing. For now the only thing I know is to draw every small piece of it frame by frame but I suppose there is a better method.

  • Drawing a box with now fill and an outline

    I know this is simple, but I it's driving me crazy. Using the rectangle tool how do you draw a box with: an outline and no fill, and an outline with a different color fill. thanks

    public class Flags3 extends JFrame {
        public Flags3() {
            setContentPane( new JPanel() {
                public void paintComponent(Graphics g) {
                    int w = getWidth();
                    int h = getHeight();
                    int x = 0;
                    int y = 0;
                    System.out.println("Width:"+getWidth()+" Height: "+getHeight());
                    for (int i=0; i<100; i++) {
                        Color newGrey = Color.getHSBColor(150, 0, i/100.0f);
                        g.setColor(newGrey);
                        g.fillRect(0, (h/100)*i, w, (h/100));
            Dimension size = new Dimension(800, 600);
            getContentPane().setPreferredSize(size);
            getContentPane().setMinimumSize(size);
            getContentPane().setMaximumSize(size);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            pack();
            setVisible(true);
        public static void main(String[] args) {
            new Flags3();
    }I wrote this mainly to make sure I wasn't giving you bad info, but I also improved your paint method a little bit. It's a JFrame instead of a JApplet, so you'll have to make some changes, but it gives the full range of black to white (although it doesn't include full brightness white, the B value only goes to .99).

  • I have my macbook pro 17" 2.5 Q.C. i7,750GB HDD 5400rpm, 4gb ram, amd radeon 1gb dedicated graphics with intel hd graphics 3000,antiglare screen when i turned on my laptop and see the specs is not showing the 1gb graph. only 512mb.

    i have my macbook pro 17" 2.5 Quad. Core. i7,750GB HDD 5400rpm, 4gb ram, amd radeon 1gb dedicated graphics with intel hd graphics 3000,antiglare screen when i turned on my laptop and see the specs is not showing the 1gb graph. only 512mb is there anybody out there have the same problem please how can i know or is there any other way to be sure what's the real capacity of my graphics?take note this is brand new late 2011 model made to customize MD311 with anti glare screen...

    I have the same machine, except it's running the blessed fast Snow Kitty,
    "when I turn on my laptop and see the specs is not showing the 1gb graph, only 512mb is there"
    What specs are you refering about?
    Hold the command shift and 4 keys down, draw a box around what your seeing and upload the desktop image in your post response here.

  • EPS Graphic with transparent bkgd placed over shape: IDCS3

    In Photoshop CS3 I created a graphic of a basketball player and masked him out. I then deleted the mask, leaving me with just the player. I now have a document that is 8x10", 300 dpi, with a transparent background. I flattened it and saved it as a Photoshop EPS.
    In InDesign CS3 I created a shape layer.
    I then created a graphics frame and placed my graphic with transparent bkgd in it.
    I arranged the layers so that my graphics layer is directly above my shape layer.
    Why isn't the background of the graphics layer transparent? It does not let the shape show through.
    I tried this technique:
    Object>Clipping Path>Options>Detect Edges = This is roughly what I want, but the edges are ragged.
    What is this technique called that I am trying to perform? I can't decide on the vocab. to use to navigate through the help menus or forum topics here.
    Thank you.

    ^ Just a quick note on #2 that transparency *effects* (as in 50% opacity) are not supported. However, simple background transparency should be.
    The Photoshop trip is probably your culprit as noted by OldBob, but whenever you work with EPS, you should also set your import options for EPS graphics to "Raster preview from postscript" (or whatever the "from postscript" option is called). Without that option, drop shadows will generate around the bounding box not the shape of the EPS object. Not sure whether the background will be correctly transparent either.

  • How to draw a bar with Gradient Color ?

    Hi,
    How to draw a bar with Gradient Color ? I see
    in Java Help about GradientPaint, maybe this
    can help ?
    Thanks in advance,
    Michael

    Try to use this in you paint method :
    public void paint(Graphics g)
    Graphics2D g2D = (Graphics2D) g;
    // Get the height & width
    int width = this.getWidth();
    int height = this.getHeight();
    // Create the gradient paint
    gradientPaint = new GradientPaint(0,0, Color.blue, width, height, Color.red);
    g2D.setPaint(gradientPaint);
    g2D.fillRect(0,0, width, height);

  • Draw a box with a stroke, then invert to a fill, causes resizing using the invisible stroke

    ID-CS3
    Draw a box with a stroke, then invert to a fill, causes resizing using the invisible stroke. Is there a way to fix and have the graphic resize using the fill size without redrawing the shape? Something like expand appearance?
    I'm not looking for a workaround or to redraw the shape. This problem description was used to present the simplest explanation to recreate the problem.

    I'm not sure I understand your question/problem, but if I make a box with an outside stroke and assign a stroke color, then... invert the stroke and fill, the stroke gets redrawn as a centered stroke --- it is no longer an outside stroke.
    This seems to me to be incorrect behavior, but it's more likely I just don't understand *why* this happens.
    Tad

  • How to draw an arc with width more than 1

    Hi!
    I got the following problem:
    I need to draw an arc under JDK1.1.
    It works fine, but I need to be able to adjust the
    thickness. I didn't find anything in the graphics-
    class.
    Who knows?
    Valentin

    I think you're just gunna have to draw multiple arcs with start/end points that are pixel increments away from each other. In Java2 you could use set the "stroke" with Java 2D, but that's not availale in 1.1.

  • [JS] CS4 How to position a graphic within a Frame

    I have a JS script that I am converting from CS3 to CS4 and I am finding that the behaviour for positioning a graphic within a frame has changed.  I have code that sets the geometric bounds of a graphic to a negitave value within the frame, within CS3 this works great.  However using the same code on CS4 to set the geometric bounds does not produce the same result.  The graphic is always placed at 0,0 and it ignores the negitive top and left values supplied.
    Does anyone know what has changed with the geometric bounds of a graphic within a recrangle frame?  How would I set the position of the graphic within the frame since setting the geometric bounds does not seem to work any longer.
    Thanks,
    Sheldon

    I have yet to determine why the behavior is different from CS3 to CS4 and how to correct the positioning within CS4.  To help explain the problem further I have included a sample script which demonstrates the problem.  I have run the script on both CS3 and CS4 and included screen shots of the results when the resulting INDD file is opened.  Could someone help explain why the position of the image is wrong in CS4 and what I can do to correct the problem?
    Here is the sample script ...
    for(i=app.documents.count()-1;i>=0;i--){app.documents.item(i).close();}
    app.textPreferences.useOpticalSize = false;
    app.textPreferences.typographersQuotes = false;
    app.textImportPreferences.useTypographersQuotes = false;
    app.taggedTextImportPreferences.useTypographersQuotes = false;
    app.pasteboardPreferences.minimumSpaceAboveAndBelow = "300p";
    app.textFramePreferences.firstBaselineOffset = FirstBaseline.ascentOffset;
    app.colorSettings.cmsSettingsPath = File("C:\\etc\\Friesens_Yearbook_Custom_Color_Settings.csf");
    app.marginPreferences.top = '24pt';
    app.marginPreferences.bottom = '48pt';
    app.marginPreferences.left = '36pt';
    app.marginPreferences.right = '36pt';
    var doc = app.documents.add();
    doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
    doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
    doc.documentPreferences.pageHeight = 792;
    doc.documentPreferences.pageWidth = 612;
    doc.documentPreferences.pageOrientation = PageOrientation.portrait;
    doc.documentPreferences.pagesPerDocument = 2;
    doc.documentPreferences.facingPages = true;
    doc.sections.firstItem().continueNumbering = false;
    doc.sections.firstItem().pageNumberStart = 2;
    var pg = doc.pages.item(0);
    var frm = pg.rectangles.add();
    frm.geometricBounds = ['200.5pt','200.2pt','447.8551pt','415.5206pt'];
    try{frm.place (File('c:\\test.jpg'), false);}catch(err){};
    if(frm.graphics.count() > 0) {frm.graphics.firstItem().geometricBounds = [frm.geometricBounds[0]-147, frm.geometricBounds[1]-49, 407.04+frm.geometricBounds[0]-147, 271.68+frm.geometricBounds[1]-49];};
    var objStyle = doc.objectStyles.add();
    objStyle.enableStroke= false;
    objStyle.transparencySettings.blendingSettings.opacity = 100;
    frm.applyObjectStyle(objStyle, true, true);
    frm.rotationAngle = 59;
    doc.label = '824203.indd';
    doc.packageForPrint('c:\\test\\824203\\', true, true, true, true, true, false, '', false, false);
    for(i=app.documents.count()-1;i>=0;i--){app.documents.item(i).close();}
    The line that I highlighted is the one that adjusts the images position within its frame.  It uses a formula to determine the exact position relative to the containing frames position.  This is why you will see the calculations to determine the geometric bounds.
    Here is the result of the script using InDesign Server CS3, notice the position of the image based on the 'Direct Selection Tool' highlight area (this is the desired result):
    And, here is the result after running the script against InDesign Server CS4:
    As you can see the Image is placed at the lot left corrner of the frame which is wrong.  Any insight into the diffrences in the behavior would be appreciated.
    Thanks

Maybe you are looking for

  • Count Days in month

    Hi Team members, we are working on a budgeting application and stuck on below Research, please assist/advise is there any built-in Function to count Days in a Month which we can use or a work around . Requirement: To calculate budgeted Expenses per m

  • PAR iView: Only one instance need to be opened by a user in a portal sessio

    Hi All,   Please  let us know how to enforce only one instance of PAR iView is opened at a given time for a user. Regards, Gangadharayya. For Eg: let us say We have created PAR iview <b>A</b>. Once user <b>U</b> logs in to portal and opens A by clcki

  • My phione number has been allocated to someone els...

    Well - yesterday I got a call from my sister in law saying she had phoned my home number and had been connected to a lady who said this was now her number. I spoke to the lady in question and she stated that she had converetd from Talk Talk to BT yes

  • How to get session.maintain property on server side?

    Is there a way to trap javax.xml.rpc.session.maintain property on the server side in JAX-RPC compliant web service implementation? I would like to know if the client has enabled session.maintain property to true (which false by default). If not, can

  • [b]Managing Active/Passive Cluster.[/b]

    Hi, We are having active passive cluster environment and we are running webMethods on it. The problem we are having is whenever we do any changes we need to do a failover and then do the same task on the passive one as well. Can anybody help how to m