Re: Get video dimensions (resolution: Width x Height)

I dunno. Google search for JMF (Java Media Framework).

Thanks for the quick answer.
This is either not what i was looking for or i might be to stupid right now
This is what ive done:
private function playSingleStream(source:String):void
    _streamResource = new StreamingURLResource(source, _streamType, start, _streamEnd);
    _streamResource.urlIncludesFMSApplicationInstance = true;
    _streamElement = new VideoElement(_streamResource, _netLoader);
    _streamElement.smoothing = true;
    _streamElement.addEventListener(MediaElementEvent.TRAIT_ADD, traitAddHandler);
    _mediaPlayer.media = _streamElement;
    _mediaContainer.addMediaElement(_streamElement);
private function traitAddHandler(e:MediaElementEvent):void
    if(e.traitType == MediaTraitType.DISPLAY_OBJECT)
        var t:VideoElement = e.currentTarget as VideoElement;
        var dp:DisplayObjectTrait = t.getTrait("displayObject") as DisplayObjectTrait;
        dp.addEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE, mediaSizeChangeHandler);
private function mediaSizeChangeHandler(e:DisplayObjectEvent):void
    log(e.newWidth);
    log(e.newHeight);
i am still only getting the original size of the video in mediaSizeChangeHandler.
also the MEDIA_SIZE_CHANGE is not triggered when i resize the videoplayer although video the video
is definitly resized because it is displayed in correct size and place.
greets
vincent

Similar Messages

  • Getting video dimensions

    Hello,
    Is it possible to get video dimensions (for example 320x240) using JMF.
    thanks

    Hello,
    Is it possible to get video dimensions (for example 320x240) using JMF.
    thanks

  • [svn:fx-4.x] 15080: Fix FTE in UIFTETextField which occured if baseline getter was called before width or height were set and autoSize =TextFieldAutoSize.NONE.

    Revision: 15080
    Revision: 15080
    Author:   [email protected]
    Date:     2010-03-26 14:47:47 -0700 (Fri, 26 Mar 2010)
    Log Message:
    Fix FTE in UIFTETextField which occured if baseline getter was called before width or height were set and autoSize=TextFieldAutoSize.NONE.  In this case, createTextLinesFromTextBlock returned without creating any text lines because there wasn't any width.  FTETextField.getLineMetrics assumes there is at least one line and throws a range error if there isn't.  In this case, set autoSize to TextFieldAutoSize.LEFT, measure the text, and then restore the autoSize value.
    QE notes:
    Doc notes: None
    Bugs: SDK-26016
    Reviewed By: Jason
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-26016
    Modified Paths:
        flex/sdk/branches/4.x/frameworks/projects/spark/src/mx/core/UIFTETextField.as

  • How to get video dimensions?

    I'm using a ParallelElement with multiple videos. How can I get each videos dimensions? There is no width/height attribute for a VideoElement and I had no luck using the metaData either. Seems like such a basic task but I've been trying for hours now.

    I guess correct video size is available only after metadata arrives (after playback start). To get video size try to acquire DisplayObjectTrait of VideoElement and look into mediaWidth/mediaHeight values.
    You may want to listen to DisplayObjectEvent.MEDIA_SIZE_CHANGE events from that display object trait - it fires when video metadata arrives.

  • Get video dimensions

    Hi,
    how do i get video width and height?
    Ive set up the simplest of all video players just using a mediaContainer and mediaPlayer.
    mediaContainer width and height are set to 640x360px (16:9).
    when i load a 4:3 video i know that the video is set to 480x360 to maintain the aspect ratio.
    But as i am working with a dynamic size for the video player i am searching for an easy way
    to get the size of the current video. I know that i could do it by taking the aspect ratio of the
    video from the metadata and calculate the size by myselt, but there must be an easier way to do it?!
    greets
    vincent

    Thanks for the quick answer.
    This is either not what i was looking for or i might be to stupid right now
    This is what ive done:
    private function playSingleStream(source:String):void
        _streamResource = new StreamingURLResource(source, _streamType, start, _streamEnd);
        _streamResource.urlIncludesFMSApplicationInstance = true;
        _streamElement = new VideoElement(_streamResource, _netLoader);
        _streamElement.smoothing = true;
        _streamElement.addEventListener(MediaElementEvent.TRAIT_ADD, traitAddHandler);
        _mediaPlayer.media = _streamElement;
        _mediaContainer.addMediaElement(_streamElement);
    private function traitAddHandler(e:MediaElementEvent):void
        if(e.traitType == MediaTraitType.DISPLAY_OBJECT)
            var t:VideoElement = e.currentTarget as VideoElement;
            var dp:DisplayObjectTrait = t.getTrait("displayObject") as DisplayObjectTrait;
            dp.addEventListener(DisplayObjectEvent.MEDIA_SIZE_CHANGE, mediaSizeChangeHandler);
    private function mediaSizeChangeHandler(e:DisplayObjectEvent):void
        log(e.newWidth);
        log(e.newHeight);
    i am still only getting the original size of the video in mediaSizeChangeHandler.
    also the MEDIA_SIZE_CHANGE is not triggered when i resize the videoplayer although video the video
    is definitly resized because it is displayed in correct size and place.
    greets
    vincent

  • How do i get the max width and height?

    Hey
    I want to get the max width and height, so my desktoppanes size can be set automatically.
    I know i should use getBounds but i cant find a concrete example on goole, on how to use it.
    Can someone point me in the right direction, with an example?

    Ok, assuming you want to get the screen resolution, i.e. 1024 x 768.
    You will need these imports:
    import java.awt.Dimension;
    import java.awt.Toolkit;and this line of code:
    Dimension myScreen =  Toolkit.getDefaultToolkit().getScreenSize() ;You can now use myScreen.width and myScreen.height to access the height and width of your screen's resolution. (width = 1024, height = 768 in my case)
    Hope this helps,
    Stern
    Edited by: Stern on Apr 13, 2008 6:49 AM

  • "Error Message: File video dimensions (width/height) too large"

    Hello,
    I believe someone else had a similar problem and posted to this forum, but here it goes...
    I have a project in Premiere CS3 that uses MPG files. The files open just fine in CS3 at work. At home I have CS4, but those MPG files do not import. I've tried converting the files to a MOV file but I just get the same result:
    "Error Message: File video dimensions (width/height) too large"
    I'm using Premiere CS4 version 4.1.0 on a Mac. My work computer is a PC.
    I've tried running the file through MPEG Streamclip a couple times with different settings, but so far no luck. I realy have no idea what I'm doing there or what setting could work, but I've got another conversion cranking away now. We'll see how that goes.
    Thanks

    A handheld 4K camera with exchangeable lenses with 1" sensors, standard with a 20-600 mm equivalent zoom range, with extender, with a simple battery that lasts at least 12 hours, that records on $ 25 SD 128 GB cards, available at every streetcorner and does 4:4:4 color space uncompressed I-frame with a weight of less than 4 Lbs and with a dynamic range over 60 dB, all under $ 1 K?
    Take out the prices and you've fairly accurately described the forthcoming Scarlet.
    It also describes somewhat well AVC-I cameras.
    But overall, I would not argue with your description as a goal to be achieved in 5 years.  In the interim there would have to be compromises, of course.  But there are three things that should never be compromised in any video camera anywhere - the imaging devices should always be full resolution, the recording format should always record the full raster, and only using I-frame compression.
    This was the norm for standard definition.  Only with HD have camera makers mucked things up.  It's time they got back to basics and made proper cameras.

  • Why can't I import anything? "File video dimensions (width/height) too large"

    New to PP CS4 here (that will be obvious momentarily...).  I can't seem to import any footage into any project (well, at least none of the bits I've tried, and I don't think there's anything 'wrong' with them).  Every time I attempt to do so, I get the error:
    Dialog title: File Import Failure
    Error Message: File video dimensions (width/height) too large.
    This occurs with every files I've thrown at it - admittedly, they all have a lot in common, but they're not particularly exotic.
    The files are (mostly) AVI files (I know, I know...before I get jumped, I understand it's just a wrapper, etc.). The files come from two cameras:
    1. A Sony DCR-TRV20. Opening up the AVI in QuickTime Player, I see it's listed as "DV/DVCPRO - NTSC 640X480"
    2. Canon PowerShot A620. Opening up the AVI in QuickTime Player, I see it's listed as "MotionJPEG OpenDML 320x240"
    3. I somehow managed to get the AME to spit out a FLV file. That failed to import with the same error message, too.
    I tried running these files through AME, and got the same results (although never having used AME previously, I have a question on that, below).
    New project, settings are all (I think) the defaults: Preset DV-NTSC/Standard 32kHz
    New installation of PP CS4, with the 4.1 update, on a PC running Vista 32 with all the endless MS updates applied.
    Related question: I've skimmed other threads here, and noted the advice to "always convert any non-standard footage to DV-AVI Type II" before importing....however, I see no such option for that output format in AME....only generic things like "Microsoft AVI" and "Uncompressed Microsoft AVI".
    Codec issues?  I'm a little skeptical, since these AVI files play just fine in Windows if I double-click them. Does that not suggest that there's a codec there for them?  The files are from (what I believe to be) garden-variety consumer cameras (these devices are a bit old and certainly not high-end, but they're hardly exotic formats, I think). The files are small, short clips I'm attempting to use just to learn Premiere, but it gags on every one of them, every time.
    PP is so insistent that every file I throw at it has improper dimensions, but these files appear to be perfectly reasonably sized, and I assume it's operator error (I'm withholding judgement on the quality and accuracy of the error string it's presenting me).  But I'm not sure where to look for the right knob to twist.  Pretty frustrating to be stuck on Square 1 (actually, Square Zero).
    Can someone point me in the right direction?
    Please be gentle, it's my first time....

    Thanks, but....mmmm....maybe not.
    I've tried multiple settings for New Projects. Just created a new one using the preset for DV-NTSC/Widecsreen 48kHz (frame size 720 x 480, 48 kHz audio).  Exactly the same results.
    You say "To point you in a certain direction, DV from a TRV is 720x480, not 640x480."  However, according to QuickTime's Movie Inspector panel, the file is 640x480.  This clip was captured through Premiere - that wouldn't change its aspect ratio, would it?
    The files from the Canon still camera are AVI files, not still images (so I don't see how the reference to Photoshop applies, or perhaps I misunderstood your point). They are 320x240, according to QuickTime's Movie Inspector panel. If they're 320x240, wouldn't that be the same aspect ratio as 640x480?  Attempting to import them, I get the same error....
    While not exactly Hollywood quality, I just need files to play with as I attempt to learn the program, and it's not clear to me why these files should not work - other than the fact that NO files seem to work. Also, I'm not sure what your reference to "exporting" pertains to - I can't get anything imported, I'm not trying to export anything that (I'm aware of) - I'll worry about exporting once I've managed to get something, ANYTHING to import.
    I've got some PP training videos (from "you-probably-know-who.com"). Following along using their project files and their video assets (MOV files in this case), I still get the exact same error.
    So to summarize, so far, I've seen no evidence that this copy of PP can import ANY video file.
    While I'm sure I would benefit from spending more time with the fine manual, I think there's something wrong here that's not going to be addressed in the introductory documentation.  If I can't import any footage into any project, progress is going to be slow.
    How about this: is there some known-to-be-good test file I can grab and try importing that?  I've got very strong suspicions that I'll get the same error message.
    Thanks again.

  • File video dimensions (width/height) too large

    I cannot impoty any file of any type into my time line.  I was having some issues with crashing, ended up upgrading my OS to snow leopard, and then reinstalling all my adobe products. Now all of my media is showing up as off line, when i try to relink anything, jpg, psd, ai, and all video files, i get the error "File video dimensions (width/height) too large".  I really do not want to start over and re edit everything I have ever done, and i am not even sure i can do that at this point, as it also happens when i try to create a new file.
    does anyone have any other fixes?  Please Help, I am going insane. 
    I have CS4 Production Premium.
    OS Snow Leopard.
    Mac Pro, 8 core.

    Hi,
    What kind of video files are you working with ?
    I did a google search using ---- file video dimensions ( width/height 0 too large ---  and most of the info I looked at in the search results is about files ( still images mostly ) that are larger than 4000 x 4000 px.. which is a limit for the NLE....but some results were about using cineform codec and matrox graphic card and some stuff about nero and so on....so I would guess the more info you can give about what you have and have done the better...
    Rod

  • File video dimensions (width/height) too large, importing AVI

    I'm testing Windows 7RC and Adobe Production Premium CS4. Both CS4 and Windows are fully updated with all updates available through today. Premiere Pro CS4 is at 4.1.0.
    I have hundreds and hundreds of AVI files captured from tape and from memory cards created by the capture process in Adobe Premiere Pro 1.5.1.  if I create a new project, HDV 1080i (60i) and try to import my AVI files I get the error message about 'file video dimensions (width/height) too large'. These files were created with the Cineform HD codec that came with 1.5.1. I have the CFHD codec "CineForm 10-bit-visually Perfect HD" loaded on this computer, and G-spot verifies that and can render and play the avi files. Since these are from HDV their actual dimensions are 1440x1080. I've also tried to import standard def AVI files with the same result.
    I just picked a few random projects to attempt to open, and none of them will open. Not SD not HDV. I get the 'too large' message.
    Suggestions?
    Hawkeye

    Throwing out wild guess here, but I think things changed with the way Premiere handled HDV with 2.0, at which point it went 'native' - meaning it no longer uses the Cineform codec.  I wonder if it's possible the two versions just don't mix, despite the Cineform codec being installed.

  • [svn:osmf:] 10085: Fixing video width and height getting reset when there' s no true dimensional change reported by 'onMetaData'.

    Revision: 10085
    Author:   [email protected]
    Date:     2009-09-09 07:39:54 -0700 (Wed, 09 Sep 2009)
    Log Message:
    Fixing video width and height getting reset when there's no true dimensional change reported by 'onMetaData'.
    Modified Paths:
        osmf/trunk/framework/MediaFramework/org/openvideoplayer/video/VideoElement.as

    hi their i have tried your last code but their is a problem with it on my pc that when i click the send video button it gives the error related to vector,
    Vector deviceList = CaptureDeviceManager.getDeviceList()
    di = (CaptureDeviceInfo)deviceList.firstElement();
    returns zero.
    please help my email address is [email protected]
    kindly send me an email regarding the solution of my problem. i am using 'creative web cam' over XP windows.

  • How handle Add Media Failure Error: File Video Dimensions (Width/Height) Too Large?

    I am a brand new user of Premiere Elements.  I am using it for stop gap animation, bringing in digital still photos from my Nikon D3200.  I just attempted to bring in the first set of photos from the SD card.  I'm running Windows 7.   After loading the photos, an "Add Media Failure" box came up with the message "Error:  File Video Dimensions (width/height) too large".   Is something wrong with the width and height of the photos and if so what do I need to do to make it work?  There were 763 photos, but the message seems to refer to the height/width of each photo and not the total file size so to speak - right?  During the import process, the program prompted us to bring the photos in as images and not as videos -- so that is what we selected.  Thank you for any assistance.

    Photo Scaling for Video http://forums.adobe.com/thread/450798
    -Too Large May = Crash http://forums.adobe.com/thread/879967
    -And another crash report http://forums.adobe.com/thread/973935

  • "file video dimensions (width/height) too large" is the exact message, what is the solution please?

    Trying to make a slideshow in Prem Pro CS4 with full size D800 jpegs, but the message "file video dimensions (width/height) too large" appears
    I have checked the FAQ and found that the res of the D800 at 7000x5000ish is well below the 25,000x25,000 Prem quotes,
    Can anyone help please?
    Thanks

    4,096 X 4,096. See this:
    http://help.adobe.com/en_US/PremierePro/4.0/WS92DAB4F5-E46F-46fb-B2D8-71813E6A3AE4a.html
    The newer versions explained here:
    http://blogs.adobe.com/premierepro/2010/07/maximum_dimensions_in_premiere.html

  • How do you change the image size and resolution in photoshop everytime I change the width the height changes my measurements will not stay

    Can someone assist me with changing image size and resolution.  each time I change the width the height changes and vice/versa?

    There's a chain link between width and height. The point is to keep the aspect ratio the same, otherwise your picture would get stretched.
    You click on the chain-link to shut that off and you can adjust width and height separately.
    Also could you give us your version of Photoshop, what OS you are running it on (Windows 7 for example) and what exactly you want to do with your document?
    Resolution is the print term for how many pixels will be printed on an inch of paper. It doesn't apply if your image is intended for screen viewing.
    Gene

  • 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 :)

Maybe you are looking for

  • How can I add a new vaiable to the file loaded by Property Loader without changing my script

    I have an input file to my script that I load via Property Loader. The number of parameters in the input file may change from test to test.. Is it possible in some way to add a new parameter without changing the sequence file? Is there for example a

  • How to save raw images as TIFF files on Adobe Bridge?

    I am trying to upload my raw images from my camera onto Adobe Bridge and save them as a TIFF file. But it does not give me that option and simply automatically saves them as JPEGs. Where is the option to keep them as raw, large TIFF files?

  • Error When using Element level link in Dataset Joins

    Hi All , I am joining two data sets using element level link ,I am getting the following Error message ORA-00972: identifier is too long at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462) at oracle.jdbc.driver.T4CTTIoer.processError(T4C

  • A way to copy the fonts?

    The reason I ask this is because I'm doing some print work that uses a few fonts. All mac system fonts. I should include these with the cd for the printshop... however is this even necessary since, i'm assuming, that windows and osx both have these s

  • Text underlined in table control

    Hello all, In TC Co03 there is a table control for operations.  The field short text is "click-sensitiv". So the short text is underlined. But - for some users this short text is underlined and for some users they are not. My question: How can I defi