예제 #1
0
 public Dimension preferredLayoutSize(Container parent) {
   return LayoutUtil.add(
       useSelectedComponentSize
           ? component == null ? new Dimension(0, 0) : component.getPreferredSize()
           : LayoutUtil.getMaxPreferredSize(parent.getComponents()),
       parent.getInsets());
 }
예제 #2
0
  public void layoutContainer(Container parent) {
    Component[] c = parent.getComponents();
    Insets parentInsets = parent.getInsets();
    Dimension size = LayoutUtil.getInteriorSize(parent);

    for (int i = 0; i < c.length; i++) {
      c[i].setBounds(parentInsets.left, parentInsets.top, size.width, size.height);
    }
  }
예제 #3
0
  public void showComponent(Component c) {
    final Component oldComponent = component;

    if (oldComponent == c) return;

    component = c;

    boolean hasFocus =
        oldComponent != null
            && LayoutUtil.isDescendingFrom(
                KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(),
                oldComponent);

    if (oldComponent != null) oldComponent.setVisible(false);

    if (component != null) {
      component.setVisible(true);

      if (hasFocus)
        // component.requestFocusInWindow();
        ComponentUtil.smartRequestFocus(component);
    }

    /*    if (oldComponent != null) {
    //      oldComponent.setVisible(false);
          SwingUtilities.invokeLater(new Runnable() {
            public void run() {
              if (oldComponent.getParent() == container && oldComponent != component) {
                oldComponent.setVisible(false);
              }

    //          FocusUtil.unblockFocusChanges();
            }
          });
        }*/
  }
예제 #4
0
 public Dimension maximumLayoutSize(Container target) {
   return LayoutUtil.add(LayoutUtil.getMinMaximumSize(target.getComponents()), target.getInsets());
 }
예제 #5
0
 public Dimension minimumLayoutSize(Container parent) {
   return LayoutUtil.add(LayoutUtil.getMaxMinimumSize(parent.getComponents()), parent.getInsets());
 }