Example usage for javax.swing JPanel setPreferredSize

List of usage examples for javax.swing JPanel setPreferredSize

Introduction

In this page you can find the example usage for javax.swing JPanel setPreferredSize.

Prototype

@BeanProperty(preferred = true, description = "The preferred size of the component.")
public void setPreferredSize(Dimension preferredSize) 

Source Link

Document

Sets the preferred size of this component.

Usage

From source file:desmoj.extensions.visualization2d.engine.modelGrafic.StatisticGrafic.java

/**
 * Build content for animationType StatisticGrafic.ANIMATION_LastValue
 * @return/*from   ww w. jav a 2s.c  o  m*/
 */
private JPanel buildLastValuePanel() {
    JPanel out = new JPanel();
    out.setBackground(Grafic.COLOR_BACKGROUND);
    out.setOpaque(true);
    out.setLayout(new BorderLayout());
    switch (this.statistic.getTypeIndex()) {
    case Statistic.INDEX_None:
        this.valueLabel = new JLabel();
        this.valueLabel.setFont(Grafic.FONT_BIG);
        this.valueLabel.setForeground(Grafic.COLOR_FOREGROUND);
        out.add(this.valueLabel, BorderLayout.CENTER);
        if (this.isIntValue)
            out.setPreferredSize(new Dimension(80, 50));
        else
            out.setPreferredSize(new Dimension(100, 50));
        break;
    case Statistic.INDEX_Min_Max:
        this.valueLabel = new JLabel();
        this.valueLabel.setFont(Grafic.FONT_BIG);
        this.valueLabel.setForeground(Grafic.COLOR_FOREGROUND);
        out.add(this.valueLabel, BorderLayout.CENTER);
        ;
        Box top = Box.createVerticalBox();
        this.minLabel = new JLabel();
        this.minLabel.setFont(Grafic.FONT_DEFAULT);
        this.minLabel.setForeground(Grafic.COLOR_FOREGROUND);
        top.add(this.minLabel);
        this.maxLabel = new JLabel();
        this.maxLabel.setFont(Grafic.FONT_DEFAULT);
        this.maxLabel.setForeground(Grafic.COLOR_FOREGROUND);
        top.add(this.maxLabel);
        out.add(top, BorderLayout.SOUTH);
        if (this.isIntValue)
            out.setPreferredSize(new Dimension(80, 70));
        else
            out.setPreferredSize(new Dimension(100, 70));
        break;
    case Statistic.INDEX_Mean_StdDev:
        this.valueLabel = new JLabel();
        this.valueLabel.setFont(Grafic.FONT_BIG);
        this.valueLabel.setForeground(Grafic.COLOR_FOREGROUND);
        out.add(this.valueLabel, BorderLayout.CENTER);
        ;
        Box bottom = Box.createVerticalBox();
        this.meanLabel = new JLabel();
        this.meanLabel.setFont(Grafic.FONT_DEFAULT);
        this.meanLabel.setForeground(Grafic.COLOR_FOREGROUND);
        bottom.add(this.meanLabel);
        this.stdDevLabel = new JLabel();
        this.stdDevLabel.setFont(Grafic.FONT_DEFAULT);
        this.stdDevLabel.setForeground(Grafic.COLOR_FOREGROUND);
        bottom.add(this.stdDevLabel);
        out.add(bottom, BorderLayout.SOUTH);
        if (this.isIntValue)
            out.setPreferredSize(new Dimension(80, 70));
        else
            out.setPreferredSize(new Dimension(100, 70));
        break;
    }
    return out;
}

From source file:de.ailis.xadrian.frames.MainFrame.java

/**
 * Creates the content.//from  w w w . jav  a  2  s.c  om
 */
private void createContent() {
    this.tabs = new JTabbedPane();
    this.tabs.setPreferredSize(new Dimension(640, 480));
    this.tabs.addChangeListener(this);
    this.tabs.setTransferHandler(this.transferHandler);

    final JPanel welcomePanel = this.welcomePanel = new JPanel();
    welcomePanel.setTransferHandler(this.transferHandler);

    welcomePanel.setLayout(new GridBagLayout());
    final GridBagConstraints c = new GridBagConstraints();

    welcomePanel.setPreferredSize(new Dimension(640, 480));
    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());
    c.anchor = GridBagConstraints.CENTER;
    welcomePanel.add(buttonPanel, c);

    final JButton newButton = new JButton(this.newAction);
    newButton.setHorizontalAlignment(SwingConstants.LEFT);
    newButton.setIconTextGap(10);
    newButton.setText("<html><body><strong>" + newButton.getText() + "</strong><br />"
            + newButton.getToolTipText() + "</body></html>");
    newButton.setToolTipText(null);
    newButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    c.insets.set(5, 5, 5, 5);
    buttonPanel.add(newButton, c);

    final JButton openButton = new JButton(this.openAction);
    openButton.setHorizontalAlignment(SwingConstants.LEFT);
    openButton.setIconTextGap(10);
    openButton.setText("<html><body><strong>" + openButton.getText() + "</strong><br />"
            + openButton.getToolTipText() + "</body></html>");
    openButton.setToolTipText(null);
    openButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy++;
    buttonPanel.add(openButton, c);

    final JPanel separator = new JPanel();
    separator.setPreferredSize(new Dimension(20, 20));
    c.gridy++;
    buttonPanel.add(separator, c);

    final JButton donateButton = new JButton(this.donateAction);
    donateButton.setHorizontalAlignment(SwingConstants.LEFT);
    donateButton.setIconTextGap(10);
    donateButton.setText("<html><body><strong>" + donateButton.getText() + "</strong><br />"
            + donateButton.getToolTipText() + "</body></html>");
    donateButton.setToolTipText(null);
    donateButton.setMargin(new Insets(5, 10, 5, 10));
    c.gridy++;
    buttonPanel.add(donateButton, c);

    final SocialPane socialPane = new SocialPane();
    c.insets.top = 50;
    c.gridy++;
    buttonPanel.add(socialPane, c);
    installStatusHandler(buttonPanel);

    add(welcomePanel, BorderLayout.CENTER);
}

From source file:edu.ucla.stat.SOCR.chart.SuperXYChart_QQ.java

public void initMapPanel() {
    listIndex = new int[dataTable.getColumnCount()];
    for (int j = 0; j < listIndex.length; j++)
        listIndex[j] = 1;//from  w w  w.  j  av a 2 s . c om
    bPanel = new JPanel(new BorderLayout());
    mapPanel = new JPanel(new GridLayout(2, 3, 50, 50));
    bPanel.add(mapPanel, BorderLayout.CENTER);

    addButton1.addActionListener(this);
    addButton2.addActionListener(this);
    removeButton1.addActionListener(this);
    removeButton2.addActionListener(this);

    lModelAdded = new DefaultListModel();
    lModelDep = new DefaultListModel();
    lModelIndep = new DefaultListModel();

    int cellWidth = 10;

    listAdded = new JList(lModelAdded);
    listAdded.setSelectedIndex(0);
    listDepRemoved = new JList(lModelDep);
    listIndepRemoved = new JList(lModelIndep);

    paintMappingLists(listIndex);
    listAdded.setFixedCellWidth(cellWidth);
    listDepRemoved.setFixedCellWidth(cellWidth);
    listIndepRemoved.setFixedCellWidth(cellWidth);

    tools1 = new JToolBar(JToolBar.VERTICAL);
    tools2 = new JToolBar(JToolBar.VERTICAL);

    tools1.add(depLabel);
    //    tools2.add(indLabel);

    tools1.setFloatable(false);
    tools2.setFloatable(false);
    tools1.add(addButton1);
    tools1.add(removeButton1);
    //  tools2.add(addButton2);
    //   tools2.add(removeButton2);

    JRadioButton disChoices_normal;
    JRadioButton disChoices_poisson;

    //
    JPanel choicesPanel = new JPanel();
    disChoices_normal = new JRadioButton("Normal");
    disChoices_normal.addActionListener(this);
    disChoices_normal.setActionCommand(NORMAL);
    disChoices_normal.setSelected(true);
    disChoice = NORMAL;

    disChoices_poisson = new JRadioButton("Poisson");
    disChoices_poisson.addActionListener(this);
    disChoices_poisson.setActionCommand(POISSON);

    ButtonGroup group = new ButtonGroup();
    group.add(disChoices_normal);
    group.add(disChoices_poisson);
    choicesPanel.add(new JLabel("Choices of distribution:"));
    choicesPanel.add(disChoices_normal);
    choicesPanel.add(disChoices_poisson);
    choicesPanel.setPreferredSize(new Dimension(200, 100));

    mapPanel.add(new JScrollPane(listAdded));
    mapPanel.add(tools1);
    mapPanel.add(new JScrollPane(listDepRemoved));
    //      JPanel emptyPanel = new JPanel(new GridLayout(0,1));
    //   mapPanel.add(emptyPanel);
    mapPanel.add(choicesPanel);
    mapPanel.add(tools2);
    mapPanel.add(new JScrollPane(listIndepRemoved));

}

From source file:org.jfree.chart.demo.SuperDemo.java

private JPanel createNoDemoSelectedPanel() {
    JPanel jpanel = new JPanel(new FlowLayout()) {

        private static final long serialVersionUID = 1L;

        public String getToolTipText() {
            return "(" + getWidth() + ", " + getHeight() + ")";
        }/*from w w w  .j a v a2 s .c o m*/

    };
    ToolTipManager.sharedInstance().registerComponent(jpanel);
    jpanel.add(new JLabel("No demo selected"));
    jpanel.setPreferredSize(new Dimension(600, 400));
    return jpanel;
}

From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java

private final JPanel buildBottomPanel() {
    JPanel panel = new JPanel(new BorderLayout());
    JTabbedPane tabbedPane = new JTabbedPane();
    Dimension size = new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT / 10);

    panel.setSize(size);//  www.j  av  a2s . co m
    panel.setPreferredSize(size);

    tabbedPane.add("Symbol Profiling", new JScrollPane(profilingSymbolTable));

    tabbedPane.add("Message Profiling", new JScrollPane(profilingMsgTable));

    tabbedPane.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            profilingSymbolTable.clearSelection();
            profilingMsgTable.clearSelection();
        }
    });
    panel.add(tabbedPane);

    return panel;
}

From source file:de.codesourcery.eve.skills.ui.components.impl.AssetListComponent.java

@Override
protected JPanel createPanel() {

    // Merge controls.
    final JPanel mergeControlsPanel = new JPanel();
    mergeControlsPanel.setLayout(new GridBagLayout());
    mergeControlsPanel.setBorder(BorderFactory.createTitledBorder("Merging"));

    int y = 0;// ww  w.  jav  a  2 s  .c  o m

    // merge by type
    mergeAssetsByType.setSelected(true);
    mergeAssetsByType.addActionListener(actionListener);

    mergeControlsPanel.add(mergeAssetsByType, constraints(0, y).anchorWest().end());
    mergeControlsPanel.add(new JLabel("Merge assets by type", SwingConstants.LEFT),
            constraints(1, y++).width(2).end());

    // "ignore different packaging"
    ignorePackaging.setSelected(true);
    ignorePackaging.addActionListener(actionListener);

    mergeControlsPanel.add(new JLabel(""), constraints(0, y).anchorWest().end());
    mergeControlsPanel.add(ignorePackaging, constraints(1, y).anchorWest().end());
    final JLabel label1 = new JLabel("Merge different packaging", SwingConstants.RIGHT);
    mergeControlsPanel.add(label1, constraints(2, y++).end());

    // "ignore different locations"
    ignoreLocations.setSelected(true);
    ignoreLocations.addActionListener(actionListener);

    mergeControlsPanel.add(new JLabel(""), constraints(0, y).anchorWest().end());
    mergeControlsPanel.add(ignoreLocations, constraints(1, y).anchorWest().end());
    final JLabel label2 = new JLabel("Merge different locations", SwingConstants.RIGHT);
    mergeControlsPanel.add(label2, constraints(2, y++).end());

    linkComponentEnabledStates(mergeAssetsByType, ignoreLocations, ignorePackaging, label1, label2);

    /*
     * Filter controls.
     */

    final JPanel filterControlsPanel = new JPanel();
    filterControlsPanel.setLayout(new GridBagLayout());
    filterControlsPanel.setBorder(BorderFactory.createTitledBorder("Filters"));

    y = 0;
    // filter by location combo box
    filterByLocation.addActionListener(actionListener);
    locationComboBox.addActionListener(actionListener);

    filterByLocation.setSelected(false);
    linkComponentEnabledStates(filterByLocation, locationComboBox);

    locationComboBox.setRenderer(new LocationRenderer());
    locationComboBox.setPreferredSize(new Dimension(150, 20));
    locationComboBox.setModel(locationModel);

    filterControlsPanel.add(filterByLocation, constraints(0, y).end());
    filterControlsPanel.add(locationComboBox, constraints(1, y++).end());

    // filter by type combo box
    filterByType.addActionListener(actionListener);
    typeComboBox.addActionListener(actionListener);

    filterByType.setSelected(false);

    linkComponentEnabledStates(filterByType, typeComboBox);

    typeComboBox.setPreferredSize(new Dimension(150, 20));
    typeComboBox.setModel(typeModel);

    filterControlsPanel.add(filterByType, constraints(0, y).end());
    filterControlsPanel.add(typeComboBox, constraints(1, y++).end());

    // filter by item category combobox
    filterByCategory.addActionListener(actionListener);
    categoryComboBox.addActionListener(actionListener);
    categoryComboBox.setRenderer(new DefaultListCellRenderer() {

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {

            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

            setText(getDisplayName((InventoryCategory) value));
            setEnabled(categoryComboBox.isEnabled());
            return this;
        }
    });

    filterByCategory.setSelected(false);
    linkComponentEnabledStates(filterByCategory, categoryComboBox);

    categoryComboBox.setPreferredSize(new Dimension(150, 20));
    categoryComboBox.setModel(categoryModel);

    filterControlsPanel.add(filterByCategory, constraints(0, y).end());
    filterControlsPanel.add(categoryComboBox, constraints(1, y++).end());

    // filter by item group combobox
    filterByGroup.addActionListener(actionListener);
    groupComboBox.addActionListener(actionListener);

    filterByGroup.setSelected(false);

    linkComponentEnabledStates(filterByGroup, groupComboBox);

    groupComboBox.setPreferredSize(new Dimension(150, 20));
    groupComboBox.setModel(groupModel);

    filterControlsPanel.add(filterByGroup, constraints(0, y).end());
    filterControlsPanel.add(groupComboBox, constraints(1, y++).end());

    /*
     * Table panel.
     */

    table = new JTable() {

        @Override
        public TableCellRenderer getCellRenderer(int row, int column) {

            // subclassing hack is needed because table
            // returns different renderes depending on column type
            final TableCellRenderer result = super.getCellRenderer(row, column);

            return new TableCellRenderer() {

                @Override
                public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                        boolean hasFocus, int row, int column) {

                    final Component comp = result.getTableCellRendererComponent(table, value, isSelected,
                            hasFocus, row, column);

                    final int modelRow = table.convertRowIndexToModel(row);
                    final Asset asset = model.getRow(modelRow);

                    final StringBuilder label = new StringBuilder("<HTML><BODY>");
                    label.append(asset.getItemId() + " - flags: " + asset.getFlags() + "<BR>");
                    if (asset.hasMultipleLocations()) {
                        label.append("<BR>");
                        for (ILocation loc : asset.getLocations()) {
                            label.append(loc.getDisplayName()).append("<BR>");
                        }
                    }

                    label.append("</BODY></HTML>");
                    ((JComponent) comp).setToolTipText(label.toString());

                    return comp;
                }
            };
        }
    };

    model.setViewFilter(this.viewFilter);

    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            updateSelectedVolume();
        }
    });

    FixedBooleanTableCellRenderer.attach(table);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setModel(model);
    table.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    table.setRowSorter(model.getRowSorter());

    popupMenuBuilder.addItem("Refine...", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final List<Asset> assets = getSelectedAssets();
            if (assets == null || assets.isEmpty()) {
                return;
            }

            final ICharacter c = selectionProvider.getSelectedItem();
            final RefiningComponent comp = new RefiningComponent(c);
            comp.setItemsToRefine(assets);
            ComponentWrapper.wrapComponent("Refining", comp).setVisible(true);
        }

        @Override
        public boolean isEnabled() {
            return table.getSelectedRow() != -1;
        }
    });

    popupMenuBuilder.addItem("Copy selection to clipboard (text)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final List<Asset> assets = getSelectedAssets();
            if (assets == null || assets.isEmpty()) {
                return;
            }

            new PlainTextTransferable(toPlainText(assets)).putOnClipboard();
        }

        @Override
        public boolean isEnabled() {
            return table.getSelectedRow() != -1;
        }
    });

    popupMenuBuilder.addItem("Copy selection to clipboard (CSV)", new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final List<Asset> assets = getSelectedAssets();
            if (assets == null || assets.isEmpty()) {
                return;
            }

            final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();

            clipboard.setContents(new PlainTextTransferable(toCsv(assets)), null);
        }

        @Override
        public boolean isEnabled() {
            return table.getSelectedRow() != -1;
        }
    });

    table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    this.popupMenuBuilder.attach(table);

    final JScrollPane scrollPane = new JScrollPane(table);

    /*
     * Name filter
     */

    final JPanel nameFilterPanel = new JPanel();
    nameFilterPanel.setLayout(new GridBagLayout());
    nameFilterPanel.setBorder(BorderFactory.createTitledBorder("Filter by name"));
    nameFilterPanel.setPreferredSize(new Dimension(150, 70));
    nameFilter.setColumns(10);
    nameFilter.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void changedUpdate(DocumentEvent e) {
            model.viewFilterChanged();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            model.viewFilterChanged();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            model.viewFilterChanged();
        }
    });

    nameFilterPanel.add(nameFilter, constraints(0, 0).resizeHorizontally().end());
    final JButton clearButton = new JButton("Clear");
    clearButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            nameFilter.setText(null);
        }
    });
    nameFilterPanel.add(clearButton, constraints(1, 0).noResizing().end());

    // Selected volume
    final JPanel selectedVolumePanel = this.selectedVolume.getPanel();

    // add control panels to result panel
    final JPanel topPanel = new JPanel();
    topPanel.setLayout(new GridBagLayout());

    topPanel.add(mergeControlsPanel, constraints(0, 0).height(2).weightX(0).anchorWest().end());
    topPanel.add(filterControlsPanel, constraints(1, 0).height(2).anchorWest().weightX(0).end());
    topPanel.add(nameFilterPanel, constraints(2, 0).height(1).anchorWest().useRemainingWidth().end());
    topPanel.add(selectedVolumePanel, constraints(2, 1).height(1).anchorWest().useRemainingWidth().end());

    final JSplitPane splitPane = new ImprovedSplitPane(JSplitPane.VERTICAL_SPLIT, topPanel, scrollPane);

    splitPane.setDividerLocation(0.3d);

    final JPanel content = new JPanel();
    content.setLayout(new GridBagLayout());
    content.add(splitPane, constraints().resizeBoth().useRemainingSpace().end());

    return content;
}

From source file:edu.clemson.cs.nestbed.client.gui.ConfigManagerFrame.java

private final JPanel buildLeftPanel() throws ClassNotFoundException {
    JPanel panel = new JPanel(new BorderLayout());
    Dimension size = new Dimension(WINDOW_WIDTH / 4, (int) (WINDOW_HEIGHT * (2 / 3.0)));

    panel.setBorder(new TitledBorder("Programs"));
    panel.setSize(size);/*from w ww .  j a v  a2s.com*/
    panel.setPreferredSize(size);
    panel.setMinimumSize(size);

    panel.add(new JScrollPane(programTree), BorderLayout.CENTER);

    return panel;
}

From source file:com.eviware.soapui.impl.wsdl.monitor.SoapMonitor.java

private JComponent buildToolbars(JXToolBar mainToolbar) {
    toolbar = UISupport.createSmallToolbar();
    mainToolbar.addFixed(/*from  w  w  w  .  jav a 2s  . c om*/
            startButton = UISupport.createToolbarButton(UISupport.createImageIcon("/run_testcase.gif")));
    mainToolbar.addFixed(
            stopButton = UISupport.createToolbarButton(UISupport.createImageIcon("/stop_testcase.gif")));
    mainToolbar.addFixed(optionsButton = UISupport.createToolbarButton(new SoapMonitorOptionsAction()));

    toolbar.addFixed(
            createRequestButton = UISupport.createToolbarButton(UISupport.createImageIcon("/request.gif")));
    toolbar.addFixed(
            addToTestCaseButton = UISupport.createToolbarButton(UISupport.createImageIcon("/testCase.gif")));
    // toolbar.addFixed( addToRestTestCaseButton =
    // UISupport.createToolbarButton( UISupport
    // .createImageIcon( "/testCase.gif" ) ) );
    toolbar.addFixed(addToMockServiceButton = UISupport
            .createToolbarButton(UISupport.createImageIcon("/mockService.gif")));
    toolbar.addFixed(
            clearButton = UISupport.createToolbarButton(UISupport.createImageIcon("/clear_loadtest.gif")));

    startButton.setToolTipText("Starts the HTTP Monitor as configured");
    stopButton.setToolTipText("Stops the HTTP Monitor");
    optionsButton.setToolTipText("Sets Monitor Options");
    clearButton.setToolTipText("Clear all/selected messages from the log");
    createRequestButton.setToolTipText("Creates requests from selected messages");
    addToTestCaseButton.setToolTipText("Adds selected requests to a TestCase");
    // addToRestTestCaseButton.setToolTipText(
    // "Adds selected REST requests to a TestCase" );
    addToMockServiceButton.setToolTipText("Adds selected reponses to a MockService");

    createRequestButton.setEnabled(false);
    addToMockServiceButton.setEnabled(false);
    addToTestCaseButton.setEnabled(false);
    // addToRestTestCaseButton.setEnabled( false );

    startButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            start();
        }
    });

    stopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            stop();
        }
    });

    clearButton.addActionListener(new ClearAction());
    createRequestButton.addActionListener(new CreateRequestsAction());
    addToTestCaseButton.addActionListener(new AddToTestCaseAction());
    // addToRestTestCaseButton.addActionListener( new
    // AddToRESTTestCaseAction() );
    addToMockServiceButton.addActionListener(new AddToMockServiceAction());

    mainToolbar.addGlue();

    infoLabel = new JLabel();
    infoLabel.setPreferredSize(new Dimension(150, 20));
    infoLabel.setOpaque(false);
    mainToolbar.addFixed(infoLabel);

    progressBar = new JProgressBar();

    JPanel progressBarPanel = UISupport.createProgressBarPanel(progressBar, 2, false);
    progressBarPanel.setPreferredSize(new Dimension(60, 20));

    mainToolbar.addFixed(progressBarPanel);
    return toolbar;
}

From source file:eu.apenet.dpt.standalone.gui.DataPreparationToolGUI.java

private JPanel createWest() {
    JPanel fileLists = new JPanel(new GridLayout(0, 1));
    JPanel xmlEadListPanel = new JPanel(new BorderLayout());
    xmlEadList.setCellRenderer(new IconListCellRenderer(fileInstances));
    xmlEadList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    xmlEadListLabel = new JLabel(labels.getString("xmlEadFiles"));
    xmlEadListPanel.add(new JScrollPane(xmlEadList, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER);
    xmlEadListPanel.add(xmlEadListLabel, BorderLayout.NORTH);
    fileLists.add(xmlEadListPanel);/* w w w. ja  v a2  s.c o m*/
    JPanel p = new JPanel(new BorderLayout());
    p.setPreferredSize(new Dimension(200, 100));
    p.add(fileLists);
    p.add(createSouthWest(), BorderLayout.SOUTH);
    return p;
}

From source file:it.unifi.rcl.chess.traceanalysis.gui.TracePanel.java

private void initialize() {

    this.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

    JPanel pnlInfo = new JPanel();
    JPanel pnlBound = new JPanel();
    JPanel pnlPlot = new JPanel();
    JPanel pnlPhases = new JPanel();

    pnlInfo.setLayout(new BoxLayout(pnlInfo, BoxLayout.Y_AXIS));
    pnlBound.setLayout(new BoxLayout(pnlBound, BoxLayout.Y_AXIS));
    pnlPlot.setLayout(new BoxLayout(pnlPlot, BoxLayout.Y_AXIS));
    pnlPhases.setLayout(new BoxLayout(pnlPhases, BoxLayout.Y_AXIS));

    //      pnlInfo.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlBound.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlPlot.setBorder(BorderFactory.createLineBorder(Color.black));
    //      pnlPhases.setBorder(BorderFactory.createLineBorder(Color.black));
    pnlInfo.setPreferredSize(new Dimension(300, 250));
    pnlBound.setPreferredSize(new Dimension(400, 250));
    pnlPlot.setPreferredSize(new Dimension(300, 250));
    pnlPhases.setPreferredSize(new Dimension(400, 250));

    pnlInfo.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlBound.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlPlot.setBorder(new EmptyBorder(6, 6, 6, 6));
    pnlPhases.setBorder(new EmptyBorder(6, 6, 6, 6));

    this.add(pnlInfo);
    this.add(pnlBound);
    this.add(pnlPlot);
    this.add(pnlPhases);

    lblInfo = new JPlainLabel("<html><b>TRACE SUMMARY</b><br/>"
            + "<em>Information about the loaded trace.</em><br/><br/></html>");
    pnlInfo.add(lblInfo);//  w w w  .  j ava  2 s. c  om

    lblPoints = new JPlainLabel("#Points");
    pnlInfo.add(lblPoints);

    lblTraceName = new JPlainLabel();
    pnlInfo.add(lblTraceName);

    lblStat = new JPlainLabel();
    pnlInfo.add(lblStat);

    btnReload = new JButton("Reload");
    btnReload.addActionListener(new ButtonAction("Reload", KeyEvent.VK_L));
    pnlInfo.add(btnReload);

    btnClose = new JButton("Close");
    btnClose.addActionListener(new ButtonAction("Close", KeyEvent.VK_U));
    pnlInfo.add(btnClose);

    /* Bound evaluation */
    lblSectionBounds = new JPlainLabel("<html><b>BOUND EVALUATION</b><br/>"
            + "<em>Compute probabilistic bounds on manually selected portions of the trace.</em></html>");
    lblSectionBounds.setToolTipText("Compute probabilistic bounds on manually selected portions of the trace");
    lblSectionBounds.setFont(new Font("Dialog", Font.PLAIN, 12));
    //      lblSectionBounds.setBorder(BorderFactory.createLineBorder(Color.black));
    pnlBound.add(lblSectionBounds);

    scrollTabBounds = new JScrollPane();
    scrollTabBounds.setPreferredSize(new Dimension(400, 100));
    pnlBound.add(scrollTabBounds);

    tableBounds = new BoundsTable();
    scrollTabBounds.setViewportView(tableBounds);

    btnUpdateBoundsTable = new JButton("Update");
    btnUpdateBoundsTable.addActionListener(new ButtonAction("Update", KeyEvent.VK_U));
    pnlBound.add(btnUpdateBoundsTable);

    btnClearBoundsTable = new JButton("Clear Table");
    btnClearBoundsTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C));
    pnlBound.add(btnClearBoundsTable);

    /* Plotting */
    lblSectionPlot = new JPlainLabel("<html><b>PLOTTING</b><br/>"
            + "<em>Plot the trace, together with \"dynamic\" probabilistic bounds, i.e., bounds obtained dynamically as if they were evaluated at runtime with a fixed window size.</em></html>");
    lblSectionPlot.setToolTipText("Plot the trace and dynamic bounds");
    pnlPlot.add(lblSectionPlot);

    scrollTabWSize = new JScrollPane();
    scrollTabWSize.setPreferredSize(new Dimension(400, 200));
    pnlPlot.add(scrollTabWSize);

    tableWindowSize = new JDynamicTable();
    tableWindowSize.setModel(new DefaultTableModel(new Object[][] { { 100, 0.99 }, { null, null } },
            new String[] { "WindowSize", "Confidence" }) {

        Class[] columnTypes = new Class[] { Integer.class, Double.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }
    });
    tableWindowSize.setMonitoredColumn(0);
    tableWindowSize.setMonitoredColumn(1);
    tableWindowSize.getColumnModel().getColumn(0).setPreferredWidth(10);
    tableWindowSize.getColumnModel().getColumn(1).setPreferredWidth(10);
    scrollTabWSize.setViewportView(tableWindowSize);

    btnPlot = new JButton("Plot");
    btnPlot.addActionListener(new ButtonAction("Plot", KeyEvent.VK_P));
    pnlPlot.add(btnPlot);

    btnBoundExport = new JButton("Export");
    btnBoundExport.addActionListener(new ButtonAction("Export", KeyEvent.VK_E));
    pnlPlot.add(btnBoundExport);

    btnCompareAll = new JButton("Compare All Traces");
    btnCompareAll.addActionListener(new ButtonAction("Compare All Traces", KeyEvent.VK_A));
    pnlPlot.add(btnCompareAll);

    btnClearWSizeTable = new JButton("Clear Table");
    btnClearWSizeTable.addActionListener(new ButtonAction("Clear Table", KeyEvent.VK_C));
    pnlPlot.add(btnClearWSizeTable);

    /* Phases analysis */
    lblSectionPhases = new JPlainLabel("<html><b>PHASES ANALYSIS</b><br/>"
            + "<em>Detect phases in the trace having different probabilistic properties.</em></html>.");
    lblSectionPhases.setToolTipText("Detect phases in the trace having different probabilistic properties");
    pnlPhases.add(lblSectionPhases);

    scrollTabPhases = new JScrollPane();
    scrollTabPhases.setPreferredSize(new Dimension(200, 150));
    pnlPhases.add(scrollTabPhases);

    tablePhases = new JTable();
    tablePhases.setModel(new DefaultTableModel(new Object[][] { { null, null, null, null } },
            new String[] { "Start", "End", "Distribution*", "Bound*" }) {

        Class[] columnTypes = new Class[] { Integer.class, Integer.class, String.class, String.class };

        public Class getColumnClass(int columnIndex) {
            return columnTypes[columnIndex];
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    });
    tablePhases.getColumnModel().getColumn(0).setPreferredWidth(10);
    tablePhases.getColumnModel().getColumn(1).setPreferredWidth(10);
    tablePhases.getColumnModel().getColumn(2).setPreferredWidth(100);
    tablePhases.getColumnModel().getColumn(3).setPreferredWidth(100);
    scrollTabPhases.setViewportView(tablePhases);

    lblPhasesCoverage = new JPlainLabel("Coverage: ");
    pnlPhases.add(lblPhasesCoverage);
    txtPhasesCoverage = new JTextField("0.99");
    pnlPhases.add(txtPhasesCoverage);

    lblPhasesWSize = new JPlainLabel("Window Size: ");
    pnlPhases.add(lblPhasesWSize);
    txtPhasesWSize = new JTextField("20");
    pnlPhases.add(txtPhasesWSize);

    btnPhaseDetection = new JButton("Phases Analysis");
    ;
    btnPhaseDetection.addActionListener(new ButtonAction("PhasesAnalysis", KeyEvent.VK_P));
    pnlPhases.add(btnPhaseDetection);
}