Example usage for java.awt FlowLayout setVgap

List of usage examples for java.awt FlowLayout setVgap

Introduction

In this page you can find the example usage for java.awt FlowLayout setVgap.

Prototype

public void setVgap(int vgap) 

Source Link

Document

Sets the vertical gap between components and between the components and the borders of the Container .

Usage

From source file:org.openmicroscopy.shoola.agents.measurement.util.ui.ResultsCellRenderer.java

/**
 * Adds the appropriate shape icon to the label.
 * //w w w. j a va 2  s. c om
 * @param shape above.
 */
private JComponent makeShapeIcon(JLabel label, String shape) {
    if (FigureUtil.SCRIBBLE_TYPE.equals(shape))
        label.setIcon(SCRIBBLE);
    else if (FigureUtil.LINE_TYPE.equals(shape))
        label.setIcon(LINE);
    else if (FigureUtil.LINE_CONNECTION_TYPE.equals(shape))
        label.setIcon(CONNECTION);
    else if (FigureUtil.POLYGON_TYPE.equals(shape))
        label.setIcon(POLYGON);
    else if (FigureUtil.POINT_TYPE.equals(shape))
        label.setIcon(POINT);
    else if (FigureUtil.RECTANGLE_TYPE.equals(shape))
        label.setIcon(RECTANGLE);
    else if (FigureUtil.ELLIPSE_TYPE.equals(shape))
        label.setIcon(ELLIPSE);
    else if (FigureUtil.TEXT_TYPE.equals(shape))
        label.setIcon(TEXT);
    else if (FigureUtil.MASK_TYPE.equals(shape))
        label.setIcon(MASK);
    else
        label.setText(shape);
    if (label.getIcon() != null) {
        JPanel p = new JPanel();
        FlowLayout layout = new FlowLayout(FlowLayout.CENTER);
        layout.setVgap(0);
        p.setBorder(BorderFactory.createEmptyBorder());
        p.setLayout(layout);
        p.setOpaque(true);
        p.setBackground(getBackground());
        p.add(label);
        return p;
    }
    return label;
}