Example usage for javax.swing JSplitPane HORIZONTAL_SPLIT

List of usage examples for javax.swing JSplitPane HORIZONTAL_SPLIT

Introduction

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

Prototype

int HORIZONTAL_SPLIT

To view the source code for javax.swing JSplitPane HORIZONTAL_SPLIT.

Click Source Link

Document

Horizontal split indicates the Components are split along the x axis.

Usage

From source file:edu.ucla.stat.SOCR.applications.demo.StockApplication.java

public void init() {

    updateGraph();/*w w  w .jav a  2 s .co  m*/

    s_serie = new XYSeries("S", false);
    c_serie = new XYSeries("C", false);
    t_serie = new XYSeries("Total", false);
    m_serie = new XYSeries("M", false);

    upContainer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel),
            new JScrollPane(chartPanel));

    this.getMainPanel().removeAll();
    this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER);
    this.getMainPanel().validate();
}

From source file:com.joey.software.Tools.AScanViewerTool.java

public void createJPanel() {
    JSplitPane graphSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    graphSplit.setLeftComponent(previewPanel);
    graphSplit.setRightComponent(dataPanel);
    graphSplit.setOneTouchExpandable(true);
    graphSplit.setDividerLocation(400);//from  w  ww .  ja  v  a2 s . co m

    JPanel graphHolder = new JPanel(new BorderLayout());
    graphHolder.add(graphSplit, BorderLayout.CENTER);
    graphHolder.setBorder(BorderFactory.createTitledBorder(""));

    JPanel tool = new JPanel(new BorderLayout());
    tool.add(saveCSVData, BorderLayout.SOUTH);
    tool.add(aScanType, BorderLayout.CENTER);

    JPanel leftPanel = new JPanel(new BorderLayout());
    leftPanel.add(graphHolder, BorderLayout.CENTER);
    leftPanel.add(tool, BorderLayout.SOUTH);

    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setOneTouchExpandable(true);
    split.setRightComponent(imageViewPanel);
    split.setLeftComponent(leftPanel);
    split.setDividerLocation(600);

    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(split, BorderLayout.CENTER);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(mainPanel);

    aScanType.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            imageViewPanel.setViewType(aScanType.getSelectedIndex());

        }
    });
    saveCSVData.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                File f = FileSelectionField.getUserFile();
                f = FileOperations.renameFileType(f, "csv");
                saveAScanData(f);
            } catch (Exception e1) {
                JOptionPane.showMessageDialog(null, "Error : " + e1.getLocalizedMessage(), "Error Saving Data",
                        JOptionPane.ERROR_MESSAGE);
                e1.printStackTrace();
            }
        }
    });
}

From source file:gui.TwopointPWDPanel.java

private JPanel createControls() {
    // Marker model (for ordered list of markers)
    markerModel = new PWDTableModel();

    // Populate the marker table
    markerTable = new JTable(markerModel);
    markerTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    markerTable.getColumnModel().getColumn(1).setPreferredWidth(175);
    markerTable.getColumnModel().getColumn(2).setPreferredWidth(60);
    for (CMarker cm : order.getLinkageGroup().getMarkers()) {
        markerModel.addRow(new Object[] { cm.marker.getPrefix(), cm, cm.marker.getRatio() });
    }//from  ww w . j  a va  2  s  . c  o  m
    markerTable.getSelectionModel().addListSelectionListener(this);

    // Phase model (for scores of each ordered marker against the others)
    phaseModel = new PWDTableModel2();
    phaseModel.setColumnIdentifiers(new Object[] { "Graph Code", "Marker Name", "Recom Freq", "LOD Score" });

    phaseTable = new JTable(phaseModel);
    phaseTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    phaseTable.getSelectionModel().addListSelectionListener(this);

    rfqChart = new PWDChartPanel("Recombination Freq");
    lodChart = new PWDChartPanel("LOD Score");

    m1Label = new JLabel("");
    m1Label.setFont(new Font("Monospaced", Font.PLAIN, 11));
    m2Label = new JLabel("");
    m2Label.setFont(new Font("Monospaced", Font.PLAIN, 11));

    JScrollPane mSP = new JScrollPane(markerTable);
    mSP.setPreferredSize(new Dimension(300, 10));

    JPanel p1 = new JPanel(new BorderLayout(5, 0));
    p1.add(new JLabel("Ordered Markers:"), BorderLayout.NORTH);
    p1.add(mSP);

    JPanel p2 = new JPanel(new BorderLayout(5, 0));
    p2.add(new JLabel("Scores:"), BorderLayout.NORTH);
    p2.add(new JScrollPane(phaseTable));

    JPanel p3 = new JPanel(new GridLayout(2, 1, 2, 2));
    p3.setBorder(BorderFactory.createLoweredBevelBorder());
    p3.add(m1Label);
    p3.add(m2Label);

    JPanel p4 = new JPanel(new GridLayout(1, 2, 5, 5));
    p4.add(rfqChart);
    p4.add(lodChart);

    JPanel p5 = new JPanel(new BorderLayout(5, 5));
    p5.add(p3, BorderLayout.NORTH);
    p5.add(p4, BorderLayout.CENTER);

    JSplitPane splits = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splits.setResizeWeight(0.5);
    splits.setLeftComponent(p1);
    splits.setRightComponent(p2);

    JPanel p6 = new JPanel(new BorderLayout(5, 5));
    p6.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    p6.add(splits);
    p6.add(p5, BorderLayout.SOUTH);

    return p6;
}

From source file:gui.DownloadManagerGUI.java

public DownloadManagerGUI(String name) {
    super(name);/*  w w w .  j a va 2 s  . c o  m*/

    setLayout(new BorderLayout());

    preferences = Preferences.userRoot().node("db");
    final PreferencesDTO preferencesDTO = getPreferences();

    LookAndFeel.setLaf(preferencesDTO.getPreferencesInterfaceDTO().getLookAndFeelName());

    createFileHierarchy();

    mainToolbar = new MainToolBar();
    categoryPanel = new CategoryPanel(
            preferencesDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs());
    downloadPanel = new DownloadPanel(this, preferencesDTO.getPreferencesSaveDTO().getDatabasePath(),
            preferencesDTO.getPreferencesConnectionDTO().getConnectionTimeOut(),
            preferencesDTO.getPreferencesConnectionDTO().getReadTimeOut());
    messagePanel = new MessagePanel(this);
    JTabbedPane mainTabPane = new JTabbedPane();
    mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, categoryPanel, mainTabPane);
    mainSplitPane.setOneTouchExpandable(true);
    statusPanel = new StatusPanel();
    addNewDownloadDialog = new AddNewDownloadDialog(this);

    mainTabPane.addTab(messagesBundle.getString("downloadManagerGUI.mainTabPane.downloadPanel"), downloadPanel);
    mainTabPane.addTab(messagesBundle.getString("downloadManagerGUI.mainTabPane.messagePanel"), messagePanel);

    preferenceDialog = new PreferenceDialog(this, preferencesDTO);

    aboutDialog = new AboutDialog(this);

    categoryPanel.setCategoryPanelListener((fileExtensions, downloadCategory) -> downloadPanel
            .setDownloadsByDownloadPath(fileExtensions, downloadCategory));

    //     preferenceDialog.setDefaults(preferencesDTO);

    addNewDownloadDialog.setAddNewDownloadListener(textUrl -> {
        Objects.requireNonNull(textUrl, "textUrl");
        if (textUrl.equals(""))
            throw new IllegalArgumentException("textUrl is empty");

        String downloadName;
        try {
            downloadName = ConnectionUtil.getRealFileName(textUrl);
        } catch (IOException e) {
            logger.error("Can't get real name of file that you want to download." + textUrl);
            messageLogger.error("Can't get real name of file that you want to download." + textUrl);
            downloadName = ConnectionUtil.getFileName(textUrl);
        }
        String fileExtension = FilenameUtils.getExtension(downloadName);
        File downloadPathFile = new File(
                preferencesDTO.getPreferencesSaveDTO().getPathByFileExtension(fileExtension));
        File downloadRangeFile = new File(preferencesDTO.getPreferencesSaveDTO().getTempDirectory());
        int maxNum = preferencesDTO.getPreferencesConnectionDTO().getMaxConnectionNumber();

        Download download = null;

        List<Download> downloads = downloadPanel.getDownloadList();
        String properDownloadName = getProperNameForDownload(downloadName, downloads, downloadPathFile);

        // todo must set stretegy pattern
        switch (ProtocolType.valueOfByDesc(textUrl.getProtocol())) {
        case HTTP:
            download = new HttpDownload(downloadPanel.getNextDownloadID(), textUrl, properDownloadName, maxNum,
                    downloadPathFile, downloadRangeFile, ProtocolType.HTTP);
            break;
        case FTP:
            // todo must be created ...
            break;
        case HTTPS:
            download = new HttpsDownload(downloadPanel.getNextDownloadID(), textUrl, properDownloadName, maxNum,
                    downloadPathFile, downloadRangeFile, ProtocolType.HTTPS);
            break;
        }

        downloadPanel.addDownload(download);
    });

    // Add panels to display.
    add(mainToolbar, BorderLayout.PAGE_START);
    add(mainSplitPane, BorderLayout.CENTER);
    add(statusPanel, BorderLayout.PAGE_END);

    setJMenuBar(initMenuBar());

    mainToolbar.setMainToolbarListener(new MainToolbarListener() {
        @Override
        public void newDownloadEventOccured() {
            addNewDownloadDialog.setVisible(true);
            addNewDownloadDialog.onPaste();
        }

        @Override
        public void pauseEventOccured() {
            downloadPanel.actionPause();
            mainToolbar.setStateOfButtonsControl(false, false, false, false, false, true); // canceled
        }

        @Override
        public void resumeEventOccured() {
            downloadPanel.actionResume();
        }

        @Override
        public void pauseAllEventOccured() {
            downloadPanel.actionPauseAll();
        }

        @Override
        public void clearEventOccured() {
            downloadPanel.actionClear();
        }

        @Override
        public void clearAllCompletedEventOccured() {
            downloadPanel.actionClearAllCompleted();
        }

        @Override
        public void reJoinEventOccured() {
            downloadPanel.actionReJoinFileParts();
        }

        @Override
        public void reDownloadEventOccured() {
            downloadPanel.actionReDownload();
        }

        @Override
        public void propertiesEventOccured() {
            downloadPanel.actionProperties();
        }

        @Override
        public void preferencesEventOccured() {
            preferenceDialog.setVisible(true);
        }
    });

    downloadPanel.setDownloadPanelListener(new DownloadPanelListener() {
        @Override
        public void stateChangedEventOccured(DownloadStatus downloadState) {
            updateButtons(downloadState);
        }

        @Override
        public void downloadSelected(Download download) {
            statusPanel.setStatus(download.getDownloadName());
        }
    });

    preferenceDialog.setPreferencesListener(new PreferencesListener() {
        @Override
        public void preferencesSet(PreferencesDTO preferenceDTO) {
            setPreferencesOS(preferenceDTO);
        }

        @Override
        public void preferenceReset() {
            PreferencesDTO resetPreferencesDTO = getPreferences();
            preferenceDialog.setPreferencesDTO(resetPreferencesDTO);
            categoryPanel.setTreeModel(
                    resetPreferencesDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs());
        }

        @Override
        public void preferenceDefaults() {
            PreferencesDTO defaultPreferenceDTO = new PreferencesDTO();
            resetAndSetPreferencesDTOFromConf(defaultPreferenceDTO);
            preferenceDialog.setPreferencesDTO(defaultPreferenceDTO);
            categoryPanel.setTreeModel(
                    defaultPreferenceDTO.getPreferencesSaveDTO().getPreferencesDirectoryCategoryDTOs());
        }
    });

    // Handle window closing events.
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent windowEvent) {
            int action = JOptionPane.showConfirmDialog(DownloadManagerGUI.this,
                    "Do you realy want to exit the application?", "Confirm Exit", JOptionPane.OK_CANCEL_OPTION);
            if (action == JOptionPane.OK_OPTION) {
                logger.info("Window Closing");
                downloadPanel.actionPauseAll();
                dispose();
                System.gc();
            }
        }
    });

    Authenticator.setDefault(new DialogAuthenticator(this));

    setIconImage(
            Utils.createIcon(messagesBundle.getString("downloadManagerGUI.mainFrame.iconPath")).getImage());

    setMinimumSize(new Dimension(640, 480));
    // Set window size.
    pack();
    setSize(900, 580);

    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    setVisible(true);
}

From source file:com.intuit.tank.tools.debugger.PanelBuilder.java

/**
 * @param debuggerActions//  w w  w.  j  a v a2s  .  c  o m
 * @return
 */
static Component createContentPanel(final AgentDebuggerFrame frame) {
    JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true);
    pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    final RSyntaxTextArea scriptEditorTA = new RSyntaxTextArea();
    frame.setScriptEditorTA(scriptEditorTA);
    scriptEditorTA.setSelectionColor(scriptEditorTA.getCurrentLineHighlightColor());
    scriptEditorTA.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE);
    scriptEditorTA.setHyperlinksEnabled(false);
    scriptEditorTA.setEditable(false);
    scriptEditorTA.setEnabled(false);
    scriptEditorTA.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            scriptEditorTA.grabFocus();
            try {
                int offs = scriptEditorTA.viewToModel(e.getPoint());
                if (offs > -1) {
                    int line = scriptEditorTA.getLineOfOffset(offs);
                    if (frame.getSteps().size() > line) {

                        frame.fireStepChanged(line);
                        if (e.getClickCount() == 2 && !e.isPopupTrigger()) {
                            // show step xml
                            try {
                                DebugStep debugStep = frame.getSteps().get(line);
                                String text = JaxbUtil.marshall(debugStep.getStepRun());
                                StepDialog dlg = new StepDialog(frame, text, SyntaxConstants.SYNTAX_STYLE_XML);
                                dlg.setVisible(true);
                            } catch (JAXBException e1) {
                                frame.showError("Error showing step xml: " + e);
                            }
                        }
                    }
                }
            } catch (BadLocationException ble) {
                ble.printStackTrace(); // Never happens
            }
        }
    });
    RTextScrollPane scriptEditorScrollPane = new RTextScrollPane(scriptEditorTA);
    frame.setScriptEditorScrollPane(scriptEditorScrollPane);
    scriptEditorScrollPane.setIconRowHeaderEnabled(true);
    scriptEditorScrollPane.getGutter()
            .setBookmarkIcon(ActionProducer.getIcon("bullet_blue.png", IconSize.SMALL));
    scriptEditorScrollPane.getGutter()
            .setCurrentLineIcon(ActionProducer.getIcon("current_line.png", IconSize.SMALL));
    scriptEditorScrollPane.getGutter().setBookmarkingEnabled(true);
    pane.setLeftComponent(scriptEditorScrollPane);

    pane.setRightComponent(createRightPanel(frame));
    pane.setDividerLocation(300);
    pane.setResizeWeight(0.4D);
    return pane;
}

From source file:edu.purdue.cc.bionet.ui.MoleculeDetailPanel.java

public MoleculeDetailPanel(Molecule molecule, Range range, DetailWindow detailWindow, int correlationMethod) {
    super(new BorderLayout());
    Logger logger = Logger.getLogger(getClass());
    this.molecule = molecule;
    this.correlations = detailWindow.getCorrelations();
    this.correlationMethod = correlationMethod;
    logger.debug(String.format("Showing Molecule detail:\n" + "\tMolecule:   %s\n\tRange:      %s\n",
            this.molecule, range));
    this.correlationRange = range.clone();
    this.detailWindow = detailWindow;

    Language language = Settings.getLanguage();
    this.moleculeDetailTable = DataTable.getMoleculeTable(this.correlations, this.molecule);
    this.correlationsTable = DataTable.getCorrelatedTable(this.correlations, this.molecule,
            this.correlationRange, this.correlationMethod);
    this.selectedMoleculeLabel = new JLabel(language.get("Selected Molecule"));
    this.showElementButton = new JButton(language.get("Show Element"));
    this.showCorrelationButton = new JButton(language.get("Show Correlation"));
    this.coefLabel = new JLabel(String.format(language.get("Correlations between %.3f and %.3f"),
            this.correlationRange.getMin(), this.correlationRange.getMax()));
    //      JPanel leftPanel = new JPanel( new BorderLayout( ));
    //      JPanel rightPanel = new JPanel( new BorderLayout( ));
    JPanel moleculePanel = new JPanel(new BorderLayout());
    JPanel correlationPanel = new JPanel(new BorderLayout());
    JPanel buttonPanel = new JPanel(new BorderLayout());
    this.showElementButton.addActionListener(this);
    this.showCorrelationButton.addActionListener(this);
    buttonPanel.add(this.showElementButton, BorderLayout.WEST);
    buttonPanel.add(this.showCorrelationButton, BorderLayout.EAST);

    moleculePanel.add(this.selectedMoleculeLabel, BorderLayout.NORTH);
    moleculePanel.add(new JScrollPane(this.moleculeDetailTable), BorderLayout.CENTER);

    correlationPanel.add(this.coefLabel, BorderLayout.NORTH);
    correlationPanel.add(new JScrollPane(this.correlationsTable), BorderLayout.CENTER);
    correlationPanel.add(buttonPanel, BorderLayout.SOUTH);

    JSplitPane leftPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, moleculePanel, correlationPanel);
    leftPanel.setDividerLocation(200);//from ww  w.j  a  v a  2  s  . com
    //      leftPanel.add( moleculePanel, BorderLayout.NORTH );
    //      leftPanel.add( correlationPanel, BorderLayout.CENTER );

    JPanel rightPanel = new ResponseGraph(this.molecule.getSampleMap(this.correlations.getSamples()));

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel);
    splitPane.setDividerLocation(300);
    this.add(splitPane, BorderLayout.CENTER);
}

From source file:eu.cassandra.platform.gui.GUI.java

public GUI() {
    //redirectSystemStreams();
    a = new ListenInstallationComboBox();
    installationCombo.setPreferredSize(new Dimension(300, 20));

    startButton.addActionListener(new ListenStartButton());
    exitButton.addActionListener(new ListenExitButton());
    projectFileField.addMouseListener(new ListenProjectFileField());

    logTextAreaScrollPane.setPreferredSize(new Dimension(400, 500));

    projectFileField.setPreferredSize(new Dimension(600, 20));
    //      projectFileField.setText(new File(Params.SIM_PROPS).getAbsolutePath());
    projectFileField.setText("");
    projectFileField.setEditable(false);

    f.setJMenuBar(menuBar);/*from w  w w.  j av a2  s. c  o  m*/

    menuFile.add(menuItemQuit);
    menuHelp.add(menuItemAbout);
    menuBar.add(menuFile);
    menuBar.add(menuHelp);

    statsTextArea.setFont(new Font("Tahoma", Font.BOLD, 12));

    TimeSeries series = new TimeSeries("");
    dataset = new TimeSeriesCollection(series);
    JFreeChart chart = createChart("Consumption", dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    graphScrollPane = new JScrollPane(chartPanel);

    buttonPanel.add(projectFileField);
    buttonPanel.add(startButton);
    buttonPanel.add(holdButton);
    buttonPanel.add(installationCombo);
    buttonPanel.add(exitButton);

    statsTextArea.setText("Statistics:\n");
    logTextArea.setText("Logs:\n");

    JSplitPane textAreaSplitPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

    textAreaSplitPanel.setDividerLocation((int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2));
    textAreaSplitPanel.add(statsTextAreaScrollPane, JSplitPane.TOP);
    textAreaSplitPanel.add(logTextAreaScrollPane, JSplitPane.BOTTOM);

    JSplitPane mainSplitPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    mainSplitPanel.add(graphScrollPane, JSplitPane.LEFT);
    mainSplitPanel.add(textAreaSplitPanel, JSplitPane.RIGHT);
    mainSplitPanel.setDividerLocation((int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 1.5));

    f.getContentPane().setLayout(new BorderLayout());
    f.getContentPane().add(mainSplitPanel, BorderLayout.CENTER);
    f.getContentPane().add(buttonScrollPane, BorderLayout.SOUTH);

    f.addWindowListener(new ListenCloseWdw());
    menuItemQuit.addActionListener(new ListenMenuQuit());
}

From source file:com.choicemaker.cm.modelmaker.gui.panels.AsymmetricThresholdVsAccuracyPlotPanel.java

private void layoutPanel() {
    setLayout(new BorderLayout());
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setDividerSize(2);/*from   www.j  av  a  2 s .co  m*/
    splitPane.setContinuousLayout(true);
    splitPane.setDividerLocation(0.5d);
    splitPane.setResizeWeight(0.5f);
    splitPane.setOneTouchExpandable(true);
    ChartPanel dP = new ChartPanel(dPlot, false, false, false, true, true);
    //      dP.setHorizontalZoom(true);
    //      dP.setVerticalZoom(true);
    splitPane.setTopComponent(dP);
    ChartPanel mP = new ChartPanel(mPlot, false, false, false, true, true);
    //      mP.setHorizontalZoom(true);
    //      mP.setVerticalZoom(true);
    splitPane.setBottomComponent(mP);
    add(splitPane, BorderLayout.CENTER);
}

From source file:com.employee.scheduler.common.swingui.SolverAndPersistenceFrame.java

private JComponent createContentPane() {
    JComponent quickOpenPanel = createQuickOpenPanel();
    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(createToolBar(), BorderLayout.NORTH);
    mainPanel.add(createMiddlePanel(), BorderLayout.CENTER);
    mainPanel.add(createScorePanel(), BorderLayout.SOUTH);
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, quickOpenPanel, mainPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.2);// www.  j a  v  a2 s  .  c  o  m
    return splitPane;
}

From source file:com.github.rholder.gradle.ui.DependencyViewerStandalone.java

private void initContent() {
    splitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);

    JPanel main = new JPanel(new BorderLayout());
    main.add(splitter);/*  ww w.j a  va  2s . c o m*/
    getContentPane().add(main);
    setEnabled(true);
    setVisible(true);
}