Question

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);
    }

}
Was it helpful?

Solution

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

OTHER TIPS

MiG Layout is the best layout manager I've used, but I like JGoodies for its Binding and Validation libraries. You can find tutorial code samples in the older versions in the download archive.

What also might make your life easier is to use Eclipse with the WindowBuilder plugin. It's a layout tool that supports FormLayout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top