Increasing the size of JPanel.

I am trying to develop a Swing a application. The Application consists of a JFrame embedded in it is JScrollPane. The client for JScrollPane is a JPanel. At runtime i need to change the size of the JPanel topwards.
I have gone thru the scroll pane tutorial in sunwebiste wherein it is mentioned how to increase the size of the jpanel bottom wards at runtime. Is there any way to increase the size of the JPanel upwards. The requirement is if a new component comes in and i need to add in the top right corner i should be able to do it and it should accordingly increase the size of the panel both ways(top as well as right side) in case the component cannot fit into the panel.
I would appreciate if anyone can help me out at the earliest.
Thanks & Regards,
nimesh
[email protected]

There is no simple way to do it.
What is the layout of the JPanel that is the client (viewport) of the JScrollPane ?
Noah

Similar Messages

  • How to increase the size of panel

    Hi All,
    I am trying to increase the size of the panel using setPrefferedSize, but it is no change in size of the panel.
    Is there any other factors which will effect the size of the panel.
    Any help is greatly appreciated.
    Thanks in advance,
    Roja.

    Is there any other factors which will effect the size
    of the panel.The size of your JPanel may depend on the layout policy of its container's LayoutManager (see the Swing tutorial).

  • Changing the size of Jpanel

    Hi,
    I am making a paint application. I want to have a zoom functionality in it. i hava a button which when pressed will zoom the drawing area (JPanel). The Name of the Panel is Pane1.The Code for it is (scaleFactor is a variable in Pane1 Class)
    public void zoom_btn_actionPerformed(ActionEvent e) {
    Dimension d = new Dimension();
    double new_height;
    double new_width;
    // For increasing size of Pane1
    d = Pane1.getPreferredSize();
    new_width = (double)d.width + (double)(Pane1.scaleFactor-1.0) * (double)d.width;
    new_height = (double)d.height + (double)(Pane1.scaleFactor-1.0) * (double)d.height;
    Pane1.scaleFactor = Pane1.scaleFactor + 0.1;
    System.out.print(Pane1.nu_width + " " + Pane1.nu_height);
    //not working
    // Pane1.setPreferredSize(new Dimension(40,40));
    Pane1.update(Pane1.getGraphics());
    public void update(Graphics g)
    Graphics2D g2;
    g2 = (Graphics2D)g;
    g2.scale(scaleFactor,scaleFactor);
    g2.translate(translate_x,transalte_y);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
    RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
    RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    setPreferredSize(new Dimension(nu_width,nu_height) );
    try {
    g2.drawImage(buff, 0, 0, this);
    } catch (Exception e) {}
    Pane1 is inside a JscrollPane which works fine.
    The above code works fine and the image drawn is zoomed. However the size of panel remains the same. So if i zoom more it will go out of screen instead of making it scroll. It is as if the setPreferredSize function doesnt work.
    Can anyone pls tell me how to increase the size of a Jpanel at runtime ?

    there is a bit of correction in what i posted above the lines
    //not working
    // Pane1.setPreferredSize(new Dimension(40,40));
    should be
    //not working
    Pane1.setPreferredSize(new Dimension((int)new_width),(int)new_height));

  • Hi Thanks for 4.0. It runs much faster on my Mac, however, it no longer works to zoom in all of my web pages. I use to be able to use my finger pad to increase the size of all of all pages. Thanks again.

    Hi Thanks for 4.0. It runs much faster on my Mac, however, it no longer works to zoom in all of my web pages. I use to be able to use my finger pad to increase the size of all of all pages.
    Thanks again.
    PS Are you working on a version for the iPad and iPhone with Add Blocker? That would be great!

    Here are some zoom add-ons which might provide a workaround:
    [https://addons.mozilla.org/en-US/firefox/search/?q=image+zoom&cat=all&x=0&y=0 Image Zoom]
    As regards your question about iPad and iPhone, you'd be better off posting that question here: [https://forums.mozilla.org/addons/ Mozilla Add-ons Forum]
    P.S. ''Apologies for not responding earlier''.

  • I used to be able to increase the size font of the persons name sending me an email or text message.  I have an iphone 5 and can no longer do that.  Help!

    I used to be able to increase the size font of the persons name sending me an email or text message.  I have an iphone 5 and can no longer do that.  Help!

    Just the name? Don't ever recall that being a feature. However, for Mail and Messages (and a few other apps): Settings app > General > Text Size

  • How do I increase the size of a partition

    I have installed OS X on an external drive, I partioned the drive, one 20gig partition for the operating system and one 230 gig for data. I now want to increase the size of the OS partition to 30gig, can I do that without erasing the data on the partition?
    PowerBook G4   Mac OS X (10.4.8)   1.5 Gig RAM

    Hi fabio,
    you can use iPartition or VolumeWorks to do that.
    If this answered your question please consider granting some stars: Why reward points?

  • How do I increase the size of the text on the toolbar?

    How do I increase the size of the toolbar text, please?  For some reason, it's now very tiny, and everything I do only increases the font size of whichever web sites I access (which is not what I'm wanting to accomplish). 
    Thanks in advance for any help in this. Actually, I'm wondering what I might have done that would make the toolbar so tiny?

    Do  you mean the menu bar at the very top of your screen?
    If so, open System Preferences > Displays > Display > Scaled
    Try a different resolution.

  • How can I set timings to increase the size of an image in a Keynote presentation?

    I know how to use inspector to bring in and fade out text boxes, but at the end of a slide I have a graphic (that is at the bottom of the slide during the rest of the slide) that I want to increase the size of to take up the entire slide.  How can I do this?
    Thanks

    Welcome to Apple Support Communities.
    The effect you're looking for is 'Scale'
    In Keynote '09, 5.1.1 select the graphic.
    Click Inspector in the tool bar, Build Inspector (3rd icon from the left), (Build In and Build Out are both set to None for this step) Effect, Action, and then Scale.
    It rescales ('zooms') the selected item (image) up or down from 0% to 200%
    Clicking on the More Options button at the bottom opens a drawer to the left, and gives you more control over how the build occurs, whether they happen automatically, timed, or when you click, and re-order build steps.
    At 200%, double the original size, resolution could be a problem. There is a workaround, because it also scales smaller, down to 0%. So I would scale the graphic down 'small' as the first step to fit at the bottom, (even hide it behind a background-colored box) as you scale it down, and then at the end, scale up to full size to fill the screen at 'normal' resolution.
    In the attached example, I use a 'scale' up to go from 100% to 130% on a map, and use arrows and a flashing line to point out the road where a specific business is located with 12 steps. Some elements in my slides have been intentionally obscured. For simplicity, I've eliminated showing any steps but the initial title and the scale.

  • How to increase the size of text boxes in FCPX without stretching the text inside?

    How to increase the size of text boxes in FCPX without stretching the text inside?

    There are two basic Title formats — I should say Layouts — available:  Text (plain) and Paragraph.  (The plain text version usually does not appear with the blue dot controls — those generally appear for the paragraph type control.)
    If the Title is using a Paragraph layout, it's like having a mini version of Text Edit available inside FCPX. You can tell when you click on the text (when the title is selected) -- a rectangle will appear around the text like so:
    double clicking on the text will give you the bounds controls which you can use to redefine the text area without distorting the text. Once selected, notice the button that appears in the top right corner of the canvas:
    Pressing that will activate the ruler. You can right click on the ruler and add Tab Stops (left, right, center and decimal.)
    So if the title uses paragraph formatting, you can create a very WYSIWYG type of display text (use the Text inspector to alter text selections within the paragraph bounds.)

  • How to increase the size of bootcamp partition in macbook-late 2009

    How to increase the size of the bootcamp partition in macbook late 2009, without using any third party softwares.

    Pick yourself up by your own bootstrap too?
    Reinstall after restoring to HFS only then.
    You want something that works, then spend the $20 on Paragon CampTune or WinClone 3.

  • How do you increase the size of the tabs in excel?

    Hello,
    I am working with Excel on the new 27" iMac, can anyone inform how you are able to increase the size of the tabs on each worksheets?
    The software is OfficeMacs 2011.
    Thanks,
                  A

    http://answers.microsoft.com/en-us/mac?auth=1

  • How to increase the size of acquisition window in C++ code

    Hi,
    I am using PCI 1405 to continuously acquire video images from vcr playback.
    I tried to make use of the OnGrab function provided in the sample files, and included this function into my C++ application, without using LabView.
    However I have difficulties increasing the size of the acquisition window (the maximum seems to be 640 by 480) using the api functions of the niimaq.h.
    Thanks a lot.
    Best regards
    I

    EDIT:  I noticed that you already posted the question in the appropriate forum..
    Message Edited by JoeLabView on 10-22-2007 07:56 AM

  • How to increase the size of piechart in ssrs?

    Hi how to increase the size of piechart in my design mode its showing very large one,when running/preview mode its displaying very small, i have total 10 values to dispaly in the legend series values,So here i have set the visibulity option to out side ,
    so if the pie chart is dispalying small ,the values of the legend will come in one place and ,so can you suggest me how to increase the size of my chart and how would i show my legend values separatly without closing one by one.
    Can some one please help me out for this..

    Hi Ychinnari,
    According to your description that you want increase the size of pie chart in the design mode to make all the ten values in the legend series to display, you have do some setting but the pie chart still display very small and not display some of the
    values, right?
    I have tested on my local environment and found that the display of the chart legend value can be effect by many factor: the size of the chart, chart area position and chart legend position.
    Details steps below for your reference about how to set the properties to make all the legend values display correctly:
    Select the Chart properties and expand the size and increase the values for the width and the height, then preview to see if all the legend values are display.
    If this do little help, the problem due to the chart area position and chart legend position need to reset too.
    Select the chart area properties and expand the CustomPosition under the Position, choose the Enabled to true and  reset the Width, height of the pie chart.
    Reset this properties to make the chart area more Narrow, thus we can set the Legend area more wider.
    Select the chart Legend properties and expand the CustomPosition under the Position, choose the Enabled to true to reset the Width, height of the chart Legend
    Reset this properties to make the Legend area more bigger (wider and higher) thus it will display more values in the Legend area.
    If your problem still exists, please feel free to ask.
    Regards
    Vicky Liu

  • How to increase the size of a String[]

    I'm using a String[] variable that I do not know the maximal size, but i need to increase its size, how can I do that
    ex:
    String[] buffer = new String[]
    int i= 0;
    while (<condition>) {
    ???? // increase the size
    buffer [ i ] =.....
    }

    There is no way in Java to actually increase or decrease the size of an existing array. You'll have to create a new array of the appropriate size and copy elements of the first array into it, for example by using System.arraycopy.
    Or you could give your array a big enough size at start, so you won't have to do the above.
    A better idea would be to use a collection instead of an array (like an ArrayList) in the first place.

  • How to increase the size of the applet/ form displayed on the bowser

    kindly guide me how to increase the size of the applet / forms displayed on the browseri.e the width and length of the forms/applet so that i can display all the controls on the form .
    thanks with regards

    i changed the value of width and height in formsweb.cfg file in my devsuite_home/forms/server/formsweb.cfg , i am able to see the result when i compile and run the form in devsuite, whereas the same is not reflected when i run the same form in application server.
    when i tried to change the value of abbovementioned file in oracle_home /forms/server/formsweb.cfg of the application server file , the file does not have the applet wdth and applet height values. in fact this file does not have any applet information..
    pls guide
    thanks with regards.

Maybe you are looking for