Example usage for javax.swing Box setBorder

List of usage examples for javax.swing Box setBorder

Introduction

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

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:Main.java

public Main() {
    Box box = Box.createHorizontalBox();
    box.setBorder(new EmptyBorder(5, 5, 5, 5));
    Dimension size = new Dimension(100, 25);

    box.add(createButton("Button1", size));
    box.add(createStrut());//from   ww  w.j a v  a2 s. c o  m
    box.add(createButton("Button2", size));
    box.add(createStrut());
    box.add(createButton("Button3", size));
    box.add(createStrut());
    box.add(createButton("Button4", size));

    add(box);
}

From source file:Main.java

public Main() {
    JFormattedTextField formattedField = null;
    try {// w  w  w.jav a 2  s .  c  om
        MaskFormatter dateMask = new MaskFormatter("##/##/####");
        formattedField = new JFormattedTextField(dateMask);
    } catch (ParseException ex) {
        System.out.println(ex);
    }
    formattedField.setColumns(10);
    formattedField.setInputVerifier(getInputVerifier());

    JTextField field = new JTextField(10);
    format.setLenient(false);

    Box box = Box.createVerticalBox();
    box.add(formattedField);
    box.add(Box.createVerticalStrut(10));
    box.add(field);
    box.setBorder(new EmptyBorder(10, 10, 10, 10));

    JFrame frame = new JFrame();
    frame.add(box);
    frame.pack();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:PizzaGridBagLayout.java

public PizzaGridBagLayout() {
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel panel1 = new JPanel();
    panel1.setLayout(new GridBagLayout());
    addItem(panel1, new JLabel("Name:"), 0, 0, 1, 1, GridBagConstraints.EAST);
    addItem(panel1, new JLabel("Phone:"), 0, 1, 1, 1, GridBagConstraints.EAST);
    addItem(panel1, new JLabel("Address:"), 0, 2, 1, 1, GridBagConstraints.EAST);

    addItem(panel1, name, 1, 0, 2, 1, GridBagConstraints.WEST);
    addItem(panel1, phone, 1, 1, 1, 1, GridBagConstraints.WEST);
    addItem(panel1, address, 1, 2, 2, 1, GridBagConstraints.WEST);

    Box sizeBox = Box.createVerticalBox();
    ButtonGroup sizeGroup = new ButtonGroup();
    sizeGroup.add(small);//from www. jav a2  s.c  o  m
    sizeGroup.add(medium);
    sizeGroup.add(large);
    sizeBox.add(small);
    sizeBox.add(medium);
    sizeBox.add(large);
    sizeBox.setBorder(BorderFactory.createTitledBorder("Size"));
    addItem(panel1, sizeBox, 0, 3, 1, 1, GridBagConstraints.NORTH);

    Box styleBox = Box.createVerticalBox();

    ButtonGroup styleGroup = new ButtonGroup();
    styleGroup.add(thin);
    styleGroup.add(thick);
    styleBox.add(thin);
    styleBox.add(thick);
    styleBox.setBorder(BorderFactory.

            createTitledBorder("Style"));
    addItem(panel1, styleBox, 1, 3, 1, 1, GridBagConstraints.NORTH);

    Box topBox = Box.createVerticalBox();
    ButtonGroup topGroup = new ButtonGroup();
    topGroup.add(pepperoni);
    topGroup.add(mushrooms);
    topGroup.add(anchovies);
    topBox.add(pepperoni);
    topBox.add(mushrooms);
    topBox.add(anchovies);
    topBox.setBorder(BorderFactory.createTitledBorder("Toppings"));
    addItem(panel1, topBox, 2, 3, 1, 1, GridBagConstraints.NORTH);

    Box buttonBox = Box.createHorizontalBox();
    buttonBox.add(okButton);
    buttonBox.add(Box.createHorizontalStrut(20));
    buttonBox.add(closeButton);
    addItem(panel1, buttonBox, 2, 4, 1, 1, GridBagConstraints.NORTH);

    this.add(panel1);
    this.pack();
    this.setVisible(true);
}

From source file:geovista.network.gui.ClusteringDemo.java

private void setUpView() throws IOException {

    /*/*  w  ww .ja v  a 2s .c  o  m*/
     * Factory<Integer> vertexFactory = new Factory<Integer>() { int n = 0;
     * public Integer create() { return n++; } }; Factory<Number>
     * edgeFactory = new Factory<Number>() { int n = 0; public Number
     * create() { return n++; } };
     */

    /*
     * PajekNetReader<Graph<Integer, Number>, Integer,Number> pnr = new
     * PajekNetReader<Graph<Integer, Number>, Integer,Number>(vertexFactory,
     * edgeFactory);
     * 
     * final Graph<Integer,Number> graph = new SparseMultigraph<Integer,
     * Number>();
     * 
     * pnr.load(br, graph);
     */

    // Create a simple layout frame
    // specify the Fruchterman-Rheingold layout algorithm
    layout = new AggregateLayout<Integer, Number>(new FRLayout<Integer, Number>(g));

    vv = new VisualizationViewer<Integer, Number>(layout);
    vv.setBackground(Color.white);
    // Tell the renderer to use our own customized color rendering
    vv.getRenderContext()
            .setVertexFillPaintTransformer(MapTransformer.<Integer, Paint>getInstance(vertexPaints));
    vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Integer, Paint>() {
        public Paint transform(Integer v) {
            if (vv.getPickedVertexState().isPicked(v)) {
                return Color.blue;
            } else {
                return Color.BLACK;
            }
        }
    });

    vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints));

    vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() {
        protected final Stroke THIN = new BasicStroke(1);
        protected final Stroke THICK = new BasicStroke(2);

        public Stroke transform(Number e) {
            Paint c = edgePaints.get(e);
            if (c == Color.LIGHT_GRAY) {
                return THIN;
            } else {
                return THICK;
            }
        }
    });

    /*
     * //add restart button JButton scramble = new JButton("Restart");
     * scramble.addActionListener(new ActionListener() { public void
     * actionPerformed(ActionEvent arg0) { Layout layout =
     * vv.getGraphLayout(); layout.initialize(); Relaxer relaxer =
     * vv.getModel().getRelaxer(); if(relaxer != null) { relaxer.stop();
     * relaxer.prerelax(); relaxer.relax(); } }
     * 
     * });
     * 
     * DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
     * vv.setGraphMouse(gm);
     */

    final JToggleButton groupVertices = new JToggleButton("Group Clusters");

    // Create slider to adjust the number of edges to remove when clustering
    final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
    edgeBetweennessSlider.setBackground(Color.WHITE);
    edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
    edgeBetweennessSlider.setPaintTicks(true);
    edgeBetweennessSlider.setMaximum(g.getEdgeCount());
    edgeBetweennessSlider.setMinimum(0);
    edgeBetweennessSlider.setValue(0);
    edgeBetweennessSlider.setMajorTickSpacing(10);
    edgeBetweennessSlider.setPaintLabels(true);
    edgeBetweennessSlider.setPaintTicks(true);

    // edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black));
    // TO DO: edgeBetweennessSlider.add(new
    // JLabel("Node Size (PageRank With Priors):"));
    // I also want the slider value to appear
    final JPanel eastControls = new JPanel();
    /*
     * eastControls.setOpaque(true); eastControls.setLayout(new
     * BoxLayout(eastControls, BoxLayout.Y_AXIS));
     * eastControls.add(Box.createVerticalGlue());
     */
    // eastControls.add(edgeBetweennessSlider);

    final Box cluster_panel = Box.createVerticalBox();
    cluster_panel.setBorder(BorderFactory.createTitledBorder("Cluster"));
    cluster_panel.add(edgeBetweennessSlider);

    final String COMMANDSTRING = "Edges removed for clusters: ";
    final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue();

    final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize);
    /*
     * eastControls.setBorder(sliderBorder); //eastControls.add(eastSize);
     * eastControls.add(Box.createVerticalGlue());
     */

    groupVertices.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors,
                    e.getStateChange() == ItemEvent.SELECTED);
            vv.repaint();
        }
    });

    clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected());

    edgeBetweennessSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();
            if (!source.getValueIsAdjusting()) {
                int numEdgesToRemove = source.getValue();
                clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected());
                sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue());
                eastControls.repaint();
                vv.validate();
                vv.repaint();
            }
        }
    });

    cluster_panel.add(groupVertices);
    Container content = getContentPane();
    content.add(new GraphZoomScrollPane(vv));
    JPanel south = new JPanel();
    JPanel grid = new JPanel(new GridLayout(2, 1));
    // grid.add(scramble);
    grid.add(cluster_panel);
    // south.add
    south.add(grid);
    south.add(eastControls);
    JPanel p = new JPanel();
    // p.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    // p.add(gm.getModeComboBox());
    south.add(p);

    content.add(south, BorderLayout.SOUTH);
}

From source file:brainflow.app.presentation.controls.FileObjectGroupSelector.java

public FileObjectGroupSelector(FileObject root) throws FileSystemException {
    if (root.getType() != FileType.FOLDER) {
        throw new IllegalArgumentException("root file must be a directory");
    }/*from   w ww. ja v a2 s.c o  m*/

    rootFolder = root;
    explorer = new FileExplorer(rootFolder);
    explorer.getJTree().setRootVisible(false);
    explorer.getJTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    setLayout(new BorderLayout());

    Box topPanel = new Box(BoxLayout.X_AXIS);
    topPanel.setBorder(BorderFactory.createEmptyBorder(8, 12, 8, 8));
    topPanel.add(regexLabel);
    topPanel.add(regexField);
    topPanel.add(Box.createHorizontalStrut(4));
    topPanel.add(searchType);
    add(topPanel, BorderLayout.NORTH);

    //JPanel mainPanel = new JPanel();
    //MigLayout layout = new MigLayout("");
    // mainPanel.setLayout(layout);

    //add(regexLabel);
    //add(regexField, "gap left 0, growx");
    //add(findButton, "align right, wrap");

    //add(searchType, "wrap");

    //add(createSplitPane(), "span 3, grow, wrap");
    add(createSplitPane(), BorderLayout.CENTER);

    depthSpinner.setMaximumSize(new Dimension(50, 200));
    depthSpinner.setModel(new SpinnerNumberModel(recursiveDepth, 0, 5, 1));

    JPanel bottomPanel = new JPanel();
    MigLayout layout = new MigLayout("", "[][grow]", "[][]");
    bottomPanel.setLayout(layout);

    //bottomPanel.setBorder(BorderFactory.createEmptyBorder(4,12,8,8));
    bottomPanel.add(new JLabel("Root Folder: "));
    rootField.setEditable(false);
    rootField.setText(root.getName().getBaseName());
    bottomPanel.add(rootField, "wrap, width 150:150:150");
    bottomPanel.add(new JLabel("Search Depth: "), "gap top 8");

    bottomPanel.add(depthSpinner, "width 35:45:55, wrap");
    add(bottomPanel, BorderLayout.SOUTH);

    explorer.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            TreePath path = e.getPath();
            Object[] obj = path.getPath();
            Object lastNode = obj[obj.length - 1];
            if (lastNode instanceof FileExplorer.FileObjectNode) {
                FileExplorer.FileObjectNode fnode = (FileExplorer.FileObjectNode) lastNode;
                try {
                    if (fnode.getFileObject().getType() == FileType.FOLDER) {
                        rootField.setText(fnode.getFileObject().getName().getBaseName());
                        rootFolder = fnode.getFileObject();
                        updateFileList();
                    }
                } catch (FileSystemException ex) {
                    throw new RuntimeException(ex);
                }

            }
        }
    });

    depthSpinner.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            recursiveDepth = ((Number) depthSpinner.getValue()).intValue();

            updateFileList();
        }
    });

    regexField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateFileList();
            System.out.println(Arrays.toString(explorer.getSelectedNodes().toArray()));
        }
    });

}

From source file:org.jdal.swing.TableEditor.java

/**
 * {@inheritDoc}//w ww  . j  ava2s .c  o m
 */
@Override
protected JComponent buildPanel() {
    Box box = Box.createVerticalBox();
    Container tablePanel = createTablePanel();
    box.add(tablePanel);
    box.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    return box;
}

From source file:hr.fer.zemris.vhdllab.platform.gui.dialog.save.SaveDialog.java

public SaveDialog(LocalizationSource source, SaveContext context) {
    super(source);
    Validate.notNull(context, "Save variant can't be null");
    // setup label
    JLabel label = new JLabel(getMainMessage(source, context));
    int width = DIALOG_WIDTH - 2 * BORDER;
    int height = LABEL_HEIGHT - 2 * BORDER;
    label.setPreferredSize(new Dimension(width, height));
    label.setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER));

    // setup check box list
    list = new CheckBoxList();
    width = DIALOG_WIDTH - 2 * BORDER;/* ww  w .j ava  2s  . c  o  m*/
    height = 0; // because list is a center component and it doesnt need
    // height
    list.setPreferredSize(new Dimension(width, height));
    list.setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER));

    // setup select all and deselect all buttons
    JButton selectAll = new JButton(source.getMessage(SELECT_ALL_MESSAGE));
    selectAll.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    selectAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            list.setSelectionToAll(true);
        }
    });

    JButton deselectAll = new JButton(source.getMessage(DESELECT_ALL_MESSAGE));
    deselectAll.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    deselectAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            list.setSelectionToAll(false);
        }
    });

    Box selectBox = Box.createHorizontalBox();
    selectBox.add(selectAll);
    selectBox.add(Box.createRigidArea(new Dimension(BORDER, BUTTON_HEIGHT)));
    selectBox.add(deselectAll);
    selectBox.setBorder(BorderFactory.createEmptyBorder(0, 0, BORDER, 0));

    // setup ok and cancel buttons
    JButton ok = new JButton(source.getMessage(OK_MESSAGE));
    ok.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    ok.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeDialog(new ArrayList<File>());
        }
    });

    JButton cancel = new JButton(source.getMessage(CANCEL_MESSAGE));
    cancel.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeDialog(null);
        }
    });

    Box actionBox = Box.createHorizontalBox();
    actionBox.add(ok);
    actionBox.add(Box.createRigidArea(new Dimension(BORDER, BUTTON_HEIGHT)));
    actionBox.add(cancel);
    actionBox.setBorder(BorderFactory.createEmptyBorder(BORDER, 0, BORDER, 0));

    JPanel selectPanel = new JPanel(new BorderLayout());
    selectPanel.add(selectBox, BorderLayout.EAST);
    JPanel actionPanel = new JPanel(new BorderLayout());
    actionPanel.add(actionBox, BorderLayout.EAST);

    JCheckBox alwaysSave = new JCheckBox(source.getMessage(ALWAYS_SAVE_MESSAGE));
    alwaysSave.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkBox = (JCheckBox) e.getSource();
            Preferences preferences = Preferences.userNodeForPackage(SaveDialog.class);
            preferences.putBoolean(SHOULD_AUTO_SAVE, checkBox.isSelected());
        }
    });
    alwaysSave.setSelected(false);
    JPanel alwaysSavePanel = new JPanel(new BorderLayout());
    alwaysSavePanel.add(alwaysSave, BorderLayout.WEST);

    JPanel lowerPanel = new JPanel(new BorderLayout());
    lowerPanel.add(selectPanel, BorderLayout.NORTH);
    lowerPanel.add(alwaysSavePanel, BorderLayout.CENTER);
    lowerPanel.add(actionPanel, BorderLayout.SOUTH);

    this.setLayout(new BorderLayout());
    JPanel messagePanel = new JPanel(new BorderLayout());
    messagePanel.add(label, BorderLayout.NORTH);
    messagePanel.add(list, BorderLayout.CENTER);
    messagePanel.add(lowerPanel, BorderLayout.SOUTH);
    this.getContentPane().add(messagePanel, BorderLayout.CENTER);
    this.getRootPane().setDefaultButton(ok);
    this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
    this.setTitle(getTitle(source, context));
}

From source file:components.FrameDemo2.java

protected JComponent createOptionControls() {
    JLabel label1 = new JLabel("Decoration options for subsequently created frames:");
    ButtonGroup bg1 = new ButtonGroup();
    JLabel label2 = new JLabel("Icon options:");
    ButtonGroup bg2 = new ButtonGroup();

    //Create the buttons
    JRadioButton rb1 = new JRadioButton();
    rb1.setText("Look and feel decorated");
    rb1.setActionCommand(LF_DECORATIONS);
    rb1.addActionListener(this);
    rb1.setSelected(true);/*from   w w w  .j  a  v  a  2 s  .com*/
    bg1.add(rb1);
    //
    JRadioButton rb2 = new JRadioButton();
    rb2.setText("Window system decorated");
    rb2.setActionCommand(WS_DECORATIONS);
    rb2.addActionListener(this);
    bg1.add(rb2);
    //
    JRadioButton rb3 = new JRadioButton();
    rb3.setText("No decorations");
    rb3.setActionCommand(NO_DECORATIONS);
    rb3.addActionListener(this);
    bg1.add(rb3);
    //
    //
    JRadioButton rb4 = new JRadioButton();
    rb4.setText("Default icon");
    rb4.setActionCommand(DEFAULT_ICON);
    rb4.addActionListener(this);
    rb4.setSelected(true);
    bg2.add(rb4);
    //
    JRadioButton rb5 = new JRadioButton();
    rb5.setText("Icon from a JPEG file");
    rb5.setActionCommand(FILE_ICON);
    rb5.addActionListener(this);
    bg2.add(rb5);
    //
    JRadioButton rb6 = new JRadioButton();
    rb6.setText("Painted icon");
    rb6.setActionCommand(PAINT_ICON);
    rb6.addActionListener(this);
    bg2.add(rb6);

    //Add everything to a container.
    Box box = Box.createVerticalBox();
    box.add(label1);
    box.add(Box.createVerticalStrut(5)); //spacer
    box.add(rb1);
    box.add(rb2);
    box.add(rb3);
    //
    box.add(Box.createVerticalStrut(15)); //spacer
    box.add(label2);
    box.add(Box.createVerticalStrut(5)); //spacer
    box.add(rb4);
    box.add(rb5);
    box.add(rb6);

    //Add some breathing room.
    box.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    return box;
}

From source file:com.t3.macro.api.functions.input.ColumnPanel.java

/** Creates a group of radio buttons. */
public JComponent createRadioControl(VarSpec vs) {
    int listIndex = vs.optionValues.getNumeric("SELECT");
    if (listIndex < 0 || listIndex >= vs.valueList.size())
        listIndex = 0;/*from   w  w  w  .j a  va 2 s  .c om*/
    ButtonGroup bg = new ButtonGroup();
    Box box = (vs.optionValues.optionEquals("ORIENT", "H")) ? Box.createHorizontalBox()
            : Box.createVerticalBox();

    // If the prompt is suppressed by SPAN=TRUE, use it as the border title
    String title = "";
    if (vs.optionValues.optionEquals("SPAN", "TRUE"))
        title = vs.prompt;
    box.setBorder(new TitledBorder(new EtchedBorder(), title));

    int radioCount = 0;
    for (String value : vs.valueList) {
        JRadioButton radio = new JRadioButton(value, false);
        bg.add(radio);
        box.add(radio);
        if (listIndex == radioCount)
            radio.setSelected(true);
        radioCount++;
    }
    return box;
}

From source file:com.diversityarrays.kdxplore.field.FieldViewPanel.java

public FieldViewPanel(PlotVisitList plotVisitList, Map<Integer, Trait> traitMap,
        SeparatorVisibilityOption visible, SimplePlotCellRenderer plotRenderer, Component... extras) {
    super(new BorderLayout());

    this.plotVisitList = plotVisitList;
    this.traitMap = traitMap;

    trial = plotVisitList.getTrial();// w  ww .j av a 2 s.c o  m

    fieldLayoutTableModel.setTrial(trial);

    int rowHeight = fieldLayoutTable.getRowHeight();
    fieldLayoutTable.setRowHeight(4 * rowHeight);

    fieldLayoutTable.setCellSelectionEnabled(true);

    fieldLayoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);

    // IMPORTANT: DO NOT SORT THE FIELD LAYOUT TABLE
    fieldLayoutTable.setAutoCreateRowSorter(false);

    Map<Integer, Plot> plotById = new HashMap<>();
    FieldLayout<Integer> plotIdLayout = FieldLayoutUtil.createPlotIdLayout(trial.getTrialLayout(),
            trial.getPlotIdentSummary(), plotVisitList.getPlots(), plotById);

    KdxploreFieldLayout<Plot> kdxFieldLayout = new KdxploreFieldLayout<Plot>(Plot.class, plotIdLayout.imageId,
            plotIdLayout.xsize, plotIdLayout.ysize);
    kdxFieldLayout.warning = plotIdLayout.warning;

    String displayName = null;
    for (VisitOrder2D vo : VisitOrder2D.values()) {
        if (vo.imageId == plotIdLayout.imageId) {
            displayName = vo.displayName;
            break;
        }
    }
    //      VisitOrder2D vo = plotVisitList.getVisitOrder();
    KDClientUtils.initAction(plotIdLayout.imageId, changeCollectionOrder, displayName);

    hasUserPlotId = lookForUserPlotIdPresent(plotById, plotIdLayout, kdxFieldLayout);

    this.plotCellRenderer = plotRenderer;
    plotCellRenderer.setShowUserPlotId(hasUserPlotId);

    plotCellRenderer.setPlotXYprovider(getXYprovider());

    plotCellRenderer.setPlotVisitList(plotVisitList);

    fieldLayoutTable.setDefaultRenderer(Plot.class, plotCellRenderer);
    fieldLayoutTable.setCellSelectionEnabled(true);

    fieldLayoutTableModel.setFieldLayout(kdxFieldLayout);

    if (kdxFieldLayout.warning != null && !kdxFieldLayout.warning.isEmpty()) {
        warningMessage.setText(kdxFieldLayout.warning);
    } else {
        warningMessage.setText("");
    }

    fieldLayoutTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    fieldLayoutTable.getTableHeader().setReorderingAllowed(false);
    fieldLayoutTable.setCellSelectionEnabled(true);

    StringBuilder naming = new StringBuilder();
    String nameForRow = plotVisitList.getTrial().getNameForRow();
    if (!Check.isEmpty(nameForRow)) {
        naming.append(nameForRow);
    }
    String nameForCol = plotVisitList.getTrial().getNameForColumn();
    if (!Check.isEmpty(nameForCol)) {
        if (naming.length() > 0) {
            naming.append('/');
        }
        naming.append(nameForCol);
    }
    fieldTableScrollPane = new JScrollPane(fieldLayoutTable);
    if (naming.length() > 0) {
        JLabel cornerLabel = new JLabel(naming.toString());
        fieldTableScrollPane.setCorner(JScrollPane.UPPER_LEFT_CORNER, cornerLabel);
    }
    fieldTableScrollPane.setRowHeaderView(rowHeaderTable);

    //      fieldLayoutTable.setRowHeaderTable(rowHeaderTable);

    //      Box extra = Box.createHorizontalBox();
    //      extra.add(new JButton(changeCollectionOrder));
    //      if (extras != null && extras.length > 0) {
    //         extra.add(Box.createHorizontalStrut(8));
    //         for (Component c : extras) {
    //            extra.add(c);
    //         }
    //      }
    //      extra.add(Box.createHorizontalGlue());

    switch (visible) {
    case NOTVISIBLE:
        break;

    case VISIBLE:
    default:
        Box top = Box.createHorizontalBox();
        top.setOpaque(true);
        top.setBackground(Color.LIGHT_GRAY);
        top.setBorder(new MatteBorder(0, 0, 1, 0, Color.GRAY));
        JLabel label = new JLabel("Field");
        label.setForeground(Color.DARK_GRAY);
        label.setFont(label.getFont().deriveFont(Font.BOLD));
        top.add(label);
        top.add(new JButton(changeCollectionOrder));

        if (extras != null && extras.length > 0) {
            top.add(Box.createHorizontalStrut(8));
            for (Component c : extras) {
                top.add(c);
            }
        }
        add(top, BorderLayout.NORTH);
        break;
    }

    add(fieldTableScrollPane, BorderLayout.CENTER);
    add(warningMessage, BorderLayout.SOUTH);
}