Example usage for javax.swing Box getPreferredSize

List of usage examples for javax.swing Box getPreferredSize

Introduction

In this page you can find the example usage for javax.swing Box getPreferredSize.

Prototype

@Transient
public Dimension getPreferredSize() 

Source Link

Document

If the preferredSize has been set to a non-null value just returns it.

Usage

From source file:visolate.Visolate.java

public Visolate(File file) {

    processstatus = 0;/*from w  w  w  .  j a  v a  2s  . c o m*/
    display = new Display(this);
    simulator = new Simulator(this);
    model = new Model(this);
    // TODO: get a toolpathsProcessor here, too, and get rid of myToolpathsProcessor.
    gCodeWriter = new GCodeFileWriter();

    setBackground(Color.WHITE);
    setOpaque(true);

    Dimension d;

    Box processingBox = getProcessingBox();

    Box box = Box.createVerticalBox();

    box.add(getLoadFileBox());
    box.add(display);
    box.add(model);
    box.add(getGCodeOptionsBox());
    box.add(processingBox);

    setLayout(new BorderLayout());
    add(box, "Center");

    //make display take up max available space

    Dimension orig = getPreferredSize();

    d = getLoadFileBox().getPreferredSize();
    getLoadFileBox().setMaximumSize(new Dimension(Integer.MAX_VALUE, d.height));

    d = model.getPreferredSize();
    model.setMaximumSize(new Dimension(Integer.MAX_VALUE, d.height));

    d = processingBox.getPreferredSize();
    processingBox.setMaximumSize(new Dimension(Integer.MAX_VALUE, d.height));

    display.setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    setPreferredSize(orig);

    if (file != null)
        loadFile(file);
}