Example usage for javax.swing Box add

List of usage examples for javax.swing Box add

Introduction

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

Prototype

public Component add(Component comp) 

Source Link

Document

Appends the specified component to the end of this container.

Usage

From source file:TextureByReference.java

public JPanel buildGui() {
    flipB = new JCheckBox("flip image", true);
    flipB.addItemListener(this);
    javax.swing.Box flipBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    flipBox.add(flipB);
    Component strut1 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    Component strut2 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    Component strut3 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    Component strut4 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    Component strut5 = flipBox.createVerticalStrut(flipB.getPreferredSize().height);
    flipBox.add(strut1);/*from w w w . j ava  2 s .  c om*/
    flipBox.add(strut2);
    flipBox.add(strut3);
    flipBox.add(strut4);
    flipBox.add(strut5);

    yUp = new JRadioButton("y up");
    yUp.addActionListener(this);
    yUp.setSelected(true);
    yDown = new JRadioButton("y down");
    yDown.addActionListener(this);
    ButtonGroup yGroup = new ButtonGroup();
    yGroup.add(yUp);
    yGroup.add(yDown);
    JLabel yLabel = new JLabel("Image Orientation:");
    javax.swing.Box yBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    yBox.add(yLabel);
    yBox.add(yUp);
    yBox.add(yDown);
    strut1 = yBox.createVerticalStrut(yUp.getPreferredSize().height);
    strut2 = yBox.createVerticalStrut(yUp.getPreferredSize().height);
    strut3 = yBox.createVerticalStrut(yUp.getPreferredSize().height);
    yBox.add(strut1);
    yBox.add(strut2);
    yBox.add(strut3);

    texByRef = new JRadioButton("by reference");
    texByRef.addActionListener(this);
    texByRef.setSelected(true);
    texByCopy = new JRadioButton("by copy");
    texByCopy.addActionListener(this);
    ButtonGroup texGroup = new ButtonGroup();
    texGroup.add(texByRef);
    texGroup.add(texByCopy);
    JLabel texLabel = new JLabel("Texture:*");
    javax.swing.Box texBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    texBox.add(texLabel);
    texBox.add(texByRef);
    texBox.add(texByCopy);
    strut1 = texBox.createVerticalStrut(texByRef.getPreferredSize().height);
    strut2 = texBox.createVerticalStrut(texByRef.getPreferredSize().height);
    strut3 = texBox.createVerticalStrut(texByRef.getPreferredSize().height);
    texBox.add(strut1);
    texBox.add(strut2);
    texBox.add(strut3);

    geomByRef = new JRadioButton("by reference");
    geomByRef.addActionListener(this);
    geomByRef.setSelected(true);
    geomByCopy = new JRadioButton("by copy");
    geomByCopy.addActionListener(this);
    ButtonGroup geomGroup = new ButtonGroup();
    geomGroup.add(geomByRef);
    geomGroup.add(geomByCopy);
    JLabel geomLabel = new JLabel("Geometry:");
    javax.swing.Box geomBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    geomBox.add(geomLabel);
    geomBox.add(geomByRef);
    geomBox.add(geomByCopy);
    strut1 = geomBox.createVerticalStrut(geomByRef.getPreferredSize().height);
    strut2 = geomBox.createVerticalStrut(geomByRef.getPreferredSize().height);
    strut3 = geomBox.createVerticalStrut(geomByRef.getPreferredSize().height);
    geomBox.add(strut1);
    geomBox.add(strut2);
    geomBox.add(strut3);

    img4ByteABGR = new JRadioButton("TYPE_4BYTE_ABGR");
    img4ByteABGR.addActionListener(this);
    img4ByteABGR.setSelected(true);
    img3ByteBGR = new JRadioButton("TYPE_3BYTE_BGR");
    img3ByteBGR.addActionListener(this);
    imgIntARGB = new JRadioButton("TYPE_INT_ARGB");
    imgIntARGB.addActionListener(this);
    imgCustomRGBA = new JRadioButton("TYPE_CUSTOM RGBA");
    imgCustomRGBA.addActionListener(this);
    imgCustomRGB = new JRadioButton("TYPE_CUSTOM RGB");
    imgCustomRGB.addActionListener(this);
    ButtonGroup imgGroup = new ButtonGroup();
    imgGroup.add(img4ByteABGR);
    imgGroup.add(img3ByteBGR);
    imgGroup.add(imgIntARGB);
    imgGroup.add(imgCustomRGBA);
    imgGroup.add(imgCustomRGB);
    JLabel imgLabel = new JLabel("Image Type:*");
    javax.swing.Box imgBox = new javax.swing.Box(BoxLayout.Y_AXIS);
    imgBox.add(imgLabel);
    imgBox.add(img4ByteABGR);
    imgBox.add(img3ByteBGR);
    imgBox.add(imgIntARGB);
    imgBox.add(imgCustomRGBA);
    imgBox.add(imgCustomRGB);

    javax.swing.Box topBox = new javax.swing.Box(BoxLayout.X_AXIS);
    topBox.add(flipBox);
    topBox.add(texBox);
    topBox.add(geomBox);
    topBox.add(yBox);
    Component strut = topBox.createRigidArea(new Dimension(10, 10));
    topBox.add(strut);
    topBox.add(imgBox);

    frameDelay = new JSlider(0, 50, 0);
    frameDelay.addChangeListener(this);
    frameDelay.setSnapToTicks(true);
    frameDelay.setPaintTicks(true);
    frameDelay.setPaintLabels(true);
    frameDelay.setMajorTickSpacing(10);
    frameDelay.setMinorTickSpacing(1);
    frameDelay.setValue(20);
    JLabel delayL = new JLabel("frame delay");
    javax.swing.Box delayBox = new javax.swing.Box(BoxLayout.X_AXIS);
    delayBox.add(delayL);
    delayBox.add(frameDelay);

    animationB = new JButton(" stop animation ");
    animationB.addActionListener(this);

    JLabel texInfo1 = new JLabel("*To use ImageComponent by reference feature, use TYPE_4BYTE_ABGR on Solaris");
    JLabel texInfo2 = new JLabel("and TYPE_3BYTE_BGR on Windows");

    JPanel buttonP = new JPanel();
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    buttonP.setLayout(gridbag);
    c.anchor = GridBagConstraints.CENTER;
    c.gridwidth = GridBagConstraints.REMAINDER;
    gridbag.setConstraints(topBox, c);
    buttonP.add(topBox);
    gridbag.setConstraints(delayBox, c);
    buttonP.add(delayBox);
    gridbag.setConstraints(animationB, c);
    buttonP.add(animationB);
    gridbag.setConstraints(texInfo1, c);
    buttonP.add(texInfo1);
    gridbag.setConstraints(texInfo2, c);
    buttonP.add(texInfo2);

    return buttonP;

}

From source file:org.genedb.jogra.plugins.TermRationaliser.java

/**
 * Return a new JFrame which is the main interface to the Rationaliser.
 *//*from  ww  w  .  jav a 2s  .  c o  m*/
public JFrame getMainPanel() {

    /* JFRAME */
    frame.setTitle(WINDOW_TITLE);
    frame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
    frame.setLayout(new BorderLayout());

    /* MENU */
    JMenuBar menuBar = new JMenuBar();

    JMenu actions_menu = new JMenu("Actions");
    JMenuItem actions_mitem_1 = new JMenuItem("Refresh lists");
    actions_mitem_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            initModels();
        }
    });
    actions_menu.add(actions_mitem_1);

    JMenu about_menu = new JMenu("About");
    JMenuItem about_mitem_1 = new JMenuItem("About");
    about_mitem_1.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            JOptionPane.showMessageDialog(null,
                    "Term Rationaliser \n" + "Wellcome Trust Sanger Institute, UK \n" + "2009",
                    "Term Rationaliser", JOptionPane.PLAIN_MESSAGE);
        }
    });
    about_menu.add(about_mitem_1);

    menuBar.add(about_menu);
    menuBar.add(actions_menu);
    frame.add(menuBar, BorderLayout.NORTH);

    /* MAIN BOX */
    Box center = Box.createHorizontalBox(); //A box that displays contents from left to right
    center.add(Box.createHorizontalStrut(5)); //Invisible fixed-width component

    /* FROM LIST AND PANEL */
    fromList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); //Allow multiple products to be selected 
    fromList.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_RIGHT) {
                synchroniseLists(fromList, toList); //synchronise from left to right
            }
        }

        @Override
        public void keyReleased(KeyEvent arg0) {
        }

        @Override
        public void keyTyped(KeyEvent arg0) {
        }
    });

    Box fromPanel = this.createRationaliserPanel(FROM_LIST_NAME, fromList); //Box on left hand side
    fromPanel.add(Box.createVerticalStrut(55)); //Add some space
    center.add(fromPanel); //Add to main box
    center.add(Box.createHorizontalStrut(3)); //Add some space

    /* MIDDLE PANE */
    Box middlePane = Box.createVerticalBox();

    ClassLoader classLoader = this.getClass().getClassLoader(); //Needed to access the images later on
    ImageIcon leftButtonIcon = new ImageIcon(classLoader.getResource("left_arrow.gif"));
    ImageIcon rightButtonIcon = new ImageIcon(classLoader.getResource("right_arrow.gif"));

    leftButtonIcon = new ImageIcon(leftButtonIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH)); //TODO: Investigate simpler way to resize an icon!
    rightButtonIcon = new ImageIcon(rightButtonIcon.getImage().getScaledInstance(20, 20, Image.SCALE_SMOOTH)); //TODO: Investigate simpler way to resize an icon!

    JButton rightSynch = new JButton(rightButtonIcon);
    rightSynch.setToolTipText("Synchronise TO list. \n Shortcut: Right-arrow key");

    rightSynch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            synchroniseLists(fromList, toList);
        }
    });

    JButton leftSynch = new JButton(leftButtonIcon);
    leftSynch.setToolTipText("Synchronise FROM list. \n Shortcut: Left-arrow key");

    leftSynch.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            synchroniseLists(toList, fromList);
        }
    });

    middlePane.add(rightSynch);
    middlePane.add(leftSynch);

    center.add(middlePane); //Add middle pane to main box
    center.add(Box.createHorizontalStrut(3));

    /* TO LIST AND PANEL */
    toList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //Single product selection in TO list
    toList.addKeyListener(new KeyListener() {
        @Override
        public void keyPressed(KeyEvent arg0) {
            if (arg0.getKeyCode() == KeyEvent.VK_LEFT) {
                synchroniseLists(toList, fromList); //synchronise from right to left
            }
        }

        @Override
        public void keyReleased(KeyEvent arg0) {
        }

        @Override
        public void keyTyped(KeyEvent arg0) {
        }
    });

    Box toPanel = this.createRationaliserPanel(TO_LIST_NAME, toList);

    Box newTerm = Box.createVerticalBox();

    textField = new JTextArea(1, 1); //textfield to let the user edit the name of an existing term
    textField.setMaximumSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().height, 10));

    textField.setForeground(Color.BLUE);
    JScrollPane jsp = new JScrollPane(textField); //scroll pane so that there is a horizontal scrollbar
    jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    newTerm.add(jsp);
    TitledBorder editBorder = BorderFactory.createTitledBorder("Edit term name");
    editBorder.setTitleColor(Color.DARK_GRAY);
    newTerm.setBorder(editBorder);
    toPanel.add(newTerm); //add textfield to panel

    center.add(toPanel); //add panel to main box
    center.add(Box.createHorizontalStrut(5));

    frame.add(center); //add the main panel to the frame

    initModels(); //load the lists with data

    /* BOTTOM HALF OF FRAME */
    Box main = Box.createVerticalBox();
    TitledBorder border = BorderFactory.createTitledBorder("Information");
    border.setTitleColor(Color.DARK_GRAY);

    /* INFORMATION BOX */
    Box info = Box.createVerticalBox();

    Box scope = Box.createHorizontalBox();
    scope.add(Box.createHorizontalStrut(5));
    scope.add(scopeLabel); //label showing the scope of the terms
    scope.add(Box.createHorizontalGlue());

    Box productCount = Box.createHorizontalBox();
    productCount.add(Box.createHorizontalStrut(5));
    productCount.add(productCountLabel); //display the label showing the number of terms
    productCount.add(Box.createHorizontalGlue());

    info.add(scope);
    info.add(productCount);
    info.setBorder(border);

    /* ACTION BUTTONS */
    Box actionButtons = Box.createHorizontalBox();
    actionButtons.add(Box.createHorizontalGlue());
    actionButtons.add(Box.createHorizontalStrut(10));

    JButton findFix = new JButton(new FindClosestMatchAction());
    actionButtons.add(findFix);
    actionButtons.add(Box.createHorizontalStrut(10));

    RationaliserAction ra = new RationaliserAction();
    // RationaliserAction2 ra2 = new RationaliserAction2();
    JButton go = new JButton(ra);
    actionButtons.add(go);
    actionButtons.add(Box.createHorizontalGlue());

    /* MORE INFORMATION TOGGLE */
    Box buttonBox = Box.createHorizontalBox();
    final JButton toggle = new JButton("Hide information <<");

    buttonBox.add(Box.createHorizontalStrut(5));
    buttonBox.add(toggle);
    buttonBox.add(Box.createHorizontalGlue());

    Box textBox = Box.createHorizontalBox();

    final JScrollPane scrollPane = new JScrollPane(information);
    scrollPane.setPreferredSize(new Dimension(frame.getWidth(), 100));
    scrollPane.setVisible(true);
    textBox.add(Box.createHorizontalStrut(5));
    textBox.add(scrollPane);

    ActionListener actionListener = new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            if (toggle.getText().equals("Show information >>")) {
                scrollPane.setVisible(true);
                toggle.setText("Hide information <<");
                frame.setPreferredSize(new Dimension(frame.getWidth(), frame.getHeight() + 100));
                frame.pack();
            } else if (toggle.getText().equals("Hide information <<")) {
                scrollPane.setVisible(false);
                toggle.setText("Show information >>");
                frame.setPreferredSize(new Dimension(frame.getWidth(), frame.getHeight() - 100));
                frame.pack();
            }
        }
    };
    toggle.addActionListener(actionListener);

    main.add(Box.createVerticalStrut(5));
    main.add(info);
    main.add(Box.createVerticalStrut(5));
    main.add(Box.createVerticalStrut(5));
    main.add(actionButtons);
    main.add(Box.createVerticalStrut(10));
    main.add(buttonBox);
    main.add(textBox);

    frame.add(main, BorderLayout.SOUTH);
    frame.pack();
    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    frame.setVisible(true);
    //initModels();

    return frame;
}

From source file:com.diversityarrays.kdxplore.trials.TrialOverviewPanel.java

public TrialOverviewPanel(String title, OfflineData offdata, TrialExplorerManager manager,
        FileListTransferHandler flth, MessagePrinter mp, final Closure<List<Trial>> onTrialSelected) {
    super(new BorderLayout());

    offlineData = offdata;/*from   ww  w  . ja v  a2  s .co  m*/
    KdxploreDatabase kdxdb = offlineData.getKdxploreDatabase();
    if (kdxdb != null) {
        kdxdb.addEntityChangeListener(trialChangeListener);
        kdxdb.addEntityChangeListener(traitChangeListener);
    }

    this.messagePrinter = mp;

    TableTransferHandler tth = TableTransferHandler.initialiseForCopySelectAll(trialsTable, true);
    trialsTable.setTransferHandler(new ChainingTransferHandler(flth, tth));
    trialsTable.setAutoCreateRowSorter(true);

    trialsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                List<Trial> selectedTrials = getSelectedTrials();
                if (selectedTrials.size() == 1) {
                    trialTraitsTableModel.setSelectedTrial(selectedTrials.get(0));
                } else {
                    trialTraitsTableModel.setSelectedTrial(null);
                }
                onTrialSelected.execute(selectedTrials);
            }
        }
    });
    trialsTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton(e)) {
                fireEditCommand(e);
            }
        }
    });

    GuiUtil.setVisibleRowCount(trialsTable, MAX_INITIAL_VISIBLE_TRIAL_ROWS);

    offlineData.addOfflineDataChangeListener(offlineDataChangeListener);

    trialTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            updateRefreshAction();
        }
    });
    trialTraitsTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            updateAddTraitAction();
            updateRemoveTraitAction();
            updateScoringOrderAction();
        }
    });
    trialTraitsTable.addMouseListener(new MouseAdapter() {

        List<Trait> selectedTraits;
        JPopupMenu popupMenu;
        Action showTraitsAction = new AbstractAction("Select in Trait Explorer") {
            @Override
            public void actionPerformed(ActionEvent e) {
                manager.showTraitsInTraitExplorer(selectedTraits);
            }
        };

        @Override
        public void mouseClicked(MouseEvent e) {

            if (SwingUtilities.isLeftMouseButton(e) && 2 == e.getClickCount()) {
                // Start editing the Trait
                e.consume();
                int vrow = trialTraitsTable.rowAtPoint(e.getPoint());
                if (vrow >= 0) {
                    int mrow = trialTraitsTable.convertRowIndexToModel(vrow);
                    if (mrow >= 0) {
                        Trait trait = trialTraitsTableModel.getTraitAt(mrow);
                        if (trait != null) {
                            traitExplorer.startEditing(trait);
                            ;
                        }
                    }
                }
            } else if (SwingUtilities.isRightMouseButton(e) && 1 == e.getClickCount()) {
                // Select the traits in the traitExplorer
                e.consume();
                List<Integer> modelRows = GuiUtil.getSelectedModelRows(trialTraitsTable);
                if (!modelRows.isEmpty()) {
                    selectedTraits = modelRows.stream().map(trialTraitsTableModel::getTraitAt)
                            .collect(Collectors.toList());

                    if (popupMenu == null) {
                        popupMenu = new JPopupMenu();
                        popupMenu.add(showTraitsAction);
                    }
                    Point pt = e.getPoint();
                    popupMenu.show(trialTraitsTable, pt.x, pt.y);
                }
            }
        }
    });
    trialTraitsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                updateRemoveTraitAction();
            }
        }
    });
    updateAddTraitAction();
    updateRemoveTraitAction();
    updateScoringOrderAction();
    updateRefreshAction();

    KDClientUtils.initAction(ImageId.REFRESH_24, refreshTrialTraitsAction, "Refresh");
    KDClientUtils.initAction(ImageId.MINUS_GOLD_24, removeTraitAction, "Remove selected Traits");
    KDClientUtils.initAction(ImageId.PLUS_BLUE_24, addTraitAction, "Add Traits to Trial");
    KDClientUtils.initAction(ImageId.TRAIT_ORDER_24, setScoringOrderAction, "Define Trait Scoring Order");

    Box buttons = Box.createHorizontalBox();

    buttons.add(new JButton(setScoringOrderAction));
    buttons.add(Box.createHorizontalGlue());
    buttons.add(new JButton(addTraitAction));
    buttons.add(new JButton(removeTraitAction));
    buttons.add(Box.createHorizontalStrut(10));
    buttons.add(refreshTrialTraitsButton);

    JPanel traitsPanel = new JPanel(new BorderLayout());
    traitsPanel.add(GuiUtil.createLabelSeparator("Uses Traits", buttons), BorderLayout.NORTH);
    traitsPanel.add(new PromptScrollPane(trialTraitsTable,
            "If the (single) selected Trial has Traits they will appear here"), BorderLayout.CENTER);

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(trialsTable), traitsPanel);
    splitPane.setResizeWeight(0.5);

    add(splitPane, BorderLayout.CENTER);
}

From source file:graph.jung2.MyLensDemo.java

public void init() {

    // create a simple graph for the demo
    TemporalNetworkOfWikipediaNodes net = null;
    try {/*  w ww. j  av a 2 s . co m*/

        // net = new TemporalNetworkOfWikipediaNodes(null, null);
        net = new TemporalNetworkOfWikipediaNodes(r, level);
        graph = net.createSampleNetwork(); //getCC_EDIT_Graph();

    } catch (Exception ex) {
        Logger.getLogger(MyLensDemo.class.getName()).log(Level.SEVERE, null, ex);
    }

    //        if ( net == null ) {
    //            graph = TemporalNetworkOfWikipediaNodes.createSampleNetwork();
    //        }
    //        else {
    //            graph = net.getGraph();
    //        }

    graphLayout = new FRLayout<String, Number>(graph);
    ((FRLayout) graphLayout).setMaxIterations(1000);

    Dimension preferredSize = new Dimension(600, 600);
    Map<String, Point2D> map = new HashMap<String, Point2D>();
    Transformer<String, Point2D> vlf = TransformerUtils.mapTransformer(map);
    grid = this.generateVertexGrid(map, preferredSize, 25);
    gridLayout = new StaticLayout<String, Number>(grid, vlf, preferredSize);

    final VisualizationModel<String, Number> visualizationModel = new DefaultVisualizationModel<String, Number>(
            graphLayout, preferredSize);
    vv = new VisualizationViewer<String, Number>(visualizationModel, preferredSize);

    PickedState<String> ps = vv.getPickedVertexState();
    PickedState<Number> pes = vv.getPickedEdgeState();
    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(ps, Color.red, Color.yellow));
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(pes, Color.black, Color.cyan));
    vv.setBackground(Color.white);

    vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());

    final Transformer<String, Shape> ovals = vv.getRenderContext().getVertexShapeTransformer();
    final Transformer<String, Shape> squares = new ConstantTransformer(new Rectangle2D.Float(-10, -10, 20, 20));

    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller());

    Container content = getContentPane();
    GraphZoomScrollPane gzsp = new GraphZoomScrollPane(vv);
    content.add(gzsp);

    /**
     * the regular graph mouse for the normal view
     */
    final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse();

    vv.setGraphMouse(graphMouse);
    vv.addKeyListener(graphMouse.getModeKeyListener());

    hyperbolicViewSupport = new ViewLensSupport<String, Number>(vv,
            new HyperbolicShapeTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
            new ModalLensGraphMouse());
    hyperbolicLayoutSupport = new LayoutLensSupport<String, Number>(vv,
            new HyperbolicTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
            new ModalLensGraphMouse());
    magnifyViewSupport = new ViewLensSupport<String, Number>(vv,
            new MagnifyShapeTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.VIEW)),
            new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
    magnifyLayoutSupport = new LayoutLensSupport<String, Number>(vv,
            new MagnifyTransformer(vv,
                    vv.getRenderContext().getMultiLayerTransformer().getTransformer(Layer.LAYOUT)),
            new ModalLensGraphMouse(new LensMagnificationGraphMousePlugin(1.f, 6.f, .2f)));
    hyperbolicLayoutSupport.getLensTransformer()
            .setLensShape(hyperbolicViewSupport.getLensTransformer().getLensShape());
    magnifyViewSupport.getLensTransformer()
            .setLensShape(hyperbolicLayoutSupport.getLensTransformer().getLensShape());
    magnifyLayoutSupport.getLensTransformer()
            .setLensShape(magnifyViewSupport.getLensTransformer().getLensShape());

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    ButtonGroup radio = new ButtonGroup();
    JRadioButton normal = new JRadioButton("None");
    normal.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                if (hyperbolicViewSupport != null) {
                    hyperbolicViewSupport.deactivate();
                }
                if (hyperbolicLayoutSupport != null) {
                    hyperbolicLayoutSupport.deactivate();
                }
                if (magnifyViewSupport != null) {
                    magnifyViewSupport.deactivate();
                }
                if (magnifyLayoutSupport != null) {
                    magnifyLayoutSupport.deactivate();
                }
            }
        }
    });

    final JRadioButton hyperView = new JRadioButton("Hyperbolic View");
    hyperView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            hyperbolicViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton hyperModel = new JRadioButton("Hyperbolic Layout");
    hyperModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            hyperbolicLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton magnifyView = new JRadioButton("Magnified View");
    magnifyView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            magnifyViewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    final JRadioButton magnifyModel = new JRadioButton("Magnified Layout");
    magnifyModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            magnifyLayoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    JLabel modeLabel = new JLabel("     Mode Menu >>");
    modeLabel.setUI(new VerticalLabelUI(false));
    radio.add(normal);
    radio.add(hyperModel);
    radio.add(hyperView);
    radio.add(magnifyModel);
    radio.add(magnifyView);
    normal.setSelected(true);

    graphMouse.addItemListener(hyperbolicLayoutSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(hyperbolicViewSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(magnifyLayoutSupport.getGraphMouse().getModeListener());
    graphMouse.addItemListener(magnifyViewSupport.getGraphMouse().getModeListener());

    ButtonGroup graphRadio = new ButtonGroup();
    JRadioButton graphButton = new JRadioButton("Graph");
    graphButton.setSelected(true);
    graphButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(graphLayout);
                vv.getRenderContext().setVertexShapeTransformer(ovals);
                vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
                vv.repaint();
            }
        }
    });
    JRadioButton gridButton = new JRadioButton("Grid");
    gridButton.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                visualizationModel.setGraphLayout(gridLayout);
                vv.getRenderContext().setVertexShapeTransformer(squares);
                vv.getRenderContext().setVertexLabelTransformer(new ConstantTransformer(null));
                vv.repaint();
            }
        }
    });
    graphRadio.add(graphButton);
    graphRadio.add(gridButton);

    JPanel modePanel = new JPanel(new GridLayout(3, 1));
    modePanel.setBorder(BorderFactory.createTitledBorder("Display"));
    modePanel.add(graphButton);
    modePanel.add(gridButton);

    JMenuBar menubar = new JMenuBar();
    menubar.add(graphMouse.getModeMenu());
    gzsp.setCorner(menubar);

    Box controls = Box.createHorizontalBox();
    JPanel zoomControls = new JPanel(new GridLayout(2, 1));
    zoomControls.setBorder(BorderFactory.createTitledBorder("Zoom"));
    JPanel hyperControls = new JPanel(new GridLayout(3, 2));
    hyperControls.setBorder(BorderFactory.createTitledBorder("Examiner Lens"));
    zoomControls.add(plus);
    zoomControls.add(minus);

    hyperControls.add(normal);
    hyperControls.add(new JLabel());

    hyperControls.add(hyperModel);
    hyperControls.add(magnifyModel);

    hyperControls.add(hyperView);
    hyperControls.add(magnifyView);

    controls.add(zoomControls);
    controls.add(hyperControls);
    controls.add(modePanel);
    controls.add(modeLabel);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:com.diversityarrays.kdxplore.curate.SampleEntryPanel.java

SampleEntryPanel(CurationData cd, IntFunction<Trait> traitProvider, TypedSampleMeasurementTableModel tsm,
        JTable table, TsmCellRenderer tsmCellRenderer, JToggleButton showPpiOption,
        Closure<Void> refreshFieldLayoutView,
        BiConsumer<Comparable<?>, List<CurationCellValue>> showChangedValue, SampleType[] sampleTypes) {
    this.curationData = cd;
    this.traitProvider = traitProvider;
    this.typedSampleTableModel = tsm;
    this.typedSampleTable = table;

    this.showPpiOption = showPpiOption;

    this.initialTableRowHeight = typedSampleTable.getRowHeight();
    this.tsmCellRenderer = tsmCellRenderer;
    this.refreshFieldLayoutView = refreshFieldLayoutView;
    this.showChangedValue = showChangedValue;

    List<SampleType> list = new ArrayList<>();
    list.add(NO_SAMPLE_TYPE);//w ww . j  a v  a  2 s  . c om
    for (SampleType st : sampleTypes) {
        list.add(st);
        sampleTypeById.put(st.getTypeId(), st);
    }

    sampleTypeCombo = new JComboBox<SampleType>(list.toArray(new SampleType[list.size()]));

    typedSampleTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            if (TableModelEvent.HEADER_ROW == e.getFirstRow()) {
                typedSampleTable.setAutoCreateColumnsFromModel(true);
                everSetData = false;
            }
        }
    });

    showStatsAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_STATS_FOR_KDSMART_SAMPLES());
    showStatsOption.setFont(showStatsOption.getFont().deriveFont(Font.BOLD));
    showStatsOption.setPreferredSize(new Dimension(30, 30));

    JLabel helpPanel = new JLabel();
    helpPanel.setHorizontalAlignment(JLabel.CENTER);
    String html = "<HTML>Either enter a value or select<br>a <i>Source</i> for <b>Value From:</b>";
    if (shouldShowSampleType(sampleTypes)) {
        html += "<BR>You may also select a <i>Sample Type</i> if it is relevant.";
    }
    helpPanel.setText(html);

    singleOrMultiCardPanel.add(helpPanel, CARD_SINGLE);
    singleOrMultiCardPanel.add(applyToPanel, CARD_MULTI);
    //        singleOrMultiCardPanel.add(multiCellControlsPanel, CARD_MULTI);

    validationMessage.setBorder(new LineBorder(Color.LIGHT_GRAY));
    validationMessage.setForeground(Color.RED);
    validationMessage.setBackground(new JLabel().getBackground());
    validationMessage.setHorizontalAlignment(SwingConstants.CENTER);
    //      validationMessage.setEditable(false);
    Box setButtons = Box.createHorizontalBox();
    setButtons.add(new JButton(deleteAction));
    setButtons.add(new JButton(notApplicableAction));
    setButtons.add(new JButton(missingAction));
    setButtons.add(new JButton(setValueAction));

    deleteAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_UNSET());
    notApplicableAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_NA());
    missingAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_MISSING());
    setValueAction.putValue(Action.SHORT_DESCRIPTION, Vocab.TOOLTIP_SET_VALUE());

    Box sampleType = Box.createHorizontalBox();
    sampleType.add(new JLabel(Vocab.LABEL_SAMPLE_TYPE()));
    sampleType.add(sampleTypeCombo);

    statisticsControls = generateStatControls();

    setBorder(new TitledBorder(new LineBorder(Color.GREEN.darker().darker()), "Sample Entry Panel"));
    GBH gbh = new GBH(this);
    int y = 0;

    gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, statisticsControls);
    ++y;

    if (shouldShowSampleType(sampleTypes)) {
        sampleType.setBorder(new LineBorder(Color.RED));
        sampleType.setToolTipText("DEVELOPER MODE: sampleType is possible hack for accept/suppress");
        gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, sampleType);
        ++y;
    }

    sampleSourceControls = Box.createHorizontalBox();
    sampleSourceControls.add(new JLabel(Vocab.PROMPT_VALUES_FROM()));
    //        sampleSourceControls.add(new JSeparator(JSeparator.VERTICAL));
    sampleSourceControls.add(sampleSourceComboBox);
    sampleSourceControls.add(Box.createHorizontalGlue());
    sampleSourceComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateSetValueAction();
        }
    });

    gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, sampleSourceControls);
    ++y;

    gbh.add(0, y, 2, 1, GBH.HORZ, 1, 1, GBH.CENTER, valueDescription);
    ++y;

    gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.WEST, showStatsOption);
    gbh.add(1, y, 1, 1, GBH.HORZ, 2, 1, GBH.CENTER, sampleValueTextField);
    ++y;

    gbh.add(0, y, 2, 1, GBH.NONE, 1, 1, GBH.CENTER, setButtons);
    ++y;

    gbh.add(0, y, 2, 1, GBH.HORZ, 2, 1, GBH.CENTER, validationMessage);
    ++y;

    gbh.add(0, y, 2, 1, GBH.HORZ, 2, 0, GBH.CENTER, singleOrMultiCardPanel);
    ++y;

    deleteAction.setEnabled(false);
    sampleSourceControls.setVisible(false);

    sampleValueTextField.setGrayWhenDisabled(true);
    sampleValueTextField.addActionListener(enterKeyListener);

    sampleValueTextField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent e) {
            updateSetValueAction();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            updateSetValueAction();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            updateSetValueAction();
        }
    });

    setValueAction.setEnabled(false);
}

From source file:cloud.gui.CloudGUI.java

private void createInstanceTable(Box currentInstancesPanel) {
    model = new DefaultTableModel(new String[][] {}, instanceTableColumn);
    instances = new JTable(model) {
        private static final long serialVersionUID = 8374219580041789497L;

        public boolean isCellEditable(int rowIndex, int colIndex) {
            return false;
        }/*  ww  w. j  a va  2 s . c  o m*/
    };
    instances.addMouseListener(instanceTablePopupMenuListener);
    JScrollPane tableScrollPane = new JScrollPane(instances);
    currentInstancesPanel.add(tableScrollPane);
}

From source file:org.rdv.ui.ControlPanel.java

/**
 * Setup the UI./*from  w  ww .  j  av  a  2 s.c o  m*/
 */
private void initPanel() {
    setLayout(new BorderLayout());

    GridBagConstraints c = new GridBagConstraints();

    JPanel container = new JPanel();
    container.setLayout(new GridBagLayout());

    Box firstRowPanel = new Box(BoxLayout.LINE_AXIS);

    beginButton = new JButton();
    beginButton.setName("beginButton");
    beginButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setLocationBegin();
        }
    });
    firstRowPanel.add(beginButton);

    rtButton = new JButton();
    rtButton.setName("rtButton");
    rtButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (rtButton.isSelected()) {
                rbnbController.pause();
            } else {
                rbnbController.monitor();
            }
        }
    });
    firstRowPanel.add(rtButton);

    playButton = new JButton();
    playButton.setName("playButton");
    playButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (playButton.isSelected()) {
                rbnbController.pause();
            } else {
                rbnbController.play();
            }
        }
    });
    firstRowPanel.add(playButton);

    endButton = new JButton();
    endButton.setName("endButton");
    endButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setLocationEnd();
        }
    });
    firstRowPanel.add(endButton);

    firstRowPanel.add(Box.createHorizontalStrut(8));

    SpinnerListModel playbackRateModel = new SpinnerListModel(playbackRates);
    playbackRateSpinner = new JSpinner(playbackRateModel);
    playbackRateSpinner.setName("playbackRateSpinner");
    JSpinner.ListEditor playbackRateEditor = new JSpinner.ListEditor(playbackRateSpinner);
    playbackRateEditor.getTextField().setEditable(false);
    playbackRateSpinner.setEditor(playbackRateEditor);
    playbackRateSpinner.setPreferredSize(new Dimension(80, playbackRateSpinner.getPreferredSize().height));
    playbackRateSpinner.setMinimumSize(playbackRateSpinner.getPreferredSize());
    playbackRateSpinner.setMaximumSize(playbackRateSpinner.getPreferredSize());
    playbackRateSpinner.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            playbackRateChanged();
        }
    });
    firstRowPanel.add(playbackRateSpinner);

    firstRowPanel.add(Box.createHorizontalStrut(8));

    timeScaleComboBox = new JComboBox();
    timeScaleComboBox.setName("timeScaleComboBox");
    timeScaleComboBox.setEditable(true);
    timeScaleComboBox.setPreferredSize(new Dimension(96, timeScaleComboBox.getPreferredSize().height));
    timeScaleComboBox.setMinimumSize(timeScaleComboBox.getPreferredSize());
    timeScaleComboBox.setMaximumSize(timeScaleComboBox.getPreferredSize());
    for (int i = 0; i < timeScales.length; i++) {
        timeScaleComboBox.addItem(DataViewer.formatSeconds(timeScales[i]));
    }
    timeScaleComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            timeScaleChange();
        }
    });
    firstRowPanel.add(timeScaleComboBox);

    firstRowPanel.add(Box.createHorizontalGlue());

    locationButton = new JButton();
    locationButton.setName("locationButton");
    locationButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            TimeRange timeRange = RBNBHelper.getChannelsTimeRange();
            double time = DateTimeDialog.showDialog(ControlPanel.this, rbnbController.getLocation(),
                    timeRange.start, timeRange.end);
            if (time >= 0) {
                rbnbController.setLocation(time);
            }
        }
    });
    firstRowPanel.add(locationButton);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(8, 8, 8, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(firstRowPanel, c);

    zoomTimeSlider = new TimeSlider();
    zoomTimeSlider.setRangeChangeable(false);
    zoomTimeSlider.addTimeAdjustmentListener(this);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(0, 8, 0, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(zoomTimeSlider, c);

    JPanel zoomTimePanel = new JPanel();
    zoomTimePanel.setLayout(new BorderLayout());

    zoomMinimumLabel = new JLabel();
    zoomMinimumLabel.setName("zoomMinimumLabel");
    zoomTimePanel.add(zoomMinimumLabel, BorderLayout.WEST);

    zoomRangeLabel = new JLabel();
    zoomRangeLabel.setName("zoomRangeLabel");
    zoomRangeLabel.setHorizontalAlignment(JLabel.CENTER);
    zoomTimePanel.add(zoomRangeLabel, BorderLayout.CENTER);

    zoomMaximumLabel = new JLabel();
    zoomMaximumLabel.setName("zoomMaximumLabel");
    zoomTimePanel.add(zoomMaximumLabel, BorderLayout.EAST);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(8, 8, 0, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(zoomTimePanel, c);

    globalTimeSlider = new TimeSlider();
    globalTimeSlider.setValueChangeable(false);
    globalTimeSlider.addTimeAdjustmentListener(this);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.weighty = 1;
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;
    c.insets = new java.awt.Insets(8, 8, 8, 8);
    c.anchor = GridBagConstraints.NORTHWEST;
    container.add(globalTimeSlider, c);

    add(container, BorderLayout.CENTER);

    log.info("Initialized control panel.");
}

From source file:org.freeplane.view.swing.features.time.mindmapmode.NodeList.java

public void startup() {
    if (dialog != null) {
        dialog.toFront();/*from www .  ja  v a  2s.  c  om*/
        return;
    }
    NodeList.COLUMN_MODIFIED = TextUtils.getText(PLUGINS_TIME_LIST_XML_MODIFIED);
    NodeList.COLUMN_CREATED = TextUtils.getText(PLUGINS_TIME_LIST_XML_CREATED);
    NodeList.COLUMN_ICONS = TextUtils.getText(PLUGINS_TIME_LIST_XML_ICONS);
    NodeList.COLUMN_TEXT = TextUtils.getText(PLUGINS_TIME_LIST_XML_TEXT);
    NodeList.COLUMN_DATE = TextUtils.getText(PLUGINS_TIME_LIST_XML_DATE);
    NodeList.COLUMN_NOTES = TextUtils.getText(PLUGINS_TIME_LIST_XML_NOTES);
    dialog = new JDialog(Controller.getCurrentController().getViewController().getFrame(), modal /* modal */);
    String windowTitle;
    if (showAllNodes) {
        windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE_ALL_NODES;
    } else {
        windowTitle = PLUGINS_TIME_MANAGEMENT_XML_WINDOW_TITLE;
    }
    dialog.setTitle(TextUtils.getText(windowTitle));
    dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    final WindowAdapter windowListener = new WindowAdapter() {

        @Override
        public void windowGainedFocus(WindowEvent e) {
            mFilterTextSearchField.getEditor().selectAll();
        }

        @Override
        public void windowClosing(final WindowEvent event) {
            disposeDialog();
        }
    };
    dialog.addWindowListener(windowListener);
    dialog.addWindowFocusListener(windowListener);
    UITools.addEscapeActionToDialog(dialog, new AbstractAction() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            disposeDialog();
        }
    });
    final Container contentPane = dialog.getContentPane();
    final GridBagLayout gbl = new GridBagLayout();
    contentPane.setLayout(gbl);
    final GridBagConstraints layoutConstraints = new GridBagConstraints();
    layoutConstraints.gridx = 0;
    layoutConstraints.gridy = 0;
    layoutConstraints.gridwidth = 1;
    layoutConstraints.gridheight = 1;
    layoutConstraints.weightx = 0.0;
    layoutConstraints.weighty = 0.0;
    layoutConstraints.anchor = GridBagConstraints.WEST;
    layoutConstraints.fill = GridBagConstraints.HORIZONTAL;
    contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_FIND)), layoutConstraints);
    layoutConstraints.gridwidth = 1;
    layoutConstraints.gridx++;
    contentPane.add(Box.createHorizontalStrut(40), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(new JLabel(TextUtils.getText("filter_match_case")), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(matchCase, layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(Box.createHorizontalStrut(40), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(useRegexInFind, layoutConstraints);
    layoutConstraints.gridx = 0;
    layoutConstraints.weightx = 1.0;
    layoutConstraints.gridwidth = GridBagConstraints.REMAINDER;
    layoutConstraints.gridy++;
    contentPane.add(/* new JScrollPane */(mFilterTextSearchField), layoutConstraints);
    layoutConstraints.gridy++;
    layoutConstraints.weightx = 0.0;
    layoutConstraints.gridwidth = 1;
    contentPane.add(new JLabel(TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_REPLACE)), layoutConstraints);
    layoutConstraints.gridx = 5;
    contentPane.add(new JLabel(TextUtils.getText("regular_expressions")), layoutConstraints);
    layoutConstraints.gridx++;
    contentPane.add(useRegexInReplace, layoutConstraints);
    layoutConstraints.gridx = 0;
    layoutConstraints.weightx = 1.0;
    layoutConstraints.gridwidth = GridBagConstraints.REMAINDER;
    layoutConstraints.gridy++;
    contentPane.add(/* new JScrollPane */(mFilterTextReplaceField), layoutConstraints);
    dateRenderer = new DateRenderer();
    nodeRenderer = new NodeRenderer();
    notesRenderer = new NotesRenderer();
    iconsRenderer = new IconsRenderer();
    timeTable = new FlatNodeTable();
    timeTable.addKeyListener(new FlatNodeTableKeyListener());
    timeTable.addMouseListener(new FlatNodeTableMouseAdapter());
    timeTable.getTableHeader().setReorderingAllowed(false);
    timeTableModel = updateModel();
    mFlatNodeTableFilterModel = new FlatNodeTableFilterModel(timeTableModel, NodeList.NODE_TEXT_COLUMN);
    sorter = new TableSorter(mFlatNodeTableFilterModel);
    timeTable.setModel(sorter);
    sorter.setTableHeader(timeTable.getTableHeader());
    sorter.setColumnComparator(Date.class, TableSorter.COMPARABLE_COMPARATOR);
    sorter.setColumnComparator(NodeModel.class, TableSorter.LEXICAL_COMPARATOR);
    sorter.setColumnComparator(IconsHolder.class, TableSorter.COMPARABLE_COMPARATOR);
    sorter.setSortingStatus(NodeList.DATE_COLUMN, TableSorter.ASCENDING);
    final JScrollPane pane = new JScrollPane(timeTable);
    UITools.setScrollbarIncrement(pane);
    layoutConstraints.gridy++;
    GridBagConstraints tableConstraints = (GridBagConstraints) layoutConstraints.clone();
    tableConstraints.weightx = 1;
    tableConstraints.weighty = 10;
    tableConstraints.fill = GridBagConstraints.BOTH;
    contentPane.add(pane, tableConstraints);
    mTreeLabel = new JLabel();
    layoutConstraints.gridy++;
    GridBagConstraints treeConstraints = (GridBagConstraints) layoutConstraints.clone();
    treeConstraints.fill = GridBagConstraints.BOTH;
    @SuppressWarnings("serial")
    JScrollPane scrollPane = new JScrollPane(mTreeLabel) {
        @Override
        public boolean isValidateRoot() {
            return false;
        }
    };
    contentPane.add(scrollPane, treeConstraints);
    final AbstractAction exportAction = new AbstractAction(
            TextUtils.getText("plugins/TimeManagement.xml_Export")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            exportSelectedRowsAndClose();
        }
    };
    final JButton exportButton = new JButton(exportAction);
    final AbstractAction replaceAllAction = new AbstractAction(
            TextUtils.getText("plugins/TimeManagement.xml_Replace_All")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            replace(new ReplaceAllInfo());
        }
    };
    final JButton replaceAllButton = new JButton(replaceAllAction);
    final AbstractAction replaceSelectedAction = new AbstractAction(
            TextUtils.getText("plugins/TimeManagement.xml_Replace_Selected")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            replace(new ReplaceSelectedInfo());
        }
    };
    final JButton replaceSelectedButton = new JButton(replaceSelectedAction);
    final AbstractAction gotoAction = new AbstractAction(TextUtils.getText("plugins/TimeManagement.xml_Goto")) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            selectSelectedRows();
        }
    };
    final JButton gotoButton = new JButton(gotoAction);
    final AbstractAction disposeAction = new AbstractAction(
            TextUtils.getText(PLUGINS_TIME_MANAGEMENT_XML_CLOSE)) {
        /**
             * 
             */
        private static final long serialVersionUID = 1L;

        public void actionPerformed(final ActionEvent arg0) {
            disposeDialog();
        }
    };
    final JButton cancelButton = new JButton(disposeAction);
    /* Initial State */
    gotoAction.setEnabled(false);
    exportAction.setEnabled(false);
    replaceSelectedAction.setEnabled(false);
    final Box bar = Box.createHorizontalBox();
    bar.add(Box.createHorizontalGlue());
    bar.add(cancelButton);
    bar.add(exportButton);
    bar.add(replaceAllButton);
    bar.add(replaceSelectedButton);
    bar.add(gotoButton);
    bar.add(Box.createHorizontalGlue());
    layoutConstraints.gridy++;
    contentPane.add(/* new JScrollPane */(bar), layoutConstraints);
    final JMenuBar menuBar = new JMenuBar();
    final JMenu menu = new JMenu(TextUtils.getText("plugins/TimeManagement.xml_menu_actions"));
    final AbstractAction[] actionList = new AbstractAction[] { gotoAction, replaceSelectedAction,
            replaceAllAction, exportAction, disposeAction };
    for (int i = 0; i < actionList.length; i++) {
        final AbstractAction action = actionList[i];
        final JMenuItem item = menu.add(action);
        item.setIcon(new BlindIcon(UIBuilder.ICON_SIZE));
    }
    menuBar.add(menu);
    dialog.setJMenuBar(menuBar);
    final ListSelectionModel rowSM = timeTable.getSelectionModel();
    rowSM.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(final ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            final ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            final boolean enable = !(lsm.isSelectionEmpty());
            replaceSelectedAction.setEnabled(enable);
            gotoAction.setEnabled(enable);
            exportAction.setEnabled(enable);
        }
    });
    rowSM.addListSelectionListener(new ListSelectionListener() {
        String getNodeText(final NodeModel node) {
            return TextController.getController().getShortText(node)
                    + ((node.isRoot()) ? "" : (" <- " + getNodeText(node.getParentNode())));
        }

        public void valueChanged(final ListSelectionEvent e) {
            if (e.getValueIsAdjusting()) {
                return;
            }
            final ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            if (lsm.isSelectionEmpty()) {
                mTreeLabel.setText("");
                return;
            }
            final int selectedRow = lsm.getLeadSelectionIndex();
            final NodeModel mindMapNode = getMindMapNode(selectedRow);
            mTreeLabel.setText(getNodeText(mindMapNode));
        }
    });
    final String marshalled = ResourceController.getResourceController()
            .getProperty(NodeList.WINDOW_PREFERENCE_STORAGE_PROPERTY);
    final WindowConfigurationStorage result = TimeWindowConfigurationStorage.decorateDialog(marshalled, dialog);
    final WindowConfigurationStorage storage = result;
    if (storage != null) {
        timeTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        int column = 0;
        for (final TimeWindowColumnSetting setting : ((TimeWindowConfigurationStorage) storage)
                .getListTimeWindowColumnSettingList()) {
            timeTable.getColumnModel().getColumn(column).setPreferredWidth(setting.getColumnWidth());
            sorter.setSortingStatus(column, setting.getColumnSorting());
            column++;
        }
    }
    mFlatNodeTableFilterModel.setFilter((String) mFilterTextSearchField.getSelectedItem(),
            matchCase.isSelected(), useRegexInFind.isSelected());
    dialog.setVisible(true);
}

From source file:de.adv_online.aaa.katalogtool.KatalogDialog.java

private Component createMainTab() {

    // bernahme der Eigenschaften
    String s = "";

    String appSchemaStr;//from ww  w.  j a  v  a 2 s  . c  o  m
    s = options.parameter("appSchemaName");
    if (s != null && s.trim().length() > 0)
        appSchemaStr = s.trim();
    else
        appSchemaStr = "";

    String schemaKennungenStr;
    s = options.parameter(paramKatalogClass, "schemakennungen");
    if (s != null && s.trim().length() > 0)
        schemaKennungenStr = s.trim();
    else
        schemaKennungenStr = "*";

    Boolean geerbEigBool = false;
    s = options.parameter(paramKatalogClass, "geerbteEigenschaften");
    if (s != null && s.equals("true"))
        geerbEigBool = true;

    String modellartenStr;
    s = options.parameter(paramKatalogClass, "modellarten");
    if (s == null || s.trim().length() == 0)
        modellartenStr = "";
    else
        modellartenStr = s.trim();

    Boolean grundDatBool = false;
    s = options.parameter(paramKatalogClass, "nurGrunddatenbestand");
    if (s != null && s.equals("true"))
        grundDatBool = true;

    Boolean profEinschrBool = false;
    Boolean profDateiBool = false;
    String profileStr;
    s = options.parameter(paramKatalogClass, "profile");
    if (s == null || s.trim().length() == 0)
        profileStr = "";
    else
        profileStr = s.trim();
    if (profileStr.length() > 0)
        profEinschrBool = true;
    s = options.parameter(paramKatalogClass, "profilquelle");
    if (s != null && s.trim().equals("Datei"))
        profDateiBool = true;

    Boolean pkgBool = false;
    String pkgStr;
    s = options.parameter(paramKatalogClass, "paket");
    if (s == null || s.trim().length() == 0)
        pkgStr = "";
    else
        pkgStr = s.trim();
    if (pkgStr.length() > 0)
        pkgBool = true;

    String xsltPfadStr;
    s = options.parameter(paramKatalogClass, "xsltPfad");
    if (s == null || s.trim().length() == 0)
        xsltPfadStr = "";
    else {
        if (s.toLowerCase().startsWith("http://")) {
            xsltPfadStr = s;
        } else {
            File f = new File(s.trim());
            if (f.exists())
                xsltPfadStr = f.getAbsolutePath();
            else
                xsltPfadStr = "";
        }
    }

    String outDirStr;
    s = options.parameter(paramKatalogClass, "Verzeichnis");
    if (s == null || s.trim().length() == 0)
        outDirStr = "";
    else {
        File f = new File(s.trim());
        if (f.exists())
            outDirStr = f.getAbsolutePath();
        else
            outDirStr = "";
    }

    String mdlDirStr = eap;

    // Anwendungsschema

    final JPanel appSchemaPanel = new JPanel();
    final JPanel appSchemaInnerPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 30, 5));
    appSchemaPanel.setLayout(new BoxLayout(appSchemaPanel, BoxLayout.X_AXIS));
    appSchemaPanel.setBorder(BorderFactory.createEmptyBorder(15, 20, 15, 10));

    appSchemaField = new JTextField(37);
    appSchemaField.setText(appSchemaStr);
    appSchemaFieldLabel = new JLabel("Name des zu exportierenden Anwendungsschemas:");

    Box asBox = Box.createVerticalBox();
    asBox.add(appSchemaFieldLabel);
    asBox.add(appSchemaField);

    pkgBox = new JCheckBox("Eingeschrnkt auf Paket:");
    pkgBox.setSelected(pkgBool);
    pkgBox.addItemListener(this);
    pkgField = new JTextField(37);
    pkgField.setText(pkgStr);
    if (pkgStr.length() == 0) {
        pkgField.setEnabled(false);
        pkgField.setEditable(false);
    }
    asBox.add(pkgBox);
    asBox.add(pkgField);

    appSchemaInnerPanel.add(asBox);

    appSchemaPanel.add(appSchemaInnerPanel);

    // Ausgabeoptionen

    Box outOptBox = Box.createVerticalBox();

    final JPanel outOptInnerPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 15, 5));
    Box skBox = Box.createVerticalBox();
    schemaKennFieldLabel1 = new JLabel("Liste der zu bercksichtigenden Schema-Kennungen");
    skBox.add(schemaKennFieldLabel1);
    schemaKennFieldLabel2 = new JLabel("(nur Klassen mit diesen Kennungen werden exportiert)");
    skBox.add(schemaKennFieldLabel2);
    schemaKennField = new JTextField(35);
    schemaKennField.setText(schemaKennungenStr);
    skBox.add(schemaKennField);
    outOptInnerPanel.add(skBox);
    outOptBox.add(outOptInnerPanel);

    final JPanel targetPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 5));
    for (String label : targetLabels) {
        targetPanel.add(targetGuiElems.get(label).selBox);
    }
    outOptBox.add(targetPanel);

    final JPanel geerbEigPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 5));
    geerbEigBox = new JCheckBox("Eigenschaften aus Superklassen auch in abgeleiteten Klassen darstellen");
    geerbEigBox.setSelected(geerbEigBool);
    geerbEigBox.addItemListener(this);
    geerbEigPanel.add(geerbEigBox);
    outOptBox.add(geerbEigPanel);

    final JPanel outOptPanel = new JPanel();
    outOptPanel.add(outOptBox);
    outOptPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Ausgabeoptionen", TitledBorder.LEFT,
            TitledBorder.TOP));

    // Modellarten und Profile
    Box modProfBox = Box.createVerticalBox();

    final JPanel modProfInnerPanel1 = new JPanel(new FlowLayout(FlowLayout.LEADING, 15, 5));

    skBox = Box.createVerticalBox();
    modellartFieldLabel = new JLabel("Ausgewhlte Modellarten:");
    modellartField = new JTextField(45);
    modellartField.setText(modellartenStr);
    skBox.add(modellartFieldLabel);
    skBox.add(modellartField);
    modProfInnerPanel1.add(skBox);
    modProfBox.add(modProfInnerPanel1);
    final JPanel grundDatPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 8));
    grundDatBox = new JCheckBox("Nur Grunddatenbestand exportieren");
    grundDatBox.setSelected(grundDatBool);
    grundDatBox.addItemListener(this);
    grundDatPanel.add(grundDatBox);
    modProfBox.add(grundDatPanel);

    final JPanel profPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 10, 5));
    profEinschrBox = new JCheckBox("Eingeschrnkt auf folgende Profilkennung(en) im Modell:");
    profEinschrBox.setSelected(profEinschrBool);
    profEinschrBox.addItemListener(this);
    profPanel.add(profEinschrBox);
    final JPanel profPanel2 = new JPanel(new FlowLayout(FlowLayout.LEADING, 15, 2));
    profileField = new JTextField(45);
    profileField.setText(profileStr);
    profPanel2.add(profileField);
    final JPanel profPanel3 = new JPanel(new FlowLayout(FlowLayout.LEADING, 15, 2));
    profDateiBox = new JCheckBox(
            "Profil(e) nur aus 3ap-Datei laden und verwenden statt der Profilkennungen aus dem Modell");
    profDateiBox.setSelected(profDateiBool);
    profDateiBox.addItemListener(this);
    profPanel3.add(profDateiBox);
    if (profileStr.length() == 0) {
        profileField.setEnabled(false);
        profileField.setEditable(false);
        profDateiBox.setEnabled(false);
    }

    modProfBox.add(profPanel);
    modProfBox.add(profPanel2);
    modProfBox.add(profPanel3);

    final JPanel modProfPanel = new JPanel();
    modProfPanel.add(modProfBox);
    modProfPanel.setBorder(new TitledBorder(new LineBorder(Color.black), "Auswahl der Modellarten und Profile",
            TitledBorder.LEFT, TitledBorder.TOP));

    // Pfadangaben
    Box pfadBox = Box.createVerticalBox();
    final JPanel pfadInnerPanel = new JPanel();
    skBox = Box.createVerticalBox();
    xsltpfadFieldLabel = new JLabel("Pfad in dem die XSLT-Skripte liegen:");
    skBox.add(xsltpfadFieldLabel);
    xsltpfadField = new JTextField(45);
    xsltpfadField.setText(xsltPfadStr);
    skBox.add(xsltpfadField);
    outDirFieldLabel = new JLabel("Pfad in den die Kataloge geschrieben werden:");
    skBox.add(outDirFieldLabel);
    outDirField = new JTextField(45);
    outDirField.setText(outDirStr);
    skBox.add(outDirField);
    mdlDirFieldLabel = new JLabel("Pfad zum Modell:");
    skBox.add(mdlDirFieldLabel);
    mdlDirField = new JTextField(45);
    mdlDirField.setText(mdlDirStr);
    skBox.add(mdlDirField);
    pfadInnerPanel.add(skBox);
    pfadBox.add(pfadInnerPanel);

    final JPanel pfadPanel = new JPanel();
    pfadPanel.add(pfadBox);
    pfadPanel.setBorder(
            new TitledBorder(new LineBorder(Color.black), "Pfadangaben", TitledBorder.LEFT, TitledBorder.TOP));

    // Zusammenstellung
    Box fileBox = Box.createVerticalBox();
    fileBox.add(appSchemaPanel);
    fileBox.add(outOptPanel);
    fileBox.add(modProfPanel);
    fileBox.add(pfadPanel);

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(fileBox, BorderLayout.NORTH);

    return panel;
}

From source file:com.diversityarrays.kdxplore.trials.TrialViewPanel.java

public TrialViewPanel(WindowOpener<JFrame> windowOpener, OfflineData od,
        Transformer<Trial, Boolean> checkIfEditorActive, Consumer<Trial> onTraitInstancesRemoved,
        MessagePrinter mp) {/*from  w  ww  .ja va2s  .  c o  m*/
    super(new BorderLayout());

    this.windowOpener = windowOpener;
    this.checkIfEditorActive = checkIfEditorActive;
    this.onTraitInstancesRemoved = onTraitInstancesRemoved;
    this.messagePrinter = mp;

    this.offlineData = od;
    this.offlineData.addOfflineDataChangeListener(offlineDataChangeListener);
    KdxploreDatabase db = offlineData.getKdxploreDatabase();
    if (db != null) {
        db.addEntityChangeListener(trialChangeListener);
    }

    trialDataTable.setTransferHandler(TableTransferHandler.initialiseForCopySelectAll(trialDataTable, true));
    trialPropertiesTable
            .setTransferHandler(TableTransferHandler.initialiseForCopySelectAll(trialPropertiesTable, true));

    // Note: Can't use renderers because the TM always returns String.class
    // for getColumnClass()
    // trialPropertiesTable.setDefaultRenderer(TrialLayout.class, new
    // TrialLayoutRenderer(trialPropertiesTableModel));
    // trialPropertiesTable.setDefaultRenderer(PlotIdentOption.class, new
    // PlotIdentOptionRenderer(trialPropertiesTableModel));

    trialPropertiesTableModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            if (trialPropertiesTableModel.getRowCount() > 0) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        GuiUtil.initialiseTableColumnWidths(trialPropertiesTable);
                    }
                });
                trialPropertiesTableModel.removeTableModelListener(this);
            }
        }
    });

    //      int tnsColumnIndex = -1;
    //      for (int col = trialPropertiesTableModel.getColumnCount(); --col >= 0; ) {
    //         if (TraitNameStyle.class == trialPropertiesTableModel.getColumnClass(col)) {
    //            tnsColumnIndex = col;
    //            break;
    //         }
    //      }

    editAction.setEnabled(false);
    trialPropertiesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                int vrow = trialPropertiesTable.getSelectedRow();
                editAction.setEnabled(vrow >= 0 && trialPropertiesTableModel.isCellEditable(vrow, 1));
            }
        }
    });

    errorMessage.setForeground(Color.RED);
    Box top = Box.createHorizontalBox();
    top.add(errorMessage);
    top.add(Box.createHorizontalGlue());
    top.add(new JButton(editAction));

    JPanel main = new JPanel(new BorderLayout());
    main.add(new JScrollPane(trialPropertiesTable), BorderLayout.CENTER);
    main.add(legendPanel, BorderLayout.SOUTH);

    JScrollPane trialDataTableScrollPane = new JScrollPane(trialDataTable);

    // The preferred height of the viewport is determined
    // by whether or not we need to use hh:mm:ss in the name of any of
    // the scoring data sets.
    JViewport viewPort = new JViewport() {
        @Override
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.height = 32;
            TableModel model = trialDataTable.getModel();
            if (model instanceof TrialData) {
                if (((TrialData) model).isUsingHMSformat()) {
                    d.height = 48;
                }
            }
            return d;
        }
    };
    trialDataTableScrollPane.setColumnHeader(viewPort);

    JTableHeader th = trialDataTable.getTableHeader();
    th.setDefaultRenderer(trialDataTableHeaderRenderer);
    th.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            int column = th.columnAtPoint(e.getPoint());
            trialDataTableHeaderRenderer.columnSelected = column;
            boolean shifted = 0 != (MouseEvent.SHIFT_MASK & e.getModifiers());
            boolean right = SwingUtilities.isRightMouseButton(e);
            updateDeleteSamplesAction(shifted, right);
            e.consume();
        }
    });

    trialDataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                removeTraitInstancesAction.setEnabled(trialDataTable.getSelectedRowCount() > 0);
            }
        }
    });
    removeTraitInstancesAction.setEnabled(false);

    KDClientUtils.initAction(ImageId.PLUS_BLUE_24, addSampleGroupAction, Msg.TOOLTIP_ADD_SAMPLES_FOR_SCORING());
    KDClientUtils.initAction(ImageId.TRASH_24, deleteSamplesAction, Msg.TOOLTIP_DELETE_COLLECTED_SAMPLES());
    KDClientUtils.initAction(ImageId.EXPORT_24, exportSamplesAction, Msg.TOOLTIP_EXPORT_SAMPLES_OR_TRAITS());
    KDClientUtils.initAction(ImageId.MINUS_GOLD_24, removeTraitInstancesAction,
            Msg.TOOLTIP_REMOVE_TRAIT_INSTANCES_WITH_NO_DATA());

    JPanel trialDataPanel = new JPanel(new BorderLayout());
    Box buttons = Box.createHorizontalBox();

    buttons.add(new JButton(removeTraitInstancesAction));
    buttons.add(Box.createHorizontalGlue());
    buttons.add(new JButton(exportSamplesAction));
    buttons.add(Box.createHorizontalGlue());
    buttons.add(new JButton(addSampleGroupAction));
    buttons.add(Box.createHorizontalStrut(8));
    buttons.add(new JButton(deleteSamplesAction));
    trialDataPanel.add(GuiUtil.createLabelSeparator("Measurements by Source", buttons), BorderLayout.NORTH);
    trialDataPanel.add(trialDataTableScrollPane, BorderLayout.CENTER);

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, main, trialDataPanel);
    splitPane.setResizeWeight(0.5);

    add(top, BorderLayout.NORTH);
    add(splitPane, BorderLayout.CENTER);

    trialDataTable.setDefaultRenderer(Object.class, new TrialDataCellRenderer());

    trialDataTable.addPropertyChangeListener("model", new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            trialDataTableHeaderRenderer.columnSelected = -1;
            updateDeleteSamplesAction(false, false);
        }
    });
}