Search code examples
javaswingjframejgoodiesform-layout

JGoodies... FormLayout


Ok so i am trying to get a 3 JPanel JFrame where right and left panel have a fixed width but are vertically re-sizable and a center panel that can be re-sized both horizontally and vertically.

Since standard LayoutManagers are terrible and simply annoying i have been told that the industry standard and easiest to work whit and handle is JGoodies. However seems that a lot of link on JGoodies website are dead regarding their examples / tutorials there is a 400 page PDF i dont want to read.

Anyhow i have started implementing FormLayout to my first UI_View and i ran in to a problem

package ppe.view;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import com.jgoodies.forms.layout.*;

public class UI_View extends JFrame
{
    private JScrollPane right   = new JScrollPane();
    private JList       browse  = new JList();

    public UI_View()
    {
        this.setTitle("Prototype MVC Arhitecture");
        this.setMinimumSize(new Dimension(800, 600));
        this.setExtendedState(this.MAXIMIZED_BOTH);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        FormLayout layout = new FormLayout("right:pref, 7dlu","p, 1dlu");
        layout.setColumnGroups(new int [][]{{1}});
        JPanel content = new JPanel(layout);

        CellConstraints c = new CellConstraints();
        right.add(browse);
        content.add(right, c.xy(1, 1));
        this.add(content);
    }

    public static void main(String[] args)
    {
        new UI_View().setVisible(true);
    }

}

Solution

  • You a missing a Jar file. JGoodies has several Jar files, make sure you have the ones you need.