Help setPreferredSize and resizing a frame

Hey,
I have an internal JFrame that contains a JPanel which contains an image. The JPanel is the only compnent of the internal JFrame and must take up the whole of the space in the frame. The image must take up the whole of the Jpanel.
At the moment the image is drawn in the paint component part of the JPanel:
     // draw the racing track
     g.drawImage(track, 0, 0, imageWidth, imageHeight, this);
I set the preferred size of the JPanel so that the JFrame fits exactly around the image. This is to avoid clipping that would occur if i set the frame to the size of the image. This is implemented in the constructor of the JPanel :
// track is the image i am trying to draw
     imageWidth = track.getWidth(this);
     imageHeight = track.getHeight(this);
     setPreferredSize(new Dimension(imageWidth, imageHeight));
In the JInternalFrame I extend I call the pack() method; I believe this is what sets the frame to the right size so that no clipping occurs.
This works fine; the image currently appears with no clipping. However now I want to resize the internal frame. When this happens I want the image to be resized so that it can appear larger or smaller but it must maintain its original proportions.
I have the following event listener in place in the class that creates all of the internal frames :
tFrame.addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent evt) {
tFrameComponentResized(evt);
private void tFrameComponentResized(ComponentEvent evt) {
     trackWidth = tFrame.getWidth();
     trackHeight = tFrame.getHeight();
I am not sure how to continue from here. Any help would be greatly appreciated!!
Thanks Guys (and gals!)
Alex.

I have no idea if this is what you were looking for :import javax.swing.*;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.net.URL;
import java.net.MalformedURLException;
public class ResizableImage extends JPanel {
     private Image theImage;
     public ResizableImage(Image anImage) {
          if (anImage.getWidth(null) == 0) throw new IllegalArgumentException("Image's width is null");
          if (anImage.getHeight(null) == 0) throw new IllegalArgumentException("Image's height is nul");
          theImage = anImage;
     public Dimension getPreferredSize() {
          return new Dimension(theImage.getWidth(null), theImage.getHeight(null));
     protected void paintComponent(Graphics g) {
          super.paintComponents(g);
          Graphics2D g2D = (Graphics2D)g;
          Dimension available = getSize();
          if (available.width * available.height == 0) return;
          Dimension image = new Dimension(theImage.getWidth(null), theImage.getHeight(null));
          if (image.width * image.height == 0) return;
          if (image.equals(available)) {
               g2D.drawImage(theImage, 0, 0, null);
               return;
          double scale;
          if (available.height * image.width < available.width * image.height) {
               scale = (double)available.height / (double)image.height;
          } else {
               scale = (double)available.width / (double)image.width;
          g2D.drawImage(theImage, AffineTransform.getScaleInstance(scale, scale), null);
     public static void main(String[] args) {
          try {
               final JFrame frame = new JFrame("Resizable image");
               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
               URL imageUrl = new URL("http://java.sun.com/docs/books/tutorial/uiswing/components/example-1dot4/images/Bird.gif");
               frame.setContentPane(new ResizableImage(new ImageIcon(imageUrl).getImage()));
               SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                         frame.pack();
                         frame.show();
          } catch (MalformedURLException e) {
               e.printStackTrace();
}

Similar Messages

  • Newbie question: Rotating video and resizing the frame

    Hey guys'n'gals,
    I'm new at doing "advanced" (relative term) editing to video in Adobe Premiere Pro (CS4 version 4.2.1) and was hoping that 1) there's a way to change the output size of a video (IE: 640X480 to 480X640), 2) that someone can please tell me how, and 3) how to  rotate the video that's currently sideways.
    Thanks in advance,
    Brandon

    Brandon,
    I'm not sure that I am following. You say that you have the Video shot vertically, i.e. rotated 90 degrees, but then want to Export to a vertical Aspect Ratio.
    First, you can just choose a Desktop Preset, set the Aspect Ratio to match your footage, and then Export that to a delivery scheme that allows complete control of the Aspect Ratio - obviously not any of the DV/BD formats.
    Now, if you want to Rotate that vertical footage to horizontal, you can use the fixed Effect>Rotate. Note: you will have to now resize your footage to fit into a horizontal Frame Size Aspect Ratio. This would then allow you to Export to a horizontal Aspect Ratio, but I am not sure that this is what you really want in the end.
    Good luck,
    Hunt

  • Help needed in Drag and Drop and  resizing of image icons

    Hi all,
    I'm doing a project on Drag and Drop and resizing of image icons.
    There is one DragContainer in which i have loaded the image icons and i want to drop these image icons on to the DropContainer.
    After Dropping these icons on to the DropContainer i need to resize them.
    I have used the Rectangle object in resizing.
    The problem now i'm facing is when i drag, drop and resize an image icon and when i try to drag, drop a second image icon the first image icon gets erased.
    can any one help me in fixing this error.
    if u want i can provide the source code.
    thanks in advance
    murali

    the major restrictions in its implemented only in
    jdk1.1.Why!

  • Okay so i had an iphone 5.  I backed it up on icloud. Then i got the new iphone 5s i restored ot from icloud from my previous iphone 5.  Now everything works find execept now the games are slowy and drops the frame rate and look choppy. Please help.

    Okay so i had an iphone 5.  I backed it up on icloud. Then i got the new iphone 5s i restored ot from icloud from my previous iphone 5.  Now everything works find execept now the games are slowy and drops the frame rate and look choppy. Then i restarted my iphone 5s as a new device downloaded the same apps even the ones optimized for ios 7 and the games still lag. And i just got my iphone 5s replace.  The funny thing is.  While im playing games and their running choppy and slow and if i take a snap shot inside the phone. They run smooth and HD but just for a few seconds and boom they go back to slow and choppy.  Is it the ios 7 or the iphone 5s it self? Like i said this is my replacement iphone 5s because the other 5s did the same thing. And it was running slowly.

    As far as I know you can't delete the primary email address for an iCloud account.  It's assigned when the account is created.  But your neighbor wouldn't have been able to get into your iCloud account without your Apple ID and password.  Are you sure the account wasn't still on your phone when you gave it to him?
    You could migrate a copy of your data to a new iCloud account but I would still be concerned that someone else was using my old account, which presumably still has your data in it.
    I'm fairly certain that you're going to have to have iCloud support help you sort this one out as they may have the ability to make changes to an existing account that users can't.  Make an appointment with the genius bar at a nearby Apple store and have them take a look at it.  If necessary, they should be able to contact iCloud support for you.

  • Need to global find and scale and resize frame on a linked graphic

    I have a whole set of files that contain multiple instances of an icon set (placed AI file). All of these are formatted to flow in the text as anchored objects with various object styles. I need to make sure that all instances of the placed AI icons are scaled to 30% and that their frames are fit to content. I have a LOT of files and each one has at least 20 of these icons. I thought the Object find and replace would help, but unfortunately it will not let you search for links, and while I can search for the object styles, there's no option to change scale and the fit content options does not have the "fit frame to content" (and doesn't work anyway from the few tests I ran using "fit content proportionally"). 
    Does anyone have any ideas for how I can fix this globally in nearly 500 documents without having to manually select each icon and change the scale and apply the fit frame to content? I've done a handful of files this way, and it's VERY time consuming.

    First make sure this works by duplicating a file and testing.
    Make 1 image the size you need it
    Grep search for
    Find
    ~a
    Change to
    ~C
    if that doesn't work then try ~c (lower case) I can't remember how that works
    If it does work - then you can open 2 documents and choose "All Documents" in the Search field.
    If it's fine on 2 docs - then I'd say go ahead and do the rest.
    I stress to please use a duplicate set of files in case things go bad.

  • HELP PLASE ! JavaBean and Javascript in frames :)

    Hello,
    First please excuse me for my bad english I'm French think you in advance for your patience and your help ! :)
    To resum the problem :
    I have 2 frames, a menu frame and a main frame
    I use a javabean wich is saved in application variable.
    When the pages of main frame use the javabean there is no probleme.
    BUT when menu frame calls pages of main frame it don't restore the javabean, it looks like je page called by menu frame, which operates on the javabean, wasn't called, and the changes I do in this page aren't saved
    Menu frame uses javascript to calls main frame pages so I think the problem is conjonction of frame and javascript.
    But I have no choice because it's volonty of my boss, so please help me ! :)
    More precisly :
    the javabean : NavigationBean
    page frame menu : menu_page.jsp
    main pages which use javabean : pageA.jsp, pageB.jsp, pageC.jsp
    pageA.jsp has reference on pageB.jsp which has reference on pageC.jsp
    Traitement of the javabean NavigationBean in pageA.jsp, pageB.jsp and pageC.jsp :
    <jsp:useBean      id="gestionNavigation"
              class= "NavigationBean"          
              scope="application">                         
    </jsp:useBean>
    <jsp:setProperty      name="gestionNavigation"
                   property="request"
                   value="<%=request%>" />     
    (it needs response and request to run)
    <jsp:setProperty      name="gestionNavigation"
                   property="response"
                   value="<%=response%>" />
    <jsp:setProperty      name="gestionNavigation"
                   property="pageActuelle"
                   value="<%=urlActuelle%>" />
    (it saves in NavigationBean object the url where user is)
    In pageA I clean all NavigationBean so all pages saved are deleted
    if user go DIRECTLY on pageA.jsp, all is ok :
    user go on
         pageA -> pageB -> pageC
    and NavigationBean save
         pageA -> pageB -> pageC
    That's good ! :)
    BUT if after user go on menu frame it's wrong !
    user go on
         pageA -> pageB -> pageC -> menu_page.jsp -> pageA -> pageB
    BUT NavigationBean save
         pageA -> pageB -> pageC -> pageB
    instead of
         pageA -> pageB
    To resume, for NavigationBean when user go directly on main pages there is no problem, but when it uses menu frame it doesn't save that user go on pageA
    I clean NavigationBean on pageA, but instead of this problem it doesn't clean and retrieve old datas
    It looks like that when user uses menu FRAME it uses an old NavigationBean object, but when it go directly on pages of main frame it runs !
    And I use scope application so don't understand, I have tried session scope but no change :(
    I have tried using "response.encondeURL" but no change
    Think you in advance for your help, and good luck from Paris for all New York people ! :)
    David

    It sounds like what might be happening is when the user goes 'back' to the menu, they're not requesting the page from the server. So, they're either getting the old page cached by the browser. Maybe. If you reload the menu page manually, does it work?

  • Need help regarding image scanning from scanner and resizing it...

    Hi,
    I need help regarding scanning of image directly from scanner. Here is the scenario when the person clicks scan button on the webpage should scan the image and resize it and store it in some temp location. Is there any way i can do this. Any Help regarding this would be great!!!
    Thanks,
    Avinash.
    Edited by: Kalakonda on Jul 24, 2009 8:08 AM

    Kalakonda wrote:
    I need help regarding scanning of image directly from scanner. Here is the scenario when the person clicks scan button on the webpage should scan the image and resize it and store it in some temp location. Is there any way i can do this. Any Help regarding this would be great!!!So what you are doing is you have a Scanner (hardware: like an HP flatbed scanner) attached to a server that you want to use as a scanning station? Is this the senario that you are talking about?

  • When I apply smoothing to a clip, it does nothing and the video frame remains static! Please Help!

    When I apply smoothing to a clip, it does nothing and the video frame remains static. As opposed to moving around in order to compensate for my movement, which exposes black edges. That is what I am trying to get. Please help
    These are the steps I follow. Import clip > Library > Behaviours > Motion > Stabilize. I then add the stabilize > go to inspector and change method to smooth and finally, analyze. However, it is not doing anything. My Macbook Pro was recently replaced and this is what I recall doing on my previous one, but it doesnt seem to be working for me. Is there a step im missing or something?
    Thanks for any help!

    Smooth is just going to smooth out a little "jitter" or jerkiness in the footage. Unless there is a lot of camera movement, you won't notice much. If you really want to see Motion go to work, change the Method to Stabilize.
    BTW, once the footage is analyzed, you can make any changes you want to any of the other parameters - you don't have to re-analyze. I recommend Stabilize with Adjust: Position Scale and Rotation and Borders set to Zoom (depending on the quality of the video) — or you might consider adding a mask to the group the stabilized video is in

  • Panel doesn't display properly until I resize the frame

    Hiya folks,
    I'm currently trying to write a simple piece of music notation software. This is my first time using swing beyond a relatively simple JApplet and some dialog stuff. Anywho, I ran into a pretty discouraging issue early on. So far I've got a frame with a menu bar and a toolbar on the bottom border. The toolbar contains a button which should draw a new staff panel containing 11 panels (potentially more) within it, alternating between lines and spaces. Sort of like this:
    import javax.swing.*;
    import java.awt.*;
    public class Staff extends JPanel {
       private static JPanel nsp1,nsp3,nsp5,nsp7,nsp9,nsp11;
       private static JPanel nsp2,nsp4,nsp6,nsp8,nsp10;
       private ImageIcon image= new ImageIcon(this.getClass().getResource( "icons/treble clef.gif"));
        public Staff(){
        setLayout(new GridLayout(11,1));
        add(nsp1= new NoteSpace());
        add(nsp2= new LineSpace());
        add(nsp3= new NoteSpace());
        add(nsp4= new LineSpace());
        add(nsp5= new NoteSpace());
        add(nsp6= new LineSpace());
        add(nsp7= new NoteSpace());
        add(nsp8= new LineSpace());
        add(nsp9= new NoteSpace());
        add(nsp10= new LineSpace());
        add(nsp11= new NoteSpace());
    static class NoteSpace extends JPanel{
        public NoteSpace(){
        setPreferredSize(new Dimension(this.getWidth(),2));
    static class LineSpace extends JPanel{
          public LineSpace(){
          setPreferredSize(new Dimension(this.getWidth(),1));
          public void paint(Graphics g) {
              super.paint(g);
              g.drawLine(0, (int) super.getHeight()/2, (int)super.getWidth(), (int)super.getHeight()/2);
    }Anyway, this panel displays as a tiny box wherein nothing is visible until I resize the frame. Really frustrating. And I have have no idea what the problem might be. Here's the actionlistener:
    jbtcleff.addActionListener(new ActionListener (){
            public void actionPerformed (ActionEvent e){
                staff.setBounds(50,panel.getHeight()/2,panel.getWidth()-50,panel.getHeight()/2);
                panel.add(staff);
                staff.repaint();
            });...which is located in a custom jtoolbar class within the Main class, an extension of JFrame:
    public class Main extends JFrame{
       JMenuBar jmb=new CustomMenuBar();
       JToolBar jtb= new CustomToolBars("ToolBar");
       static boolean isStaff=false;
       static boolean isNote=false;
       static JPanel panel = new JPanel();
       private static Staff staff= new Staff();
        private static Toolkit toolkit= Toolkit.getDefaultToolkit();
       private static Image image=toolkit.getImage("C:/Users/tim/Documents/NetBeansProjects/ISP/src/MusicGUI/icons/treble clef.jpg");
        private static Cursor noteCursor = toolkit.createCustomCursor(image,new Point(0,0),"Image"); 
       public Main (String m) {   
            super(m);
            setJMenuBar(jmb);    
            getContentPane().add(jtb,BorderLayout.SOUTH);       
            panel.setLayout(new CardLayout(60,60));
            getContentPane().add(panel);
    public static void main (String[]args){
            JFrame frame= new Main("Music");
            frame.setSize(800,400);
            frame.setLocationRelativeTo(null);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
            frame.setIconImage(image);
           Sorry for all the code. I'm desperate.
    Thanks!

    Oh my... have you been through the Swing tutorial?
    Let's look at some of your code,
    static class NoteSpace extends JPanel{
        public NoteSpace(){
        setPreferredSize(new Dimension(this.getWidth(),2));
    static class LineSpace extends JPanel{
          public LineSpace(){
          setPreferredSize(new Dimension(this.getWidth(),1));
          public void paint(Graphics g) {
              super.paint(g);
              g.drawLine(0, (int) super.getHeight()/2, (int)super.getWidth(), (int)super.getHeight()/2);
    }Here, NoteSpace and LineSpace are being set to a preferred size of 0x2 pixels, and 0x1 pixels respectfully. If you want them at 0 width, how do you expect them to show? In particular, NoteSpace isn't doing anything special. It's just a panel. Why an inner class? Lastly you should not override paint() for SWING. That's AWT stuff. For Swing, you override paintComponent(Graphics g) .
    Then we have this
    jbtcleff.addActionListener(new ActionListener (){
            public void actionPerformed (ActionEvent e){
                staff.setBounds(50,panel.getHeight()/2,panel.getWidth()-50,panel.getHeight()/2);
                panel.add(staff);
                staff.repaint();
            });I'm not sure what the variable jbtcleff is, but it seems you are adding your Staff panel to "panel" every time a button is pressed.... why? Why not just add it once (outside the action listener) and be done with it. Your panel object has a CardLayout, so I assume you meant to create a new+ staff panel everytime a button is pressed, and then add it to the card layout panel. Even so, setBounds(...) does not seem pertinant to this goal. (In fact, in most situtations the use of setBounds(...) is the antithesis of using layout managers).
    The problem you mentioned though seems to be related to the use of a JPanel (your Staff class) that adds zero-width compontents to a grid array.

  • Adobe consistently crashes when resizing a frame

    I'm helping a company which publish a review every month with InDesign. The entire document is divided into three columns. Only some titles cover the 3 columns. That seems to be these titles which makes Indesign crashing. As soon as I resize a frame just above this kind of title Indesign crash instantly. I thought about paragraph style, links, layers, but all my tests has been uneffective, impossible to find the reason why Indesign crash. Does someone have an idea to help dealing with it ?
    I'm sorry for this incorrect English and hope some will understand my issue.
    Blaise

    The crash report doesn't show me spscifically what's wrong becasue I'm not an expert at reading them, but it does show it's text related.
    To check to see if span/split is used, you would select the paragraph that spanns the columns and check the settings. Yes, it's a pain to go back to the old way, but if youare crashing because of spanned columns it doesn't make a lot of sense to continue with them.
    Other users have reported problems with the span/split feature.

  • Resize of Frame after frame is created

    Hi,
    I have a tabbed pane inside a Frame. When I press one of the tabs I want to resize the Frame.
    Since the tabbed pane is inside the frame I use the following code:
    this.getParent().setSize(640,480); // This does not resize the frame
    this.getParent().resize(640,480); // This does not resize the frame
    I am using Swing.
    What could be wrong or how do I resize the frame after the frame has been created?
    Thanks.

    Hi,
    I guees I might have not told every detail.
    I have a class called TabbedPane that extends JPanel.
    This class then contains a JTabbedPane.
    I then have a JMainFrame that extends Frame that in turn creates a TabbedPane.
    Inside my TabbedPane class I listen to which Tab the user has selected, depending on which Tab I have to resize the Frame. Here is where I can't get it to work.
    if(index == 1) {
    Dimension d = new Dimension(640,480);
    setPreferredSize(d);
    updateUI(); // DOES not work.                              
    } else {
    Dimension d = new Dimension(400,400);
    setPreferredSize(d);
    updateUI();
    Please help :)
    Thanks

  • JFrame decorations and resizing

    I'm creating a simple resizable JFrame with some components. When the user resizes the frame by dragging the decorations, the frame does not resize until the user releases the mouse. For example, if increasing the size of the frame, a gray box extends from the frame until the mouse is released. The entire process looks hideous, since the gray box looks tacky and the frame flickers badly. How do I force the frame to resize the decorations and root pane while the user is dragging?
    This problem is really bugging me. I haven't worked with Swing in some time, so I'm adapting a lot of code from one of my earlier projects. Interestingly enough, my last project's main window resized exactly the way I want! The decorations and root pane adjust with the dragging of the mouse. All day, I've been scouring through my old code to no avail.
    Both programs are running on the same JDK (1.4.2) in Windows XP Home.
    Thanks in advance for any help!

    This code reproduces the problem on my system. As far as I know, this is the standard way to create a custom JFrame.
    import javax.swing.*;
    public class MyFrame extends JFrame {
         public MyFrame() {
              JPanel panel = new JPanel();
              panel.setBorder(BorderFactory.createRaisedBevelBorder());
              getContentPane().add(panel);
         public static void main(String[] args) {
              // JFrame.setDefaultLookAndFeelDecorated(true);
              JFrame frame = new MyFrame();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.pack();
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
    }I'm primarily concerned with the root pane. In this example, the decorations resize as the user drags, since they're drawn by the underlying OS. If I uncomment the look and feel line, then the decorations do not resize with the mouse. In both cases, the root pane does not resize until the user releases the mouse.
    Thanks for your help!

  • Upload and Resize Image not inserting filename in database

    I have a form that I created using the insert record form wizard. One of the fields is a file field and my form enctype is set to multipart/form-data. I then used the upload and resize image behavior and set the parameters. When testing the form the file uploads to the correct directory but no entry is made into the database for that particular field. The other fields are entered into the database just fine. If it helps, here is the code generated before the  tag:
    <br />
    <br /><?php require_once('../../Connections/test.php'); ?>
    <br /><?php<br />// Load the common classes<br />require_once('../../includes/common/KT_common.php');<br /><br />// Load the tNG classes<br />require_once('../../includes/tng/tNG.inc.php');<br /><br />// Make a transaction dispatcher instance<br />$tNGs = new tNG_dispatcher("../../");<br /><br />// Make unified connection variable<br />$conn_test = new KT_connection($test, $database_test);<br /><br />// Start trigger<br />$formValidation = new tNG_FormValidation();<br />$tNGs->prepareValidation($formValidation);<br />// End trigger<br /><br />//start Trigger_ImageUpload trigger<br />//remove this line if you want to edit the code by hand <br />function Trigger_ImageUpload(&$tNG) {<br />  $uploadObj = new tNG_ImageUpload($tNG);<br />  $uploadObj->setFormFieldName("picture");<br />  $uploadObj->setDbFieldName("picture");<br />  $uploadObj->setFolder("../images/");<br />  $uploadObj->setResize("true", 120, 0);<br />  $uploadObj->setMaxSize(1500);<br />  $uploadObj->setAllowedExtensions("gif, jpg, jpe, jpeg, png, bmp");<br />  $uploadObj->setRename("auto");<br />  return $uploadObj->Execute();<br />}<br />//end Trigger_ImageUpload trigger<br /><br />// Make an insert transaction instance<br />$ins_team = new tNG_insert($conn_test);<br />$tNGs->addTransaction($ins_team);<br />// Register triggers<br />$ins_team->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");<br />$ins_team->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);<br />$ins_team->registerTrigger("END", "Trigger_Default_Redirect", 99, "../team.php");<br />$ins_team->registerTrigger("AFTER", "Trigger_ImageUpload", 97);<br />// Add columns<br />$ins_team->setTable("team");<br />$ins_team->addColumn("id", "NUMERIC_TYPE", "POST", "id");<br />$ins_team->addColumn("sort", "NUMERIC_TYPE", "POST", "sort");<br />$ins_team->addColumn("name", "STRING_TYPE", "POST", "name");<br />$ins_team->addColumn("title", "STRING_TYPE", "POST", "title");<br />$ins_team->addColumn("description", "STRING_TYPE", "POST", "description");<br />$ins_team->addColumn("picture", "FILE_TYPE", "FILES", "picture");<br />$ins_team->setPrimaryKey("id", "NUMERIC_TYPE");<br /><br />// Execute all the registered transactions<br />$tNGs->executeTransactions();<br /><br />// Get the transaction recordset<br />$rsteam = $tNGs->getRecordset("team");<br />$row_rsteam = mysql_fetch_assoc($rsteam);<br />$totalRows_rsteam = mysql_num_rows($rsteam);<br />?>

    If the reason is about memory, warning message should be happened when upload the image, because "show thumbnail" means resize at second time, how come you failed to resize the picture that system let it upload succeed at the first time by the same resize process?
    upload procedure
    a.jpg: 2722x1814, 1.2mb
    upload condition: fixed width 330px, 1.5mb
    "upload and resize" a.jpg -> file upload -> "resize engine" -> passed (but not work and no warning message)
    "show thumbnail" a.jpg -> "resize engine" -> failed (not enough memory)
    it doesn't make sense.
    and you miss an important key point, I upload the same picture myself, and resize work, so I said it happened at random, and that's why I am so worried.

  • [CS3][JS] Help with image resizing

    I'm still a newbie of ID scripting.
    I'm using js scripting in Indesign CS3 to make an auto-impaginator and I have a problem with images.
    I charged my contents from an xml set of tables, that I put into a fixed textFrame of the master page.
    Because of the table needs to fill multiple pages, I made a function that keep creating pages and link the textFrames so that the table continues in various pages.
    In this whole process I have some images too, that I need to resize them to fill the cell, because now they pass the parent cell.
    I found a method that looks at the bounds and resizes the image and the rectangle too, but it doesn't work always, because if a image is overflowing, it hasn't any bound and it fails, and this causes other problems in my process, so I would find another method.
    So:
    Is there another way to resize an image on-the-way while importing it? Some xml attribute or preference?
    Or some method that works also if the image is overflowing?

    These forums are pointless. Adobe must believe that other users will cut the mustard. Absolutely a waste of effort for everyone. Adobe should PAY at least a junior developer involved in the projects to monitor and help with these posts. FLEX rules yeah and thousands more do scripting than develop plug ins...
    Come on Adobe, step up your better than this. Customer Service can be free to the customers ... we are not talking about GET IT ALL FREE, talking about buy it and create a community and support it, but then again LAYERS and INDESIGN SECRETS have people who actually want to help users rather than rabbit hole everything.
    Please join hands and SING...

  • How do I allow the user to select and resize the CNiGraph while executing?

    I am writing an application with Measurement Studio and Visual C++ that will allow the user to create graphs on the fly. I need to give them the capability to select a graph and resize it in a manner consistent with most other Windows programs (i.e. resize handles). I have tried various implementations of the CRectTracker class and can get it to work for Microsoft controls, but I can not get it to work with the CNiGraph (the only one I have tried so far). The code runs but I never get the selection box or handles around the control. Is there a way to do this and is there an example anywhere that I can go from? Any help would be appreciated.

    Never mind. I have now found the way to do this.

Maybe you are looking for

  • I have BIS but can't surf, send/receive email, use apps

    i have BB Curve 8520. My BIS was running smoothly (sending and receiving emails real time and surfing the net through BIS), until i noticed when i tried to reply to an email that came in, it won't send. i noticed that it's fluctuating. i was able to

  • Container appearing  in two different colors at same time screenshot attached .

    Hi , I am very much impressed with this site Look , as you can observer that in this the Container is showing in two different colors at the same time as shown in screenshot attached . Please tell me how to achieve this ?? One Part is Loading Adverti

  • Multi-touch unintentional clicks in 10.6.7

    My wife's Multi-touch pad seems to behave as if it is stuck in "click" mode, constantly selecting text and dragging objects so as to make the trackpad completely unusable.     This only started to happen over the past few days, and she cannot remembe

  • BAPI to get the Sales order line item details

    Hi, My program gets Sale sorder and item as the input and I need to fetch all the item (Given item) details for this Sales Order from VBAP. Is there any BAPI to get the item details?

  • Installing Webcam

    Hi all, Im having some problems getting my webcam to work with Arch. As far as I can tell, the webcam is using gspca (on the wiki) it mentions that "This driver does not have V4L1 support." but when I'm trying to take an image, it's using V4L2. I've