Exemplo n.º 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());
 }
Exemplo n.º 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);
    }
  }
Exemplo n.º 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();
            }
          });
        }*/
  }
Exemplo n.º 4
0
 public Dimension maximumLayoutSize(Container target) {
   return LayoutUtil.add(LayoutUtil.getMinMaximumSize(target.getComponents()), target.getInsets());
 }
Exemplo n.º 5
0
 public Dimension minimumLayoutSize(Container parent) {
   return LayoutUtil.add(LayoutUtil.getMaxMinimumSize(parent.getComponents()), parent.getInsets());
 }