Example usage for javax.swing JScrollPane getMaximumSize

List of usage examples for javax.swing JScrollPane getMaximumSize

Introduction

In this page you can find the example usage for javax.swing JScrollPane getMaximumSize.

Prototype

@Transient
public Dimension getMaximumSize() 

Source Link

Document

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

Usage

From source file:ca.phon.app.session.editor.view.segmentation.SegmentationEditorView.java

private void init() {
    segmentWindowField = new JTextField();
    SegmentWindowDocument segDoc = new SegmentWindowDocument();
    segmentWindowField.setDocument(segDoc);
    segmentWindowField.setText(DEFAULT_SEGMENT_WINDOW + "");
    segDoc.addDocumentListener(new SegmentWindowListener());

    segmentLabel = new SegmentLabel();
    segmentLabel.setSegmentWindow(DEFAULT_SEGMENT_WINDOW);
    segmentLabel.setCurrentTime(0L);/*from  ww  w  .ja  v a2s .  co m*/
    segmentLabel.lockSegmentStartTime(-1L);

    modeBox = new JComboBox(SegmentationMode.values());
    modeBox.setSelectedItem(SegmentationMode.INSERT_AFTER_CURRENT);

    JPanel topPanel = new JPanel();
    FormLayout topLayout = new FormLayout("right:pref, 3dlu, fill:default:grow, pref",
            "pref, pref, pref, pref");
    topPanel.setLayout(topLayout);
    CellConstraints cc = new CellConstraints();
    topPanel.add(new JLabel("Segment Window"), cc.xy(1, 1));
    topPanel.add(segmentWindowField, cc.xy(3, 1));
    topPanel.add(new JLabel("ms"), cc.xy(4, 1));

    JLabel infoLabel = new JLabel("Set to 0 for unlimited segment time");
    infoLabel.setFont(infoLabel.getFont().deriveFont(10.0f));

    topPanel.add(infoLabel, cc.xy(3, 2));
    topPanel.add(new JLabel("Current Window"), cc.xy(1, 3));
    topPanel.add(segmentLabel, cc.xy(3, 3));

    topPanel.add(new JLabel("Mode"), cc.xy(1, 4));
    topPanel.add(modeBox, cc.xyw(3, 4, 2));

    setLayout(new BorderLayout());
    add(topPanel, BorderLayout.NORTH);

    participantPanel = new JPanel();

    participantPanel.setBackground(Color.white);
    participantPanel.setOpaque(true);

    JScrollPane participantScroller = new JScrollPane(participantPanel);
    Dimension prefSize = participantScroller.getPreferredSize();
    prefSize.height = 150;
    participantScroller.setPreferredSize(prefSize);
    Dimension maxSize = participantScroller.getMaximumSize();
    maxSize.height = 200;
    participantScroller.setMaximumSize(maxSize);
    Dimension minSize = participantScroller.getMinimumSize();
    minSize.height = 100;
    participantScroller.setMinimumSize(minSize);
    participantScroller.setBorder(BorderFactory.createTitledBorder("Participants"));

    add(participantScroller, BorderLayout.CENTER);

    updateParticipantPanel();
    setupEditorActions();
}