Java Code Examples for javax.swing.SwingConstants#WEST

The following examples show how to use javax.swing.SwingConstants#WEST . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WindowsLayoutStyle.java    From RipplePower with Apache License 2.0 6 votes vote down vote up
public int getPreferredGap(JComponent source, JComponent target, int type, int position, Container parent) {
	super.getPreferredGap(source, target, type, position, parent);

	if (type == INDENT) {
		if (position == SwingConstants.EAST || position == SwingConstants.WEST) {
			int gap = getButtonChildIndent(source, position);
			if (gap != 0) {
				return gap;
			}
			return 10;
		}
		type = RELATED;
	}
	if (type == UNRELATED) {
		return getCBRBPadding(source, target, position, dluToPixels(7, position));
	} else {
		boolean sourceLabel = (source.getUIClassID() == "LabelUI");
		boolean targetLabel = (target.getUIClassID() == "LabelUI");

		if (((sourceLabel && !targetLabel) || (targetLabel && !sourceLabel))
				&& (position == SwingConstants.EAST || position == SwingConstants.WEST)) {
			return getCBRBPadding(source, target, position, dluToPixels(3, position));
		}
		return getCBRBPadding(source, target, position, dluToPixels(4, position));
	}
}
 
Example 2
Source File: WindowsLayoutStyle.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
private int dluToPixels(int dlu, int direction) {
	if (baseUnitX == 0) {
		calculateBaseUnits();
	}
	if (direction == SwingConstants.EAST || direction == SwingConstants.WEST) {
		return dlu * baseUnitX / 4;
	}
	assert (direction == SwingConstants.NORTH || direction == SwingConstants.SOUTH);
	return dlu * baseUnitY / 8;
}
 
Example 3
Source File: CrossBorderLayout.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private static boolean isBasis(int constraint) {
    if (constraint == SwingConstants.NORTH) return true;
    if (constraint == SwingConstants.WEST) return true;
    if (constraint == SwingConstants.SOUTH) return true;
    if (constraint == SwingConstants.EAST) return true;
    if (constraint == SwingConstants.CENTER) return true;
    return false;
}
 
Example 4
Source File: PlafPaintUtils.java    From pumpernickel with MIT License 5 votes vote down vote up
private static void drawColors(Color[] colors, Graphics g, int x1, int y1,
		int x2, int y2, int direction) {
	for (int a = 0; a < colors.length; a++) {
		g.setColor(colors[colors.length - a - 1]);
		if (direction == SwingConstants.SOUTH) {
			g.drawLine(x1, y1 - a, x2, y2 - a);
		} else if (direction == SwingConstants.NORTH) {
			g.drawLine(x1, y1 + a, x2, y2 + a);
		} else if (direction == SwingConstants.EAST) {
			g.drawLine(x1 - a, y1, x2 - a, y2);
		} else if (direction == SwingConstants.WEST) {
			g.drawLine(x1 + a, y1, x2 + a, y2);
		}
	}
}
 
Example 5
Source File: PlafPaintUtils.java    From PyramidShader with GNU General Public License v3.0 5 votes vote down vote up
private static void drawColors(Color[] colors,Graphics g,int x1,int y1,int x2,int y2,int direction) {
	for(int a = 0; a<colors.length; a++) {
		g.setColor(colors[colors.length-a-1]);
		if(direction==SwingConstants.SOUTH) {
			g.drawLine(x1, y1-a, x2, y2-a);
		} else if(direction==SwingConstants.NORTH) {
			g.drawLine(x1, y1+a, x2, y2+a);
		} else if(direction==SwingConstants.EAST) {
			g.drawLine(x1-a, y1, x2-a, y2);
		} else if(direction==SwingConstants.WEST) {
			g.drawLine(x1+a, y1, x2+a, y2);
		}
	}
}
 
Example 6
Source File: GroupLayout.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
public void calculatePadding(int axis) {
	size = UNSET;
	int maxPadding = UNSET;
	if (matches != null) {
		LayoutStyle p = getLayoutStyle0();
		int position;
		if (axis == HORIZONTAL) {
			if (isLeftToRight()) {
				position = SwingConstants.EAST;
			} else {
				position = SwingConstants.WEST;
			}
		} else {
			position = SwingConstants.SOUTH;
		}
		for (int i = matches.size() - 1; i >= 0; i--) {
			AutopaddingMatch match = (AutopaddingMatch) matches.get(i);
			maxPadding = Math.max(maxPadding, calculatePadding(p, position, match.source, match.target));
		}
	}
	if (size == UNSET) {
		size = 0;
	}
	if (maxPadding == UNSET) {
		maxPadding = 0;
	}
	if (lastSize != UNSET) {
		size += Math.min(maxPadding, lastSize);
	}
}
 
Example 7
Source File: ParagraphView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public int getNextVisualPositionFromChecked(int offset, Bias bias, Shape alloc,
        int direction, Bias[] biasRet)
{
    int retOffset;
    switch (direction) {
        case SwingConstants.EAST:
        case SwingConstants.WEST:
            retOffset = children.getNextVisualPositionX(this, offset, bias, alloc,
                    direction == SwingConstants.EAST, biasRet);
            break;
        case SwingConstants.NORTH:
        case SwingConstants.SOUTH:
            DocumentView docView = getDocumentView();
            if (docView != null) {
                retOffset = children.getNextVisualPositionY(this, offset, bias, alloc,
                        direction == SwingConstants.SOUTH, biasRet,
                        HighlightsViewUtils.getMagicX(docView, this, offset, bias, alloc));
            } else {
                retOffset = offset;
            }
            break;
        default:
            throw new IllegalArgumentException("Bad direction " + direction); // NOI18N
    }
    return retOffset;
}
 
Example 8
Source File: CrossBorderLayout.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static String constraintName(int constraint) {
    if (constraint == SwingConstants.NORTH) return "NORTH"; // NOI18N
    if (constraint == SwingConstants.WEST) return "WEST"; // NOI18N
    if (constraint == SwingConstants.SOUTH) return "SOUTH"; // NOI18N
    if (constraint == SwingConstants.EAST) return "EAST"; // NOI18N
    if (constraint == SwingConstants.NORTH_WEST) return "NORTH_WEST"; // NOI18N
    if (constraint == SwingConstants.NORTH_EAST) return "NORTH_EAST"; // NOI18N
    if (constraint == SwingConstants.SOUTH_WEST) return "SOUTH_WEST"; // NOI18N
    if (constraint == SwingConstants.SOUTH_EAST) return "SOUTH_EAST"; // NOI18N
    if (constraint == SwingConstants.CENTER) return "CENTER"; // NOI18N

    return "UNSUPPORTED_CONSTRAINT (value=" + constraint + ")"; // NOI18N
}
 
Example 9
Source File: CrossBorderLayout.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void checkSupported(int constraint) {
    if (constraint == SwingConstants.NORTH) return;
    if (constraint == SwingConstants.WEST) return;
    if (constraint == SwingConstants.SOUTH) return;
    if (constraint == SwingConstants.EAST) return;
    if (constraint == SwingConstants.NORTH_WEST) return;
    if (constraint == SwingConstants.NORTH_EAST) return;
    if (constraint == SwingConstants.SOUTH_WEST) return;
    if (constraint == SwingConstants.SOUTH_EAST) return;
    if (constraint == SwingConstants.CENTER) return;
    
    throw new IllegalArgumentException("Unsupported constraint: " + constraint); // NOI18N
}
 
Example 10
Source File: CrossBorderLayout.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private static void checkSupported(int constraint) {
    if (constraint == SwingConstants.NORTH) return;
    if (constraint == SwingConstants.WEST) return;
    if (constraint == SwingConstants.SOUTH) return;
    if (constraint == SwingConstants.EAST) return;
    if (constraint == SwingConstants.NORTH_WEST) return;
    if (constraint == SwingConstants.NORTH_EAST) return;
    if (constraint == SwingConstants.SOUTH_WEST) return;
    if (constraint == SwingConstants.SOUTH_EAST) return;
    if (constraint == SwingConstants.CENTER) return;
    
    throw new IllegalArgumentException("Unsupported constraint: " + constraint); // NOI18N
}
 
Example 11
Source File: AxisComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected void paintVerticalBasis(Graphics g, Rectangle clip, Rectangle chartMask) {
    g.setColor(getForeground());
    if (location == SwingConstants.WEST) {
        g.drawLine(getWidth() - 1, chartMask.y - 1, getWidth() - 1, chartMask.y + chartMask.height);
    } else {
        g.drawLine(0, chartMask.y, 0, chartMask.y + chartMask.height);
    }
}
 
Example 12
Source File: TriangleIcon.java    From pumpernickel with MIT License 5 votes vote down vote up
/**
 * Creates a new TriangleIcon.
 * 
 * @param direction
 *            one of the SwingConstant constants for NORTH, SOUTH, EAST or
 *            WEST. For example, if the direction is EAST this triangle will
 *            point to the right.
 * @param width
 *            the width of this icon
 * @param height
 *            the height of this icon
 * @param color
 *            the color to fill this icon with.
 */
public TriangleIcon(int direction, int width, int height, Color color) {
	this.direction = direction;
	this.width = width;
	this.height = height;
	this.color = color;

	if (direction == SwingConstants.EAST
			|| direction == SwingConstants.RIGHT) {
		triangle.moveTo(0, 0);
		triangle.lineTo(width, height / 2);
		triangle.lineTo(0, height);
	} else if (direction == SwingConstants.WEST
			|| direction == SwingConstants.LEFT) {
		triangle.moveTo(width, 0);
		triangle.lineTo(0, height / 2);
		triangle.lineTo(width, height);
	} else if (direction == SwingConstants.NORTH
			|| direction == SwingConstants.TOP) {
		triangle.moveTo(0, height);
		triangle.lineTo(width / 2, 0);
		triangle.lineTo(width, height);
	} else if (direction == SwingConstants.SOUTH
			|| direction == SwingConstants.BOTTOM) {
		triangle.moveTo(0, 0);
		triangle.lineTo(width / 2, height);
		triangle.lineTo(width, 0);
	} else {
		throw new IllegalArgumentException(
				"direction ("
						+ direction
						+ ") must be one of the SwingConstant constants: NORTH, SOUTH, EAST or WEST.");
	}
	triangle.closePath();
}
 
Example 13
Source File: XDMScrollBarUI.java    From xdm with GNU General Public License v2.0 5 votes vote down vote up
private JButton createScrollButton(int orientation) {
	darkMode = scrollbar instanceof DarkScrollBar;

	if (darkMode) {
		return createZeroButton();
	}

	CustomButton btn = new CustomButton();
	btn.setBackground(darkMode ? trackColor2 : trackColor1);
	btn.setContentAreaFilled(false);
	btn.setHorizontalAlignment(JButton.CENTER);
	btn.setMargin(new Insets(0, 0, 0, 0));
	btn.setBorderPainted(false);
	if (orientation == SwingConstants.NORTH) {
		btn.setIcon(ImageResource.getIcon("up.png", 10, 10));
		btn.setPreferredSize(new Dimension(XDMUtils.getScaledInt(15), XDMUtils.getScaledInt(18)));
	}
	if (orientation == SwingConstants.SOUTH) {
		btn.setIcon(ImageResource.getIcon("down.png", 10, 10));
		btn.setPreferredSize(new Dimension(XDMUtils.getScaledInt(15), XDMUtils.getScaledInt(18)));
	}
	if (orientation == SwingConstants.EAST) {
		btn.setIcon(ImageResource.getIcon("right.png", 10, 10));
		btn.setPreferredSize(new Dimension(XDMUtils.getScaledInt(18), XDMUtils.getScaledInt(15)));
	}
	if (orientation == SwingConstants.WEST) {
		btn.setIcon(ImageResource.getIcon("left.png", 10, 10));
		btn.setPreferredSize(new Dimension(XDMUtils.getScaledInt(18), XDMUtils.getScaledInt(15)));
	}
	return btn;
}
 
Example 14
Source File: CrossBorderLayout.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private static boolean isWest(Integer[] constraints) {
    return constraints[1] == SwingConstants.WEST;
}
 
Example 15
Source File: MetalLayoutStyle.java    From RipplePower with Apache License 2.0 4 votes vote down vote up
public int getPreferredGap(JComponent source, JComponent target, int type, int position, Container parent) {
	// Invoke super to check arguments.
	super.getPreferredGap(source, target, type, position, parent);

	if (type == INDENT) {
		if (position == SwingConstants.EAST || position == SwingConstants.WEST) {
			int gap = getButtonChildIndent(source, position);
			if (gap != 0) {
				return gap;
			}
			return 12;
		}
		// Treat vertical INDENT as RELATED
		type = RELATED;
	}

	String sourceCID = source.getUIClassID();
	String targetCID = target.getUIClassID();
	int offset;

	if (type == RELATED) {
		if (sourceCID == "ToggleButtonUI" && targetCID == "ToggleButtonUI") {
			ButtonModel sourceModel = ((JToggleButton) source).getModel();
			ButtonModel targetModel = ((JToggleButton) target).getModel();
			if ((sourceModel instanceof DefaultButtonModel)
					&& (targetModel instanceof DefaultButtonModel) && (((DefaultButtonModel) sourceModel)
							.getGroup() == ((DefaultButtonModel) targetModel).getGroup())
					&& ((DefaultButtonModel) sourceModel).getGroup() != null) {
				// When toggle buttons are exclusive (that is, they form a
				// radio button set), separate them with 2 pixels. This
				// rule applies whether the toggle buttons appear in a
				// toolbar or elsewhere in the interface.
				// Note: this number does not appear to include any borders
				// and so is not adjusted by the border of the toggle
				// button
				return 2;
			}
			// When toggle buttons are independent (like checkboxes)
			// and used outside a toolbar, separate them with 5
			// pixels.
			if (isOcean) {
				return 6;
			}
			return 5;
		}
		offset = 6;
	} else {
		offset = 12;
	}
	if ((position == SwingConstants.EAST || position == SwingConstants.WEST)
			&& ((sourceCID == "LabelUI" && targetCID != "LabelUI")
					|| (sourceCID != "LabelUI" && targetCID == "LabelUI"))) {
		// Insert 12 pixels between the trailing edge of a
		// label and any associated components. Insert 12
		// pixels between the trailing edge of a label and the
		// component it describes when labels are
		// right-aligned. When labels are left-aligned, insert
		// 12 pixels between the trailing edge of the longest
		// label and its associated component
		return getCBRBPadding(source, target, position, offset + 6);
	}
	return getCBRBPadding(source, target, position, offset);
}
 
Example 16
Source File: MSynthPainter.java    From swift-k with Apache License 2.0 4 votes vote down vote up
@Override
public void paintArrowButtonForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int direction) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setColor(SELECTED);
    switch (direction) {
        case SwingConstants.NORTH:
            g2.fillRoundRect(x, y, w, h + 4, 5, 5);
            g2.setColor(Color.BLACK);
            g2.fillRect(x, y + h, w, 4);
            break;
        case SwingConstants.SOUTH:
            g2.fillRoundRect(x, y - 4, w, h + 4, 5, 5);
            g2.setColor(Color.BLACK);
            g2.fillRect(x, y - 4, w, 4);
            break;
        case SwingConstants.WEST:
            g2.fillRoundRect(x, y, w + 4, h, 5, 5);
            g2.setColor(Color.BLACK);
            g2.fillRect(x + w, y, 4, h);
            break;
        case SwingConstants.EAST:
            g2.fillRoundRect(x - 4, y, w + 4, h, 5, 5);
            g2.setColor(Color.BLACK);
            g2.fillRect(x - 4, y, 4, h);
            break;
    }
    
    
    g2.setColor(ACCENT);
    Path2D p = new Path2D.Double();
    p.moveTo(4, 0);
    p.lineTo(8, 6);
    p.lineTo(0, 6);
    p.closePath();
    
    switch (direction) {
        case SwingConstants.NORTH:
            // no transform
            break;
        case SwingConstants.SOUTH:
            p.transform(AffineTransform.getRotateInstance(Math.PI, 4, 4));
            break;
        case SwingConstants.WEST:
            p.transform(AffineTransform.getRotateInstance(-Math.PI / 2, 4, 4));
            break;
        case SwingConstants.EAST:
            p.transform(AffineTransform.getRotateInstance(Math.PI / 2, 4, 4));
            break;
    }
    
    p.transform(AffineTransform.getTranslateInstance((w - 8) / 2.0, (h - 7) / 2.0));
    g2.fill(p);
}
 
Example 17
Source File: EditorPaneTesting.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/**
 * Move/select caret left/right/up/down by directions WEST/EAST/NORTH/SOUTH from SwingConstants.
 *
 * @param context
 * @param direction
 * @throws Exception
 */
public static void moveOrSelect(Context context, int direction, boolean select) throws Exception {
    JEditorPane pane = context.getInstance(JEditorPane.class);
    String actionName;
    String directionName;
    String debugDirection;
    switch (direction) {
        case SwingConstants.WEST:
            actionName = select ? DefaultEditorKit.selectionBackwardAction : DefaultEditorKit.backwardAction;
            directionName = "left";
            debugDirection = "SwingConstants.WEST";
            break;
        case SwingConstants.EAST:
            actionName = select ? DefaultEditorKit.selectionForwardAction : DefaultEditorKit.forwardAction;
            directionName = "right";
            debugDirection = "SwingConstants.EAST";
            break;
        case SwingConstants.NORTH:
            actionName = select ? DefaultEditorKit.selectionUpAction : DefaultEditorKit.upAction;
            directionName = "up";
            debugDirection = "SwingConstants.NORTH";
            break;
        case SwingConstants.SOUTH:
            actionName = select ? DefaultEditorKit.selectionDownAction : DefaultEditorKit.downAction;
            directionName = "down";
            debugDirection = "SwingConstants.SOUTH";
            break;
        default:
            throw new IllegalStateException("Invalid direction=" + direction); // NOI18N
    }
    StringBuilder sb = null;
    if (context.isLogOp()) {
        sb = context.logOpBuilder();
        sb.append(select ? "Selection" : "Cursor").append(' ').append(directionName).append("\n");
        debugCaret(sb, pane).append(" => ");
        sb.append("moveOrSelect(context, ").append(debugDirection).append(", ").append(select).append(")");
        sb.append(" => "); // Fill in after action gets performed
    }
    performAction(context, pane, actionName, null, false);
    if (context.isLogOp()) {
        debugCaret(sb, pane);
        context.logOp(sb);
    }
}
 
Example 18
Source File: DataInstaller.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Build the user interface ready for display.
 */
private void initComponents()
{
	GridBagConstraints gbc = new GridBagConstraints();
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.anchor = GridBagConstraints.WEST;
	gbc.insets = new Insets(2, 2, 2, 2);
	GridBagLayout gridbag = new GridBagLayout();
	setTitle(TITLE);
	setLayout(gridbag);

	// Data set selection row
	Utility.buildConstraints(gbc, 0, 0, 1, 1, 0.0, 0.0);
	JLabel dataSetLabel = new JLabel(LanguageBundle.getString("in_diDataSet"), SwingConstants.RIGHT);
	gridbag.setConstraints(dataSetLabel, gbc);
	add(dataSetLabel, gbc);

	Utility.buildConstraints(gbc, 1, 0, 2, 1, 1.0, 0.0);
	dataSetSel = new JTextField("", SwingConstants.WEST);
	dataSetSel.setEditable(false);
	gridbag.setConstraints(dataSetSel, gbc);
	add(dataSetSel, gbc);

	Utility.buildConstraints(gbc, 3, 0, 1, 1, 0.0, 0.0);
	gbc.fill = GridBagConstraints.NONE;
	selectButton = new JButton();
	CommonMenuText.name(selectButton, "select"); //$NON-NLS-1$
	gridbag.setConstraints(selectButton, gbc);
	add(selectButton, gbc);
	selectButton.addActionListener(listener);

	// Data set details row
	Utility.buildConstraints(gbc, 0, 1, 4, 1, 1.0, 1.0);
	dataSetDetails = new JFXPanelFromResource<>(
			SimpleHtmlPanelController.class,
			"SimpleHtmlPanel.fxml"
	);
	dataSetDetails.setPreferredSize(new Dimension(400, 200));
	dataSetDetails.setBackground(getBackground());
	gbc.fill = GridBagConstraints.BOTH;
	JScrollPane jScrollPane = new JScrollPane();
	jScrollPane.setViewportView(dataSetDetails);
	gridbag.setConstraints(jScrollPane, gbc);
	add(jScrollPane, gbc);

	// Location row
	Utility.buildConstraints(gbc, 0, 2, 1, 1, 0.0, 0.0);
	gbc.fill = GridBagConstraints.HORIZONTAL;
	JLabel locLabel = new JLabel(LanguageBundle.getString("in_diLocation"), SwingConstants.RIGHT);
	gridbag.setConstraints(locLabel, gbc);
	add(locLabel, gbc);

	ButtonGroup exclusiveGroup = new ButtonGroup();
	locDataButton = new JRadioButton(LanguageBundle.getString("in_diData"));
	locDataButton.setToolTipText(LanguageBundle.getString("in_diData_tip"));
	exclusiveGroup.add(locDataButton);
	locVendorDataButton = new JRadioButton(LanguageBundle.getString("in_diVendorData"));
	locVendorDataButton.setToolTipText(LanguageBundle.getString("in_diVendorData_tip"));
	exclusiveGroup.add(locVendorDataButton);
	locHomebrewDataButton = new JRadioButton(LanguageBundle.getString("in_diHomebrewData"));
	locHomebrewDataButton.setToolTipText(LanguageBundle.getString("in_diHomebrewData_tip"));
	exclusiveGroup.add(locHomebrewDataButton);
	JPanel optionsPanel = new JPanel();
	optionsPanel.add(locDataButton);
	optionsPanel.add(locVendorDataButton);
	optionsPanel.add(locHomebrewDataButton);
	Utility.buildConstraints(gbc, 1, 2, 3, 1, 0.0, 0.0);
	gridbag.setConstraints(optionsPanel, gbc);
	gbc.fill = GridBagConstraints.NONE;
	gbc.anchor = GridBagConstraints.WEST;
	add(optionsPanel, gbc);

	// Buttons row
	installButton = new JButton();
	CommonMenuText.name(installButton, "diInstall"); //$NON-NLS-1$
	installButton.addActionListener(listener);
	closeButton = new JButton();
	CommonMenuText.name(closeButton, "close"); //$NON-NLS-1$
	closeButton.addActionListener(listener);

	JPanel buttonsPanel = new JPanel();
	buttonsPanel.add(installButton);
	buttonsPanel.add(closeButton);
	Utility.buildConstraints(gbc, 2, 3, 2, 1, 0.0, 0.0);
	gridbag.setConstraints(buttonsPanel, gbc);
	gbc.fill = GridBagConstraints.NONE;
	gbc.anchor = GridBagConstraints.EAST;
	add(buttonsPanel, gbc);

	pack();
}
 
Example 19
Source File: FirstIcon.java    From pumpernickel with MIT License 4 votes vote down vote up
public FirstIcon(int barWidth, int width, int height, Color color) {
	triangleIcon = new TriangleIcon(SwingConstants.WEST, width - 2
			* barWidth, height, color);
	barIcon = new BarIcon(barWidth, height, color);
}
 
Example 20
Source File: LayoutStyle.java    From RipplePower with Apache License 2.0 3 votes vote down vote up
/**
 * Returns the amount of space to position a component inside its parent.
 * 
 * @param component
 *            the <code>Component</code> being positioned
 * @param position
 *            the position <code>component</code> is being placed relative
 *            to its parent; one of <code>SwingConstants.NORTH</code>,
 *            <code>SwingConstants.SOUTH</code>,
 *            <code>SwingConstants.EAST</code> or
 *            <code>SwingConstants.WEST</code>
 * @param parent
 *            the parent of <code>component</code>; this may differ from the
 *            actual parent and may be null
 * @return the amount of space to place between the component and specified
 *         edge
 * @throws IllegalArgumentException
 *             if <code>position</code> is not one of
 *             <code>SwingConstants.NORTH</code>,
 *             <code>SwingConstants.SOUTH</code>,
 *             <code>SwingConstants.EAST</code> or
 *             <code>SwingConstants.WEST</code>; or <code>component</code>
 *             is null
 */
public int getContainerGap(JComponent component, int position, Container parent) {
	if (position != SwingConstants.NORTH && position != SwingConstants.SOUTH && position != SwingConstants.WEST
			&& position != SwingConstants.EAST) {
		throw new IllegalArgumentException("Invalid position");
	}
	if (component == null) {
		throw new IllegalArgumentException("Component must be non-null");
	}
	return 12;
}