コード例 #1
0
 @Override
 public void removeLayoutComponent(Component comp) {
   if (comp instanceof JRibbon) {
     throw new IllegalArgumentException("Can't remove JRibbon component");
   }
   super.removeLayoutComponent(comp);
 }
コード例 #2
0
 @Override
 public void addLayoutComponent(Component comp, Object constraints) {
   if ((constraints != null) && constraints.equals(BorderLayout.NORTH)) {
     if (getLayoutComponent(BorderLayout.NORTH) != null) {
       throw new IllegalArgumentException("Already has a NORTH JRibbon component");
     }
     if (!(comp instanceof JRibbon)) {
       throw new IllegalArgumentException("Can't add non-JRibbon component to NORTH location");
     }
   }
   super.addLayoutComponent(comp, constraints);
 }