Applet size width and height = 100%

Hello All.
I am using the large font in windows. So I’ve change the applet size in formsweb.cfg file to width=100% and height=100%. Now the applet area fills the browser windows when I maximize it. But if I try to resize it using the mouse from the lower right corner. The form will be busy and never respond to any event and staying like this forever.
Is there any one come across the problem?
I am using
Application server 10g (9.0.4)
Form 9i
Client PC (windows 2000)

Ooookay ..... then how come I've got an demo of
someone's applet here that does exactly this, i.e.
draws outside of it's original size ?
Show us the demo.
How might they do it ? (dont really want to decompile
someone else's class file, coz that's rude :-)Maybe someone will do it for you; the impossible has always attracted the human mind.

Similar Messages

  • SWF loader need to load 100% width and height

    Hi,
        I have using dashboard in my application.In which the flex pages are loaded using SWF loader. the swf is not loading 100% when i minimize the browser. actually its loading 100% when the browser is full screen mode. suppose the browser is opened in 75% the swf also gets loaded based on the browser size. but after maxmizing the browser the SWF its not expaned to the actuall size of the browser. could you anybody help me plz..?
    Thanks & Regards
    Muthu

    Hi,
         I have used this code to load the swf in the main application:
    <mx:Canvas id="dashCanvas"  creationPolicy="all" cachePolicy="on" width="100%"  backgroundColor="#FFFFFF" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
                   <mx:SWFLoader id="dashBoard" trustContent="true"  width="100%" height="100%" scaleContent="true" autoLoad="true"
    source="@Embed(source='../../../../assets/appl/dashboard/dashboard.swf')"  /> 
    </mx:Canvas>
    And i have set width and height as 100% in <mx:Appilcation> .
    Thanks and egards
    Muthu

  • Fullscreen published in flash - htm 100%  width and height file is too big

    Hello everyone
    I need some help to create a fullcreen flash animation inside
    dreamweaver.
    What I did was to create a html file published in flash 100%
    width and height.
    It worked well on my explorer browser, but the size of the
    file is 995 k and this would be my index.
    When I publish on my provider the file doesn't open, probably
    is too big as an index, i don't know.
    Is there anyone there that could help me on that one?
    Thank you
    This is the code on Dreamweaver html
    <HTML>
    <HEAD>
    <meta http-equiv=Content-Type content="text/html;
    charset=ISO-8859-1">
    <TITLE>back_men</TITLE>
    </HEAD>
    <BODY bgcolor="#262626">
    <!-- URL's used in the movie-->
    <!-- text used in the movie-->
    11cf-96B8-444553540000"
    codebase="
    http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
    WIDTH="100%" HEIGHT="100%" id="back_men" ALIGN="">
    <PARAM NAME=movie
    VALUE="file:///C|/betoko_webfiles/flash_files/betoko/back_men.swf">
    <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor
    VALUE=#262626> <EMBED
    src="file:///C|/betoko_webfiles/flash_files/betoko/back_men.swf"
    quality=high bgcolor=#262626 WIDTH="100%" HEIGHT="100%"
    NAME="back_men" ALIGN=""
    TYPE="application/x-shockwave-flash" PLUGINSPAGE="
    http://www.macromedia.com/go/getflashplayer"></EMBED>
    </OBJECT>
    </BODY>
    </HTML>
    <script type="text/javascript"
    src="fixit.js"></script>

    Well, firstly you have > 60 minutes of video, therefore, you should not use the 60 minute preset. Since you have 80 minutes of video, you're probably better off using the 90 minute preset.
    Secondly, the presets assume that you are compressing your audio to AC3 with A.pack or Compressor 2 (depending on which version of DVDSP you're using). Uncompressed audio takes up lots of disc space and bandwidth.
    Thirdly, the difference between the measured size in the Finder and the size in DVDSP is the difference between true gigabytes (how the Finder measures things) and billions of bytes (how DVDSP measures things). When you Get Info in the Finder, look at the number following the file size in GB... it's a larger number that's so many billions of bytes. This larger number should agree with the number you see in DVDSP. See the DVD FAQ for a discussion of this issue.

  • How to get WIDTH and HEIGHT fields from applet tag?

    I am developing an applet using JDK1.1 (to ensure microsoft jvm compatability).
    A problem I'm facing is that there are no getWidth() or getHeight() method for Applet in 1.1, so I am hoping I can get this info from my html: <APPLET CODE="MyApplet" WIDTH=600 HEIGHT=856></APPLET>
    getParameter didn't work, so does anyone have any ideas how I could get the width and height?
    Cheers,
    James

    Write a jpeg decoder that can figure out how to determine the width/height of a jpeg file? Google it.
    Or if you're really lazy, load each jpeg using the
    Toolkit.loadImage( URL ) function and use getWidth/getHeight from there, but that's slow.

  • Deployment in browser: setting width and height to 100% (or any %)

    According to http://docs.oracle.com/javafx/2.0/deployment/deployment_toolkit.htm for deploying a browser embedded JavaFX application, you can set the width and heigth properties to either a fixed value or a percentage value (or, assumedly, any value the browser can accept).
    >
    width and height
    Dimensions used to reserve space for an embedded application. Could be absolute or relative (for example, 50 or 50%). (Required for embed().)
    >
    However, when I try to set a percentage value (e.g. 100%) from the Netbeans "Run" properties dialog, I get the following exception:
    java.lang.NumberFormatException: For input string: "100%"
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
         at java.lang.Integer.parseInt(Integer.java:492)
         at java.lang.Integer.valueOf(Integer.java:582)
         at com.sun.javafx.tools.ant.DeployFXTask.execute(DeployFXTask.java:103)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)As can be seen, the exception happens in the DeployFXTask.execute method. It seems that this method requires the values to be integers.
    So the question, how can I set the embedded application dimensions to a percentage value? (Without having to edit the HTML file manually after the build - which is a workaround.)
    Edited by: Knut Arne Vedaa on 21.feb.2012 21:06

    As a workaround, in the meantime, look at the build file in the source of the Ensemble sample application (http://www.oracle.com/technetwork/java/javafx/downloads/devpreview-1429449.html) which will patch a generated html file using a custom post processing ant task - this would not work out of the box using the NetBeans generated ant build files though. You could file an issue with NetBeans to ask them to support the workaround in their generated build scripts, but they may just decide to wait until a fix is available in the core platform. As there is a workaround though, I don't think this would be classified as a showstopper issue - just a pretty annoying thing.

  • Nested canvas in GridLayout can't get its width and height

    Hello,
    I have a class entitled DisplayCanvas, which will accept some parameters from an invocation in another class including a shape and message parameters. These parameters must be centered in the instance of DisplayCanvas.
    For some reason, when I use this.getWidth() and this.getHeight() within my DisplayCanvas class, I get 0 and 0! I need the width and height in order to center the parameters the user will enter.
    Why does the width and height result at 0? What can I do to get the width and height?
    In my DisplayCanvas class notice the lines:
    canWidth = this.getWidth();
    canHeight = this.getHeight();
    For some reason the result is 0 for each!
    Here is my code for the DisplayCanvas class:
    //import the necessary clases
    import java.awt.*;
    import java.applet.*;
    import javax.swing.*;
    //begin the DisplayCanvas
    public class DisplayCanvas extends Canvas
      //declare private data members to house the width and height of the canvas
      private int canWidth;
      private int canHeight;
      //declare private data members for the shape and message
      private String message;
      private String shape;
      private Color sColor;
      private int sWidth;
      private int sHeight;
      private String font;
      private Color ftColor;
      private int ftSize;
      //declare public data members
      //constructor of DisplayCanvas
      public DisplayCanvas()
         //set the width and height
         canWidth = this.getWidth();
         canHeight = this.getHeight();
         //set all data members to defaults
         message = "";
         shape = "";
         sColor = null;
         sWidth = 0;
         sHeight = 0;
         font = "";
         ftColor = null;
         ftSize = 0;
      } //end the constructor
      //begin the setParams function
      public void setParams(String m, String s, Color c, int w, int h,
                            String f, Color ftC, int ftS)
          //set all private data members of DisplayShape to the arguments
          //this function assumes error checking was done by DemoShape
          message = m;
          shape = s;
          sColor = c;
          sWidth = w;
          sHeight = h;
          font = f;
          ftColor = ftC;
          ftSize = ftS;
      } //end the setParams function
      //begin the public paint function of ShowShape
      public void paint(Graphics g)
          //set and output the shape according to the arguments
          //determine the x and y of the shape
          int x = (canWidth - sWidth) / 2;
          int y = (canHeight - sHeight) / 2;
          //set the color for the graphic object
          g.setColor(sColor);
          //output the shape
          g.drawRect(x, y, sWidth, sHeight);
          //set and output the message according to the arguments
          //set the color and the font for the graphic object
          g.setColor(ftColor);
          g.setFont(new Font(font, Font.PLAIN, ftSize));
          //determine the centering of the message
          //output the message with the settings
          g.drawString(canWidth + " " + canHeight, 10, 10);
      } //end the paint function of ShowShape class
    } //end the DisplayCanvas classHere is my form entry class using the nested DisplayCanvas instance entitled drawCanvas:
    //import the necessary java packages
    import java.awt.*;                  //for the awt widgets
    import javax.swing.*;               //for the swing widgets
    import java.awt.event.*;            //for the event handler interfaces
    //no import is needed for the DisplayCanvas class
    //if in the same directory as the DemoShape class
    public class DemoShape extends JApplet
        //declare private data members of the DemoShape class
        //declare the entry and display panel containers
        private Container entire;           //houses entryPanel and displayCanvas
        private JPanel entryPanel;          //accepts the user entries into widgets
        private DisplayCanvas drawCanvas;   //displays the response of entries
        //required control buttons for the entryPanel
        private JTextField xShapeText, yShapeText, messageText, fontSizeText;
        private ButtonGroup shapeRadio;
        private JRadioButton rect, oval, roundRect;
        private JComboBox shapeColorDrop, fontTypeDrop, fontColorDrop;
        //declare public data members of the DemoShape class
        //init method to initialize the applet objects
        public void init()
            //arrays of string to be used later in combo boxes
            //some are used more than once
            String fonts[] = {"Dialog", "Dialog Input", "Monospaced",
                                "Serif", "Sans Serif"};
            String shapes[] = {"Rectangle", "Round Rectangle", "Oval"};   
            String colors[] = {"Black", "Blue", "Cyan", "Dark Gray",
                                "Gray", "Green", "Light Gray", "Magenta", "Orange",
                                "Pink", "Red", "White", "Yellow"};
            //declare variables to assist with the layout
            //these are the left and right justified x coordinates
            int ljX = 10; int rjX = 150;
            //this is the y coordinates for the rows
            int yRow1 = 10;     //the shape rows
            int yRow2 = 40;
            int yRow3 = 60;
            int yRow4 = 130;
            int yRow5 = 150;
            int yRow6 = 210;    //the message rows
            int yRow7 = 240;
            int yRow8 = 260;
            int yRow9 = 300;
            int yRow10 = 320;
            int yRow11 = 360;
            int yRow12 = 380;
            //these are the widths for the text boxes, drop downs
            //message entry,  big message entry and radio buttons
            int tWidth = 30; int dWidth = 100;
            int mWidth = 250; int bmWidth = 250;
            int rWidth = 125;
            //the height is universal, even for the messages!
            int height = 25;
            //set a content pane for the entire applet
            //set the size of the entire window and show the entire applet
            entire = this.getContentPane();
            entire.setLayout(new GridLayout(1, 2));
            //create the entry panel and add it to the entire pane
            entryPanel = new JPanel();
            entryPanel.setLayout(null);
            entire.add(entryPanel);
            //create the display canvas and add it to the entire pane
            //this will display the output
            drawCanvas = new DisplayCanvas();
            entire.add(drawCanvas);       
            //entry panel code
            //add the form elements in the form of rows
            //the first row (label)
            JLabel entryLabel = new JLabel("Enter Shape Parameters:");
            entryPanel.add(entryLabel);
            entryLabel.setBounds(ljX, yRow1, bmWidth, height);
            //second row (labels)
            JLabel shapeTypeLabel = new JLabel("Select Shape:");
            shapeTypeLabel.setBounds(ljX, yRow2, mWidth, height);
            entryPanel.add(shapeTypeLabel);
            JLabel shapeColorLabel = new JLabel("Select Shape Color:");
            shapeColorLabel.setBounds(rjX, yRow2, mWidth, height);
            entryPanel.add(shapeColorLabel);
            //third row (entry)        
            rect = new JRadioButton("Rectangle", true);
            oval = new JRadioButton("Oval", false);
            roundRect = new JRadioButton("Round Rectangle", false);
            rect.setBounds(ljX, yRow3, rWidth, height);
            oval.setBounds(ljX, yRow3 + 20, rWidth, height);
            roundRect.setBounds(ljX, yRow3 + 40, rWidth, height);
            shapeRadio = new ButtonGroup();
            shapeRadio.add(rect);
            shapeRadio.add(oval);
            shapeRadio.add(roundRect);
            entryPanel.add(rect);
            entryPanel.add(oval);
            entryPanel.add(roundRect);       
            shapeColorDrop = new JComboBox(colors);
            shapeColorDrop.setBounds(rjX, yRow3, dWidth, height);
            shapeColorDrop.addFocusListener(new focusListen());
            entryPanel.add(shapeColorDrop);
            //the fourth row (labels)
            JLabel xShapeLabel = new JLabel("Enter Width:");
            xShapeLabel.setBounds(ljX, yRow4, mWidth, height);
            entryPanel.add(xShapeLabel);
            JLabel yShapeLabel = new JLabel("Enter Height:");
            yShapeLabel.setBounds(rjX, yRow4, mWidth, height);
            entryPanel.add(yShapeLabel);
            //the fifth row (entry)
            xShapeText = new JTextField("200", 3);
            xShapeText.setBounds(ljX, yRow5, tWidth, height);
            xShapeText.addFocusListener(new focusListen());
            entryPanel.add(xShapeText);        
            yShapeText = new JTextField("200", 3);
            yShapeText.setBounds(rjX, yRow5, tWidth, height);
            yShapeText.addFocusListener(new focusListen());
            entryPanel.add(yShapeText);
            //the sixth row (label)
            JLabel messageLabel = new JLabel("Enter Message Parameters:");
            messageLabel.setBounds(ljX, yRow6, bmWidth, height);
            entryPanel.add(messageLabel);
            //the seventh row (labels)   
            JLabel messageEntryLabel= new JLabel("Enter Message:");
            messageEntryLabel.setBounds(ljX, yRow7, mWidth, height);
            entryPanel.add(messageEntryLabel);
            //the eighth row (entry)
            messageText = new JTextField("Enter your message here.");
            messageText.setBounds(ljX, yRow8, mWidth, height);
            messageText.addFocusListener(new focusListen());
            entryPanel.add(messageText);
            //the ninth row (label)
            JLabel fontTypeLabel = new JLabel("Select Font:");
            fontTypeLabel.setBounds(ljX, yRow9, mWidth, height);
            entryPanel.add(fontTypeLabel);
            JLabel fontColorLabel = new JLabel("Select Font Color:");
            fontColorLabel.setBounds(rjX, yRow9, mWidth, height);
            entryPanel.add(fontColorLabel);
            //the tenth row (entry)
            fontTypeDrop = new JComboBox(fonts);
            fontTypeDrop.setBounds(ljX, yRow10, dWidth, height);
            fontTypeDrop.addFocusListener(new focusListen());
            entryPanel.add(fontTypeDrop);       
            fontColorDrop = new JComboBox(colors);
            fontColorDrop.setBounds(rjX, yRow10, dWidth, height);
            fontColorDrop.addFocusListener(new focusListen());
            entryPanel.add(fontColorDrop);
            //the eleventh row (label)
            JLabel fontSizeLabel = new JLabel("Select Font Size:");
            fontSizeLabel.setBounds(ljX, yRow11, mWidth, height);
            entryPanel.add(fontSizeLabel);
            //the final row (entry)
            fontSizeText = new JTextField("12", 2);
            fontSizeText.setBounds(ljX, yRow12, tWidth, height);
            fontSizeText.addFocusListener(new focusListen());
            entryPanel.add(fontSizeText);
            //display panel code
            //use test parameters
            //these will later be retrieved from the entries
            drawCanvas.setParams("Hello", "roundRect", Color.red,
                                100, 100, "Serif", Color.black, 12);
            //set the applet to visible
            //set to visible and display
            entire.setSize(800, 600);
            entire.setVisible(true);
        }   //end the init method
        //declare an inner class to handle events
        private class focusListen implements FocusListener
            //supply the implementation of the actionPerformed method
            //pass an event variable as the argument
            public void focusLost(FocusEvent e)
            { JOptionPane.showMessageDialog(null, "Focus lost."); } 
            //declare an empty focus gained function
            public void focusGained(FocusEvent e) {}      
        }   //end testListen class
    }   //end DemoShape class

    Sorry for glossing over your code sample, particularly as it looks like one of the best I've seen so far on the forums, but I'm pretty sure the answer you are looking for is as follows:
    Java doesn't render a component until paint() is called so until then you are not going to have any size settings because the jvm simply doesn't know how big the visual component is. This makes sense when you think about what the jvm is doing. The layout manager controls the display of the components depending on the settings it is supplied. So until it knows how many components you want, where, what kind of spacing, etc, etc, etc, how can the size be determined.
    The true cycle of events is therefore:
    create an instance of DisplayCanvas,
    add it to your container,
    make the container visible (which renders the component),
    get the size of the DisplayCanvas instance.
    You are being hampered because your desired chain of events is:
    create an instance of DisplayCanvas,
    get the size of the DisplayCanvas instance,
    add it to your container,
    make the container visible.
    This state of affairs is highly annoying and then leads to the next question "what do we do about that?". There is a cunning trick which is to get the jvm to render the component to an off-screen image, thus calculating the dimensions of the component so that you can do precisely the kind of enquiry on the object that you have been looking for. It should be noted that this may not be the visual size for all the reasons given above, but it is the "preferred size" for the component. Check the Swing tutorials and have a look at the section on Layout Managers for a run down on what that means.
    Anyway, we can use this handy code sample to determine the preferred size for your component. Notice the call to "paint()" (normally you would never make a direct call to paint() in swing) and the "g.dispose()" to free resources:
    package com.coda.swing.desktool.gui;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    public class PaintUtil
         public PaintUtil()
              super();
         public static Component paintBuffer(Component comp)
              Dimension size = comp.getPreferredSize();
              comp.setSize(size);
              BufferedImage img = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
              Graphics2D g2 = img.createGraphics();
              comp.paint(g2);
              g2.dispose();
              return comp;
    }Before you make a call to getWidth() or getHeight() put in a call to "PaintUtil.paintBuffer(this);" and see what happens.
    By the way, I can't claim credit for this code ... and I really wish I could remember where I got it from myself so I can thank them :)

  • How to change the width and height of the visible part of the of the report

    I have define a report with paper size 'Letter', orientation 'landscape' and 30 columns. Dynamically I am changing width of columns and suppressing many columns of the report.
    Mostly using first 16-20 columns and others get suppressed.
    Now problem is that when navigating the report thru crystal viewer, a huge blank spaces getting display on right of the report. When we take jump to some part of report thru navigation tree, the whole report gets shifted to left and only blank part is visible and it is required to scroll left.
    Even printing is not working correctly.
    Is there any way to change the width and height of the visible part of the report in the viewer thru .net classes? Setting the width and height of the report in Load event handler doesn't help.  
    Example: CrystalReportViewer1.Width = 200; - is not helping.
    Is there any other solution?
    Please let me know.
    Thanks
    Mahesh Patel

    Hi Yogesh,
    Your suggestion 'reportDocument.PrintOptions.PaperSize=PaperSize.PaperLedger;' along with 'PaperOrientation' setting as follow works fine. I tried to switch between Landscape and Portrait depending on report width.
    reportDocument.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
    But problem with crystal viewer remain as it is.
    While navigating report thru crystal viewer, when we take jump to some part of report thru navigation tree, the whole report gets shifted to left and it is required to scroll left.
    Thanks for your very good suggestion.
    Mahesh Patel

  • Java returning incorrect values for width and height of a Tiff image

    I have some TIFF images (sorry, I cannot post them b/c of there confidential nature) that are returning the incorrect values for the width and height. I am using Image.getWidth(null) and have tried the relevant methods from BufferedImage. When I open the same files in external viewers (Irfanview, MS Office Document Imaging) they look fine and report the "correct" dimensions. When I re-save the files, my code works fine. Obviously, there is something wrong with the files, but why would the Java code fail and not the external viewers? Is there some way I can detect file problems?
    Here is the code, the relevant section is in the print() routine.
    * ImagePrinter.java
    * Created on Feb 27, 2008
    * Created by tso1207
    import java.awt.Graphics2D;
    import java.awt.Image;
    import java.awt.print.PageFormat;
    import java.awt.print.PrinterException;
    import java.io.File;
    import java.io.IOException;
    import java.util.Iterator;
    import javax.imageio.ImageIO;
    import javax.imageio.ImageReader;
    import javax.imageio.stream.FileImageInputStream;
    import javax.imageio.stream.ImageInputStream;
    import com.shelter.io.FileTypeIdentifier;
    public class ImagePrinter extends FilePrintable
       private final ImageReader _reader;
       private final int _pageCount;
       private final boolean _isTiff;
       //for speed we will hold current page info in memory
       private Image _image = null;
       private int _imgWidth = 0;
       private int _imgHeight = 0;
       private int _currentPage = -1;
       public ImagePrinter(File imageFile) throws IOException
          super(imageFile);
          ImageInputStream fis = new FileImageInputStream(getFile());
          Iterator readerIter = ImageIO.getImageReaders(fis);
          ImageReader reader = null;
          while (readerIter.hasNext())
             reader = (ImageReader) readerIter.next();
          reader.setInput(fis);
          _reader = reader;
          int pageCount = 1;
          String mimeType = FileTypeIdentifier.getMimeType(imageFile, true);
          if (mimeType.equalsIgnoreCase("image/tiff"))
             _isTiff = true;
             pageCount = reader.getNumImages(true);
          else
             _isTiff = false;
          _pageCount = pageCount;
       public int print(java.awt.Graphics g, java.awt.print.PageFormat pf, int pageIndex)
          throws java.awt.print.PrinterException
          int drawX = 0, drawY = 0;
          double scaleRatio = 1;
          if (getCurrentPage() != (pageIndex - getPageOffset()))
             try
                setCurrentPage(pageIndex - getPageOffset());
                setImage(_reader.read(getCurrentPage()));
                setImgWidth(getImage().getWidth(null));
                setImgHeight(getImage().getHeight(null));
             catch (IndexOutOfBoundsException e)
                return NO_SUCH_PAGE;
             catch (IOException e)
                throw new PrinterException(e.getLocalizedMessage());
             if (!_isTiff && getImgWidth() > getImgHeight())
                pf.setOrientation(PageFormat.LANDSCAPE);
             else
                pf.setOrientation(PageFormat.PORTRAIT);
          Graphics2D g2 = (Graphics2D) g;
          g2.translate(pf.getImageableX(), pf.getImageableY());
          g2.setClip(0, 0, (int) pf.getImageableWidth(), (int) pf.getImageableHeight());
          scaleRatio =
             (double) ((getImgWidth() > getImgHeight())
                ? (pf.getImageableWidth() / getImgWidth())
                : (pf.getImageableHeight() / getImgHeight()));
          //check the scale ratio to make sure that we will not write something off the page
          if ((getImgWidth() * scaleRatio) > pf.getImageableWidth())
             scaleRatio = (pf.getImageableWidth() / getImgWidth());
          else if ((getImgHeight() * scaleRatio) > pf.getImageableHeight())
             scaleRatio = (pf.getImageableHeight() / getImgHeight());
          int drawWidth = getImgWidth();
          int drawHeight = getImgHeight();
          //center image
          if (scaleRatio < 1)
             drawX = (int) ((pf.getImageableWidth() - (getImgWidth() * scaleRatio)) / 2);
             drawY = (int) ((pf.getImageableHeight() - (getImgHeight() * scaleRatio)) / 2);
             drawWidth = (int) (getImgWidth() * scaleRatio);
             drawHeight = (int) (getImgHeight() * scaleRatio);
          else
             drawX = (int) (pf.getImageableWidth() - getImgWidth()) / 2;
             drawY = (int) (pf.getImageableHeight() - getImgHeight()) / 2;
          g2.drawImage(getImage(), drawX, drawY, drawWidth, drawHeight, null);
          g2.dispose();
          return PAGE_EXISTS;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since version XXX
        * @return
       public int getPageCount()
          return _pageCount;
       public void destroy()
          setImage(null);
          try
             _reader.reset();
             _reader.dispose();
          catch (Exception e)
          System.gc();
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public Image getImage()
          return _image;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getImgHeight()
          return _imgHeight;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getImgWidth()
          return _imgWidth;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param image
       public void setImage(Image image)
          _image = image;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setImgHeight(int i)
          _imgHeight = i;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setImgWidth(int i)
          _imgWidth = i;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @return
       public int getCurrentPage()
          return _currentPage;
        * <br><br>
        * Created By: TSO1207 - John Loyd
        * @since Mar 25, 2008
        * @param i
       public void setCurrentPage(int i)
          _currentPage = i;
    }Edited by: jloyd01 on Jul 3, 2008 8:26 AM

    Figured it out. The files have a different vertical and horizontal resolutions. In this case the horizontal resolution is 200 DPI and the vertical is 100 DPI. The imgage width and height values are based on those resolution values. I wrote a section of code to take care of the problem (at least for TIFF 6.0)
       private void setPageSize(int pageNum) throws IOException
          IIOMetadata imageMetadata = _reader.getImageMetadata(pageNum);
          //Get the IFD (Image File Directory) which is the root of all the tags
          //for this image. From here we can get all the tags in the image.
          TIFFDirectory ifd = TIFFDirectory.createFromMetadata(imageMetadata);
          double xPixles = ifd.getTIFFField(256).getAsDouble(0);
          double yPixles = ifd.getTIFFField(257).getAsDouble(0);
          double xRes = ifd.getTIFFField(282).getAsDouble(0);
          double yres = ifd.getTIFFField(283).getAsDouble(0);
          int resUnits = ifd.getTIFFField(296).getAsInt(0);
          double imageWidth = xPixles / xRes;
          double imageHeight = yPixles / yres;
          //if units are in CM convert ot inches
          if (resUnits == 3)
             imageWidth = imageWidth * 0.3937;
             imageHeight = imageHeight * 0.3937;
          //convert to pixles in 72 DPI
          imageWidth = imageWidth * 72;
          imageHeight = imageHeight * 72;
          setImgWidth((int) Math.round(imageWidth));
          setImgHeight((int) Math.round(imageHeight));
          setImgAspectRatio(imageWidth / imageHeight);
       }

  • Finding the width and height of an image

    Hi...
    i have a path to an image "images/me.gif" and i'm trying to find its width and height.. am trying to use javax.swing.ImageIcon but it refuses to recognise the constructor with just the filename (string) parameter, and needs a URL to the file... anyone knows what i'm doing wrong??? is this the wrong class that i'm using...!??!?!?!?!?

    String filename = "images/me.gif";
    Image myImage = carregarImagem(filename);
    System.out.println(myImage.getWidth(this));
    System.out.println(myImage.getHeight(this));
    * M�todo que carrega imagens na mem�ria, a partir da URL onde o
    * applet est� sendo carregado. O uso de um 'mediaTracker' � fundamental para
    * evitar problemas quanto � velocidade de carga de uma imagem. Se voc� n�o
    * usar um mediaTracker, o seu c�digo pode tentar usar uma imagem antes dela
    * estar plenamente carregada na mem�ria, o que causaria um erro de execu��o.
    * @param nomeDaImagem O nome da imagem a ser carregada
    * @return A imagem requisitada ou null caso n�o haja tal imagem na url do applet
    public Image carregarImagem(String nomeDaImagem)
                   try
                                   Image imagem = getImage(getDocumentBase(), nomeDaImagem);
                                   MediaTracker carregador = new MediaTracker(this);
                                   carregador.addImage(imagem, 0);
                                   carregador.waitForID(0);
                                   return imagem;
                   catch(Exception erro)
                                   erro.printStackTrace();
                                   System.exit(0);
                                   return null;

  • How do I save the width and height of a photo for repeated use?

    How do I save the width and height of a picture for repeated use, rather than having to enter it each time in the 'new file' box?
    Thanks,  Ed Jackson.

    It could be that I'm older and have forgotten. I'm now 73 and will admit I have forgotten many things over the years. I have been using Photoshop since Photoshop version 3.  And can not really recall which features or changes were made in ever version of Photoshop I have installed.  Adobe has added many features over the years. The number of bugs introduce has also greatly increased after CS3.  "New Doc Sizes.psp"  in your user id preferences is edited using the two buttons in the new document dialog.
    As for guide lines in new documents Photoshop CS6 or CC seem to add some for video file presets with guide lines.  I do not know how to edit or add guide line to new doc presets. Guide line actions are easy to create. I have also seem some guideline in new documents when I did not expect any perhaps a new bug. Photoshop like most software has bugs. If you do not see Adobe new presets perhaps you copied an old  "New Doc Sizes.psp"  over Adobe's newer default file or Adobe migrared you presets and wand wiped their presets out. There are bugs. Close Photoshop down and rename your current  "New Doc Sizes.psp"  in you user id Photoshop cc preferences folder and start Photoshop it will add a dedault  "New Doc Sizes.psp"  file see if you see Adobe new presets in the new doc pull down when you select video and film...

  • Pdf in new window full width and height

    Hi i managed to create a new window and add a pdf to it :
    var pdf = new air.HTMLLoader();
    pdf.height = 600;
    pdf.width = 400;
    pdf.load(request);
    mywin = window.open("",
    "pdfWindow","height=600,width=400,top=10,left=10");
    mywin.nativeWindow.stage.addChild(pdf)
    But i would like to make the pdf scale to the width and
    height of the window , i tried width = '100%' but then it doesn't
    show a pdf
    for the current result see :
    Screen

    Okay i created a test :
    var pdf = new air.HTMLLoader();
    pdf.height = 600;
    pdf.width = 400;
    pdf.load(request);
    mywin = window.open("",
    "pdfWindow","height=700,width=500,top=10,left=10");
    mywin.nativeWindow.stage.addChild(pdf)
    pdf.width = mywin.nativeWindow.stage.stageWidth
    pdf.height = mywin.nativeWindow.stage.stageheight
    But then the pdf doesn't show, i also think this wouldn't
    work on resize of the window ?
    Or is there a event that is triggered

  • How to set a minimum width and height for a stage or scene?

    Hello,
    Does anyone how to set a minimum width and height for a stage or scene?
    I tried listening for width/height property value changes and then adjust the width/height if necessary, but that causes unpleasant flickering of the window.
    In JavaFX 2.1 beta SDK for Mac OS, the Stage class has setMinWidth() and setMinHeight() functions which work very well.
    I'm wondering what's the equivalent way to do that when using the FX SDK for Windows.
    Any help is appreciated!
    Thanks.

    I was wondering how to enforce a minimum stage size with JavaFX 2.0.3.The same flickering way you are currently doing it. See: http://javafx-jira.kenai.com/browse/RT-15200 "Need a way to set the minimum size of a window"

  • The crawled property of Image width and height - is there a differnce when the image is png format?

    Hi,
    We are indexing file share with images and get the properties of Image Width, Image Height, Image Size (we show it as refiners in SharePoint after make it managed properties). Somehow when the picture is png format - we see only Size but not height and width.
    Is that any setting that should be done in the file share (when i select an image in the windows explorer window i can see all its properties, and it seems that png files do expose the width and height properties
    keren tsur

    Hi  Keren,
    According to your description, my understanding is that when you tried to  crawl file share with images, the ows_ImageWidth and ows_ImageHeight crawled property for PNG  file could not be generated.
    For your issue, I can reproduce your issue in my SharePoint 2013 environment. For a workaround, you can upload the PNG images into SharePoint images Library and they would work fine.
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Obtain width and height in device central?

    I'm using device Central with Flash CS5.
    How do I obtain the width and height of the device being simulated?
    I need to write some special code to handle screen size in device central - as my application is already able to obtain the screen dimensions when run on a real device.

    I need to know if this is possible, too!
    Hopefully this is working somehow.
    Thanks

  • Sizing a scrollPane to fit its contents' width and height

    Hi,
    I have a MC loaded into a ScrollPane and have attempted to
    detect the MC's width and height and use that to set the size of
    the scrollPane per the documentation at
    Adobe
    Live Docs. I am probably not adapting the code correctly (well,
    duh), but what I have isn't working and I don't know why. Does
    anyone around here have a clue? Thanks in advance.

    OK, the forum ate my code :(
    Not sure how to get it to display. Feel free to close the topic as it doesn't make sense. I'll ask elsewhere.
    Thanks,
    Aral

Maybe you are looking for