コード例 #1
0
ファイル: MarginLayout.java プロジェクト: cbsistem/PlatypusJS
 public static void ajustHeight(java.awt.Component aChild, int aValue) {
   assert aChild.getParent().getLayout() instanceof MarginLayout;
   MarginLayout layout = (MarginLayout) aChild.getParent().getLayout();
   MarginConstraints anchors = layout.getLayoutConstraints(aChild);
   int containerHeight = aChild.getParent().getHeight();
   int childTop = aChild.getLocation().y;
   if (anchors.getHeight() != null) {
     anchors.getHeight().setPlainValue(aValue, containerHeight);
   } else if (anchors.getTop() != null && anchors.getBottom() != null) {
     anchors.getBottom().setPlainValue(containerHeight - childTop - aValue, containerHeight);
   }
   aChild.getParent().revalidate();
   aChild.getParent().repaint();
 }
コード例 #2
0
ファイル: MarginLayout.java プロジェクト: cbsistem/PlatypusJS
 public static void ajustWidth(Component aChild, int aValue) {
   assert aChild.getParent().getLayout() instanceof MarginLayout;
   MarginLayout layout = (MarginLayout) aChild.getParent().getLayout();
   MarginConstraints anchors = layout.getLayoutConstraints(aChild);
   int containerWidth = aChild.getParent().getWidth();
   int childLeft = aChild.getLocation().x;
   if (anchors.getWidth() != null) {
     anchors.getWidth().setPlainValue(aValue, containerWidth);
   } else if (anchors.getLeft() != null && anchors.getRight() != null) {
     anchors.getRight().setPlainValue(containerWidth - childLeft - aValue, containerWidth);
   }
   aChild.getParent().revalidate();
   aChild.getParent().repaint();
 }