Java JPanel Child addSpacer(JPanel panel)

Here you can find the source of addSpacer(JPanel panel)

Description

add Spacer

License

Apache License

Declaration

public static void addSpacer(JPanel panel) 

Method Source Code

//package com.java2s;
/*/*ww  w . j  a v a  2 s  .co m*/
 * Copyright (C) 2011 Cozycode.net
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.awt.Dimension;

import javax.swing.JPanel;

public class Main {
    public static void addSpacer(JPanel panel) {
        JPanel filler = new JPanel();
        filler.setOpaque(false);
        filler.setPreferredSize(new Dimension(0, 10));
        panel.add(filler, "span");
    }
}

Related

  1. addComponent(JPanel panel, Component c, int x, int y, int width, int height, int ipadx, int ipady, double weightx, double weighty, int fill, int anchor)
  2. addComponents(JPanel panel, JComponent... comps)
  3. addGBC(JPanel panel, Component component, int gridx, int gridy, int anchor, Insets insets)
  4. addInput2Pane(String label, Component c, JPanel p, int row)
  5. addSection(JPanel panel, String title)
  6. addTo(JPanel panel, String label, String value)
  7. addToGridBag(Component comp, JPanel panel, int gridx, int gridy, int width, int height, int anchor)
  8. addToGridBag(final JPanel panel, final Component component, final int x, final int y)
  9. addTwoCheckBoxes(JPanel panel, JCheckBox first, boolean firstChecked, JCheckBox second, boolean secondChecked)