Example usage for javax.swing JTabbedPane addTab

List of usage examples for javax.swing JTabbedPane addTab

Introduction

In this page you can find the example usage for javax.swing JTabbedPane addTab.

Prototype

public void addTab(String title, Component component) 

Source Link

Document

Adds a component represented by a title and no icon.

Usage

From source file:gui.DownloadManagerGUI.java

public DownloadManagerGUI(String name) {
    super(name);//  w  ww.j  a va2  s  .co 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:be.agiv.security.demo.Main.java

private void showPreferences() {
    JTabbedPane tabbedPane = new JTabbedPane();

    GridBagLayout proxyGridBagLayout = new GridBagLayout();
    GridBagConstraints proxyGridBagConstraints = new GridBagConstraints();
    JPanel proxyPanel = new JPanel(proxyGridBagLayout) {

        private static final long serialVersionUID = 1L;

        @Override/*w ww.ja v a2s .com*/
        public Insets getInsets() {
            return new Insets(10, 10, 10, 10);
        }
    };
    tabbedPane.addTab("Proxy", proxyPanel);

    JCheckBox proxyEnableCheckBox = new JCheckBox("Enable proxy", this.proxyEnable);
    proxyGridBagConstraints.gridx = 0;
    proxyGridBagConstraints.gridy = 0;
    proxyGridBagConstraints.anchor = GridBagConstraints.WEST;
    proxyGridBagConstraints.ipadx = 5;
    proxyGridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    proxyGridBagLayout.setConstraints(proxyEnableCheckBox, proxyGridBagConstraints);
    proxyPanel.add(proxyEnableCheckBox);
    proxyGridBagConstraints.gridwidth = 1;

    JLabel proxyHostLabel = new JLabel("Host:");
    proxyGridBagConstraints.gridx = 0;
    proxyGridBagConstraints.gridy++;
    proxyGridBagLayout.setConstraints(proxyHostLabel, proxyGridBagConstraints);
    proxyPanel.add(proxyHostLabel);

    JTextField proxyHostTextField = new JTextField(this.proxyHost, 20);
    proxyGridBagConstraints.gridx++;
    proxyGridBagLayout.setConstraints(proxyHostTextField, proxyGridBagConstraints);
    proxyPanel.add(proxyHostTextField);

    JLabel proxyPortLabel = new JLabel("Port:");
    proxyGridBagConstraints.gridx = 0;
    proxyGridBagConstraints.gridy++;
    proxyGridBagLayout.setConstraints(proxyPortLabel, proxyGridBagConstraints);
    proxyPanel.add(proxyPortLabel);

    JTextField proxyPortTextField = new JTextField(Integer.toString(this.proxyPort), 8);
    proxyGridBagConstraints.gridx++;
    proxyGridBagLayout.setConstraints(proxyPortTextField, proxyGridBagConstraints);
    proxyPanel.add(proxyPortTextField);

    JLabel proxyTypeLabel = new JLabel("Type:");
    proxyGridBagConstraints.gridx = 0;
    proxyGridBagConstraints.gridy++;
    proxyGridBagLayout.setConstraints(proxyTypeLabel, proxyGridBagConstraints);
    proxyPanel.add(proxyTypeLabel);

    JComboBox proxyTypeComboBox = new JComboBox(new Object[] { Proxy.Type.HTTP, Proxy.Type.SOCKS });
    proxyTypeComboBox.setSelectedItem(this.proxyType);
    proxyGridBagConstraints.gridx++;
    proxyGridBagLayout.setConstraints(proxyTypeComboBox, proxyGridBagConstraints);
    proxyPanel.add(proxyTypeComboBox);

    int dialogResult = JOptionPane.showConfirmDialog(this, tabbedPane, "Preferences",
            JOptionPane.OK_CANCEL_OPTION);
    if (dialogResult == JOptionPane.CANCEL_OPTION) {
        return;
    }

    this.statusBar.setStatus("Applying new preferences...");
    this.proxyHost = proxyHostTextField.getText();
    this.proxyPort = Integer.parseInt(proxyPortTextField.getText());
    this.proxyType = (Proxy.Type) proxyTypeComboBox.getSelectedItem();
    this.proxyEnable = proxyEnableCheckBox.isSelected();
}

From source file:edu.ku.brc.specify.tasks.subpane.security.SecurityAdminPane.java

/**
 * /*from ww w .j  a  v a  2s .c om*/
 */
private void createUserPanel() {
    final EditorPanel infoPanel = new EditorPanel(this);
    final CellConstraints cc = new CellConstraints();

    PermissionEditor prefsEdt = new PermissionEditor("SEC_PREFS", new PrefsPermissionEnumerator(), infoPanel,
            false, "SEC_NAME_TITLE", "SEC_ENABLE_PREF", null, null, null);

    JButton selectAllBtn = createI18NButton("SELECTALL");
    JButton deselectAllBtn = createI18NButton("DESELECTALL");

    final PermissionPanelEditor generalEditor = new PermissionPanelEditor(selectAllBtn, deselectAllBtn);
    generalEditor.addPanel(
            new IndvPanelPermEditor("SEC_TOOLS", "SEC_TOOLS_DSC", new TaskPermissionEnumerator(), infoPanel));
    generalEditor.addPanel(new PermissionEditor("SEC_TABLES", new TablePermissionEnumerator(), infoPanel));
    generalEditor.addPanel(prefsEdt);

    final PermissionPanelEditor objEditor = new PermissionPanelEditor(selectAllBtn, deselectAllBtn);
    objEditor.addPanel(
            new IndvPanelPermEditor("SEC_DOS", "SEC_DOS_DSC", new ObjectPermissionEnumerator(), infoPanel));

    // create user form
    ViewBasedDisplayPanel panel = createViewBasedDisplayPanelForUser(infoPanel);

    // create tabbed panel for different kinds of permission editing tables
    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab(getResourceString("SEC_GENERAL"), generalEditor);
    //tabbedPane.addTab("Objects", objEditor);     // I18N

    //final PanelBuilder mainPB = new PanelBuilder(new FormLayout("f:p:g", "t:p,4px,p,5px,f:p:g,2dlu,p"), infoPanel);
    //setting min size for generalEditor (only px settings work.)
    final PanelBuilder mainPB = new PanelBuilder(new FormLayout("f:p:g", "t:p,4px,p,5px,f:[400px,p]:g,2dlu,p"),
            infoPanel);

    // lay out controls on panel
    int y = 1;
    mainPB.add(panel, cc.xy(1, y));
    y += 2;
    mainPB.addSeparator(getResourceString("SEC_PERMS"), cc.xy(1, y));
    y += 2;
    mainPB.add(tabbedPane, cc.xy(1, y));
    y += 2;

    PanelBuilder saveBtnPB = new PanelBuilder(new FormLayout("f:p:g,p,2px,p,2px,p,2px,p", "p"));

    Viewable viewable = panel.getMultiView().getCurrentView();
    JButton valBtn = FormViewObj.createValidationIndicator(viewable.getUIComponent(), viewable.getValidator());
    panel.getMultiView().getCurrentValidator().setValidationBtn(valBtn);

    saveBtnPB.add(selectAllBtn, cc.xy(2, 1));
    saveBtnPB.add(deselectAllBtn, cc.xy(4, 1));
    saveBtnPB.add(valBtn, cc.xy(6, 1));
    saveBtnPB.add(infoPanel.getSaveBtn(), cc.xy(8, 1));

    mainPB.add(saveBtnPB.getPanel(), cc.xy(1, y));
    y += 2;

    String className = SpecifyUser.class.getCanonicalName();
    infoCards.add(infoPanel, className);

    AdminInfoSubPanelWrapper subPanel = new AdminInfoSubPanelWrapper(panel);

    subPanel.addPermissionEditor(generalEditor);
    subPanel.addPermissionEditor(objEditor);
    infoSubPanels.put(className, subPanel);
    editorPanels.put(className, infoPanel);

    selectAllBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ((PermissionPanelEditor) tabbedPane.getComponentAt(tabbedPane.getSelectedIndex())).selectAll();
        }
    });

    deselectAllBtn.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ((PermissionPanelEditor) tabbedPane.getComponentAt(tabbedPane.getSelectedIndex())).deselectAll();
        }
    });
}

From source file:com.polivoto.vistas.Charts.java

private void crearPieChart(Pregunta pregunta) {
    JTabbedPane tabPanel = new JTabbedPane();
    panelGrafica.add(tabPanel);/*from w  w  w  .j a  va 2 s .  co  m*/

    //Calcular el nmero N de perfiles. Si N=1, no discriminar por pestanas. 
    //Si son N perfiles (N>2), hacer N+1 pestanas (la ltima representa la
    //suma de los resultados sin segregacin.
    int n = pregunta.obtenerCantidadDePerfiles();
    System.out.println(" n " + n);
    if (n > 1) {
        for (int i = 0; i < n; i++) {
            JPanel panel = hacerPiePanel(pregunta, pregunta.obtenerResultadoPorPerfil(i).getOpciones());
            panel.setName(pregunta.obtenerResultadoPorPerfil(i).getPerfil());
            tabPanel.addTab(panel.getName(), panel);

        }
    }

    JPanel panel = hacerPiePanel(pregunta, pregunta.obtenerOpciones());
    panel.setName("Todos");
    tabPanel.addTab(panel.getName(), panel);
    tabPanel.setFont(new Font("Roboto", 0, 24));
    tabPanel.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            tabIndex = ((JTabbedPane) (e.getSource())).getSelectedIndex();
        }
    });
    tabPanel.setSelectedIndex(tabIndex);
    panelGrafica.add(tabPanel, BorderLayout.CENTER);
    panelGrafica.repaint();
    panelGrafica.revalidate();
}

From source file:juicebox.windowui.QCDialog.java

public QCDialog(MainWindow mainWindow, HiC hic, String title) {
    super(mainWindow);

    Dataset dataset = hic.getDataset();//from  www.j a v  a  2 s  . c  o  m

    String text = dataset.getStatistics();
    String textDescription = null;
    String textStatistics = null;
    String graphs = dataset.getGraphs();
    JTextPane description = null;
    JTabbedPane tabbedPane = new JTabbedPane();
    HTMLEditorKit kit = new HTMLEditorKit();

    StyleSheet styleSheet = kit.getStyleSheet();
    styleSheet.addRule("table { border-collapse: collapse;}");
    styleSheet.addRule("body {font-family: Sans-Serif; font-size: 12;}");
    styleSheet.addRule("td { padding: 2px; }");
    styleSheet.addRule(
            "th {border-bottom: 1px solid #000; text-align: left; background-color: #D8D8D8; font-weight: normal;}");

    if (text != null) {
        int split = text.indexOf("</table>") + 8;
        textDescription = text.substring(0, split);
        textStatistics = text.substring(split);
        description = new JTextPane();
        description.setEditable(false);
        description.setContentType("text/html");
        description.setEditorKit(kit);
        description.setText(textDescription);
        tabbedPane.addTab("About Library", description);

        JTextPane textPane = new JTextPane();
        textPane.setEditable(false);
        textPane.setContentType("text/html");

        textPane.setEditorKit(kit);
        textPane.setText(textStatistics);
        JScrollPane pane = new JScrollPane(textPane);
        tabbedPane.addTab("Statistics", pane);
    }
    boolean success = true;
    if (graphs != null) {

        long[] A = new long[2000];
        long sumA = 0;
        long[] mapq1 = new long[201];
        long[] mapq2 = new long[201];
        long[] mapq3 = new long[201];
        long[] intraCount = new long[100];
        final XYSeries intra = new XYSeries("Intra Count");
        final XYSeries leftRead = new XYSeries("Left");
        final XYSeries rightRead = new XYSeries("Right");
        final XYSeries innerRead = new XYSeries("Inner");
        final XYSeries outerRead = new XYSeries("Outer");
        final XYSeries allMapq = new XYSeries("All MapQ");
        final XYSeries intraMapq = new XYSeries("Intra MapQ");
        final XYSeries interMapq = new XYSeries("Inter MapQ");

        Scanner scanner = new Scanner(graphs);
        try {
            while (!scanner.next().equals("["))
                ;

            for (int idx = 0; idx < 2000; idx++) {
                A[idx] = scanner.nextLong();
                sumA += A[idx];
            }

            while (!scanner.next().equals("["))
                ;
            for (int idx = 0; idx < 201; idx++) {
                mapq1[idx] = scanner.nextInt();
                mapq2[idx] = scanner.nextInt();
                mapq3[idx] = scanner.nextInt();

            }

            for (int idx = 199; idx >= 0; idx--) {
                mapq1[idx] = mapq1[idx] + mapq1[idx + 1];
                mapq2[idx] = mapq2[idx] + mapq2[idx + 1];
                mapq3[idx] = mapq3[idx] + mapq3[idx + 1];
                allMapq.add(idx, mapq1[idx]);
                intraMapq.add(idx, mapq2[idx]);
                interMapq.add(idx, mapq3[idx]);
            }
            while (!scanner.next().equals("["))
                ;
            for (int idx = 0; idx < 100; idx++) {
                int tmp = scanner.nextInt();
                if (tmp != 0)
                    innerRead.add(logXAxis[idx], tmp);
                intraCount[idx] = tmp;
                tmp = scanner.nextInt();
                if (tmp != 0)
                    outerRead.add(logXAxis[idx], tmp);
                intraCount[idx] += tmp;
                tmp = scanner.nextInt();
                if (tmp != 0)
                    rightRead.add(logXAxis[idx], tmp);
                intraCount[idx] += tmp;
                tmp = scanner.nextInt();
                if (tmp != 0)
                    leftRead.add(logXAxis[idx], tmp);
                intraCount[idx] += tmp;
                if (idx > 0)
                    intraCount[idx] += intraCount[idx - 1];
                if (intraCount[idx] != 0)
                    intra.add(logXAxis[idx], intraCount[idx]);
            }
        } catch (NoSuchElementException exception) {
            JOptionPane.showMessageDialog(getParent(), "Graphing file improperly formatted", "Error",
                    JOptionPane.ERROR_MESSAGE);
            success = false;
        }

        if (success) {
            final XYSeriesCollection readTypeCollection = new XYSeriesCollection();
            readTypeCollection.addSeries(innerRead);
            readTypeCollection.addSeries(outerRead);
            readTypeCollection.addSeries(leftRead);
            readTypeCollection.addSeries(rightRead);

            final JFreeChart readTypeChart = ChartFactory.createXYLineChart("Types of reads vs distance", // chart title
                    "Distance (log)", // domain axis label
                    "Binned Reads (log)", // range axis label
                    readTypeCollection, // data
                    PlotOrientation.VERTICAL, true, // include legend
                    true, false);

            final XYPlot readTypePlot = readTypeChart.getXYPlot();

            readTypePlot.setDomainAxis(new LogarithmicAxis("Distance (log)"));
            readTypePlot.setRangeAxis(new LogarithmicAxis("Binned Reads (log)"));
            readTypePlot.setBackgroundPaint(Color.white);
            readTypePlot.setRangeGridlinePaint(Color.lightGray);
            readTypePlot.setDomainGridlinePaint(Color.lightGray);
            readTypeChart.setBackgroundPaint(Color.white);
            readTypePlot.setOutlinePaint(Color.black);
            final ChartPanel chartPanel = new ChartPanel(readTypeChart);

            final XYSeriesCollection reCollection = new XYSeriesCollection();
            final XYSeries reDistance = new XYSeries("Distance");

            for (int i = 0; i < A.length; i++) {
                if (A[i] != 0)
                    reDistance.add(i, A[i] / (float) sumA);
            }
            reCollection.addSeries(reDistance);

            final JFreeChart reChart = ChartFactory.createXYLineChart(
                    "Distance from closest restriction enzyme site", // chart title
                    "Distance (bp)", // domain axis label
                    "Fraction of Reads (log)", // range axis label
                    reCollection, // data
                    PlotOrientation.VERTICAL, true, // include legend
                    true, false);

            final XYPlot rePlot = reChart.getXYPlot();
            rePlot.setDomainAxis(new NumberAxis("Distance (bp)"));
            rePlot.setRangeAxis(new LogarithmicAxis("Fraction of Reads (log)"));
            rePlot.setBackgroundPaint(Color.white);
            rePlot.setRangeGridlinePaint(Color.lightGray);
            rePlot.setDomainGridlinePaint(Color.lightGray);
            reChart.setBackgroundPaint(Color.white);
            rePlot.setOutlinePaint(Color.black);
            final ChartPanel chartPanel2 = new ChartPanel(reChart);

            final XYSeriesCollection intraCollection = new XYSeriesCollection();

            intraCollection.addSeries(intra);

            final JFreeChart intraChart = ChartFactory.createXYLineChart("Intra reads vs distance", // chart title
                    "Distance (log)", // domain axis label
                    "Cumulative Sum of Binned Reads (log)", // range axis label
                    intraCollection, // data
                    PlotOrientation.VERTICAL, true, // include legend
                    true, false);

            final XYPlot intraPlot = intraChart.getXYPlot();
            intraPlot.setDomainAxis(new LogarithmicAxis("Distance (log)"));
            intraPlot.setRangeAxis(new NumberAxis("Cumulative Sum of Binned Reads (log)"));
            intraPlot.setBackgroundPaint(Color.white);
            intraPlot.setRangeGridlinePaint(Color.lightGray);
            intraPlot.setDomainGridlinePaint(Color.lightGray);
            intraChart.setBackgroundPaint(Color.white);
            intraPlot.setOutlinePaint(Color.black);
            final ChartPanel chartPanel3 = new ChartPanel(intraChart);

            final XYSeriesCollection mapqCollection = new XYSeriesCollection();
            mapqCollection.addSeries(allMapq);
            mapqCollection.addSeries(intraMapq);
            mapqCollection.addSeries(interMapq);

            final JFreeChart mapqChart = ChartFactory.createXYLineChart("MapQ Threshold Count", // chart title
                    "MapQ threshold", // domain axis label
                    "Count", // range axis label
                    mapqCollection, // data
                    PlotOrientation.VERTICAL, true, // include legend
                    true, // include tooltips
                    false);

            final XYPlot mapqPlot = mapqChart.getXYPlot();
            mapqPlot.setBackgroundPaint(Color.white);
            mapqPlot.setRangeGridlinePaint(Color.lightGray);
            mapqPlot.setDomainGridlinePaint(Color.lightGray);
            mapqChart.setBackgroundPaint(Color.white);
            mapqPlot.setOutlinePaint(Color.black);
            final ChartPanel chartPanel4 = new ChartPanel(mapqChart);

            tabbedPane.addTab("Pair Type", chartPanel);
            tabbedPane.addTab("Restriction", chartPanel2);
            tabbedPane.addTab("Intra vs Distance", chartPanel3);
            tabbedPane.addTab("MapQ", chartPanel4);
        }
    }

    final ExpectedValueFunction df = hic.getDataset().getExpectedValues(hic.getZoom(),
            hic.getNormalizationType());
    if (df != null) {
        double[] expected = df.getExpectedValues();
        final XYSeriesCollection collection = new XYSeriesCollection();
        final XYSeries expectedValues = new XYSeries("Expected");
        for (int i = 0; i < expected.length; i++) {
            if (expected[i] > 0)
                expectedValues.add(i + 1, expected[i]);
        }
        collection.addSeries(expectedValues);
        String title1 = "Expected at " + hic.getZoom() + " norm " + hic.getNormalizationType();
        final JFreeChart readTypeChart = ChartFactory.createXYLineChart(title1, // chart title
                "Distance between reads (log)", // domain axis label
                "Genome-wide expected (log)", // range axis label
                collection, // data
                PlotOrientation.VERTICAL, false, // include legend
                true, false);
        final XYPlot readTypePlot = readTypeChart.getXYPlot();

        readTypePlot.setDomainAxis(new LogarithmicAxis("Distance between reads (log)"));
        readTypePlot.setRangeAxis(new LogarithmicAxis("Genome-wide expected (log)"));
        readTypePlot.setBackgroundPaint(Color.white);
        readTypePlot.setRangeGridlinePaint(Color.lightGray);
        readTypePlot.setDomainGridlinePaint(Color.lightGray);
        readTypeChart.setBackgroundPaint(Color.white);
        readTypePlot.setOutlinePaint(Color.black);
        final ChartPanel chartPanel5 = new ChartPanel(readTypeChart);

        tabbedPane.addTab("Expected", chartPanel5);
    }

    if (text == null && graphs == null) {
        JOptionPane.showMessageDialog(this, "Sorry, no metrics are available for this dataset", "Error",
                JOptionPane.ERROR_MESSAGE);
        setVisible(false);
        dispose();

    } else {
        getContentPane().add(tabbedPane);
        pack();
        setModal(false);
        setLocation(100, 100);
        setTitle(title);
        setVisible(true);
    }
}

From source file:TransformExplorer.java

JPanel guiPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());
    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Translation", translationPanel());
    tabbedPane.addTab("Scaling", scalePanel());
    tabbedPane.addTab("Rotation", rotationPanel());
    tabbedPane.addTab("Reference Point", refPtPanel());
    panel.add("Center", tabbedPane);
    panel.add("South", configPanel());
    return panel;
}

From source file:fll.subjective.SubjectiveFrame.java

private void createSubjectiveTable(final JTabbedPane tabbedPane, final ScoreCategory subjectiveCategory) {
    final SubjectiveTableModel tableModel = new SubjectiveTableModel(_scoreDocument, subjectiveCategory,
            _schedule, _scheduleColumnMappings);
    final JTable table = new JTable(tableModel);
    table.setDefaultRenderer(Date.class, DateRenderer.INSTANCE);

    // Make grid lines black (needed for Mac)
    table.setGridColor(Color.BLACK);

    // auto table sorter
    table.setAutoCreateRowSorter(true);//from w  ww .j  av a2 s. c  om

    final String title = subjectiveCategory.getTitle();
    _tables.put(title, table);
    final JScrollPane tableScroller = new JScrollPane(table);
    tableScroller.setPreferredSize(new Dimension(640, 480));
    tabbedPane.addTab(title, tableScroller);

    table.setSelectionBackground(Color.YELLOW);

    setupTabReturnBehavior(table);

    int goalIndex = 0;
    for (final AbstractGoal goal : subjectiveCategory.getGoals()) {
        final TableColumn column = table.getColumnModel()
                .getColumn(goalIndex + tableModel.getNumColumnsLeftOfScores());
        if (goal.isEnumerated()) {
            final Vector<String> posValues = new Vector<String>();
            posValues.add("");
            for (final EnumeratedValue posValue : goal.getSortedValues()) {
                posValues.add(posValue.getTitle());
            }

            column.setCellEditor(new DefaultCellEditor(new JComboBox<String>(posValues)));
        } else {
            final JTextField editor = new SelectTextField();
            column.setCellEditor(new DefaultCellEditor(editor));
        }
        ++goalIndex;
    }
}

From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java

/**
 * Primary UI Setup Operations/*from  ww  w.  j a v a 2 s . c  o  m*/
 */
private void setupUI() {

    setTitle("Nebula Grid - Cluster Manager");
    setSize(WIDTH, HEIGHT);

    /* -- Menu Bar -- */
    setJMenuBar(setupMenu());

    /* -- Content -- */

    setLayout(new BorderLayout());

    JPanel centerPanel = new JPanel();

    add(centerPanel, BorderLayout.CENTER);

    /* -- Setup Tabs -- */
    centerPanel.setLayout(new BorderLayout());
    JTabbedPane tabs = new JTabbedPane();
    tabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    centerPanel.add(tabs);
    addUIElement("tabs", tabs); // Add to components map

    // General Tab
    tabs.addTab("General", setupGeneralTab());

    setupTrayIcon(this);

    // Create Job Start Hook
    ServiceEventsSupport.addServiceHook(new ServiceHookCallback() {
        public void onServiceEvent(final ServiceMessage message) {
            createJobTab(message.getMessage());
        }
    }, ServiceMessageType.JOB_START);
}

From source file:com.emental.mindraider.ui.frames.MindRaiderMainWindow.java

private MindRaiderMainWindow() {
    super(MindRaider.getTitle(), Gfx.getGraphicsConfiguration());
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            System.exit(0);//from  w  w  w .  j av a2 s.c om
        }
    });
    // catch resize
    addComponentListener(this);

    configuration = new ConfigurationBean();

    // drag & drop registration
    DropTarget dropTarget = new DropTarget(this, (DropTargetListener) this);
    this.setDropTarget(dropTarget);

    // warn on different java version
    // checkJavaVersion();

    singleton = this;

    setIconImage(IconsRegistry.getImage("programIcon.gif"));
    SplashScreen splash = new SplashScreen(this, false);
    splash.showSplashScreen();

    // kernel init
    MindRaider.preSetProfiles();
    // message in here because of locales
    logger.debug(Messages.getString("MindRaiderJFrame.bootingKernel"));

    // master control panel
    MindRaider.setMasterToolBar(new MasterToolBar());
    getContentPane().add(MindRaider.masterToolBar, BorderLayout.NORTH);

    // status bar
    getContentPane().add(StatusBar.getStatusBar(), BorderLayout.SOUTH);

    // build menu
    buildMenu(MindRaider.spidersGraph);
    // profile
    MindRaider.setProfiles();

    // left sidebar: folder/notebooks hierarchy, taxonomies, ...
    final JTabbedPane leftSidebar = new JTabbedPane(SwingConstants.BOTTOM);
    leftSidebar.setTabPlacement(SwingConstants.TOP);
    // TODO add icons to tabs
    leftSidebar.addTab(Messages.getString("MindRaiderJFrame.explorer"), ExplorerJPanel.getInstance());

    // TODO just blank panel
    //leftSidebar.addTab("Tags",new OutlookBarMain());

    leftSidebar.addTab(
            Messages.getString("MindRaiderJFrame.trash"), /* IconsRegistry.getImageIcon("trashFull.png"), */
            TrashJPanel.getInstance());

    leftSidebar.setSelectedIndex(0);
    leftSidebar.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent arg0) {
            if (arg0.getSource() instanceof JTabbedPane) {
                if (leftSidebar.getSelectedIndex() == 1) {
                    // refresh trash
                    TrashJPanel.getInstance().refresh();
                }
            }
        }
    });

    // main panel: (notebook outline & RDF Navigator) + Control panel
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(OutlineJPanel.getInstance(), BorderLayout.CENTER);

    // split: left sidebar/main panel
    leftSidebarSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSidebar, mainPanel);
    leftSidebarSplitPane.setOneTouchExpandable(true);
    leftSidebarSplitPane.setDividerLocation(200);
    leftSidebarSplitPane.setLastDividerLocation(200);
    leftSidebarSplitPane.setDividerSize(6);
    leftSidebarSplitPane.setContinuousLayout(true);
    getContentPane().add(leftSidebarSplitPane, BorderLayout.CENTER);

    Gfx.centerAndShowWindow(this, 1024, 768);

    MindRaider.postSetProfiles();

    if (!configuration.isShowSpidersTagSnailPane()) {
        OutlineJPanel.getInstance().hideSpiders();
    }

    splash.hideSplash();
}

From source file:org.biojava.bio.view.MotifAnalyzer.java

public void displayCharts(int chartNum) throws IOException {
    JFrame chartsFrame = new JFrame("Charts Analysis" + chartNum);
    chartsFrame.setSize(700, 600);//from w  w  w  . j  a  va2 s.  c  om
    JTabbedPane tabs = new JTabbedPane();
    chartsFrame.add(tabs);
    String dataset = ((Dataset) datasetComboBox.getSelectedItem()).name();

    //tabs.addTab("Log", getOutputTextPane(log));
    tabs.addTab("Statistics", new JScrollPane(getStatisticsTab(chartNum)));
    String[] chartsNames = FileNames.getCharts(chartNum);
    for (int i = 0; i < chartsNames.length; i++) {
        JPanel image1 = new JPanel(new BorderLayout());
        image1.add(new JLabel(new ImageIcon(ImageIO.read(new File(chartsNames[i])))));
        image1.setBackground(Color.white);
        tabs.addTab("Chart " + (i + 1) + "(" + dataset + ")", image1);
    }
    chartsFrame.setVisible(true);

}