Vertical layout Problem!

I have implemented a Vertical layout Which ads the componenst vertically.
The problem is the components gets added below the last component added.I want to add the component at the specific location ie : Point in the container...Can somebody please help me out !!!
the code for Vertical layout is
public class VerticalLayout implements LayoutManager2,Serializable{
private int MIN_WIDTH=300;
public float getLayoutAlignmentY(Container target) {
return 0.0f;
public float getLayoutAlignmentX(Container target) {
return 0.0f;
//not used
public void addLayoutComponent(Component comp, Object constraints) {
//not used
public void addLayoutComponent(String name, Component comp){
//not used
public void removeLayoutComponent(Component comp) {
* Returns the maximum size of this component.
* @see java.awt.Component#getMinimumSize()
* @see java.awt.Component#getPreferredSize()
* @see LayoutManager
public Dimension maximumLayoutSize(Container target) {
Insets insets=target.getInsets();
int width=0;
int height=vGap;
for(int i=0;i<target.getComponentCount();i++)
Component child=target.getComponent(i);
width=Math.max(child.getMaximumSize().width,width);
height+=child.getMaximumSize().height+vGap;
return new Dimension(insets.left+width+insets.right,insets.top+height+insets.bottom);
* Invalidates the layout, indicating that if the layout manager
* has cached information it should be discarded.
public void invalidateLayout(Container target) {
* Calculates the minimum size dimensions for the specified
* panel given the components in the specified parent container.
* @param parent the component to be laid out
* @see #preferredLayoutSize
public Dimension minimumLayoutSize(Container parent) {
Insets insets=parent.getInsets();
int width=0;
int height=vGap;
for(int i=0;i<parent.getComponentCount();i++)
Component child=parent.getComponent(i);
width=Math.max(child.getMinimumSize().width,width);
height+=child.getMinimumSize().height+vGap;
return new Dimension(insets.left+width+insets.right,insets.top+height+insets.bottom);
* Calculates the preferred size dimensions for the specified
* panel given the components in the specified parent container.
* @param parent the component to be laid out
* @see #minimumLayoutSize
public Dimension preferredLayoutSize(Container parent) {
Insets insets=parent.getInsets();
int height=vGap;
int width=MIN_WIDTH;
for(int i=0;i<parent.getComponentCount();i++)
Component child=parent.getComponent(i);
Dimension d=child.getPreferredSize();
width=Math.max(width,d.width);
height+=d.height+vGap;
return new Dimension(insets.left+width+insets.right+2*hGap,insets.top+height+insets.bottom);//+2*vGap);[email protected] july, 02 2002
* Lays out the container in the specified panel.
* @param parent the component which needs to be laid out
public void layoutContainer(Container parent) {
Rectangle bounds=parent.getBounds();
int x=hGap;
int y=vGap;
for(int i=0;i<parent.getComponentCount();i++)
Component child=parent.getComponent(i);
Dimension prefSize=child.getPreferredSize();
int width=Math.max(bounds.width-2*hGap,MIN_WIDTH);
int height=Math.min(prefSize.height,bounds.height);
child.setBounds(x,y,width,height);
y+=height+vGap;
x=Math.max(x,bounds.width);
parent.setSize(x,y);
int hGap=0;
int vGap=0;
public void setHgap(int hGap)
this.hGap=hGap;
public void setVgap(int vGap)
this.vGap=vGap;
}

First of all when you post code use the [url http://forum.java.sun.com/features.jsp#Formatting]Formatting Tags so the posted code is actually readable.
The point of using a LayoutManager is to let the manager determine the best location for a component based on known information about the component.
If you want to manually position components (not recommended) then you don't use a Layout Manager and instead use [url http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html]Absolute Positioning.

Similar Messages

  • Layout problem - multiple repeating frames

    Hi, I have a layout problem, pls help!
    Short report description:
    - Repeating Frame1 - gives 1 record, contains all other frames, variable vertical elasticity
    - - Frame2 - contains all frames beneath - variable vertical elasticity
    - - - Frame3 - variable vertical elasticity
    - - - - some boilerplates
    - - - - Repeating Frame 2 - various number of records, fixed vertical elasticity, height 100
    - - - - Repeating Frame 3 - various number of records, fixed vertical elasticity, height 30
    - - - - .. other repeating frames ..
    When reaching the bottom of a page, and there is not enough room to print a record for Repeating frame 2, a record from Repeating frame 3 is printed in the bottom.
    Next page starts with the remaining records from Repeating frame 2.. and then the remaining records from Repeating frame 3.
    For example:
    Page 1:
    Rep frame 2 - Record 1
    Rep frame 2 - Record 2
    Rep frame 2 - Record 3
    Rep frame 3 - Record 1 -- not enough space to print Record 4, so this record is printed
    Page 2:
    Rep frame 2 - Record 4
    Rep frame 2 - Record 5
    Rep frame 3 - Record 2
    How can i ensure that all records from Rep frame 2 is printed before records from Rep frame 3?

    Hi, thanks for helping me out!
    I tried to use anchors, but they had no effect when connecting top of 3 to bottom of 2, got the same layout.
    I then tried to create frames with vertical elasticity expand around both rep frame 2 and rep frame 3, and it seems to do the job.
    - Repeating Frame1 - gives 1 record, contains all other frames, variable vertical elasticity
    - - Frame2 - contains all frames beneath - variable vertical elasticity
    - - - Frame3 - variable vertical elasticity
    - - - - some boilerplates
    - - - - Frame 4 - vertical elasticity expand
    - - - - - - Repeating Frame 2 - various number of records, fixed vertical elasticity, height 100
    - - - - Frame 5 - vertical elasticity expand
    - - - - - - Repeating Frame 3 - various number of records, fixed vertical elasticity, height 30
    and so on..
    Thanks again

  • Urgent: Layout problem in "light inner page"

    Hi Experts,
    I am facing a problem in portal content area on external facing portal. I see a vertical scroll bar which restricts application from being displayed on entire screen.
    I am getting this problem after a patching of EP 7.0, before patching every thing was running fine.
    To me it looks like a layout problem in "light inner page", When I use "Light - 1: column (Full width)" layout I get a vertical scroll bar on portal. When I use default layout then this vertical scroll bar disappears but I see an empty navigation bar on left side which is not required.
    Can some one advise a solution for this.
    -Lave

    hi,
    Similar problem in this thread. check it out
    Desktop inner page lost
    Regardss,
    Ganesh N

  • CSS Layout Problem?

    Can someone please help me with a layout problem.
    As far as I can tell the page looks as it should in Netscape,
    Firefox, etc., but IE6 and 7 refuse to work correctly.
    The page I am working on is:
    http://www.vmtampademo.com/localangler/testpage.html
    Most of the picture caption and headline of the middle column
    is behind the picture. I attempted to force the info with a
    seperating div which seems to work sometimes. I doubt that this is
    the correct solution. What am I doing wrong?
    Thank you for the help!

    It looks fine in Firefox 2.0.0.1, Opera 9.10, and IE 7.

  • Layout problem in PDF conversion

    Hi all,
    i am downloading spool data using the function module CONVERT_ABAPSPOOLJOB_2_PDF. But i am facing layout problem. e.g. RFBILA00(financial statement generation program) has written balancesheet data to the spool. This spool data has some 6 columns. but CONVERT_ABAPSPOOLJOB_2_PDF is writing only first 3 columns to the generated PDF file. i used 'GET_PRINT_PARAMETERS' function module also with values like layout as 'X_65_132' and 'X_90_120'. but no success. if anybody knows the answer, please let me know.
    Thanks in advance,
    Naveen

    Hi All,
    i am following the below approach to download the information from spool.
    program/spool output is an ALV List output data having 8 columns. but below approach is converting only first 5 columns in to PDF format. other 3 columns are getting truncated.
    FUNCTION /ngl/download_spoolinfo_as_pdf.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(I_SPOOL_REQUEST) LIKE  TSP01-RQIDENT
    *"     REFERENCE(I_FILENAME) LIKE  RLGRAP-FILENAME
    *"  EXCEPTIONS
    *"      DOWNLOAD_ERROR
      TABLES tsp01.
      DATA: mtab_pdf LIKE tline OCCURS 0 WITH HEADER LINE,
            mc_filename LIKE rlgrap-filename.
      DATA: mstr_print_parms LIKE pri_params,
            mc_valid(1) TYPE c,
            mi_bytecount TYPE i.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          copies                 = '1'
          cover_page             = space
          destination            = 'locl'
          expiration             = '1'
          immediately            = space
          mode                   = space
          new_list_id            = 'X'
          no_dialog              = 'X'
          user                   = sy-uname
          line_size              = 200
          line_count             = 65
         layout                 = 'X_65_200'
          layout                 = 'X_90_120'
          sap_cover_page         = 'X'
        IMPORTING
          out_parameters         = mstr_print_parms
          valid                  = mc_valid
        EXCEPTIONS
          archive_info_not_found = 1
          invalid_print_params   = 2
          invalid_archive_params = 3
          OTHERS                 = 4.
      IF sy-subrc EQ 0.
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid              = i_spool_request
            no_dialog                = 'X'
            dst_device               = mstr_print_parms-pdest
          IMPORTING
            pdf_bytecount            = mi_bytecount
          TABLES
            pdf                      = mtab_pdf
          EXCEPTIONS
            err_no_abap_spooljob     = 1
            err_no_spooljob          = 2
            err_no_permission        = 3
            err_conv_not_possible    = 4
            err_bad_destdevice       = 5
            user_cancelled           = 6
            err_spoolerror           = 7
            err_temseerror           = 8
            err_btcjob_open_failed   = 9
            err_btcjob_submit_failed = 10
            err_btcjob_close_failed  = 11
            OTHERS                   = 12.
        IF sy-subrc EQ 0.
          mc_filename = i_filename.
          DATA: lv_filename TYPE string.
          lv_filename = i_filename.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              bin_filesize = mi_bytecount
              filename     = lv_filename
              filetype     = 'BIN'
            TABLES
              data_tab     = mtab_pdf
            EXCEPTIONS
              OTHERS       = 22.
          IF sy-subrc EQ 0.
            WRITE:/ mc_filename, 'CONVERTED TO PDF AND DOWNLOADED'.
          ELSE.
            WRITE:/ 'PROBLEM WITH DOWNLOAD'.
            RAISE download_error.
          ENDIF.
        ELSE.
          WRITE:/ 'PROBLEM WITH PDF CONVERSION'.
          RAISE download_error.
        ENDIF.
      ELSE.
        WRITE:/ 'PROBLEM GETTING PRINT PARAMETERS'.
        RAISE download_error.
      ENDIF.
    ENDFUNCTION.

  • Layout Problem in swings

    I have an Layout problem. My Applications consists of a label and a panel in which some more labels are present.
    The panel should contain the scrollbar in order to view all the label that excced the size of the panel.This label and a panel should be adjacent to each other.
    My problem is, I am not getting the scroll bar to the panel when I am adding the label that excced the size of the panel, when I am adding the label adjacent to this label.

    Did you use JScrollPanel? If not, use it.

  • [solved] layout problem in amarok 2.02

    Hi,
    Here, I have a bad layout problem with amarok 2.02. Amarok does not fit on my screen which is 1400 pixels large! I cannot reduce the part where the collection is shown. So that it is really unpractical to use.
    I uploaded a snapshot to illustrate the problem (it is the full screen!):
    emmanuelfavrenicolin.free.fr/Public/Sna … ok202.jpeg
    Someone have the same problem ?
    I tried to install svn version but I stopped after 3 hours of compilation, it is quite a big application.
    Last edited by manouchk (2009-05-23 06:28:43)

    Well, I tried amarok2-devel 2.0.90-1 but the problem of graphic layout remains similar, no improvement. Is it normall? Maybe amarok is only available for computer with screen >= 1600x1200  or is there an hidden configuration file where I could tweek this?
    Last edited by manouchk (2009-05-18 02:41:03)

  • T43 Vertical Scrolling Problem (not just Firefox)- Any official response from Lenovo

    After searching the forum, i have not been able to find any response from Lenovo as to how to correct this problem.
    Incidentally, my "occasional" vertical scrolling problem occurs in any browser,  IE7, Firefox3, Opera9 (at least those 3) as well as Windows applications with a vertical scroll bar like Windows Explorer.
    This only started to occur very randomly around 6 months ago.  But as of late it is occuring more often.
    The only work-around
    http://blog.jonschneider.com/2008/03/workaround-th​inkpad-gets-into-always.html 
    might indicate that it is a possible hardware problem.
    However, I have to say that I rarely use the laptop scrolling buttons and 99.9% of the time, latetly, I use a Logitech laser USB mouse for scrolling purposes. 
    As another possible work-around (if you are using an external mouse) is to uncheck the enable virtual scrolling in the touchpad properties window. 
    I certainly hope it is not a hardware problem, as the warranty on my T43 ran out a long time ago.
    btw, I am running Windows XP Pro XP3.
    Moderator Note; added system type to subject
    Message Edited by andyP on 07-27-2009 09:32 PM

    Reset the page zoom on pages that cause problems: <b>View > Zoom > Reset</b> (Ctrl+0 (zero); Cmd+0 on Mac)
    See [[Text Zoom]] and [[Page Zoom]] and http://kb.mozillazine.org/Zoom_text_of_web_pages

  • Div layout problem

    Hi - stuck on what I think should be a fairly basic layout problem:
    I have 2 divs, equal widths but varying heights, one floated to the left and one to the right so that they appear next to eachother on the page.  The one on the left contains varying amounts of text, the one on the right contains a flash player so never varies.
    Where the text for the left div is long, I want it to start off next to the player, but then flow beneath it rather than continuing downwards at the same width as the div.  If I remove the width of the left div, so that it reverts to the container width, the player div positions itself below it, so I can't work out how to get the effect.
    Can anyone help?

    Hi,
    hope I understood in the right way: I used (translated from German DW) "modify table" and so I got one more row and two columns in your Main_Content. In one of the new columns I copied the image and beneath I took the text (you now can replace with image and text of your choice), like this:
    If that's not a help for your question, please ask me again.
    What concerns the width of the pictures, I would format them with PS or a similar program in the same wide.
    Hans-G.

  • Fixed vertical layout for mobile

    Hi, I have done the design mobile site by using adobe muse.  I want to keep the fixed vertical layout, how can I set to disable the auto rotation funcation for mobile only?
    Thanks,
    Andy

    Hi
    I believe you want to restrict the orientation of site when opened in phone browser to vertical.
    With native Muse features we cannot stop orientation changing when user rotate its phone to landscape ,though can be done using custom code.
    View port helps to change the orientation of the site in device browser. Its not advisable to restrict users from using the orientation they want to use the site, but you can try the suggestions mentioned in the documents :
    http://stackoverflow.com/questions/10975387/mobile-site-force-landscape-only-no-auto-rotat e
    http://stackoverflow.com/questions/3501510/blocking-device-rotation-on-mobile-web-pages
    http://stackoverflow.com/questions/6052400/disable-auto-rotate-in-jquery-mobile-or-phonega p
    If this is not what you are looking for , please let me know.
    Thanks,
    Sanjit

  • Vertical Scrolling problem in Safari

    I'm currently having an odd vertical scrolling problem in Safari.  This issue is not reproduced in Chrome or Firefox.
    I've been able to reproduce this issue doing something very simple:
    I have a browser wide rectangle with a solid color.
    Beneath that I have a browser wide photo.  (Rectangle set to browser edges and then fit to fill with photo.)
    And beneath that I have another browser wide rectangle with a solid color.
    Then I scroll.
    Once the photo (the middle element) reaches the top of the screen I have shut the scrolling off so the photo will stay static. (Initial motion 1 / Final motion 0 set in the "Fill/Scroll" tab - and the key position is set so it stops at the top of the browser.)  As expected, the lowest box continues to scroll upwards and cover the static photo.
    This very simple effect is flawless in Preview mode, Chrome, and Firefox.
    Yet in Safari, the photo, once it reaches its resting spot, does stay static, but seems to jump and jitter all over the place while I continue scrolling and the below content covers it.  (In the other browsers it's super solid like a real static background.)
    I've read there are some parallax scrolling bugs in Safari Mavericks.  But I'm still in an older operating system using 10.8.5 and Safari 6.0.5.
    Any suggestions or work arounds on how to correct this? (Again, I'm controlling the scroll using the scroll tab found with "Fill". Should I also be using the one found under Scroll Effects?  What the best one to use? Although it does work in the other browsers… so…  maybe I'm not doing anything wrong and this really is a Safari problem.)
    Thanks you.

    Hi
    Please share the site url, I will have a look.
    Thanks,
    Sanjit

  • Satellite 3000 screen vertical line problem

    my laptop is Satellite 3000 , it got vertical line problem now, i wanna use a outside CRT screen to replace the current damaged LED screen.
    I have tried to use FN-F5 swap key, but it is still doesn't work, i tried to log in the system to check it, (the system (windows xp) is normal), but i can't see anything because the screen is black, it won't get in the system even if i connected it in to the LAN, because the laptop network function configuration is not allow connect with internet,( i did ghost before it completely damaged), the question is :
    1, do i need to configure something so as to it can use outside screen in windows XP system? or just use FN-F5 swap key?
    2, how will i do next step if i wanna use the outside screen ?
    thx a lot

    Hello
    If the notebook is preinstalled with all Toshiba designed tools and utilities FN+F5 key combination should work. Of course the external monitor should be connected properly.
    If you are missing some tools FN+F5 key combination will not work.
    What I want to know is what happens exactly when you use FN+F5 key combination? Stays the LCD screen black or switch to the right picture again? As far as I know if you use FN+F5 key combination and LCD on the notebook stays black that means the signal is send to external device but if the monitor is not connected properly or there is some contact problem you will not see the content on external monitor.
    Believe me it is not easy to say what is wrong there but if possible try to test it with different monitors. Satellite 3000 is pretty old notebook model and maybe is RGB port defective.

  • Design/Layout Problem in OOTB SP "Docs I'm following" page

    Hello
    The "Docs I'm following" My Sites page in SP 2013 has the following layout problem:
    Long document titles overlap with other elements (see also screenshot).
    Note: This is default SP, i.e. we have not deployed any custom branding.
    I guess this is a problem which can easily be corrected even without having to wait for a SP update. Since I'm not very good with design changes I would be grateful if you could provide
    us with a quick fix, e.g. an updated css file.
    Thanks a lot.
    Best regards
    John

    Hi  ,
    For your issue, you can add the following code into your MySite MasterPage:
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    $(".ms-contentFollowing-itemTitle a").each(function(i){
    $(this).text(shorten($(this).text(),32));
    function shorten(text,maxLength) {
    var ret = text;
    if (ret.length > maxLength) {
    ret = ret.substr(0,maxLength-3) + "...";
    return ret;
    </script>
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Help needed with a layout problem

    I'm trying to build a JTabbedPane where each tab has a grid of buttons. The number of buttons is variable, and I'd like the buttons to flow sort of like with FlowLayout, with four columns. I need all the buttons to be the same size, even across tabs. I tried GridLayout, which doesn't work when I have too few buttons to fill a row. It fails in different ways, depending on how I set things up. If I try to set the layout to GridLayout(0, 4) (four columns), then if one tab has one row and another has two, the buttons on the one-row tab expand vertically to the height of the two-row tab. If I try GridLayout(2,4), then if a tab has only one button, it expands horizontally to the maximum width of any of the tabs. (It also has the further problem that if the maximum number of buttons on any tab is 6, they are placed in a 2x3 array; I'm trying to get them to be 4 buttons on the first row and 2 on the second.)
    I'm hoping there's a standard layout manager that can do the job, but I'm not too familiar with the Swing manager classes. Can I get what I want without writing my own layout manager?
    Thanks,
    Ted Hopp
    [email protected]

    I didn't think it was specifically a Swing question.Well, its either Swing or AWT, people who develop GUIs are the ones who are going to have experience using layout managers.
    but if someone can point the way to how to do this with GridBagLayout, nested containersSince you finished reading the tutorial, what have you tried? You've explained your problems using a single layout manager, so what problems are you having using nested layout managers?
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
    Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.

  • Accordion with Vertical Navigation problem

    Following tutorial about phone layout accordion/vertical navigation menu encountering following problem in my original file:
    Create accordion - ok (style to my pref)
    Insert vertical navigation - ok (style to my pref)
    When trying to resize the v/nav to hit the red line on browser edge - both left and right, in preview and in mobile simulator the navigation panels don't expand accordingly to the width of the mobile screen.
    If try with only accordion with no menu all ok. As soon as I add the navigation and try to size to hit the red guides indicating that it will resize with browser size, when preview it doesn't as described above.
    Any suggestions?
    Thanks
    Sam

    If you DO want the slideshow overlaping the navigation try the below css:
    .sidebar1 {
        float: left;
        width: 225px;
        margin: 60px 0px 60px 60px;
        color: #FFFF0D;
        background: #595FFF;
        border-radius: 13px;
        -moz-border-radius: 13px;
        -webkit-border-radius: 13px;
        padding: 5px 5px 0px 5px;
        border: 3px solid #F7F723;
    .box {
    float: left;
    margin-left:-60px;
    width:700px;
    height:350px;
    border-radius: 13px;
    -moz-border-radius: 13px;
    -webkit-border-radius: 13px;

Maybe you are looking for

  • Code works on new form not on older form

    Hi I am trying to change an existing form (add some code). I tested the code in a new form I create on my computer but when I do the same on a form supplied and created on a different computer the code won't work What I see is that the form propertie

  • Issue while removing stock using MB1C - 562

    Hi, Our client has few materials for which batch number is captured in small alphabets and now when we are trying to remove stock using MB1C - 562 system gives error of Deficet Qty as it automatically changes small letters to CAPITAL letters as soon

  • Xlib: connection to refused by server

    Dear all, I'm trying to run a report on eBus SE. If I define the format as Text file, there's no problem. But if I defined as ODF I'm getting this error while running. Xlib: connection to "servername:0.0" refused by server Xlib: No protocol specified

  • Where are _correct_ directions for installing the Adobe Flash Reader plug-in

    There are directions for installing Adobe Flash Player in its new Firefox incarnation as a plug-in rather than its old incarnation as a stand-alone program. Unfortunately, the directions are not for the current versions of either Firefox or Adobe Fla

  • Windows XP Home unable to boot on Satellite P30

    Hello I've been using WinXP-H on a (7yr-old) Satellite P30. The screen died a while back so I've been using an external monitor, but that's an issue for another time. A few days ago Windows was updating. After about 4hours, it restarted by itself - n