void (Container parent) { int width = parent.getWidth(); int height = parent.getHeight(); if (highlightInfoComponent == null) { if (quickDocComponent != null) quickDocComponent.setBounds(0, 0, width, height); } else if (quickDocComponent == null) { highlightInfoComponent.setBounds(0, 0, width, height); } else { int h1 = WidthBasedLayout.getPreferredHeight(highlightInfoComponent, width); int h2 = WidthBasedLayout.getPreferredHeight(quickDocComponent, width); int h1Res; int h2Res; if (h1 + h2 <= height) { h1Res = h1; h2Res = h2; } else if (h1 < height / 2) { h1Res = h1; h2Res = height - h1; } else if (h2 < height / 2) { h1Res = height - h2; h2Res = h2; } else { double h1Fraction = ((double) h1) / (h1 + h2); h1Res = (int) (h1Fraction * height); h2Res = height - h1Res; } highlightInfoComponent.setBounds(0, 0, width, h1Res); quickDocComponent.setBounds(0, h1Res, width, h2Res); } }