Example usage for javax.swing.border LineBorder createGrayLineBorder

List of usage examples for javax.swing.border LineBorder createGrayLineBorder

Introduction

In this page you can find the example usage for javax.swing.border LineBorder createGrayLineBorder.

Prototype

public static Border createGrayLineBorder() 

Source Link

Document

Convenience method for getting the Color.gray LineBorder of thickness 1.

Usage

From source file:Main.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Label Text Pos");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setLayout(new GridLayout(2, 2));

    Border border = LineBorder.createGrayLineBorder();
    Icon warnIcon = MetalIconFactory.getTreeComputerIcon();

    JLabel label1 = new JLabel();
    label1.setText("Left-Bottom");
    label1.setHorizontalTextPosition(JLabel.LEFT);
    label1.setVerticalTextPosition(JLabel.BOTTOM);
    label1.setBorder(border);/*from   w ww  . j a  v a2s .co m*/
    frame.add(label1);

    JLabel label2 = new JLabel(warnIcon);
    label2.setText("Right-TOP");
    label2.setHorizontalTextPosition(JLabel.RIGHT);
    label2.setVerticalTextPosition(JLabel.TOP);
    label2.setBorder(border);
    frame.add(label2);

    JLabel label3 = new JLabel(warnIcon);
    label3.setText("Center-Center");
    label3.setHorizontalTextPosition(JLabel.CENTER);
    label3.setVerticalTextPosition(JLabel.CENTER);
    label3.setBorder(border);
    frame.add(label3);

    JLabel label4 = new JLabel(warnIcon);
    label4.setText("Center-Bottom");
    label4.setHorizontalTextPosition(JLabel.CENTER);
    label4.setVerticalTextPosition(JLabel.BOTTOM);
    label4.setBorder(border);
    frame.add(label4);

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:MainClass.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Label Text Pos");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    frame.setLayout(new GridLayout(2, 2));

    Border border = LineBorder.createGrayLineBorder();
    Icon warnIcon = MetalIconFactory.getTreeComputerIcon();

    JLabel label1 = new JLabel(warnIcon);
    label1.setText("Left-Bottom");
    label1.setHorizontalTextPosition(JLabel.LEFT);
    label1.setVerticalTextPosition(JLabel.BOTTOM);
    label1.setBorder(border);/* w w w.ja  va2s.com*/
    frame.add(label1);

    JLabel label2 = new JLabel(warnIcon);
    label2.setText("Right-TOP");
    label2.setHorizontalTextPosition(JLabel.RIGHT);
    label2.setVerticalTextPosition(JLabel.TOP);
    label2.setBorder(border);
    frame.add(label2);

    JLabel label3 = new JLabel(warnIcon);
    label3.setText("Center-Center");
    label3.setHorizontalTextPosition(JLabel.CENTER);
    label3.setVerticalTextPosition(JLabel.CENTER);
    label3.setBorder(border);
    frame.add(label3);

    JLabel label4 = new JLabel(warnIcon);
    label4.setText("Center-Bottom");
    label4.setHorizontalTextPosition(JLabel.CENTER);
    label4.setVerticalTextPosition(JLabel.BOTTOM);
    label4.setBorder(border);
    frame.add(label4);

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:LabelTextPos.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Label Text Pos");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Container content = frame.getContentPane();
    content.setLayout(new GridLayout(2, 2));

    Border border = LineBorder.createGrayLineBorder();
    Icon warnIcon = new ImageIcon("Warn.gif");

    JLabel label1 = new JLabel(warnIcon);
    label1.setText("Left-Bottom");
    label1.setHorizontalTextPosition(JLabel.LEFT);
    label1.setVerticalTextPosition(JLabel.BOTTOM);
    label1.setBorder(border);//from   w w  w . java 2 s  . co  m
    content.add(label1);

    JLabel label2 = new JLabel(warnIcon);
    label2.setText("Right-TOP");
    label2.setHorizontalTextPosition(JLabel.RIGHT);
    label2.setVerticalTextPosition(JLabel.TOP);
    label2.setBorder(border);
    content.add(label2);

    JLabel label3 = new JLabel(warnIcon);
    label3.setText("Center-Center");
    label3.setHorizontalTextPosition(JLabel.CENTER);
    label3.setVerticalTextPosition(JLabel.CENTER);
    label3.setBorder(border);
    content.add(label3);

    JLabel label4 = new JLabel(warnIcon);
    label4.setText("Center-Bottom");
    label4.setHorizontalTextPosition(JLabel.CENTER);
    label4.setVerticalTextPosition(JLabel.BOTTOM);
    label4.setBorder(border);
    content.add(label4);

    frame.setSize(300, 200);
    frame.setVisible(true);
}

From source file:BorderLayoutExample.java

public static void main(String[] args) {
    JFrame f = new JFrame();
    JMenuBar menubar = new JMenuBar();
    JMenu file = new JMenu("File");

    menubar.add(file);//from  w ww  .  j a v a 2  s.co m
    f.setJMenuBar(menubar);

    JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);

    JButton bexit = new JButton(new ImageIcon("exit.png"));
    bexit.setBorder(new EmptyBorder(0, 0, 0, 0));
    toolbar.add(bexit);

    f.add(toolbar, BorderLayout.NORTH);

    JToolBar vertical = new JToolBar(JToolBar.VERTICAL);
    vertical.setFloatable(false);
    vertical.setMargin(new Insets(10, 5, 5, 5));

    JButton selectb = new JButton(new ImageIcon("a.png"));
    selectb.setBorder(new EmptyBorder(3, 0, 3, 0));

    JButton freehandb = new JButton(new ImageIcon("b.png"));
    freehandb.setBorder(new EmptyBorder(3, 0, 3, 0));
    JButton shapeedb = new JButton(new ImageIcon("c.png"));
    shapeedb.setBorder(new EmptyBorder(3, 0, 3, 0));

    vertical.add(selectb);
    vertical.add(freehandb);
    vertical.add(shapeedb);

    f.add(vertical, BorderLayout.WEST);
    f.add(new JTextArea(), BorderLayout.CENTER);

    JLabel statusbar = new JLabel(" Statusbar");
    statusbar.setPreferredSize(new Dimension(-1, 22));
    statusbar.setBorder(LineBorder.createGrayLineBorder());
    f.add(statusbar, BorderLayout.SOUTH);
    f.setSize(350, 300);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setVisible(true);
}

From source file:com.game.ui.views.CharachterEditorPanel.java

public void doGui() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    JLabel noteLbl = new JLabel("Pls select a value to choose an enemy or you can create a new "
            + "Enemy entity below. Once selected an Enemy character, its' details will be available below");
    noteLbl.setAlignmentX(0);/*from  www .j  a  v  a  2  s .  c  o  m*/
    //        noteLbl.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    add(noteLbl);
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (GameCharacter character : GameBean.enemyDetails) {
        System.out.println(character.getName());
        model.addElement(character.getName());
    }
    comboBox = new JComboBox(model);
    comboBox.setSelectedIndex(-1);
    comboBox.setMaximumSize(new Dimension(100, 30));
    comboBox.setAlignmentX(0);
    comboBox.setActionCommand("dropDown");
    comboBox.addActionListener(this);
    add(Box.createVerticalStrut(10));
    add(comboBox);
    add(Box.createVerticalStrut(10));
    JPanel panel1 = new JPanel();
    panel1.setAlignmentX(0);
    panel1.setBorder(LineBorder.createGrayLineBorder());
    panel1.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 2;
    JLabel enemyDtlLbl = new JLabel("Enemy Character Details : ");
    enemyDtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    panel1.add(enemyDtlLbl, c);
    c.gridwidth = 1;
    c.gridy = 1;
    JLabel nameLbl = new JLabel("Name : ");
    panel1.add(nameLbl, c);
    c.gridx = 1;
    JTextField name = new JTextField("");
    name.setColumns(20);
    panel1.add(name, c);
    c.gridx = 0;
    c.gridy = 2;
    JLabel imageLbl = new JLabel("Image Path : ");
    panel1.add(imageLbl, c);
    c.gridx = 1;
    JTextField image = new JTextField("");
    image.setColumns(20);
    panel1.add(image, c);
    c.gridx = 0;
    c.gridy = 3;
    JLabel healthLbl = new JLabel("Health Pts : ");
    panel1.add(healthLbl, c);
    c.gridx = 1;
    JTextField health = new JTextField("");
    health.setColumns(20);
    panel1.add(health, c);
    c.gridx = 0;
    c.gridy = 4;
    JLabel attackPtsLbl = new JLabel("Attack Points : ");
    panel1.add(attackPtsLbl, c);
    c.gridx = 1;
    JTextField attackPts = new JTextField("");
    attackPts.setColumns(20);
    panel1.add(attackPts, c);
    c.gridx = 0;
    c.gridy = 5;
    JLabel armoursPtsLbl = new JLabel("Armour Points : ");
    panel1.add(armoursPtsLbl, c);
    c.gridx = 1;
    JTextField armourPts = new JTextField("");
    armourPts.setColumns(20);
    panel1.add(armourPts, c);
    c.gridx = 0;
    c.gridy = 6;
    JLabel attackRngeLbl = new JLabel("Attack Range : ");
    panel1.add(attackRngeLbl, c);
    c.gridx = 1;
    JTextField attackRnge = new JTextField("");
    attackRnge.setColumns(20);
    panel1.add(attackRnge, c);
    c.gridx = 0;
    c.gridy = 7;
    JLabel movementLbl = new JLabel("Movement : ");
    panel1.add(movementLbl, c);
    c.gridx = 1;
    JTextField movement = new JTextField("");
    movement.setColumns(20);
    panel1.add(movement, c);
    c.gridx = 0;
    c.gridy = 8;
    c.gridwidth = 2;
    JButton submit = new JButton("Save");
    submit.addActionListener(this);
    submit.setActionCommand("button");
    panel1.add(submit, c);
    add(panel1);
    c.gridx = 0;
    c.gridy = 9;
    JLabel validationMess = new JLabel("Pls enter all the fields or pls choose a character from the drop down");
    validationMess.setForeground(Color.red);
    validationMess.setVisible(false);
    add(validationMess, c);
    add(Box.createVerticalGlue());
}

From source file:com.game.ui.views.PlayerEditor.java

public void doGui() {
    //        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setLayout(new GridBagLayout());
    GridBagConstraints c1 = new GridBagConstraints();
    c1.fill = GridBagConstraints.NONE;
    c1.anchor = GridBagConstraints.WEST;
    c1.insets = new Insets(10, 5, 10, 5);
    c1.weightx = 0;/*from  w  ww  . j a  v  a2s. c  o m*/
    c1.weighty = 0;
    JLabel noteLbl = new JLabel("Pls select a value to choose a Player or you can create a new "
            + "Player entity below. Once selected a Player character, its' details will be available below");
    add(noteLbl, c1);
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (GameCharacter character : GameBean.playerDetails) {
        model.addElement(((Player) character).getType());
    }
    c1.gridy = 1;
    comboBox = new JComboBox(model);
    comboBox.setSelectedIndex(-1);
    comboBox.setMaximumSize(new Dimension(100, 30));
    comboBox.setActionCommand("dropDown");
    comboBox.addActionListener(this);
    add(comboBox, c1);
    JPanel wrapperPanel = new JPanel(new GridLayout(1, 2, 10, 10));
    wrapperPanel.setBorder(LineBorder.createGrayLineBorder());
    leftPanel = new JPanel();
    leftPanel.setAlignmentX(0);
    leftPanel.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 2;
    JLabel enemyDtlLbl = new JLabel("Enemy Character Details : ");
    enemyDtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    leftPanel.add(enemyDtlLbl, c);
    c.gridwidth = 1;
    c.gridy = 1;
    JLabel nameLbl = new JLabel("Name : ");
    leftPanel.add(nameLbl, c);
    c.gridx = 1;
    JTextField name = new JTextField("");
    name.setColumns(20);
    leftPanel.add(name, c);
    c.gridx = 0;
    c.gridy = 2;
    JLabel imageLbl = new JLabel("Image Path : ");
    leftPanel.add(imageLbl, c);
    c.gridx = 1;
    JTextField image = new JTextField("");
    image.setColumns(20);
    leftPanel.add(image, c);
    c.gridx = 0;
    c.gridy = 3;
    JLabel healthLbl = new JLabel("Health Pts : ");
    leftPanel.add(healthLbl, c);
    c.gridx = 1;
    JTextField health = new JTextField("");
    health.setColumns(20);
    leftPanel.add(health, c);
    c.gridx = 0;
    c.gridy = 4;
    JLabel attackPtsLbl = new JLabel("Attack Points : ");
    leftPanel.add(attackPtsLbl, c);
    c.gridx = 1;
    JTextField attackPts = new JTextField("");
    attackPts.setColumns(20);
    leftPanel.add(attackPts, c);
    c.gridx = 0;
    c.gridy = 5;
    JLabel armoursPtsLbl = new JLabel("Armour Points : ");
    leftPanel.add(armoursPtsLbl, c);
    c.gridx = 1;
    JTextField armourPts = new JTextField("");
    armourPts.setColumns(20);
    leftPanel.add(armourPts, c);
    c.gridx = 0;
    c.gridy = 6;
    JLabel attackRngeLbl = new JLabel("Attack Range : ");
    leftPanel.add(attackRngeLbl, c);
    c.gridx = 1;
    JTextField attackRnge = new JTextField("");
    attackRnge.setColumns(20);
    leftPanel.add(attackRnge, c);
    c.gridx = 0;
    c.gridy = 7;
    JLabel movementLbl = new JLabel("Movement : ");
    leftPanel.add(movementLbl, c);
    c.gridx = 1;
    JTextField movement = new JTextField("");
    movement.setColumns(20);
    leftPanel.add(movement, c);
    c.gridx = 0;
    c.gridy = 8;
    JLabel typeLbl = new JLabel("Type : ");
    leftPanel.add(typeLbl, c);
    c.gridx = 1;
    JTextField typeTxt = new JTextField("");
    typeTxt.setColumns(20);
    leftPanel.add(typeTxt, c);
    c.gridx = 0;
    c.gridy = 9;
    JLabel weaponLbl = new JLabel("Equipped Weapon : ");
    leftPanel.add(weaponLbl, c);
    c.gridx = 1;
    DefaultComboBoxModel weapon = new DefaultComboBoxModel();
    for (Item item : GameBean.weaponDetails) {
        if (item instanceof Weapon) {
            weapon.addElement(((Weapon) item).getName());
        }
    }
    JComboBox weaponDrpDown = new JComboBox(weapon);
    weaponDrpDown.setSelectedIndex(-1);
    weaponDrpDown.setMaximumSize(new Dimension(100, 30));
    leftPanel.add(weaponDrpDown, c);
    c.gridx = 0;
    c.gridy = 10;
    c.gridwidth = 2;
    JButton submit = new JButton("Save");
    submit.addActionListener(this);
    submit.setActionCommand("button");
    leftPanel.add(submit, c);
    wrapperPanel.add(leftPanel);
    lvlPanel = new LevelPanel(true, null);
    wrapperPanel.add(lvlPanel);
    c1.gridy = 2;
    c1.fill = GridBagConstraints.BOTH;
    add(wrapperPanel, c1);
    c1.fill = GridBagConstraints.NONE;
    validationMess = new JLabel("Pls enter all the fields or pls choose a character from the drop down");
    validationMess.setForeground(Color.red);
    validationMess.setVisible(false);
    c1.gridy = 3;
    add(validationMess, c1);
    c1.weightx = 1;
    c1.fill = GridBagConstraints.BOTH;
    c1.weighty = 1;
    c1.gridy = 4;
    add(new JPanel(), c1);
}

From source file:org.agmip.ui.afsirs.frames.SWFrame.java

public SWFrame(JFrame prev) {
    initComponents();// ww w.j  a  v a 2 s . c om
    this.prev = prev;
    setLocation(400, 50);
    utils = AFSIRSUtils.getInstance();
    ir = utils.getIrrigationSystem();
    DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer();
    centerRenderer.setHorizontalAlignment(JLabel.CENTER);
    soilTable.setDefaultRenderer(Double.class, centerRenderer);
    soilTable.setDefaultRenderer(Integer.class, centerRenderer);
    infoButton.setForeground(Color.blue);
    infoButton.setBorder(LineBorder.createGrayLineBorder());

    JTableHeader tHeader = soilTable.getTableHeader();
    tHeader.setPreferredSize(new Dimension(300, 35));

    wcErrorLabel.setVisible(false);
    errorLabel.setVisible(false);

    init();

    if (AFSIRSUtils.defaultMode) {
        dwtText.setText(60.0 + "");
        soilListBox.setSelectedIndex(5);
        waterholdcapacityBox.setSelectedIndex(waterHoldSelectedItemIndex[0]);
    }

    getRootPane().setDefaultButton(nextButton);
}

From source file:com.game.ui.views.WeaponEditorPanel.java

public void doGui() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    JLabel noteLbl = new JLabel(
            "<html><div style='width : 500px;'>Pls select a value to choose an Weapon or you can create a new "
                    + "Weapon entity below. Once selected a weapon, its' details will be available below</div></html>");
    noteLbl.setAlignmentX(0);//from w  w w .  j a  v a  2  s.  c  o m
    add(noteLbl);
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (Item item : GameBean.weaponDetails) {
        if (item instanceof Weapon) {
            model.addElement(((Weapon) item).getName());
        }
    }
    comboBox = new JComboBox(model);
    comboBox.setSelectedIndex(-1);
    comboBox.setMaximumSize(new Dimension(100, 30));
    comboBox.setAlignmentX(0);
    comboBox.setActionCommand("dropDown");
    comboBox.addActionListener(this);
    add(Box.createVerticalStrut(10));
    add(comboBox);
    add(Box.createVerticalStrut(10));
    JPanel panel1 = new JPanel();
    panel1.setAlignmentX(0);
    panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel1.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 2;
    JLabel weaponDtsLbl = new JLabel("Weapon Details : ");
    weaponDtsLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    panel1.add(weaponDtsLbl, c);
    c.gridwidth = 1;
    c.gridy = 1;
    JLabel nameLbl = new JLabel("Name : ");
    panel1.add(nameLbl, c);
    c.gridx = 1;
    JTextField name = new JTextField("");
    name.setColumns(20);
    panel1.add(name, c);
    c.gridx = 0;
    c.gridy = 2;
    JLabel weaponTypeLbl = new JLabel("Weapon Type : ");
    panel1.add(weaponTypeLbl, c);
    c.gridx = 1;
    JComboBox weaponType = new JComboBox(Configuration.weaponTypes);
    weaponType.setSelectedIndex(0);
    weaponType.setPreferredSize(name.getPreferredSize());
    System.out.println(name.getPreferredSize());
    panel1.add(weaponType, c);
    c.gridx = 0;
    c.gridy = 3;
    JLabel attackRangeLbl = new JLabel("Attack Range : ");
    panel1.add(attackRangeLbl, c);
    c.gridx = 1;
    JTextField attackRange = new JTextField("");
    attackRange.setColumns(20);
    panel1.add(attackRange, c);
    c.gridx = 0;
    c.gridy = 4;
    JLabel attackPtsLbl = new JLabel("Attack Points : ");
    panel1.add(attackPtsLbl, c);
    c.gridx = 1;
    JTextField attackPts = new JTextField("");
    attackPts.setColumns(20);
    panel1.add(attackPts, c);
    c.gridx = 0;
    c.gridy = 5;
    c.gridwidth = 2;
    JButton submit = new JButton("Save");
    submit.addActionListener(this);
    submit.setActionCommand("button");
    panel1.add(submit, c);
    c.gridx = 0;
    c.gridy = 6;
    c.gridwidth = 2;
    c.weighty = 0;
    c.weightx = 1;
    validationMess = new JLabel("Pls enter all the fields or pls choose a weapon from the drop down");
    validationMess.setForeground(Color.red);
    validationMess.setVisible(false);
    panel1.add(validationMess, c);
    //        c.fill = GridBagConstraints.BOTH;
    //        c.gridy = 7;
    //        c.weightx = 1;
    //        c.weighty = 1;
    //        panel1.add(new JLabel(""), c);
    panel1.setBorder(LineBorder.createGrayLineBorder());
    add(panel1);
    add(Box.createVerticalGlue());
}

From source file:com.game.ui.views.ItemPanel.java

public void doCommonStuffForContent() {
    JPanel panel1 = new JPanel();
    panel1.setAlignmentX(0);//from w ww. ja va2 s. com
    panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel1.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0.2;
    c.gridwidth = 2;
    JLabel dtlLbl = new JLabel(type + "Details : ");
    dtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    panel1.add(dtlLbl, c);
    c.gridwidth = 1;
    c.gridy = 1;
    JLabel nameLbl = new JLabel("Name : ");
    panel1.add(nameLbl, c);
    c.gridx = 1;
    JTextField name = new JTextField("");
    name.setColumns(20);
    panel1.add(name, c);
    if (ringPanel) {
        createComponentsForRing(panel1, c);
    } else if (armourPanel) {
        createComponentsForArmour(panel1, c);
    } else if (potionPanel) {
        createComponentsForPotion(panel1, c);
    } else if (treasurePanel) {
        createComponentsForTreasure(panel1, c);
    }
    c.gridx = 0;
    c.gridy = c.gridy + 1;
    c.gridwidth = 2;
    JButton submit = new JButton("Save");
    submit.addActionListener(this);
    submit.setActionCommand("button");
    panel1.add(submit, c);
    c.gridx = 0;
    c.gridy = c.gridy + 1;
    c.gridwidth = 2;
    c.weighty = 0;
    c.weightx = 1;
    validationMess = new JLabel("Pls enter all the fields or pls choose a " + type + " from the drop down");
    validationMess.setForeground(Color.red);
    validationMess.setVisible(false);
    panel1.add(validationMess, c);
    c.gridy++;
    c.weighty = 1;
    c.weightx = 1;
    panel1.add(new JPanel(), c);
    panel1.setBorder(LineBorder.createGrayLineBorder());
    add(panel1);
    add(Box.createVerticalGlue());
}

From source file:net.openbyte.gui.WelcomeFrame.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Gary Lee
    scrollPane1 = new JScrollPane();
    list1 = new JList();
    button1 = new JButton();
    label2 = new JLabel();
    button2 = new JButton();
    button3 = new JButton();
    button4 = new JButton();
    button5 = new JButton();
    scrollPane2 = new JScrollPane();
    xImagePanel1 = new JXImagePanel();
    button6 = new JButton();
    button7 = new JButton();
    button8 = new JButton();

    //======== this ========
    setTitle("Welcome to OpenByte");
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setResizable(false);//from www. j a  va2  s . c  o m
    Container contentPane = getContentPane();
    contentPane.setLayout(null);

    //======== scrollPane1 ========
    {
        scrollPane1.setBorder(new TitledBorder(LineBorder.createGrayLineBorder(), "Recent Projects"));

        //---- list1 ----
        list1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        list1.setBackground(new Color(240, 240, 240));
        list1.addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                list1ValueChanged(e);
            }
        });
        scrollPane1.setViewportView(list1);
    }
    contentPane.add(scrollPane1);
    scrollPane1.setBounds(15, 10, 165, 340);

    //---- button1 ----
    button1.setText("Open Project");
    button1.setEnabled(false);
    button1.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button1ActionPerformed(e);
        }
    });
    contentPane.add(button1);
    button1.setBounds(105, 355, 110, button1.getPreferredSize().height);

    //---- label2 ----
    label2.setText("Media");
    contentPane.add(label2);
    label2.setBounds(new Rectangle(new Point(605, 210), label2.getPreferredSize()));

    //---- button2 ----
    button2.setText("Minecraft Forums");
    button2.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button2ActionPerformed(e);
        }
    });
    contentPane.add(button2);
    button2.setBounds(500, 230, 151, button2.getPreferredSize().height);

    //---- button3 ----
    button3.setText("GitHub");
    button3.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button3ActionPerformed(e);
        }
    });
    contentPane.add(button3);
    button3.setBounds(500, 260, 150, button3.getPreferredSize().height);

    //---- button4 ----
    button4.setText("+");
    button4.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button4ActionPerformed(e);
        }
    });
    contentPane.add(button4);
    button4.setBounds(15, 355, 45, button4.getPreferredSize().height);

    //---- button5 ----
    button5.setText("-");
    button5.setEnabled(false);
    button5.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button5ActionPerformed(e);
        }
    });
    contentPane.add(button5);
    button5.setBounds(60, 355, 40, button5.getPreferredSize().height);

    //======== scrollPane2 ========
    {
        scrollPane2.setBorder(null);
        scrollPane2.setViewportView(xImagePanel1);
    }
    contentPane.add(scrollPane2);
    scrollPane2.setBounds(210, 25, 445, 160);

    //---- button6 ----
    button6.setText("Preferences");
    button6.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button6ActionPerformed(e);
        }
    });
    contentPane.add(button6);
    button6.setBounds(500, 290, 150, 30);

    //---- button7 ----
    button7.setText("About");
    button7.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button7ActionPerformed(e);
        }
    });
    contentPane.add(button7);
    button7.setBounds(500, 320, 150, 30);

    //---- button8 ----
    button8.setText("Plugins");
    button8.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            button8ActionPerformed(e);
        }
    });
    contentPane.add(button8);
    button8.setBounds(500, 350, 150, 30);

    { // compute preferred size
        Dimension preferredSize = new Dimension();
        for (int i = 0; i < contentPane.getComponentCount(); i++) {
            Rectangle bounds = contentPane.getComponent(i).getBounds();
            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
        }
        Insets insets = contentPane.getInsets();
        preferredSize.width += insets.right;
        preferredSize.height += insets.bottom;
        contentPane.setMinimumSize(preferredSize);
        contentPane.setPreferredSize(preferredSize);
    }
    setSize(675, 425);
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}