Resize a Frame height only

Hello
I know that I can resize a frame by setting this frame to resizable. Now I want to resize only height, not width. How I can do that
Many thanks
shuho

hey,
you could add a component listener to your frame...
frame.addComponentListener(new ComponentAdapter() {
  public void componentResized(ComponentEvent event) {
    frame.setSize(200, frame.getHeight())); // width is always 200
});hope that helps :)

Similar Messages

  • How to batch resize in Bridge CS6 or Image Processor using height only?

    I have batches of images that need to resized based on height only and would like to do so using Bridge/Image Processor. My height requirement is 1140px, however the original images are varied in landscape/portrait orientation and are of different aspect ratios (2:3, 3:4, etc). So far what I have had to do is filter in Bridge just the landscape images then select an aspect ratio, then plug into Image Processor the exact pixel dimensions of the resized images (that I discovered using Photoshop to resize and check the resulting pixel dimension). There has to be a more efficient way.
    An example of what I am running into:
    Image 1
    Original file = 5616 h x 3744 w Portrait orientation
    Resized file = 1140 h x 760 w
    Image 2
    Original file = 3744 h x 5616 w Landscape
    Resized file = 1140 h x 1710 w
    Image 3
    Original file = 4652 h x 3489 w Portrait
    Resized file = 1140 h x 855 w
    From that example, is there a way I can plug just the height number in Image Processor (or any other Photoshop utility) so I can just batch out a bunch of images all at once?
    FYI - I am not interested in buying any new software such as Lightroom to accomplish this task. I would like to remain within Photoshop/Bridge if possible.

    You can do what you want with Image Processor without a script.  All you have to do is enter the number of pixels you want for the height (1140 pixels in your case) and then enter a number for the width that is wider than any image you will process.  Image processor will always resize the images to fit inside this rectangle.  That is, the height will always be 1140 and the width will fall where it may.  It works like the Fit Image command in Photoshop.

  • Can an i-frame resize the page height and itself with new content?

    I built a website in Adobe Muse and embedded a blog within an i-frame on the portfolio page of the site here...
    http://dannyhardakervideo.co.uk
    This approach was taken because the client needed the ability to keep  adding videos to the portfolio section of the site themselves  indefinitely and
    i was short on ideas to implement that functionality  with Muse. I've now exported the code as HTML to Dreamweaver to see what I can achieve there.
    Using Dreamweaver, Is it possible for the page height and i-frame height to resize with new  content as more videos are added to it? Is there some script I can  add to the page?
    Is there a better solution?
    PLEASE HELP.

    Ordinarily, Iframe re-size scripts will only work when the parent page (with iframe) and the external page (blog) both reside on the same domain.   However, someone came up with a cross domain solution which requires you to put jQuery scripts on both sites.  NOTE:  I've never tested this.
    https://github.com/davidjbradshaw/iframe-resizer
    IMO, a cleaner solution is to use scripts to parse the blog's RSS feed into the main site.  You can use PHP code from FeedForAll or jQuery's jFeed plugin.
    http://alt-web.blogspot.com/2011/06/adding-blogger-rss-feed-to-html-page.html
    https://github.com/jfhovinne/jFeed
    The main advantage in using a script to parse feeds is you control the appearance -- to match your main site & how many posts are displayed on the page.
    Nancy O.

  • 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();
    }

  • 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.

  • Can I resize video frame?

    I have the Canon Vixia HF R400, which is lovely. But the video frame is very wide and thin. Is there a way to resize the frame so that it's more square-ish, and less long, thin cinematic rectangle?

    Hi Heatherelena,
    The shape of the recorded video is a by-product of the aspect ratio (the size of the width and the size of the height) of the movie.  This ratio cannot be changed from 16:9.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • 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.

  • So simple, yet so annoying: problem resizing anchored frame with grab bars

    Asked a question yesterday on how to 'snug' an anchored frame to an image. Got the answer and it works great (Esc-m-p)
    Now... the reason I needed to do this is that when I try to resize a frame with the grab bars, it 'jerks' as I move vertically or horizontally.
    What that means is...
    With borders on, the frame border is a dotted line.
    If I grab the left side of a frame and move my mouse to the right to make the frame smaller, the border doesn't move smoothly -- it jumps a distance of about 1.5 of those dotted lines. Thus I can't always make the frame fit nicely.
    Talked to another Frame user and she said that her's drags smoothly.
    So... am I missing a setting somewhere? Any thoughts would be greatly appreciated.

    ##&*!
    I was working over a VPN when I first experienced the problem... everything was slower than molasses. Set Snap off, did some other work, Frame crashed.
    Setting didn't persist, but everything had taken so long I forgot to check it.
    Gah. Yes, Snap off works wonders when it's *actually* off.

  • I have a problem with my iphoto, al the pictures show up as a gray frame with only the

    Working with import of photos to my iphotos all the photos turned into a gray frame with
    only the photo # displayed ?
    where did I go wrong

    what were you doing? (what is working with import of photos mean)  what exactly do you see? An ! 
    LN

  • Resizing graphics frames that have stroke/keylines

    When I resize a graphic frame (with a placed image in it) that has a stroke/keyline, the stroke changes weight and I have to reapply the Object Style which sets the weight. How can I keep the same weight when I resize?
    Also is there a way of changing the default behaviour of SHIFT+Resize box with mouse so that it resizes the frame AND content rather than having to use the more cumbersome ALT+SHIFT+mouse resize? I do that far more often then just resizing the frame and keeping the ratio!

    Scaling Stroke Issue: On the menu bar at the far right, select the flyout and you will see the option "Adjust Stroke Weight When Scaling" here you can deselect to turn off
    Resizing Issue: For just one image, select image, Object > Fitting > Frame Fitting Options > Turn on Autofit and Desired Fitting Option
    Resizing Issue: For multiple images, Object Styles > select stye(s) > Frame Fitting Options > Turn on Autofit and Desired Fitting Option

  • Discoverer Plus Title frame height is too small

    The Discoverer Plus default title frame height is too small to display more than a couple of lines of the report titles without scrolling. Discoverer Viewer displays the entire title area. Is there any way to increase the default height of the title frame in Plus?
    Thanks, Jim

    There is a default hieght that the title frame occupies in Discoverer Plus. If I remember, the title frame by default will not use more than 15% of the available vertical space in the Plus window - again, not sure if this includes the browser chrome or not. You can drag and increase the size of this title frame such that it occupies more of the available screen real estate.
    In Viewer, since the title is rendered as HTML - it will simply expand to show its entire contents.
    thanks
    Abhinav
    Oracle Business Intelligence Product Management
    BI - http://www.oracle.com/bi
    BI - http://www.oracle.com/technology/bi
    Blog - http://blogs.oracle.com/
    BI Blog - http://oraclebi.blogspot.com/

  • Problem with dragged component after resizing the frame

    My application is simple: I am displaying an image on a panel inside a frame (JFrame). I am able to drag the image inside the panel. My problem is that, after dragging the image around, if I am resizing the frame, the image goes back to its original position.
    Does anyone know a workaround?
    I have been using the sample provided by noah in his answer (reply no. 3) to a previous question on this forum: http://forum.java.sun.com/thread.jsp?forum=57&thread=126148
    Thank you!

    Chek out the visibility of your components. Some operations may render them invisible. Use the setVisible( boolean ) to make them visible.

  • How to resize a frame to the dimensions of the inner image?

    Hi,
    I'm preparing a JS script.
    I need to resize a frame (InDesign) to the dimensions of an inner image (in fact, the image contained by the frame itself).
    So:
    1) I need to control if the frame is bigger (larger) than the image inside it.
    2) If (1) it's true, I need to obtain the dimensions of the inner image and apply them to the frame.
    3) At the end, I will have that the frame matches perfectly the image.
    Is it possible?
    Thanks and best regards,
    Francesco Jonus

    1) I need to control if the frame is bigger (larger) than the image inside it.
    How do you define this?
    It's obvious for the one on the left, but what about the one on the right?
    If you just care about area, then compute the area and check:
    fb = app.selection[0].geometricBounds;
    framewidth = fb[3]-fb[1];
    frameheight = fb[2]-fb[0];
    framesize = framewidth * frameheight;
    ib = app.selection[0].images[0].geometricBounds;
    imagewidth = ib[3]-ib[1];
    imageheght = ib[2]-ib[0];
    imagesize = imagewidth * imageheight;
    if (framesize < imagesize) {
       alert("Frame is smaller!");

  • 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

  • Quick time player will not frame advance, only reverse

    Can anyone help?
    I hit pause and the frames will only reverse with the left arrow. They won't advance with the right arrow.
    It's a fairly new keyboard and computer with windows 7.

    VLC

Maybe you are looking for

  • Open Pages doc from server by two persons !!!

    Hi, We have noticed that you can open a pages doc from a Apple MAcOS X Server from two diffrent persons, what wil result in not saving any data. Normal you CAN'T open a file that s already open ... !! This is a really big risk .. ? What to do about t

  • Screen fuzzy when touch is connected to TV

    I purchased the apple cable to be able to watch my movies and such on my TV. When I connected it the sound comes through perfectly, but the pictures is very distorted and fuzzy. You cannot see the movie. What am I doing wrong, or what is wrong with m

  • Mac Book Pro (Apple Repairs and Serve Coverage) - Limited

    I got a Macbook Pro (late 2013) and the Apple Repairs and Service Coverage ends on Oct 2013. I recently found that my MagSafe 2 Power adapter is not working. Will they replace mine for free?

  • Balance Sheet Items- Input Schedule

    Hi Guys, I have a input schedule which have Assets Items. I enter some figure in it and send the data. It says data sent successfully. but I dont see any data in the schedule. Though I can see the data from BI side, but data is not visible in the inp

  • Error 1714. The older version of QuickTime cannot be removed. - Fix

    I ran into this problem when I was installing the latest version of i-Tunes. Because i-Tunes requires QuickTime I researched for hours. I couldn't un-install QuickTime, it wasn't showing up in a software list to uninstall. I used Regedit to remove al