Example usage for javax.swing JTabbedPane JTabbedPane

List of usage examples for javax.swing JTabbedPane JTabbedPane

Introduction

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

Prototype

public JTabbedPane() 

Source Link

Document

Creates an empty TabbedPane with a default tab placement of JTabbedPane.TOP.

Usage

From source file:gtu._work.ui.CheckJavaClassPathUI.java

private void initGUI() {
    try {/*from  w w w .ja  va  2  s  .co m*/
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        setTitle("??importjava");
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("", null, jPanel1, null);
                {
                    classPathText = new JTextField();
                    jPanel1.add(classPathText, BorderLayout.NORTH);
                    classPathText.addMouseListener(new MouseAdapter() {
                        public void mouseClicked(MouseEvent evt) {
                            if (StringUtils.isNotBlank(classPathText.getText())) {
                                String text = classPathText.getText();
                                DefaultListModel model = (DefaultListModel) classPathList.getModel();
                                boolean findOk = false;
                                for (int ii = 0; ii < model.size(); ii++) {
                                    String val = (String) model.getElementAt(ii);
                                    if (StringUtils.equals(val, text)) {
                                        findOk = true;
                                    }
                                }
                                if (!findOk) {
                                    model.addElement(text);
                                }
                            }
                        }
                    });
                }
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(492, 302));
                    {
                        DefaultListModel classPathListModel = new DefaultListModel();
                        classPathList = new JList();

                        Set<String> clzSet = new HashSet<String>();
                        for (Enumeration<?> enu = configBean.getConfigProp().keys(); enu.hasMoreElements();) {
                            String key = (String) enu.nextElement();
                            if (key.contains(CLASSNAME_KEY)) {
                                clzSet.add(configBean.getConfigProp().getProperty(key));
                            }
                        }
                        for (String clzName : clzSet) {
                            classPathListModel.addElement(clzName);
                        }

                        jScrollPane1.setViewportView(classPathList);
                        classPathList.setModel(classPathListModel);
                        classPathList.addKeyListener(new KeyAdapter() {
                            public void keyPressed(KeyEvent evt) {
                                JListUtil.newInstance(classPathList).defaultJListKeyPressed(evt);
                            }
                        });
                    }
                }
                {
                    executeBtn = new JButton();
                    jPanel1.add(executeBtn, BorderLayout.WEST);
                    executeBtn.setText("\u57f7\u884c");
                    executeBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            executeBtnActionPerformed(evt);
                        }
                    });
                }
                {
                    srcPathText = new JTextField();
                    if (configBean.getConfigProp().containsKey(SRCPATHTEXT_KEY)) {
                        srcPathText.setText(configBean.getConfigProp().getProperty(SRCPATHTEXT_KEY));
                    }

                    jPanel1.add(srcPathText, BorderLayout.SOUTH);
                    JCommonUtil.jTextFieldSetFilePathMouseEvent(srcPathText, true);
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("log", null, jPanel2, null);
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel2.add(jScrollPane2, BorderLayout.CENTER);
                    jScrollPane2.setPreferredSize(new java.awt.Dimension(530, 350));
                    {
                        logArea = new JTextArea();
                        jScrollPane2.setViewportView(logArea);
                    }
                }
            }
        }
        pack();
        this.setSize(551, 417);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:gtu._work.ui.SaveFileToPropertiesUI.java

private void initGUI() {
    try {/*from w w w. j a v  a  2 s  .  c  om*/
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        this.setTitle("save file to properties");
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("load", null, jPanel1, null);
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel1.add(jScrollPane2, BorderLayout.CENTER);
                    {
                        textArea = new JTextArea();
                        jScrollPane2.setViewportView(textArea);
                    }
                }
                {
                    jPanel2 = new JPanel();
                    jPanel1.add(jPanel2, BorderLayout.NORTH);
                    jPanel2.setPreferredSize(new java.awt.Dimension(400, 40));
                    {
                        addPropsFile = new JButton();
                        jPanel2.add(addPropsFile);
                        addPropsFile.setText("load properties from file");
                        addPropsFile.setPreferredSize(new java.awt.Dimension(234, 30));
                        addPropsFile.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                File file = JFileChooserUtil.newInstance().selectFileOnly().showOpenDialog()
                                        .getApproveSelectedFile();
                                if (file == null) {
                                    JOptionPaneUtil.newInstance().iconErrorMessage()
                                            .showMessageDialog("file is not correct!", "ERROR");
                                    return;
                                }
                                try {
                                    props.load(new InputStreamReader(new FileInputStream(file),
                                            (String) openUnknowFilecharSet.getSelectedItem()));
                                    reloadPropertiesTable();
                                } catch (Exception e) {
                                    JCommonUtil.handleException(e);
                                }
                            }
                        });
                    }
                    {
                        openFile = new JButton();
                        jPanel2.add(openFile);
                        openFile.setText("open unknow file");
                        openFile.setPreferredSize(new java.awt.Dimension(204, 30));
                        openFile.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                File file = JFileChooserUtil.newInstance().selectFileOnly().showOpenDialog()
                                        .getApproveSelectedFile();
                                if (file == null) {
                                    JOptionPaneUtil.newInstance().iconErrorMessage()
                                            .showMessageDialog("file is not correct!", "ERROR");
                                    return;
                                }
                                try {
                                    String encode = (String) openUnknowFilecharSet.getSelectedItem();
                                    BufferedReader reader = new BufferedReader(
                                            new InputStreamReader(new FileInputStream(file), encode));
                                    StringBuilder sb = new StringBuilder();
                                    for (String line = null; (line = reader.readLine()) != null;) {
                                        sb.append(line + "\n");
                                    }
                                    reader.close();
                                    textArea.setText(textArea.getText() + "\n" + sb);
                                } catch (IOException e) {
                                    JCommonUtil.handleException(e);
                                }
                            }
                        });
                    }
                    {
                        ComboBoxModel openUnknowFilecharSetModel = new DefaultComboBoxModel(
                                new String[] { "BIG5", "UTF8" });
                        openUnknowFilecharSet = new JComboBox();
                        jPanel2.add(openUnknowFilecharSet);
                        openUnknowFilecharSet.setModel(openUnknowFilecharSetModel);
                        openUnknowFilecharSet.setPreferredSize(new java.awt.Dimension(73, 24));
                    }
                    {
                        appendTextAreaToProps = new JButton();
                        jPanel2.add(appendTextAreaToProps);
                        appendTextAreaToProps.setText("append textarea to properties");
                        appendTextAreaToProps.setPreferredSize(new java.awt.Dimension(227, 30));
                        appendTextAreaToProps.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                if (StringUtils.isBlank(textArea.getText())) {
                                    JOptionPaneUtil.newInstance().iconErrorMessage()
                                            .showMessageDialog("textArea is empty", "ERROR");
                                    return;
                                }
                                try {
                                    BufferedReader reader = new BufferedReader(
                                            new StringReader(textArea.getText()));
                                    int pos = -1;
                                    String key = null;
                                    String value = null;
                                    for (String line = null; (line = reader.readLine()) != null;) {
                                        if ((pos = line.lastIndexOf("=")) != -1) {
                                            key = line.substring(0, pos);
                                            value = line.substring(pos + 1);
                                            props.put(key, value);
                                        }
                                    }
                                    reader.close();
                                    JOptionPaneUtil.newInstance().iconInformationMessage()
                                            .showMessageDialog("append success!", "SUCCESS");
                                    reloadPropertiesTable();
                                } catch (IOException e) {
                                    JCommonUtil.handleException(e);
                                }
                            }
                        });
                    }
                }
            }
            {
                jPanel3 = new JPanel();
                BorderLayout jPanel3Layout = new BorderLayout();
                jPanel3.setLayout(jPanel3Layout);
                jTabbedPane1.addTab("props edit", null, jPanel3, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel3.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(629, 361));
                    {
                        TableModel propsTableModel = new DefaultTableModel();
                        propsTable = new JTable();
                        jScrollPane1.setViewportView(propsTable);
                        propsTable.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                if (propsTable.getRowCount() == 0) {
                                    return;
                                }
                                int rowPos = JTableUtil.newInstance(propsTable).getSelectedRow();
                                Object key = propsTable.getValueAt(rowPos, 0);
                                Object value = propsTable.getValueAt(rowPos, 1);

                                JMenuItem insertRowItem = JTableUtil.newInstance(propsTable)
                                        .jMenuItem_addRow(false, null);
                                insertRowItem.setText("inert row...");

                                String rowInfo = "delete row : [" + key + "] = [" + value + "]";
                                JMenuItem delRowItem = JTableUtil.newInstance(propsTable)
                                        .jMenuItem_removeRow("are you sure remove row : \n" + rowInfo);
                                delRowItem.setText(rowInfo);

                                JPopupMenuUtil.newInstance(propsTable).applyEvent(evt)
                                        .addJMenuItem(insertRowItem, delRowItem).show();
                            }
                        });
                        propsTable.setModel(propsTableModel);
                        JTableUtil.defaultSetting(propsTable);
                    }
                }
                {
                    jPanel4 = new JPanel();
                    jPanel3.add(jPanel4, BorderLayout.SOUTH);
                    jPanel4.setPreferredSize(new java.awt.Dimension(629, 45));
                    {
                        clearProps = new JButton();
                        jPanel4.add(clearProps);
                        clearProps.setText("clear properties");
                        clearProps.setPreferredSize(new java.awt.Dimension(182, 36));
                        clearProps.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                props.clear();
                                reloadPropertiesTable();
                            }
                        });
                    }
                    {
                        savePropsToFile = new JButton();
                        jPanel4.add(savePropsToFile);
                        savePropsToFile.setText("save properties to file");
                        savePropsToFile.setPreferredSize(new java.awt.Dimension(182, 36));
                        savePropsToFile.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                File file = JFileChooserUtil.newInstance().selectFileOnly().showSaveDialog()
                                        .getApproveSelectedFile();
                                if (file == null) {
                                    JOptionPaneUtil.newInstance().iconErrorMessage()
                                            .showMessageDialog("file is not correct!", "ERROR");
                                    return;
                                }
                                try {
                                    props.clear();
                                    DefaultTableModel model = (DefaultTableModel) propsTable.getModel();
                                    Object key = null;
                                    Object value = null;
                                    for (int ii = 0; ii < model.getRowCount(); ii++) {
                                        key = model.getValueAt(ii, 0);
                                        value = model.getValueAt(ii, 1);
                                        props.put(key, value);
                                    }
                                    props.store(new FileOutputStream(file),
                                            SaveFileToPropertiesUI.class.getSimpleName());
                                    JOptionPaneUtil.newInstance().iconInformationMessage()
                                            .showMessageDialog("save completed!\n" + file, "SUCCESS");
                                } catch (IOException e) {
                                    JCommonUtil.handleException(e);
                                }
                            }
                        });
                    }
                }
            }
        }
        pack();
        this.setSize(798, 505);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:gtu._work.ui.EstoreCodeGenerateUI.java

private void initGUI() {
    try {/*from  ww  w  .  j  a  v  a2  s .c  om*/
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            jTabbedPane1.setPreferredSize(new java.awt.Dimension(717, 582));
            {
                jPanel1 = new JPanel();
                GridLayout jPanel1Layout = new GridLayout(15, 1);
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("", null, jPanel1, null);
                {
                    jLabel1 = new JLabel();
                    jPanel1.add(jLabel1);
                    jLabel1.setText("\u985e\u5225\u540d\u7a31");
                }
                {
                    classNameText = new JTextField();
                    jPanel1.add(classNameText);
                }
                {
                    jLabel6 = new JLabel();
                    jPanel1.add(jLabel6);
                    jLabel6.setText("package\u4e2d\u9593\u540d");
                }
                {
                    packageMiddleNameText = new JTextField();
                    jPanel1.add(packageMiddleNameText);
                }
                {
                    jLabel2 = new JLabel();
                    jPanel1.add(jLabel2);
                    jLabel2.setText("jsp\u8def\u5f91");
                }
                {
                    jspPathText = new JTextField();
                    jPanel1.add(jspPathText);
                    jspPathText.addFocusListener(new FocusAdapter() {
                        public void focusLost(FocusEvent evt) {
                            try {
                                String xmlConfigMessage = xmlConfigArea.getText();
                                if (StringUtils.isBlank(xmlConfigMessage)) {
                                    return;
                                }
                                StringBuilder sb = new StringBuilder();
                                String actionClassPath = jspPathText.getText();
                                actionClassPath = actionClassPath.replaceFirst("/src/main/webapp", "");
                                Pattern pattern = Pattern.compile("value=\"[\\w\\/]+\\.jsp\"");
                                Matcher matcher = null;
                                BufferedReader reader = new BufferedReader(new StringReader(xmlConfigMessage));
                                for (String line = null; (line = reader.readLine()) != null;) {
                                    matcher = pattern.matcher(line);
                                    if (matcher.find()) {
                                        StringBuffer sb2 = new StringBuffer();
                                        matcher.appendReplacement(sb2, "value=\"" + actionClassPath + "\"");
                                        matcher.appendTail(sb2);
                                        sb.append(sb2 + "\n");
                                    } else {
                                        sb.append(line + "\n");
                                    }
                                }
                                xmlConfigArea.setText(sb.toString());
                            } catch (Exception e) {
                                JCommonUtil.handleException(e);
                            }
                        }
                    });
                }
                {
                    jLabel3 = new JLabel();
                    jPanel1.add(jLabel3);
                    jLabel3.setText("action\u8def\u5f91");
                }
                {
                    actionPathText = new JTextField();
                    jPanel1.add(actionPathText);
                    actionPathText.addFocusListener(new FocusAdapter() {
                        public void focusLost(FocusEvent evt) {
                            try {
                                String xmlConfigMessage = xmlConfigArea.getText();
                                if (StringUtils.isBlank(xmlConfigMessage)) {
                                    return;
                                }
                                StringBuilder sb = new StringBuilder();
                                String actionClassPath = actionPathText.getText();
                                System.out.println(actionClassPath);
                                actionClassPath = actionClassPath.replaceAll("/src/main/java/", "")
                                        .replace('/', '.').replaceAll(".java", "");
                                Pattern pattern = Pattern.compile("class=\"com\\.sti\\.[\\w\\.]+Action\"");
                                Matcher matcher = null;
                                BufferedReader reader = new BufferedReader(new StringReader(xmlConfigMessage));
                                for (String line = null; (line = reader.readLine()) != null;) {
                                    matcher = pattern.matcher(line);
                                    if (matcher.find()) {
                                        StringBuffer sb2 = new StringBuffer();
                                        matcher.appendReplacement(sb2, "class=\"" + actionClassPath + "\"");
                                        matcher.appendTail(sb2);
                                        sb.append(sb2 + "\n");
                                    } else {
                                        sb.append(line + "\n");
                                    }
                                }
                                xmlConfigArea.setText(sb.toString());
                            } catch (Exception e) {
                                JCommonUtil.handleException(e);
                            }
                        }
                    });
                }
                {
                    jLabel4 = new JLabel();
                    jPanel1.add(jLabel4);
                    jLabel4.setText("service interface\u8def\u5f91");
                }
                {
                    serviceInterfaceText = new JTextField();
                    jPanel1.add(serviceInterfaceText);
                }
                {
                    jLabel5 = new JLabel();
                    jPanel1.add(jLabel5);
                    jLabel5.setText("service Impl\u8def\u5f91");
                }
                {
                    serviceImplText = new JTextField();
                    jPanel1.add(serviceImplText);
                    serviceImplText.addFocusListener(new FocusAdapter() {
                        public void focusLost(FocusEvent evt) {
                            try {
                                String xmlConfigMessage = xmlConfigArea.getText();
                                if (StringUtils.isBlank(xmlConfigMessage)) {
                                    return;
                                }
                                StringBuilder sb = new StringBuilder();
                                String actionClassPath = serviceImplText.getText();
                                actionClassPath = actionClassPath.replaceFirst("/src/main/java/", "")
                                        .replaceAll(".java", "").replace('/', '.');
                                Pattern pattern = Pattern.compile("class=\"com.sti[\\w\\.]+ServiceImpl\"");
                                Matcher matcher = null;
                                BufferedReader reader = new BufferedReader(new StringReader(xmlConfigMessage));
                                for (String line = null; (line = reader.readLine()) != null;) {
                                    matcher = pattern.matcher(line);
                                    if (matcher.find()) {
                                        StringBuffer sb2 = new StringBuffer();
                                        matcher.appendReplacement(sb2, "class=\"" + actionClassPath + "\"");
                                        matcher.appendTail(sb2);
                                        sb.append(sb2 + "\n");
                                    } else {
                                        sb.append(line + "\n");
                                    }
                                }
                                xmlConfigArea.setText(sb.toString());
                            } catch (Exception e) {
                                JCommonUtil.handleException(e);
                            }
                        }
                    });
                }
                {
                    updateBtn = new JButton();
                    jPanel1.add(updateBtn);
                    updateBtn.setText("\u66f4\u65b0");
                    updateBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            updateBtnActionPerformed(evt);
                        }
                    });
                }
                {
                    makeFileBtn = new JButton();
                    jPanel1.add(makeFileBtn);
                    makeFileBtn.setText("\u7522\u751f\u6a94\u6848");
                    makeFileBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            try {
                                makeFileBtnActionPerformed(evt);
                            } catch (IOException e) {
                                JCommonUtil.handleException(e);
                            }
                        }
                    });
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("xml", null, jPanel2, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel2.add(jScrollPane1, BorderLayout.CENTER);
                    {
                        xmlConfigArea = new JTextArea();
                        jScrollPane1.setViewportView(xmlConfigArea);
                    }
                }
            }
        }
        pack();
        this.setSize(733, 525);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:gtu._work.ui.RegexCatchReplacer.java

private void initGUI() {
    try {/*www .j a  v a  2s . c  o m*/
        {
        }
        BorderLayout thisLayout = new BorderLayout();
        getContentPane().setLayout(thisLayout);
        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("source", null, jPanel1, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    {
                        replaceArea = new JTextArea();
                        jScrollPane1.setViewportView(replaceArea);
                        replaceArea.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                JPopupMenuUtil.newInstance(replaceArea).applyEvent(evt)
                                        .addJMenuItem("load from file", true, new ActionListener() {

                                            Thread newThread;

                                            public void actionPerformed(ActionEvent arg0) {
                                                if (newThread != null
                                                        && newThread.getState() != Thread.State.TERMINATED) {
                                                    JCommonUtil._jOptionPane_showMessageDialog_error(
                                                            "file is loading!");
                                                    return;
                                                }

                                                final File file = JCommonUtil._jFileChooser_selectFileOnly();
                                                if (file == null) {
                                                    JCommonUtil._jOptionPane_showMessageDialog_error(
                                                            "file is not correct!");
                                                    return;
                                                }
                                                String defaultCharset = Charset.defaultCharset().displayName();
                                                String chst = (String) JCommonUtil._jOptionPane_showInputDialog(
                                                        "input your charset!", defaultCharset);
                                                final Charset charset2 = Charset.forName(
                                                        StringUtils.defaultIfEmpty(chst, defaultCharset));

                                                newThread = new Thread(Thread.currentThread().getThreadGroup(),
                                                        new Runnable() {
                                                            public void run() {
                                                                try {
                                                                    loadFromFileSb = new StringBuilder();
                                                                    BufferedReader reader = new BufferedReader(
                                                                            new InputStreamReader(
                                                                                    new FileInputStream(file),
                                                                                    charset2));
                                                                    for (String line = null; (line = reader
                                                                            .readLine()) != null;) {
                                                                        loadFromFileSb.append(line + "\n");
                                                                    }
                                                                    reader.close();
                                                                    replaceArea
                                                                            .setText(loadFromFileSb.toString());
                                                                    JCommonUtil
                                                                            ._jOptionPane_showMessageDialog_info(
                                                                                    "load completed!");
                                                                } catch (Exception e) {
                                                                    JCommonUtil.handleException(e);
                                                                }
                                                            }
                                                        }, "" + System.currentTimeMillis());
                                                newThread.setDaemon(true);
                                                newThread.start();
                                            }
                                        }).show();
                            }
                        });
                    }
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("param", null, jPanel2, null);
                {
                    exeucte = new JButton();
                    jPanel2.add(exeucte, BorderLayout.SOUTH);
                    exeucte.setText("exeucte");
                    exeucte.setPreferredSize(new java.awt.Dimension(491, 125));
                    exeucte.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            exeucteActionPerformed(evt);
                        }
                    });
                }
                {
                    jPanel3 = new JPanel();
                    GroupLayout jPanel3Layout = new GroupLayout((JComponent) jPanel3);
                    jPanel3.setLayout(jPanel3Layout);
                    jPanel2.add(jPanel3, BorderLayout.CENTER);
                    {
                        repFromText = new JTextField();
                    }
                    {
                        repToText = new JTextField();
                    }
                    jPanel3Layout.setHorizontalGroup(jPanel3Layout.createSequentialGroup()
                            .addContainerGap(25, 25)
                            .addGroup(jPanel3Layout.createParallelGroup()
                                    .addGroup(jPanel3Layout.createSequentialGroup().addComponent(repFromText,
                                            GroupLayout.PREFERRED_SIZE, 446, GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel3Layout.createSequentialGroup().addComponent(repToText,
                                            GroupLayout.PREFERRED_SIZE, 446, GroupLayout.PREFERRED_SIZE)))
                            .addContainerGap(20, Short.MAX_VALUE));
                    jPanel3Layout.setVerticalGroup(jPanel3Layout.createSequentialGroup().addContainerGap()
                            .addComponent(repFromText, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(repToText, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
                }
                {
                    addToTemplate = new JButton();
                    jPanel2.add(addToTemplate, BorderLayout.NORTH);
                    addToTemplate.setText("add to template");
                    addToTemplate.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            prop.put(repFromText.getText(), repToText.getText());
                            reloadTemplateList();
                        }
                    });
                }
            }
            {
                jPanel4 = new JPanel();
                BorderLayout jPanel4Layout = new BorderLayout();
                jPanel4.setLayout(jPanel4Layout);
                jTabbedPane1.addTab("result", null, jPanel4, null);
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel4.add(jScrollPane2, BorderLayout.CENTER);
                    jScrollPane2.setPreferredSize(new java.awt.Dimension(491, 283));
                    {
                        DefaultTableModel resultAreaModel = JTableUtil.createModel(true, "match", "count");
                        resultArea = new JTable();
                        jScrollPane2.setViewportView(resultArea);
                        JTableUtil.defaultSetting(resultArea);
                        resultArea.setModel(resultAreaModel);
                    }
                }
            }
            {
                jPanel5 = new JPanel();
                BorderLayout jPanel5Layout = new BorderLayout();
                jPanel5.setLayout(jPanel5Layout);
                jTabbedPane1.addTab("template", null, jPanel5, null);
                {
                    jScrollPane3 = new JScrollPane();
                    jPanel5.add(jScrollPane3, BorderLayout.CENTER);
                    {
                        templateList = new JList();
                        jScrollPane3.setViewportView(templateList);
                        reloadTemplateList();
                    }
                    templateList.addMouseListener(new MouseAdapter() {
                        public void mouseClicked(MouseEvent evt) {
                            if (templateList.getLeadSelectionIndex() == -1) {
                                return;
                            }
                            Entry<Object, Object> entry = (Entry<Object, Object>) JListUtil
                                    .getLeadSelectionObject(templateList);
                            repFromText.setText((String) entry.getKey());
                            repToText.setText((String) entry.getValue());
                        }
                    });
                    templateList.addKeyListener(new KeyAdapter() {
                        public void keyPressed(KeyEvent evt) {
                            JListUtil.newInstance(templateList).defaultJListKeyPressed(evt);
                        }
                    });
                }
            }
            {
                jPanel6 = new JPanel();
                FlowLayout jPanel6Layout = new FlowLayout();
                jPanel6.setLayout(jPanel6Layout);
                jTabbedPane1.addTab("result1", null, jPanel6, null);
                {
                    resultBtn1 = new JButton();
                    jPanel6.add(resultBtn1);
                    resultBtn1.setText("to String[]");
                    resultBtn1.setPreferredSize(new java.awt.Dimension(105, 32));
                    resultBtn1.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            JTableUtil tableUtil = JTableUtil.newInstance(resultArea);
                            int[] rowPoss = tableUtil.getSelectedRows();
                            DefaultTableModel model = tableUtil.getModel();
                            List<Object> valueList = new ArrayList<Object>();
                            for (int ii = 0; ii < rowPoss.length; ii++) {
                                valueList.add(model.getValueAt(rowPoss[ii], 0));
                            }
                            String reult = valueList.toString().replaceAll("[\\s]", "")
                                    .replaceAll("[\\,]", "\",\"").replaceAll("[\\[\\]]", "\"");
                            ClipboardUtil.getInstance().setContents(reult);
                        }
                    });
                }
                {
                    resultBtn2 = new JButton();
                    jPanel6.add(resultBtn2);
                    resultBtn2.setText("TODO");
                    resultBtn2.setPreferredSize(new java.awt.Dimension(105, 32));
                    resultBtn2.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            System.out.println("resultBtn1.actionPerformed, event=" + evt);
                            //TODO add your code for resultBtn1.actionPerformed
                            JCommonUtil._jOptionPane_showMessageDialog_info("TODO");
                        }
                    });
                }
            }
        }
        this.setSize(512, 350);
        JCommonUtil.setFont(repToText, repFromText, replaceArea, templateList);

        JCommonUtil.frameCloseDo(this, new WindowAdapter() {
            public void windowClosing(WindowEvent paramWindowEvent) {
                if (StringUtils.isNotBlank(repFromText.getText())) {
                    prop.put(repFromText.getText(), repToText.getText());
                }
                try {
                    prop.store(new FileOutputStream(propFile), "regexText");
                } catch (Exception e) {
                    JCommonUtil.handleException("properties store error!", e);
                }
                setVisible(false);
                dispose();
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:uk.co.petertribble.jangle.SnmpTreePanel.java

/**
 * Create a new SnmpTreePanel, starting exploration at the specified OID.
 *
 * @param startOID the OID to start from
 */// w  w  w.j  a  v a 2  s .  c  om
public SnmpTreePanel(String startOID) {
    this.startOID = startOID;
    setLayout(new BorderLayout());

    jtpl = new JTabbedPane();
    model = new DefaultListModel();
    oidList = new ArrayList<SnmpObject>();
    slist = new JList(model);
    slist.addListSelectionListener(this);
    slist.setCellRenderer(new SnmpListCellRenderer());
    jtpl.add(SnmpResources.getString("SNMP.LIST.TEXT"), new JScrollPane(slist));

    // we use explicit placement so the tabs can be manipulated later
    jtpr = new JTabbedPane();

    // details tab
    jp1 = new JPanel(new BorderLayout());
    jp2 = new JPanel(new BorderLayout());
    tp = new JingleTextPane("text/plain");
    jp1.add(new JScrollPane(tp));
    // jp2 holds the chart
    jp2 = new JPanel(new BorderLayout());
    JSplitPane jpt = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jp1, jp2);
    jpt.setOneTouchExpandable(true);
    jpt.setDividerLocation(120);

    jtpr.insertTab(SnmpResources.getString("SNMP.DETAILS.TEXT"), (Icon) null, jpt, (String) null, TAB_D);

    tpdesc = new JingleTextPane("text/plain");
    jtpr.insertTab(SnmpResources.getString("SNMP.ABOUT.TEXT"), (Icon) null, new JScrollPane(tpdesc),
            (String) null, TAB_A);

    // siblings tab
    tpsiblings = new JingleTextPane("text/plain");
    jp3 = new JPanel(new BorderLayout());
    jp3t = new JPanel(new BorderLayout());
    JSplitPane jps = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jp3t, jp3);
    jps.setOneTouchExpandable(true);
    jps.setDividerLocation(200);
    jtpr.insertTab(SnmpResources.getString("SNMP.SIBLINGS.TEXT"), (Icon) null, jps, (String) null, TAB_S);

    // cousins tab
    tpcousins = new JingleTextPane("text/plain");
    jp4 = new JPanel(new BorderLayout());
    jp4t = new JPanel(new BorderLayout());
    JSplitPane jpc = new JSplitPane(JSplitPane.VERTICAL_SPLIT, jp4t, jp4);
    jpc.setOneTouchExpandable(true);
    jpc.setDividerLocation(200);
    jtpr.insertTab(SnmpResources.getString("SNMP.COUSINS.TEXT"), (Icon) null, jpc, (String) null, TAB_C);

    // split pane to hold the lot
    JSplitPane psplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jtpl, jtpr);
    psplit.setOneTouchExpandable(true);
    psplit.setDividerLocation(200);
    add(psplit);
}

From source file:gtu._work.ui.DownloadMoveUI.java

private void initGUI() {
    try {/*from w  w w .  j av a  2  s  . c om*/
        configProp = configUtil.loadConfig();

        BorderLayout thisLayout = new BorderLayout();
        getContentPane().setLayout(thisLayout);
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                jTabbedPane1.addTab("jPanel1", null, jPanel1, null);
                {
                    isDeleteBox = new JCheckBox();
                    jPanel1.add(isDeleteBox);
                    isDeleteBox.setText("\u662f\u5426\u522a\u9664\u642c\u51fa\u7684\u76ee\u9304");
                    isDeleteBox.setPreferredSize(new java.awt.Dimension(383, 21));
                }
                {
                    jLabel4 = new JLabel();
                    jPanel1.add(jLabel4);
                    jLabel4.setText("\u4fdd\u7559\u7684\u526f\u6a94\u540d");
                }
                {
                    subFileNameText = new JTextField();
                    jPanel1.add(subFileNameText);
                    subFileNameText
                            .setText(".avi,.wmv,.mp4,.srt,.sub,.mkv,.rar,.rmvb,.idx,.zip,.7z,.flv,.asf,.ass");
                    subFileNameText.setPreferredSize(new java.awt.Dimension(304, 24));

                    if (configProp.containsKey(SUBFILENAME)) {
                        subFileNameText.setText(configProp.get(SUBFILENAME));
                    }
                }
                {
                    jLabel3 = new JLabel();
                    jPanel1.add(jLabel3);
                    jLabel3.setText("\u7b26\u5408\u7684\u6a94\u6848\u5927\u5c0f(KB)");
                }
                {
                    fileSizeText = new JTextField();
                    jPanel1.add(fileSizeText);
                    fileSizeText.setText("5000");
                    fileSizeText.setPreferredSize(new java.awt.Dimension(276, 24));

                    if (configProp.containsKey(FILESIZE)) {
                        fileSizeText.setText(configProp.get(FILESIZE));
                    }
                }
                {
                    jLabel2 = new JLabel();
                    jPanel1.add(jLabel2);
                    jLabel2.setText("\u672a\u5b8c\u6210\u526f\u6a94\u540d");
                }
                {
                    unCompleteFileSubNameText = new JTextField();
                    jPanel1.add(unCompleteFileSubNameText);
                    unCompleteFileSubNameText.setText(".td");
                    unCompleteFileSubNameText.setPreferredSize(new java.awt.Dimension(315, 24));

                    if (configProp.containsKey(UNCOMPLETEFILESUBNAME)) {
                        unCompleteFileSubNameText.setText(configProp.get(UNCOMPLETEFILESUBNAME));
                    }
                }
                {
                    jLabel1 = new JLabel();
                    jPanel1.add(jLabel1);
                    jLabel1.setText("\u4e0b\u8f09\u76ee\u9304");
                }
                {
                    downloadDirText = new JTextField();
                    JCommonUtil.jTextFieldSetFilePathMouseEvent(downloadDirText, true);
                    jPanel1.add(downloadDirText);
                    downloadDirText.setText("D:/TDDOWNLOAD");
                    downloadDirText.setPreferredSize(new java.awt.Dimension(328, 24));

                    if (configProp.containsKey(DOWNLOADDIR)) {
                        downloadDirText.setText(configProp.get(DOWNLOADDIR));
                    }
                }
                {
                    executeBtn = new JButton();
                    jPanel1.add(executeBtn);
                    executeBtn.setText("\u57f7\u884c");
                    {
                        newConfigBtn = new JButton("");
                        newConfigBtn.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent arg0) {
                                configUtil.next();
                                configProp = configUtil.loadConfig();
                                if (configProp.containsKey(SUBFILENAME)) {
                                    subFileNameText.setText(configProp.get(SUBFILENAME));
                                }
                                if (configProp.containsKey(FILESIZE)) {
                                    fileSizeText.setText(configProp.get(FILESIZE));
                                }
                                if (configProp.containsKey(UNCOMPLETEFILESUBNAME)) {
                                    unCompleteFileSubNameText.setText(configProp.get(UNCOMPLETEFILESUBNAME));
                                }
                                if (configProp.containsKey(DOWNLOADDIR)) {
                                    downloadDirText.setText(configProp.get(DOWNLOADDIR));
                                }
                            }
                        });
                        jPanel1.add(newConfigBtn);
                    }
                    executeBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            executeBtnAction();
                            saveConfig();
                        }
                    });
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("jPanel2", null, jPanel2, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel2.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(411, 262));
                    {
                        logArea = new JTextArea();
                        jScrollPane1.setViewportView(logArea);
                    }
                }
            }
        }
        pack();
        this.setSize(432, 329);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:org.freeinternals.javaclassviewer.ui.JSplitPaneClassFile.java

private void createAndShowGUI(JFrame top) {

    // Construct class file viewer
    final JTreeClassFile jTreeClassFile = new JTreeClassFile(this.classFile);
    jTreeClassFile.addTreeSelectionListener(new TreeSelectionListener() {
        @Override/*from  w w w  .  jav  a  2 s.c o m*/
        public void valueChanged(final javax.swing.event.TreeSelectionEvent evt) {
            jTreeClassFileSelectionChanged(evt);
        }
    });
    final JPanelForTree panel = new JPanelForTree(jTreeClassFile, top);

    final JTabbedPane tabbedPane = new JTabbedPane();

    // Construct binary viewer
    this.binaryViewer = new JBinaryViewer();
    this.binaryViewer.setData(this.classFile.getClassByteArray());
    this.binaryViewerView = new JScrollPane(this.binaryViewer);
    this.binaryViewerView.getVerticalScrollBar().setValue(0);
    tabbedPane.add("Class File", this.binaryViewerView);

    // Construct opcode viewer
    this.opcode = new JTextPane();
    this.opcode.setAlignmentX(Component.LEFT_ALIGNMENT);
    // this.opcode.setFont(new Font(Font.DIALOG_INPUT, Font.PLAIN, 14));
    this.opcode.setEditable(false);
    this.opcode.setBorder(null);
    this.opcode.setContentType("text/html");
    tabbedPane.add("Opcode", new JScrollPane(this.opcode));

    // Class report
    this.report = new JTextPane();
    this.report.setAlignmentX(Component.LEFT_ALIGNMENT);
    this.report.setEditable(false);
    this.report.setBorder(null);
    this.report.setContentType("text/html");
    tabbedPane.add("Report", new JScrollPane(this.report));

    this.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    this.setDividerSize(5);
    this.setDividerLocation(280);
    this.setLeftComponent(panel);
    this.setRightComponent(tabbedPane);

    this.binaryViewerView.getVerticalScrollBar().setValue(0);
}

From source file:gtu._work.ui.SqlCreaterUI.java

private void initGUI() {
    try {/*from   w ww  .  j ava2  s  .  c o  m*/
        BorderLayout thisLayout = new BorderLayout();
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        getContentPane().setLayout(thisLayout);
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("jPanel1", null, jPanel1, null);
                {
                    jPanel2 = new JPanel();
                    jPanel1.add(jPanel2, BorderLayout.NORTH);
                    jPanel2.setPreferredSize(new java.awt.Dimension(582, 112));
                    {
                        jLabel1 = new JLabel();
                        jPanel2.add(jLabel1);
                        jLabel1.setText("SQL");
                    }
                    {
                        JScrollPane jScrollPane2 = new JScrollPane();
                        jPanel2.add(jScrollPane2);
                        jScrollPane2.setPreferredSize(new java.awt.Dimension(524, 57));
                        {
                            sqlArea = new JTextArea();
                            jScrollPane2.setViewportView(sqlArea);
                        }
                    }
                    {
                        jLabel2 = new JLabel();
                        jPanel2.add(jLabel2);
                        jLabel2.setText("\u4f86\u6e90\u6a94\u8def\u5f91");
                    }
                    {
                        excelFilePathText = new JTextField();
                        JCommonUtil.jTextFieldSetFilePathMouseEvent(excelFilePathText, false);
                        jPanel2.add(excelFilePathText);
                        excelFilePathText.setPreferredSize(new java.awt.Dimension(455, 22));
                    }
                }
                {
                    executeBtn = new JButton();
                    jPanel1.add(executeBtn, BorderLayout.SOUTH);
                    executeBtn.setText("\u7522\u751f");
                    executeBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            executeBtnPreformed();
                        }
                    });
                }
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
                    jScrollPane1.setPreferredSize(new java.awt.Dimension(582, 221));
                    {
                        JScrollPane jScrollPane3 = new JScrollPane();
                        jScrollPane1.setViewportView(jScrollPane3);
                        {
                            logArea = new JTextArea();
                            jScrollPane3.setViewportView(logArea);
                        }
                    }
                }
            }
            {
                jPanel3 = new JPanel();
                FlowLayout jPanel3Layout = new FlowLayout();
                jTabbedPane1.addTab("jPanel3", null, jPanel3, null);
                jPanel3.setLayout(jPanel3Layout);
                {
                    jLabel4 = new JLabel();
                    jPanel3.add(jLabel4);
                    jLabel4.setText("Table\u540d\u7a31");
                }
                {
                    tableNameText = new JTextField();
                    jPanel3.add(tableNameText);
                    tableNameText.setPreferredSize(new java.awt.Dimension(463, 23));
                }
                {
                    jLabel3 = new JLabel();
                    jPanel3.add(jLabel3);
                    jLabel3.setText("\u4f86\u6e90\u6a94\u8def\u5f91");
                }
                {
                    excelFilePathText2 = new JTextField();
                    JCommonUtil.jTextFieldSetFilePathMouseEvent(excelFilePathText2, false);
                    jPanel3.add(excelFilePathText2);
                    excelFilePathText2.setPreferredSize(new java.awt.Dimension(455, 22));
                }
                {
                    firstRowMakeInsertSqlBtn = new JButton();
                    jPanel3.add(firstRowMakeInsertSqlBtn);
                    firstRowMakeInsertSqlBtn.setText(
                            "\u4ee5\u7b2c\u4e00\u5217\u70ba\u6b04\u4f4d\u540d\u7a31\u7522\u751fInsert SQL");
                    firstRowMakeInsertSqlBtn.setPreferredSize(new java.awt.Dimension(251, 22));
                    firstRowMakeInsertSqlBtn.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            firstRowMakeInsertSqlBtn(evt);
                        }
                    });
                }
            }
        }
        pack();
        this.setSize(595, 409);
    } catch (Exception e) {
        // add your error handling code here
        e.printStackTrace();
    }
}

From source file:components.DialogDemo.java

/** Creates the GUI shown inside the frame's content pane. */
public DialogDemo(JFrame frame) {
    super(new BorderLayout());
    this.frame = frame;
    customDialog = new CustomDialog(frame, "geisel", this);
    customDialog.pack();/*  w  ww.  ja v a2s  . c  o m*/

    //Create the components.
    JPanel frequentPanel = createSimpleDialogBox();
    JPanel featurePanel = createFeatureDialogBox();
    JPanel iconPanel = createIconDialogBox();
    label = new JLabel("Click the \"Show it!\" button" + " to bring up the selected dialog.", JLabel.CENTER);

    //Lay them out.
    Border padding = BorderFactory.createEmptyBorder(20, 20, 5, 20);
    frequentPanel.setBorder(padding);
    featurePanel.setBorder(padding);
    iconPanel.setBorder(padding);

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab("Simple Modal Dialogs", null, frequentPanel, simpleDialogDesc); //tooltip text
    tabbedPane.addTab("More Dialogs", null, featurePanel, moreDialogDesc); //tooltip text
    tabbedPane.addTab("Dialog Icons", null, iconPanel, iconDesc); //tooltip text

    add(tabbedPane, BorderLayout.CENTER);
    add(label, BorderLayout.PAGE_END);
    label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
}

From source file:juicebox.windowui.QCDialog.java

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

    Dataset dataset = hic.getDataset();/*from  w  ww .  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);
    }
}