Example usage for javax.swing JSplitPane setRightComponent

List of usage examples for javax.swing JSplitPane setRightComponent

Introduction

In this page you can find the example usage for javax.swing JSplitPane setRightComponent.

Prototype

@BeanProperty(bound = false, preferred = true, description = "The component to the right (or below) the divider.")
public void setRightComponent(Component comp) 

Source Link

Document

Sets the component to the right (or below) the divider.

Usage

From source file:org.fhaes.jsea.JSEAFrame.java

/**
 * Setup the GUI components/*from www  . jav a  2s  . co  m*/
 */
private void setupGui() {

    setTitle("jSEA - Superposed Epoch Analysis");

    getContentPane().setLayout(new MigLayout("", "[1200px,grow,fill]", "[][600px,grow,fill]"));

    initActions();
    setupMenu();
    setupToolbar();

    this.setIconImage(Builder.getApplicationIcon());
    {
        JSplitPane splitPane = new JSplitPane();
        splitPane.setOneTouchExpandable(true);
        getContentPane().add(splitPane, "cell 0 1,alignx left,aligny top");
        splitPane.setLeftComponent(contentPanel);
        contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
        contentPanel.setLayout(new MigLayout("", "[grow,fill]", "[78.00][][][grow][]"));
        {
            JPanel panel = new JPanel();
            panel.setBorder(
                    new TitledBorder(null, "Input Files", TitledBorder.LEADING, TitledBorder.TOP, null, null));
            contentPanel.add(panel, "cell 0 0,grow");
            panel.setLayout(new MigLayout("", "[][][grow][]", "[][]"));
            {
                JLabel lblContinuousTimeSeries = new JLabel("Continuous time series file:");
                panel.add(lblContinuousTimeSeries, "cell 0 0,alignx trailing");
            }
            {
                HelpTipButton label = new HelpTipButton(
                        "Continuous time series data files should be two column comma seperated (CSV) text files.  Column one should contains the years (in sequence), and column two should contain the data values.  If there are header lines or comments in the file, these lines should beginning with a *");
                panel.add(label, "cell 1 0,alignx trailing");
            }
            {
                txtTimeSeriesFile = new JTextField();
                txtwrapper = new TextComponentWrapper(txtTimeSeriesFile,
                        PrefKey.JSEA_CONTINUOUS_TIME_SERIES_FILE, "");
                txtTimeSeriesFile.setEditable(true);
                panel.add(txtTimeSeriesFile, "cell 2 0,growx");
                txtTimeSeriesFile.setColumns(10);
            }
            {
                btnTimeSeriesFile = new JButton();
                btnTimeSeriesFile.setIcon(Builder.getImageIcon("fileopen16.png"));
                btnTimeSeriesFile.setActionCommand("TimeSeriesFileBrowse");
                btnTimeSeriesFile.addActionListener(this);
                btnTimeSeriesFile.setPreferredSize(new Dimension(25, 25));
                btnTimeSeriesFile.setMaximumSize(new Dimension(25, 25));
                btnTimeSeriesFile.putClientProperty("JButton.buttonType", "segmentedTextured");
                btnTimeSeriesFile.putClientProperty("JButton.segmentPosition", "middle");

                panel.add(btnTimeSeriesFile, "cell 3 0");
            }
            {
                JLabel lblEventListFile = new JLabel("Event list file:");
                panel.add(lblEventListFile, "cell 0 1,alignx trailing");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "Event data files should be a text file with a single column of integer year values.  If there are any header or comment lines, these should begin with a *");
                panel.add(helpTipButton, "cell 1 1,alignx trailing");
            }
            {
                txtEventListFile = new JTextField();
                new TextComponentWrapper(txtEventListFile, PrefKey.JSEA_EVENT_LIST_FILE, "");
                txtEventListFile.setEditable(false);
                panel.add(txtEventListFile, "cell 2 1,growx");
                txtEventListFile.setColumns(10);
            }
            {
                btnEventListFile = new JButton();
                btnEventListFile.setIcon(Builder.getImageIcon("fileopen16.png"));
                btnEventListFile.setActionCommand("EventListFileBrowse");
                btnEventListFile.addActionListener(this);
                btnEventListFile.setPreferredSize(new Dimension(25, 25));
                btnEventListFile.setMaximumSize(new Dimension(25, 25));
                btnEventListFile.putClientProperty("JButton.buttonType", "segmentedTextured");
                btnEventListFile.putClientProperty("JButton.segmentPosition", "middle");
                panel.add(btnEventListFile, "cell 3 1");
            }
        }
        {
            JPanel panel = new JPanel();
            panel.setBorder(new TitledBorder(null, "Window, Simulation and Statistics", TitledBorder.LEADING,
                    TitledBorder.TOP, null, null));
            contentPanel.add(panel, "cell 0 1,grow");
            panel.setLayout(new MigLayout("", "[right][][fill][10px:10px:10px][right][][90.00,grow,fill]",
                    "[grow][][][]"));
            {
                JLabel lblYears = new JLabel("Years to analyse:");
                panel.add(lblYears, "cell 0 0");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "Specify which years from the dataset to analyse.");
                panel.add(helpTipButton, "cell 1 0");
            }
            {
                JPanel panel_1 = new JPanel();
                panel.add(panel_1, "cell 2 0 5 1,grow");
                panel_1.setLayout(new MigLayout("fill, insets 0", "[80px:80px][][80px:80px,fill][grow]", "[]"));
                {
                    spnFirstYear = new JSpinner();
                    spnFirstYear.setEnabled(false);
                    panel_1.add(spnFirstYear, "cell 0 0,growx");
                    spnFirstYear.setModel(new SpinnerNumberModel(new Integer(0), null, null, new Integer(1)));
                    spnFirstYear.setEditor(new JSpinner.NumberEditor(spnFirstYear, "#"));
                    new SpinnerWrapper(spnFirstYear, PrefKey.JSEA_FIRST_YEAR, 0);
                }
                {
                    JLabel lblTo = new JLabel("-");
                    panel_1.add(lblTo, "cell 1 0");
                }
                {
                    spnLastYear = new JSpinner();
                    spnLastYear.setEnabled(false);
                    panel_1.add(spnLastYear, "cell 2 0");
                    spnLastYear.setModel(new SpinnerNumberModel(new Integer(2020), null, null, new Integer(1)));
                    spnLastYear.setEditor(new JSpinner.NumberEditor(spnLastYear, "#"));
                    new SpinnerWrapper(spnLastYear, PrefKey.JSEA_LAST_YEAR, 2020);
                }
                {
                    chkAllYears = new JCheckBox("all years in series");
                    chkAllYears.setSelected(true);
                    chkAllYears.setActionCommand("AllYearsCheckbox");
                    chkAllYears.addActionListener(this);
                    panel_1.add(chkAllYears, "cell 3 0");
                }
            }
            {
                JLabel lblLagsPriorTo = new JLabel("Lags prior to event:");
                panel.add(lblLagsPriorTo, "cell 0 1");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton("");
                panel.add(helpTipButton, "cell 1 1");
            }
            {
                spnLagsPrior = new JSpinner();
                new SpinnerWrapper(spnLagsPrior, PrefKey.JSEA_LAGS_PRIOR_TO_EVENT, 6);
                panel.add(spnLagsPrior, "cell 2 1,growx");
                // spnLagsPrior.setModel(new SpinnerNumberModel(6, 1, 100, 1));
                spnLagsPrior.addChangeListener(new ChangeListener() {

                    @Override
                    public void stateChanged(ChangeEvent e) {

                        segmentationPanel.table.tableModel.clearSegments();
                        validateForm();
                    }
                });
            }
            {
                JLabel lblSimulationsToRun = new JLabel("Simulations:");
                panel.add(lblSimulationsToRun, "cell 4 1");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "Number of simulations to run.  Increasing the number of simulations increases the analysis time.");
                panel.add(helpTipButton, "cell 5 1");
            }
            {
                spnSimulationsToRun = new JSpinner();
                new SpinnerWrapper(spnSimulationsToRun, PrefKey.JSEA_SIMULATION_COUNT, 1000);
                panel.add(spnSimulationsToRun, "cell 6 1");
                spnSimulationsToRun.setModel(new SpinnerNumberModel(1000, 1, 10096, 1));
            }
            {
                JLabel lblLagsFollowingThe = new JLabel("Lags following the event:");
                panel.add(lblLagsFollowingThe, "cell 0 2");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton("");
                panel.add(helpTipButton, "cell 1 2");
            }
            {
                spnLagsAfter = new JSpinner();
                new SpinnerWrapper(spnLagsAfter, PrefKey.JSEA_LAGS_AFTER_EVENT, 4);
                panel.add(spnLagsAfter, "cell 2 2,growx");
                spnLagsAfter.addChangeListener(new ChangeListener() {

                    @Override
                    public void stateChanged(ChangeEvent e) {

                        segmentationPanel.table.tableModel.clearSegments();
                        validateForm();
                    }
                });
            }
            {
                JLabel lblSeedNumber = new JLabel("Seed number:");
                panel.add(lblSeedNumber, "cell 4 2");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "The analysis requires a pseudo-random component which is seeded with the seed number (a large integer value).  Running analyses with the same seed number enables produces the same results.  You can leave the seed as the default number unless you specifically want to generate results from a different randomised pool.");
                panel.add(helpTipButton, "cell 5 2");
            }
            {
                spnSeedNumber = new JSpinner();
                new SpinnerWrapper(spnSeedNumber, PrefKey.JSEA_SEED_NUMBER, 30188);
                panel.add(spnSeedNumber, "cell 6 2");
                spnSeedNumber.setModel(new SpinnerNumberModel(30188, 10000, 1000000, 1));
            }
            {
                JLabel lblIncludeIncompleteWindow = new JLabel("Include incomplete epoch:");
                panel.add(lblIncludeIncompleteWindow, "cell 0 3");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton("");
                panel.add(helpTipButton, "cell 1 3");
            }
            {
                chkIncludeIncompleteWindow = new JCheckBox("");
                new CheckBoxWrapper(chkIncludeIncompleteWindow, PrefKey.JSEA_INCLUDE_INCOMPLETE_WINDOW, false);

                panel.add(chkIncludeIncompleteWindow, "cell 2 3");
            }
            {
                JLabel lblPvalue = new JLabel("p-value:");
                panel.add(lblPvalue, "cell 4 3");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "The cutoff value to use for statistical significance");
                panel.add(helpTipButton, "cell 5 3,alignx trailing");
            }
            {
                cbxPValue = new JComboBox();
                panel.add(cbxPValue, "cell 6 3");
                cbxPValue.setModel(new DefaultComboBoxModel(new Double[] { 0.05, 0.01, 0.001 }));
            }
        }
        {
            JPanel panel = new JPanel();
            panel.setBorder(new TitledBorder(null, "Chart Options", TitledBorder.LEADING, TitledBorder.TOP,
                    null, null));
            contentPanel.add(panel, "cell 0 2,grow");

            panel.setLayout(new MigLayout("", "[right][][grow]", "[][]"));
            {
                JLabel lblTitleOfChart = new JLabel("Title of chart:");
                panel.add(lblTitleOfChart, "cell 0 0,alignx trailing");
            }
            {
                HelpTipButton helpTipButton = new HelpTipButton(
                        "Title to use on the chart.  The placeholder {segment} is replaced with the years of the segment being plotted.");
                panel.add(helpTipButton, "cell 1 0,alignx trailing");
            }
            {
                txtChartTitle = new JTextField();
                txtChartTitle.setToolTipText("<html>Title to be displayed on the<br/>" + "chart output");
                new TextComponentWrapper(txtChartTitle, PrefKey.JSEA_CHART_TITLE, "Chart title {segment}");
                panel.add(txtChartTitle, "cell 2 0,growx,aligny top");
                txtChartTitle.setColumns(10);
            }
            {
                JLabel lblYaxisLabel = new JLabel("Continuous series (y-axis) label");
                panel.add(lblYaxisLabel, "cell 0 1,alignx trailing");
            }
            {
                txtYAxisLabel = new JTextField();
                txtYAxisLabel
                        .setToolTipText("<html>Label to be displayed on the<br/> " + "continuous series axis");
                new TextComponentWrapper(txtYAxisLabel, PrefKey.JSEA_YAXIS_LABEL, "Y Axis");
                panel.add(txtYAxisLabel, "cell 2 1,growx");
                txtYAxisLabel.setColumns(10);
            }
        }
        {
            // Segmentation implementation used from FHSampleSize
            segmentationPanel = new SegmentationPanel();
            segmentationPanel.chkSegmentation.setText("Process subset or segments of events?");
            segmentationPanel.chkSegmentation.setActionCommand("SegmentationMode");
            segmentationPanel.chkSegmentation.addActionListener(this);
            contentPanel.add(segmentationPanel, "cell 0 3,grow");
        }
        {
            tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);
            splitPane.setRightComponent(tabbedPane);
            {
                summaryPanel = new JPanel();
                tabbedPane.addTab("Summary ", Builder.getImageIcon("info.png"), summaryPanel, null);
                summaryPanel.setLayout(new BorderLayout(0, 0));
                {
                    scrollPane = new JScrollPane();
                    summaryPanel.add(scrollPane);
                    {
                        txtSummary = new JTextArea();
                        txtSummary.setEditable(false);
                        scrollPane.setViewportView(txtSummary);
                        JMenuItem mntmCopy = new JMenuItem(actionCopy);
                        JPopupMenu popup = new JPopupMenu();
                        addPopup(scrollPane, popup);
                        popup.add(mntmCopy);
                    }
                }
            }
            {
                dataPanel = new JPanel();
                tabbedPane.addTab("Data ", Builder.getImageIcon("table.png"), dataPanel, null);
                dataPanel.setLayout(new MigLayout("", "[grow,fill]", "[grow]"));
                {
                    JSplitPane splitPaneDataTables = new JSplitPane();
                    splitPaneDataTables.setResizeWeight(0.5);
                    splitPaneDataTables.setOneTouchExpandable(true);
                    splitPaneDataTables.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    dataPanel.add(splitPaneDataTables, "cell 0 0,grow");
                    {
                        JPanel panel = new JPanel();
                        splitPaneDataTables.setLeftComponent(panel);
                        panel.setBorder(new TitledBorder(null, "Actual key events", TitledBorder.LEADING,
                                TitledBorder.TOP, null, null));
                        panel.setLayout(new MigLayout("", "[227.00px,grow,fill]", "[68.00px,grow,fill]"));
                        {
                            JScrollPane scrollPane = new JScrollPane();
                            panel.add(scrollPane, "cell 0 0,grow");
                            {
                                tblActual = new JXTable();
                                adapterActualTable = new JTableSpreadsheetByRowAdapter(tblActual);
                                scrollPane.setViewportView(tblActual);
                                tblActual.setSortable(false);
                                JMenuItem mntmCopy = new JMenuItem(actionCopy);
                                JPopupMenu popup = new JPopupMenu();
                                addPopup(tblActual, popup);
                                popup.add(mntmCopy);
                            }
                        }
                    }
                    {
                        JPanel panel = new JPanel();
                        splitPaneDataTables.setRightComponent(panel);
                        panel.setBorder(new TitledBorder(null, "Simulation results", TitledBorder.LEADING,
                                TitledBorder.TOP, null, null));
                        panel.setLayout(new MigLayout("", "[grow,fill]", "[grow,fill]"));
                        {
                            JScrollPane scrollPane = new JScrollPane();
                            panel.add(scrollPane, "cell 0 0,grow");
                            {
                                tblSimulation = new JXTable();
                                adapterSimulationTable = new JTableSpreadsheetByRowAdapter(tblSimulation);
                                scrollPane.setViewportView(tblSimulation);
                                tblSimulation.setSortable(false);
                                JMenuItem mntmCopy = new JMenuItem(actionCopy);
                                JPopupMenu popup = new JPopupMenu();
                                addPopup(tblSimulation, popup);
                                popup.add(mntmCopy);
                            }
                        }
                    }
                    splitPaneDataTables.setDividerLocation(0.5f);
                }
            }
            {
                chartPanel = new JPanel();
                tabbedPane.addTab("Chart ", Builder.getImageIcon("barchart.png"), chartPanel, null);
                chartPanel.setLayout(new MigLayout("", "[][grow]", "[][grow]"));
                {
                    segmentComboBox = new JComboBox();
                    segmentComboBox.addItemListener(new ItemListener() {

                        @Override
                        public void itemStateChanged(ItemEvent arg0) {

                            if (segmentComboBox.getItemCount() > 0) {
                                barChart = new JSEABarChart(
                                        jsea.getChartList().get(segmentComboBox.getSelectedIndex()));
                                barChart.setMaximumDrawHeight(MAX_DRAW_HEIGHT);
                                barChart.setMaximumDrawWidth(MAX_DRAW_WIDTH);
                                chartPanel.removeAll();
                                chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center");
                                chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center");
                                chartPanel.add(barChart, "cell 0 1 2 1,grow");
                                chartPanel.revalidate();
                                chartPanel.repaint();
                            }
                        }
                    });
                    {
                        plotSegmentLabel = new JLabel("Plot Segment: ");
                        chartPanel.add(plotSegmentLabel, "cell 0 0,alignx center,aligny center");
                    }
                    chartPanel.add(segmentComboBox, "cell 1 0,growx,aligny center");
                }
            }
        }
    }

    pack();
    validateForm();
    setAnalysisAvailable(false);
    setExtendedState(this.getExtendedState() | JFrame.MAXIMIZED_BOTH);
}

From source file:org.apache.jmeter.gui.MainFrame.java

/**
 * Create the GUI components and layout.
 *///  w  w w . j av  a 2  s .  co  m
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    menuBar = new JMeterMenuBar();
    setJMenuBar(menuBar);
    JPanel all = new JPanel(new BorderLayout());
    all.add(createToolBar(), BorderLayout.NORTH);

    JSplitPane treeAndMain = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

    treePanel = createTreePanel();
    treeAndMain.setLeftComponent(treePanel);

    JSplitPane topAndDown = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    topAndDown.setOneTouchExpandable(true);
    topAndDown.setDividerLocation(0.8);
    topAndDown.setResizeWeight(.8);
    topAndDown.setContinuousLayout(true);
    topAndDown.setBorder(null); // see bug jdk 4131528
    if (!DISPLAY_LOGGER_PANEL) {
        topAndDown.setDividerSize(0);
    }
    mainPanel = createMainPanel();

    logPanel = createLoggerPanel();
    errorsAndFatalsCounterLogTarget = new ErrorsAndFatalsCounterLogTarget();
    LoggingManager.addLogTargetToRootLogger(new LogTarget[] { logPanel, errorsAndFatalsCounterLogTarget });

    topAndDown.setTopComponent(mainPanel);
    topAndDown.setBottomComponent(logPanel);

    treeAndMain.setRightComponent(topAndDown);

    treeAndMain.setResizeWeight(.2);
    treeAndMain.setContinuousLayout(true);
    all.add(treeAndMain, BorderLayout.CENTER);

    getContentPane().add(all);

    tree.setSelectionRow(1);
    addWindowListener(new WindowHappenings());
    // Building is complete, register as listener
    GuiPackage.getInstance().registerAsListener();
    setTitle(DEFAULT_TITLE);
    setIconImage(JMeterUtils.getImage("icon-apache.png").getImage());// $NON-NLS-1$
    setWindowTitle(); // define AWT WM_CLASS string
}

From source file:org.executequery.gui.editor.ManageShortcutsPanel.java

private void init() {

    createTextPane();// w ww  .  j  a v  a2  s  . c  o m
    createList();

    JSplitPane splitPane = createSplitPane();
    splitPane.setLeftComponent(new JScrollPane(list));
    splitPane.setRightComponent(new JScrollPane(textPane));

    JPanel panel = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.gridy = 0;
    gbc.gridx = 1;
    gbc.insets.top = 5;
    gbc.insets.left = 5;
    gbc.insets.right = 5;
    panel.add(labelForKey("shortcuts"), gbc);
    gbc.gridy++;
    gbc.insets.bottom = 5;
    gbc.weighty = 1.0;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    panel.add(splitPane, gbc);
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.weighty = 0;
    gbc.insets.left = 5;
    gbc.insets.right = 0;
    gbc.fill = GridBagConstraints.NONE;
    panel.add(createMoveButtonsPanel(), gbc);

    addActionButton(createSaveButton());
    addActionButton(createCancelButton());

    addContentPanel(panel);

    setPreferredSize(new Dimension(600, 350));
}

From source file:org.intermine.install.swing.ProjectEditor.java

/**
 * Common initialisation: lays out the child components and wires up the necessary
 * event listeners. //from  w  ww  . ja  v  a  2  s.c  o m
 */
private void init() {

    setName("Project Editor Frame");
    setTitle(Messages.getMessage("projecteditor.title"));
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new MyWindowListener());

    modelViewerFrame = new JFrame();
    modelViewerFrame.setName("Model Viewer Frame");

    modelViewer = new ModelViewer();
    modelViewerFrame.setContentPane(modelViewer);
    modelViewerFrame.setTitle(Messages.getMessage("modelviewer.title"));
    modelViewerFrame.setSize(800, 600);

    newMineDialog = new NewMineDialog(this);
    createDatabaseDialog = new CreateDatabaseDialog(this);
    newMineDialog.setCreateDatabaseDialog(createDatabaseDialog);
    createPropertiesDialog = new CreatePropertiesDialog(this);
    createDatabaseDialog.setCreatePropertiesDialog(createPropertiesDialog);
    makeMineDialog = new MakeMineDialog(this);
    createPropertiesDialog.setMakeMineDialog(makeMineDialog);

    addSourceDialog = new AddSourceDialog(this);
    newDerivedSourceDialog = new NewDerivedTypeDialog(this);
    addSourceDialog.setNewDerivedDialog(newDerivedSourceDialog);

    postProcessorDialog = new PostProcessorDialog(this);

    buildProjectDialog = new BuildProjectDialog(this);

    preferencesDialog = new PreferencesDialog(this);

    ProjectListener projectListener = new MyProjectListener();
    addSourceDialog.addProjectListener(projectListener);
    newDerivedSourceDialog.addProjectListener(projectListener);
    postProcessorDialog.addProjectListener(projectListener);
    sourcePanel.addProjectListener(projectListener);
    makeMineDialog.addProjectListener(projectListener);
    addProjectListener(projectListener);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu fileMenu = new JMenu(Messages.getMessage("file"));
    fileMenu.setMnemonic(KeyEvent.VK_P);
    menuBar.add(fileMenu);

    fileMenu.add(new NewMineAction());
    fileMenu.add(new OpenAction());
    fileMenu.addSeparator();
    fileMenu.add(saveAction);
    fileMenu.addSeparator();
    fileMenu.add(buildProjectAction);

    JMenu editMenu = new JMenu(Messages.getMessage("edit"));
    editMenu.setMnemonic(KeyEvent.VK_E);
    menuBar.add(editMenu);

    editMenu.add(addSourceAction);
    editMenu.add(deleteSourceAction);
    editMenu.addSeparator();
    editMenu.add(postProcessorAction);

    JMenu viewMenu = new JMenu(Messages.getMessage("view"));
    viewMenu.setMnemonic(KeyEvent.VK_M);
    menuBar.add(viewMenu);

    viewMenu.add(new ViewModelAction());

    JMenu toolsMenu = new JMenu(Messages.getMessage("tools"));
    toolsMenu.setMnemonic(KeyEvent.VK_T);
    menuBar.add(toolsMenu);

    toolsMenu.add(new PreferencesAction());

    sourceListModel = new SourceListModel();
    sourceList = new JList(sourceListModel);

    Container cp = getContentPane();
    cp.setLayout(new BorderLayout());

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    cp.add(splitPane, BorderLayout.CENTER);

    initButtonPanel();

    Box vbox = Box.createVerticalBox();
    vbox.add(sourcePanel);
    vbox.add(buttonPanel);

    splitPane.setLeftComponent(new JScrollPane(sourceList));
    splitPane.setRightComponent(vbox);

    splitPane.setDividerLocation(200);

    initStatusPanel();
    cp.add(statusPanel, BorderLayout.SOUTH);

    sourceList.setCellRenderer(new SourceListRenderer());
    sourceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    sourceList.addListSelectionListener(new SourceListSelectionListener());

    statusMessageClearTimer = new Timer(4000, new StatusMessageClearer());
    statusMessageClearTimer.setInitialDelay(4000);
    statusMessageClearTimer.setRepeats(false);

    setSize(800, 600);
}

From source file:org.monkeys.gui.matcher.MatcherPanel.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//ww w  . j a v a 2  s.c  o m
 */
@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    javax.swing.JSplitPane splitPane = new javax.swing.JSplitPane();
    textPanel = new javax.swing.JPanel();
    textHeader = new org.monkeys.gui.HeaderLabel();
    javax.swing.JScrollPane textScroll = new javax.swing.JScrollPane();
    textArea = new javax.swing.JTextArea();
    editPanel = new javax.swing.JPanel();
    clearButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator2 = new javax.swing.JSeparator();
    editButton = new javax.swing.JToggleButton();
    matchingPanel = new javax.swing.JPanel();
    org.monkeys.gui.HeaderLabel matchingHeader = new org.monkeys.gui.HeaderLabel();
    matchingScroll = new javax.swing.JScrollPane();
    matchingList = new org.monkeys.gui.matcher.MatcherTable();
    org.monkeys.gui.HeaderLabel categoryLabel = new org.monkeys.gui.HeaderLabel();
    categoryDropdown = new org.monkeys.gui.CategoryDropdown();
    clipboardButton = new javax.swing.JToggleButton();
    selectButton = new javax.swing.JToggleButton();
    removeDuplicateButton = new javax.swing.JButton();
    removeRowButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator3 = new javax.swing.JSeparator();
    javax.swing.JSeparator jSeparator4 = new javax.swing.JSeparator();
    javax.swing.JSeparator jSeparator5 = new javax.swing.JSeparator();
    modifyButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator6 = new javax.swing.JSeparator();
    undoButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator7 = new javax.swing.JSeparator();
    clipboardDropdown = new javax.swing.JComboBox();

    splitPane.setBorder(null);
    splitPane.setDividerSize(8);
    splitPane.setResizeWeight(0.6);

    textHeader.setText("Text");

    textScroll.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray));
    textScroll.setMinimumSize(new java.awt.Dimension(200, 50));
    textScroll.setPreferredSize(new java.awt.Dimension(300, 150));

    textArea.setTabSize(4);
    textArea.setAutoscrolls(false);
    textScroll.setViewportView(textArea);

    clearButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/clear-20.png"))); // NOI18N
    clearButton.setText("Clear");
    clearButton.setToolTipText("Clear All Fields");
    clearButton.setBorderPainted(false);
    clearButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            clearButtonActionPerformed(evt);
        }
    });

    jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);

    editButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/lock-18.png"))); // NOI18N
    editButton.setSelected(true);
    editButton.setText("Edit");
    editButton.setToolTipText("Edit Text");
    editButton.setBorderPainted(false);
    editButton.setDisabledIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/lock-18.png"))); // NOI18N
    editButton.setIconTextGap(3);
    editButton.setSelectedIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/unlock-18.png"))); // NOI18N
    editButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            editButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout editPanelLayout = new javax.swing.GroupLayout(editPanel);
    editPanel.setLayout(editPanelLayout);
    editPanelLayout.setHorizontalGroup(editPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(editPanelLayout.createSequentialGroup().addComponent(editButton).addGap(0, 0, 0)
                    .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0).addComponent(clearButton).addGap(0, 89, Short.MAX_VALUE)));

    editPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { clearButton, editButton });

    editPanelLayout.setVerticalGroup(editPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(editPanelLayout.createSequentialGroup().addGap(0, 0, 0)
                    .addGroup(editPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSeparator2)
                            .addComponent(editButton, javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(0, 0, 0)));

    editPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { clearButton, editButton });

    javax.swing.GroupLayout textPanelLayout = new javax.swing.GroupLayout(textPanel);
    textPanel.setLayout(textPanelLayout);
    textPanelLayout.setHorizontalGroup(textPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(textPanelLayout.createSequentialGroup()
                    .addComponent(editPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(textPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(textPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textScroll, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(textHeader, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap()));
    textPanelLayout.setVerticalGroup(textPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(textPanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(textHeader, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(editPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(textScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
                    .addContainerGap()));

    splitPane.setLeftComponent(textPanel);

    matchingHeader.setText("Matches");

    matchingScroll.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray));
    matchingScroll.setMinimumSize(new java.awt.Dimension(200, 120));
    matchingScroll.setPreferredSize(new java.awt.Dimension(480, 300));
    matchingScroll.setViewportView(matchingList);

    categoryLabel.setText("Category");

    clipboardButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/clipboard-16.png"))); // NOI18N
    clipboardButton.setToolTipText("Copy Selected To Clipboard");
    clipboardButton.setBorderPainted(false);
    clipboardButton.setEnabled(false);
    clipboardButton.setIconTextGap(2);
    clipboardButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            clipboardButtonActionPerformed(evt);
        }
    });

    selectButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/list-16.png"))); // NOI18N
    selectButton.setToolTipText("Select / Unselect All");
    selectButton.setBorderPainted(false);
    selectButton.setEnabled(false);
    selectButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            selectButtonActionPerformed(evt);
        }
    });

    removeDuplicateButton.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/org/monkeys/gui/icons/remove-duplicates-16.png"))); // NOI18N
    removeDuplicateButton.setToolTipText("Remove Duplicates");
    removeDuplicateButton.setBorderPainted(false);
    removeDuplicateButton.setEnabled(false);
    removeDuplicateButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            removeDuplicateButtonActionPerformed(evt);
        }
    });

    removeRowButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/remove-16.png"))); // NOI18N
    removeRowButton.setToolTipText("Remove Selected");
    removeRowButton.setBorderPainted(false);
    removeRowButton.setEnabled(false);
    removeRowButton.setIconTextGap(2);
    removeRowButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            removeRowButtonActionPerformed(evt);
        }
    });

    jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);

    jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL);

    jSeparator5.setOrientation(javax.swing.SwingConstants.VERTICAL);

    modifyButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/edit-16.png"))); // NOI18N
    modifyButton.setToolTipText("Edit Selected");
    modifyButton.setBorderPainted(false);
    modifyButton.setEnabled(false);
    modifyButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            modifyButtonActionPerformed(evt);
        }
    });

    jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL);

    undoButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/undo-16.png"))); // NOI18N
    undoButton.setBorderPainted(false);
    undoButton.setEnabled(false);
    undoButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            undoButtonActionPerformed(evt);
        }
    });

    jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL);

    clipboardDropdown.setEditable(true);
    clipboardDropdown.setModel(
            new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
    clipboardDropdown.setEnabled(false);

    javax.swing.GroupLayout matchingPanelLayout = new javax.swing.GroupLayout(matchingPanel);
    matchingPanel.setLayout(matchingPanelLayout);
    matchingPanelLayout.setHorizontalGroup(matchingPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(matchingPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(matchingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(matchingPanelLayout.createSequentialGroup().addComponent(selectButton)
                                    .addGap(0, 0, 0)
                                    .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(removeDuplicateButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(removeRowButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(modifyButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(undoButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0)
                                    .addComponent(clipboardDropdown, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(clipboardButton)
                                    .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(matchingScroll, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(categoryLabel, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(categoryDropdown, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(matchingHeader, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap()));

    matchingPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { clipboardButton, modifyButton, removeRowButton });

    matchingPanelLayout.setVerticalGroup(matchingPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(matchingPanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(categoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(categoryDropdown, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(matchingHeader, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(matchingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(matchingPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, matchingPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(removeDuplicateButton).addComponent(jSeparator4,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(matchingPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    false)
                                            .addComponent(selectButton,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                                            .addComponent(jSeparator3,
                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(removeRowButton,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    28, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(modifyButton)
                            .addGroup(matchingPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(clipboardButton, javax.swing.GroupLayout.Alignment.TRAILING,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(matchingPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(undoButton).addComponent(jSeparator6,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jSeparator7, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(clipboardDropdown, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(matchingScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
                    .addContainerGap()));

    matchingPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { clipboardButton, clipboardDropdown });

    splitPane.setRightComponent(matchingPanel);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 664, Short.MAX_VALUE)
                    .addGap(0, 0, 0)));
    layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(splitPane));
}

From source file:org.notebook.gui.MainFrame.java

public void initGui() {
    setLayout(new BorderLayout());
    menu = new MenuToolbar(events);
    this.getRootPane().setJMenuBar(menu.getMenuBar());

    //editor = new DocumentEditor();
    //menu.addExtraToolBar(editor.getToolBar());

    //JScrollPane leftTree = new JScrollPane(tree);
    Dimension minSize = new Dimension(150, 400);

    mainPanel = new SimplePrintPanel();
    events.registerAction(mainPanel.getEventsHandler());
    _panel = new JScrollPane(mainPanel);
    _panel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    JSplitPane splitPanel;
    splitPanel = new JSplitPane();
    splitPanel.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    //splitPanel.setAutoscrolls(true);
    splitPanel.setDividerLocation(0.35);
    splitPanel.setOneTouchExpandable(true);
    splitPanel.setLeftComponent(getNavigationBar());
    splitPanel.setRightComponent(_panel);

    statusBar = new StatusBar();
    mainPanel.bar = statusBar;/*  w  w w.j a v a2  s .c o  m*/

    Container contentPane = getContentPane();
    contentPane.add(menu.getToolBar(), BorderLayout.NORTH);

    contentPane.add(splitPanel, BorderLayout.CENTER);
    //contentPane.add(_panel, BorderLayout.CENTER);

    contentPane.add(statusBar, BorderLayout.SOUTH);

    //controller = createPrivilegedProxy(new DefaultBookController(this));

    //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setIconImage(appIcon16());

    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    final MainFrame mainFrame = this;

    addWindowListener(new WindowAdapter() {
        //?
        public void windowClosing(WindowEvent e) {
            events.fireEvent(MenuToolbar.EXIT, mainFrame);
        }

        //???
        public void windowOpened(WindowEvent e) {
            events.fireEvent(MenuToolbar.LOADED, mainFrame);
        }
    });

    //????????
    events.fireEvent(MenuToolbar.GUI_INITED, this);

    events.registerAction(this);

    pack();
    setSize(670, 548);

}

From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java

/**
 * Adds a left and right component to the specified pane.
 * //from   www .j a  v  a  2s .co  m
 * @param pane   The split pane to add the components to.
 * @param left   The left component to add.
 * @param right The right component to add.
 */
private void addComponents(JSplitPane pane, JComponent left, JComponent right) {
    Component c = pane.getLeftComponent();
    if (c != null)
        pane.remove(c);
    c = pane.getRightComponent();
    if (c != null)
        pane.remove(c);
    pane.setLeftComponent(left);
    pane.setRightComponent(right);
}

From source file:org.pentaho.reporting.engine.classic.core.modules.gui.base.PreviewPane.java

private void refreshReportController(final ReportController newReportController) {
    for (int i = 0; i < outerReportControllerHolder.getComponentCount(); i++) {
        final Component maybeSplitPane = outerReportControllerHolder.getComponent(i);
        if (maybeSplitPane instanceof JSplitPane) {
            final JSplitPane splitPane = (JSplitPane) maybeSplitPane;
            reportControllerSliderSize = splitPane.getDividerLocation();
            break;
        }//from  ww w.  java  2  s .  c  o  m
    }

    if (newReportController == null) {
        if (reportControllerComponent != null) {
            // thats relatively easy.
            outerReportControllerHolder.removeAll();
            outerReportControllerHolder.add(toolbarHolder, BorderLayout.NORTH);
            outerReportControllerHolder.add(reportPaneScrollPane, BorderLayout.CENTER);
            reportControllerComponent = null;
            reportControllerInner = false;
            reportControllerLocation = null;
        }
    } else {
        final JComponent rcp = newReportController.getControlPanel();
        if (rcp == null) {
            if (reportControllerComponent != null) {
                outerReportControllerHolder.removeAll();
                outerReportControllerHolder.add(toolbarHolder, BorderLayout.NORTH);
                outerReportControllerHolder.add(reportPaneScrollPane, BorderLayout.CENTER);
                reportControllerComponent = null;
                reportControllerInner = false;
                reportControllerLocation = null;
            }
        } else if (reportControllerComponent != rcp
                || reportControllerInner != newReportController.isInnerComponent()
                || ObjectUtilities.equal(reportControllerLocation,
                        newReportController.getControllerLocation()) == false) {
            // if either the controller component or its position (inner vs outer)
            // and border-position has changed, then refresh ..
            this.reportControllerLocation = newReportController.getControllerLocation();
            this.reportControllerInner = newReportController.isInnerComponent();
            this.reportControllerComponent = newReportController.getControlPanel();

            outerReportControllerHolder.removeAll();
            if (reportControllerInner) {
                final JSplitPane innerHolder = new JSplitPane();
                innerHolder.setOpaque(false);
                if (BorderLayout.SOUTH.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setTopComponent(reportPaneScrollPane);
                    innerHolder.setBottomComponent(reportControllerComponent);
                } else if (BorderLayout.EAST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setLeftComponent(reportPaneScrollPane);
                    innerHolder.setRightComponent(reportControllerComponent);
                } else if (BorderLayout.WEST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setRightComponent(reportPaneScrollPane);
                    innerHolder.setLeftComponent(reportControllerComponent);
                } else {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setBottomComponent(reportPaneScrollPane);
                    innerHolder.setTopComponent(reportControllerComponent);
                }

                if (reportControllerSliderSize > 0) {
                    innerHolder.setDividerLocation(reportControllerSliderSize);
                }
                outerReportControllerHolder.add(toolbarHolder, BorderLayout.NORTH);
                outerReportControllerHolder.add(innerHolder, BorderLayout.CENTER);
            } else {
                final JPanel reportPaneHolder = new JPanel();
                reportPaneHolder.setOpaque(false);
                reportPaneHolder.setLayout(new BorderLayout());
                reportPaneHolder.add(toolbarHolder, BorderLayout.NORTH);
                reportPaneHolder.add(reportPaneScrollPane, BorderLayout.CENTER);

                final JSplitPane innerHolder = new JSplitPane();
                if (BorderLayout.SOUTH.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setTopComponent(reportPaneHolder);
                    innerHolder.setBottomComponent(reportControllerComponent);
                } else if (BorderLayout.EAST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setLeftComponent(reportPaneHolder);
                    innerHolder.setRightComponent(reportControllerComponent);
                } else if (BorderLayout.WEST.equals(reportControllerLocation)) {
                    innerHolder.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
                    innerHolder.setRightComponent(reportPaneHolder);
                    innerHolder.setLeftComponent(reportControllerComponent);
                } else {
                    innerHolder.setOrientation(JSplitPane.VERTICAL_SPLIT);
                    innerHolder.setBottomComponent(reportPaneHolder);
                    innerHolder.setTopComponent(reportControllerComponent);
                }
                if (reportControllerSliderSize > 0) {
                    innerHolder.setDividerLocation(reportControllerSliderSize);
                }
                outerReportControllerHolder.add(innerHolder, BorderLayout.CENTER);
            }
        }
    }
}

From source file:org.pentaho.reporting.ui.datasources.kettle.KettleDataSourceDialog.java

protected Component createContentPane() {
    final JPanel previewAndParameterPanel = createTransformParameterPanel();
    final JPanel queryListPanel = createQueryListPanel();

    final JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setBorder(new EmptyBorder(5, 5, 0, 5));
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;//from   w  w  w. ja  v  a  2  s. c o  m
    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.WEST;
    mainPanel.add(new JLabel(Messages.getString("KettleDataSourceDialog.QueryName")), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.weightx = 1;
    mainPanel.add(nameTextField, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.gridwidth = 3;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.anchor = GridBagConstraints.WEST;
    mainPanel.add(createDatasourcePanel(), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.gridwidth = 3;
    gbc.anchor = GridBagConstraints.WEST;
    mainPanel.add(previewAndParameterPanel, gbc);

    final JSplitPane panel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    panel.setLeftComponent(queryListPanel);
    panel.setRightComponent(mainPanel);
    panel.setDividerLocation(250);
    return panel;
}

From source file:org.roche.antibody.ui.components.AntibodyEditorPane.java

/**
 * initates swing component//from   www. j  a va  2s.c  om
 */
private void initComponents() {
    abstractGraphLayouter = AbstractGraphLayoutService.createLayouter();
    this.abstractAntibodyView = new Graph2DView();
    this.abstractAntibodyView.setFitContentOnResize(true);
    editMode = new AntibodyEditMode(this);
    abstractAntibodyView.addViewMode(editMode);

    // enable bridges for PolyLineEdgeRealizer
    BridgeCalculator bridgeCalculator = new BridgeCalculator();
    bridgeCalculator.setCrossingMode(BridgeCalculator.CROSSING_MODE_HORIZONTAL_CROSSES_VERTICAL);
    ((DefaultGraph2DRenderer) abstractAntibodyView.getGraph2DRenderer()).setBridgeCalculator(bridgeCalculator);
    configureKeyboardActions();

    this.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentShown(ComponentEvent e) {
            super.componentShown(e);
            LOG.debug("Call componentShown of: {}", this.getClass().getName());
            updateGraphLayout();
        }
    });
    this.setLayout(new BorderLayout());

    // --- START Graphical Representation of Antybody (Center Panel)
    JSplitPane pnlSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    pnlSplit.setOneTouchExpandable(true);
    this.add(pnlSplit, BorderLayout.CENTER);
    pnlSplit.setLeftComponent(abstractAntibodyView);
    pnlSplit.setResizeWeight(1);
    // --- START Property Table, HELM Notation etc. (Right Panel)
    pnlEast = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    pnlEast.setBorder(DEFAULT_BORDER);
    pnlEast.setResizeWeight(0.65);
    antibodyPropertyModel = new DomainTableModel();
    antibodyPropertyModel.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent e) {
            abstractGraph.updateViews();
        }
    });
    propertyTable = new JTable(antibodyPropertyModel);
    propertyTable.setDefaultRenderer(Object.class, new DomainTableCellRenderer());

    JScrollPane spnlPropertyTable = new JScrollPane(propertyTable);
    pnlEast.setTopComponent(spnlPropertyTable);
    pnlSplit.setRightComponent(pnlEast);

    // graphical preview
    graphicsPane = new JPanel(new BorderLayout());
    anotherView = new Graph2DView();
    graphicsPane.add(anotherView, BorderLayout.CENTER);

    // Tabcontainer for graphic and helm notation preview
    tabbedPane = new JTabbedPane(JTabbedPane.TOP);

    // --- HELM notation Preview Panel
    helmPreviewPane = new JPanel();
    helmPreviewPane.setLayout(new BorderLayout());
    tabbedPane.addTab("HELM Notation Preview", null, helmPreviewPane, null);

    // --- Button Panel for HELM notation preview
    JPanel pnlButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    cmdSaveAsXml = new JButton("Save Antibody",
            new ImageIcon(ResourceProvider.getInstance().get(ResourceProvider.DISK_IMAGE)));
    cmdSaveAsXml.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            XmlFileChooser dialog = new XmlFileChooser();
            if (dialog.showSaveDialog(mainEditor.getFrame()) == JFileChooser.APPROVE_OPTION) {
                File abFile = dialog.getSelectedFile();
                String newPath = FilenameUtils.removeExtension(abFile.getAbsolutePath());
                abFile = new File(newPath + AntibodyFileChooser.XML_EXTENSION);
                AntibodyContainer abContainer = new AntibodyContainer();
                try {
                    antibody.setDomainLibraryPath(ConfigFileService.getInstance().getDomainLibFilename());
                    // PreferencesService.getInstance().getDomainLibraryFile().getAbsolutePath());

                    abContainer.setAntibody(antibody);
                    abContainer.setHelmCode(helmTextArea.getText());
                    xmlService.marshal(abContainer, abFile);
                } catch (JAXBException e1) {
                    JOptionPane.showMessageDialog(mainEditor.getFrame(),
                            "Could not save Antibody! Please try again", "Error", JOptionPane.ERROR_MESSAGE);
                    LOG.error("Could not save Antibody-XML to disk! {}", e1);
                }
            }
        }
    });
    pnlButtons.add(cmdSaveAsXml);

    cmdLoadFromXml = new JButton("Load Antibody",
            new ImageIcon(ResourceProvider.getInstance().get(ResourceProvider.OPEN_FOLDER)));
    cmdLoadFromXml.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            XmlFileChooser dialog = new XmlFileChooser();
            if (dialog.showOpenDialog(mainEditor.getFrame()) == JFileChooser.APPROVE_OPTION) {
                File abFile = dialog.getSelectedFile();
                try {
                    AntibodyContainer newAbContainer = xmlService.unmarshal(abFile);
                    setModel(newAbContainer.getAntibody());
                } catch (JAXBException e1) {
                    JOptionPane.showMessageDialog(mainEditor.getFrame(),
                            "Could not load Antibody! Please try again", "Error", JOptionPane.ERROR_MESSAGE);
                    LOG.error("Could not load Antibody-XML to disk! {}", e1);
                }
            }
        }
    });
    pnlButtons.add(cmdLoadFromXml);
    helmPreviewPane.add(pnlButtons, BorderLayout.SOUTH);

    pnlEast.setBottomComponent(tabbedPane);

    // --- HELM Notation Text Area
    helmTextArea = new JTextArea();
    helmTextArea.setLineWrap(true);
    JScrollPane spnlHELMTextArea = new JScrollPane(helmTextArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    helmPreviewPane.add(spnlHELMTextArea, BorderLayout.CENTER);
}