Example usage for java.awt.event KeyEvent VK_C

List of usage examples for java.awt.event KeyEvent VK_C

Introduction

In this page you can find the example usage for java.awt.event KeyEvent VK_C.

Prototype

int VK_C

To view the source code for java.awt.event KeyEvent VK_C.

Click Source Link

Document

Constant for the "C" key.

Usage

From source file:org.planetcrypto.bitcoin.PlanetCryptoBitcoinUI.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.//from   w  w w  .j  a v a 2s. c o  m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

    MainTabbedPane = new javax.swing.JTabbedPane();
    MinerInformationPanel = new javax.swing.JPanel();
    MinerInformationTabbedPane = new javax.swing.JTabbedPane();
    InformationPanel = new javax.swing.JPanel();
    MinerSelectionBox = new javax.swing.JComboBox();
    MinerSelectionBoxLabel = new javax.swing.JLabel();
    InformationMinerIPLabel = new javax.swing.JLabel();
    InformationMinerIPTextField = new javax.swing.JTextField();
    InformationMinerPortLabel = new javax.swing.JLabel();
    InformationMinerPortTextField = new javax.swing.JTextField();
    PrivilegedLabel = new javax.swing.JLabel();
    ASICsLabel = new javax.swing.JLabel();
    PrivilegedTextField = new javax.swing.JTextField();
    ASICsTextField = new javax.swing.JTextField();
    PGAsLabel = new javax.swing.JLabel();
    PGAsTextField = new javax.swing.JTextField();
    PoolCountLabel = new javax.swing.JLabel();
    PoolCountTextField = new javax.swing.JTextField();
    MinerVersionLabel = new javax.swing.JLabel();
    MinerVersionTextField = new javax.swing.JTextField();
    MinerStrategyLabel = new javax.swing.JLabel();
    MinerStrategyTextField = new javax.swing.JTextField();
    ACSChain1Label = new javax.swing.JLabel();
    ACSChain1TextField = new javax.swing.JTextField();
    ACSChain2Label = new javax.swing.JLabel();
    ACSChain3Label = new javax.swing.JLabel();
    ACSChain4Label = new javax.swing.JLabel();
    ACSChain2TextField = new javax.swing.JTextField();
    ACSChain3TextField = new javax.swing.JTextField();
    ACSChain4TextField = new javax.swing.JTextField();
    BytesSentLabel = new javax.swing.JLabel();
    BytesRecvLabel = new javax.swing.JLabel();
    BytesSentTextField = new javax.swing.JTextField();
    BytesRecvTextField = new javax.swing.JTextField();
    HWErrorPercentLabel = new javax.swing.JLabel();
    HWErrorPercentageTextField = new javax.swing.JTextField();
    HWErrorsLabel = new javax.swing.JLabel();
    HWErrorsTextField = new javax.swing.JTextField();
    ACSChainInformationLabel = new javax.swing.JLabel();
    MinerGenericInformationRefreshButton = new javax.swing.JButton();
    MinerHashRatesPanel = new javax.swing.JPanel();
    HashRatesCurrentMiner = new javax.swing.JLabel();
    MinerCurrentHashLabel = new javax.swing.JLabel();
    MinerCurrentHashTextField = new javax.swing.JTextField();
    MinerAverageHashLabel = new javax.swing.JLabel();
    MinerAverageHashTextField = new javax.swing.JTextField();
    MinerFoundBlocksLabel = new javax.swing.JLabel();
    MinerAcceptedLabel = new javax.swing.JLabel();
    MinerRejectedLabel = new javax.swing.JLabel();
    MinerBestShareLabel = new javax.swing.JLabel();
    MinerNetworkBlocksLabel = new javax.swing.JLabel();
    MinerFoundBlocksTextField = new javax.swing.JTextField();
    MinerAcceptedTextField = new javax.swing.JTextField();
    MinerRejectedTextField = new javax.swing.JTextField();
    MinerBestShareTextField = new javax.swing.JTextField();
    MinerNetworkBlocksTextField = new javax.swing.JTextField();
    MinerSelectionBox1 = new javax.swing.JComboBox();
    MinerHashRatesRefreshButton = new javax.swing.JButton();
    MinerTemperaturePanel = new javax.swing.JPanel();
    TemperatureCurrentMinerLabel = new javax.swing.JLabel();
    MinerTemp1Label = new javax.swing.JLabel();
    MinerTemp2Label = new javax.swing.JLabel();
    MinerTemp3Label = new javax.swing.JLabel();
    MinerTemp4Label = new javax.swing.JLabel();
    MinerTempAvgLabel = new javax.swing.JLabel();
    MinerTempMaxLabel = new javax.swing.JLabel();
    MinerTemp1TextField = new javax.swing.JTextField();
    MinerTemp2TextField = new javax.swing.JTextField();
    MinerTemp3TextField = new javax.swing.JTextField();
    MinerTemp4TextField = new javax.swing.JTextField();
    MinerTempAvgTextField = new javax.swing.JTextField();
    MinerTextMaxTextField = new javax.swing.JTextField();
    MinerSelectionBox2 = new javax.swing.JComboBox();
    MinerTemperaturesRefreshButton = new javax.swing.JButton();
    MinerFansPanel = new javax.swing.JPanel();
    FansCurrentMinerLabel = new javax.swing.JLabel();
    MinerFan1Label = new javax.swing.JLabel();
    MinerFan2Label = new javax.swing.JLabel();
    MinerFan3Label = new javax.swing.JLabel();
    MinerFan4Label = new javax.swing.JLabel();
    MinerFan1TextField = new javax.swing.JTextField();
    MinerFan2TextField = new javax.swing.JTextField();
    MinerFan3TextField = new javax.swing.JTextField();
    MinerFan4TextField = new javax.swing.JTextField();
    MinerSelectionBox3 = new javax.swing.JComboBox();
    MinerFanSpeedsRefreshButton = new javax.swing.JButton();
    CustomAPICommandPanel = new javax.swing.JPanel();
    CustomAPICommandCurrentMiner = new javax.swing.JLabel();
    CustomCommandEntryLabel = new javax.swing.JLabel();
    CustomCommandEntryTextField = new javax.swing.JTextField();
    CustomCommandOutputScrollPane = new javax.swing.JScrollPane();
    CustomCommandOutputTextArea = new javax.swing.JTextArea();
    CustomCommandOutputLabel = new javax.swing.JLabel();
    CustomCommandSubmitButton = new javax.swing.JButton();
    CustomCommandJsonCheckBox = new javax.swing.JCheckBox();
    CustomCommandMinerSelectionBox = new javax.swing.JComboBox();
    MinerVitalsPanel = new javax.swing.JPanel();
    jScrollPane2 = new javax.swing.JScrollPane();
    MinerVitalStatsTextPane = new javax.swing.JTextPane();
    jLabel1 = new javax.swing.JLabel();
    VitalStatsRefreshButton = new javax.swing.JButton();
    BTCInformationPane = new javax.swing.JPanel();
    BitcoinInformationTabbedPane = new javax.swing.JTabbedPane();
    BTCGenericInformationPanel = new javax.swing.JPanel();
    BTCConversionRateLabel = new javax.swing.JLabel();
    NetworkDifficultyLabel = new javax.swing.JLabel();
    EstimatedPayoutLabel = new javax.swing.JLabel();
    NetworkDifficultyTextField = new javax.swing.JTextField();
    BTCConversionRateTextField = new javax.swing.JTextField();
    EstimatedPayoutTextField = new javax.swing.JTextField();
    CurrentBlockHashLabel = new javax.swing.JLabel();
    CurrentBlockHashTextField = new javax.swing.JTextField();
    CurrentBlockTimeLabel = new javax.swing.JLabel();
    CurrentBlockTimeTextField = new javax.swing.JTextField();
    GenericInformationCurrentMinerLabel = new javax.swing.JLabel();
    MinerSelectionBox5 = new javax.swing.JComboBox();
    BitcoinInformationRefreshButton = new javax.swing.JButton();
    GenericInformationCoinbaseUserLabel = new javax.swing.JLabel();
    GenericInformationCoinbaseUserSelectionBox = new javax.swing.JComboBox();
    GenericInformationAbbreviatedPreferredCurrencyLabel = new javax.swing.JLabel();
    GenericInformationAbbreviatedPreferredCurrencyLabel2 = new javax.swing.JLabel();
    CoinbaseAPIPanel = new javax.swing.JPanel();
    CoinbaseAPILabel = new javax.swing.JLabel();
    CoinbaseAPICurrentUserLabel = new javax.swing.JLabel();
    CoinbaseAPIUserSelectionBox = new javax.swing.JComboBox();
    EligiusPoolInformationPanel = new javax.swing.JPanel();
    EligiusStatusLabel = new javax.swing.JLabel();
    EligiusHashRateInformationScrollPane = new javax.swing.JScrollPane();
    EligiusHashRateInformationTable = new javax.swing.JTable();
    EligiusPayoutInformationPayoutScrollPane = new javax.swing.JScrollPane();
    EligiusPayoutInformationTable = new javax.swing.JTable();
    EligiusPoolInformationRefreshButton = new javax.swing.JButton();
    EligiusPayoutKeyInformationScrollPane = new javax.swing.JScrollPane();
    EligiousPayoutKeyInformationTextPane = new javax.swing.JTextPane();
    EligiusUsernameSelectionBox = new javax.swing.JComboBox();
    EligiusUsernameClipboardCopyButton = new javax.swing.JButton();
    EligiusPoolCurrentUsernameLabel = new javax.swing.JLabel();
    EligiusOpenBrowserButton = new javax.swing.JButton();
    ConfigurationPanel = new javax.swing.JPanel();
    ConfigurationTabbedPane = new javax.swing.JTabbedPane();
    MinerConfigurationPanel = new javax.swing.JPanel();
    ConfigurationPromptLabel = new javax.swing.JLabel();
    ConfigurationRemoveMinerButton = new javax.swing.JButton();
    ConfigurationAddMinerButton = new javax.swing.JButton();
    ConfigurationAddMinerNameLabel = new javax.swing.JLabel();
    ConfigurationAddMinerNameTextField = new javax.swing.JTextField();
    ConfigurationAddMinerIPLabel = new javax.swing.JLabel();
    ConfigurationAddMinerIPTextField = new javax.swing.JTextField();
    ConfigurationMinerPortLabel = new javax.swing.JLabel();
    ConfigurationMinerPortTextField = new javax.swing.JTextField();
    ConfigurationAddMinersLabel = new javax.swing.JLabel();
    ConfigurationRemoveMinersLabel = new javax.swing.JLabel();
    ConfigurationRemoveMinerNameLabel = new javax.swing.JLabel();
    ConfigurationRemoveMinerNameTextField = new javax.swing.JTextField();
    ConfigurationCurrentMinersLabel = new javax.swing.JLabel();
    ConfigurationRemoveMinerIPLabel = new javax.swing.JLabel();
    ConfigurationRemoveMinerIPTextField = new javax.swing.JTextField();
    ConfigurationResolveHostAddressLabel = new javax.swing.JLabel();
    ConfigurationResolveHostAddressTextField = new javax.swing.JTextField();
    ConfigurationResolveHostAddressButton = new javax.swing.JButton();
    ConfigurationCurrentMinersScrollPane = new javax.swing.JScrollPane();
    ConfigurationCurrentMinersTextPane = new javax.swing.JTextPane();
    ConfigurationAlarmPanel = new javax.swing.JPanel();
    ConfigurationAlarmSettingsPromptLabel = new javax.swing.JLabel();
    ConfigurationMinerTemperatureAlarmLabel = new javax.swing.JLabel();
    ConfigurationMinerFanSpeedAlarmLabel = new javax.swing.JLabel();
    ConfigurationMinerHashRateAlarmLabel = new javax.swing.JLabel();
    MinerSelectionForAlarmsBox = new javax.swing.JComboBox();
    AlarmsCurrentMinerLabel = new javax.swing.JLabel();
    ConfigurationAlarmsHWErrPercentLabel = new javax.swing.JLabel();
    ConfigurationMinerTempAlarmTextField = new javax.swing.JTextField();
    ConfigurationFanSpeedAlarmTextField = new javax.swing.JTextField();
    ConfigurationMinerHashRateAlarmTextField = new javax.swing.JTextField();
    ConfigurationMinerHardwareErrPercentAlarmTextField = new javax.swing.JTextField();
    ConfigurationDegreesCelsiusLabel = new javax.swing.JLabel();
    ConfigurationFanRPMLabel = new javax.swing.JLabel();
    ConfigurationHashRatePostfixComboBox = new javax.swing.JComboBox();
    ConfigurationHWErrorPercentLabel = new javax.swing.JLabel();
    ConfigurationMinerTempAlarmUpdateButton = new javax.swing.JButton();
    ConfigurationMinerFanSpeedAlarmUpdateButton = new javax.swing.JButton();
    ConfigurationMinerHashRateAlarmUpdateButton = new javax.swing.JButton();
    ConfigurationMinerHardwareErrPercentAlarmUpdateButton = new javax.swing.JButton();
    ConfigurationCurrentMinerAlarmsScrollPane = new javax.swing.JScrollPane();
    ConfigurationCurrentMinerAlarmsTextPane = new javax.swing.JTextPane();
    ConfigurationCurrentMinerAlarmsLabel = new javax.swing.JLabel();
    ConfigurationEligiusPoolsPanel = new javax.swing.JPanel();
    ConfigurationEligiusLabel = new javax.swing.JLabel();
    ConfigurationMiningPoolPromptLabel = new javax.swing.JLabel();
    ConfigurationEligiusUsernameLabel = new javax.swing.JLabel();
    ConfigurationEligiusUsernameTextField = new javax.swing.JTextField();
    ConfigurationEligiusHelpPromptLabel = new javax.swing.JLabel();
    ConfigurationEligiusUsernameAddButton = new javax.swing.JButton();
    ConfigurationEligiusUsernameRemoveButton = new javax.swing.JButton();
    ConfigurationEligiusExampleLabel = new javax.swing.JLabel();
    ConfigurationCoinExchangePanel = new javax.swing.JPanel();
    ConfigurationCoinbaseLabel = new javax.swing.JLabel();
    ConfigurationCoinbaseCurrencyLabel = new javax.swing.JLabel();
    ConfigurationCoinbaseCurrencyComboBox = new javax.swing.JComboBox();
    CoinbaseConfigurationSeparator = new javax.swing.JSeparator();
    CoinbaseInformationLabel = new javax.swing.JLabel();
    CoinbaseUsernameLabel = new javax.swing.JLabel();
    CoinbaseAPIUsernameTextField = new javax.swing.JTextField();
    CoinbaseAPIKeyLabel = new javax.swing.JLabel();
    CoinbaseAPIKeyTextField = new javax.swing.JTextField();
    CoinbaseAPISecretKeyLabel = new javax.swing.JLabel();
    CoinbaseAPISecretKeyTextField = new javax.swing.JTextField();
    AddCoinbaseUsernameButton = new javax.swing.JButton();
    RemoveCoinbaseUsernameButton = new javax.swing.JButton();
    CurrentCoinbaseConfigurationLabel = new javax.swing.JLabel();
    CoinbaseConfigurationSeparator1 = new javax.swing.JSeparator();
    CurrentCoinbaseConfigurationScrollPane = new javax.swing.JScrollPane();
    CurrentCoinbaseConfigurationTextPane = new javax.swing.JTextPane();
    CoinbaseConfigurationVerticalSeparator = new javax.swing.JSeparator();
    CoinbaseConfigurationInstructionsScrollPane = new javax.swing.JScrollPane();
    CoinbaseConfigurationInstructionsTextPane = new javax.swing.JTextPane();
    CoinbaseConfigurationInstructionsLabel = new javax.swing.JLabel();
    BFGMInerUIMenuBar = new javax.swing.JMenuBar();
    FileMenu = new javax.swing.JMenu();
    FileExitMenuItem = new javax.swing.JMenuItem();
    EditMenu = new javax.swing.JMenu("Edit");
    CopyMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.CopyAction());
    PasteMenuItem = new javax.swing.JMenuItem(new DefaultEditorKit.PasteAction());
    HelpMenu = new javax.swing.JMenu();
    AppHelpMenuItem = new javax.swing.JMenuItem();
    AboutMenuItem = new javax.swing.JMenuItem();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("PlanetCrypto Bitcoin");
    setBackground(new java.awt.Color(204, 255, 255));

    MainTabbedPane.setToolTipText("");
    MainTabbedPane.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MainTabbedPane.setName(""); // NOI18N

    MinerInformationTabbedPane.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N

    ArrayList<String> miners = new ArrayList<>();
    existing_miners = currentMiners();
    //jComboBox1.
    if (existing_miners.get(0) == null) {
        miners.add("No Miners");
    } else {
        for (int i = 0; i < existing_miners.size(); i++) {
            miners.add(existing_miners.get(i).get("name"));
        }
    }
    MinerSelectionBox.setModel(new javax.swing.DefaultComboBoxModel(miners.toArray()));
    MinerSelectionBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            MinerSelectionBoxActionPerformed(evt);
        }
    });
    MinerSelectionBoxActionPerformed(null);

    MinerSelectionBoxLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerSelectionBoxLabel.setText("Current Miner:");

    InformationMinerIPLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    InformationMinerIPLabel.setText("Miner IP:");

    /*
    if (existing_miners.get(MinerSelectionBox.getSelectedIndex()).get("name").equals("None")) {
    InformationMinerIPTextField.setText("None");
    } else {
    InformationMinerIPTextField.setText(existing_miners.get(MinerSelectionBox.getSelectedIndex()).get("ip"));
    }
    */
    InformationMinerIPTextField.setEditable(false);

    InformationMinerPortLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    InformationMinerPortLabel.setText("Miner Port:");

    InformationMinerPortTextField.setEditable(false);
    /*
    if (existing_miners.get(MinerSelectionBox.getSelectedIndex()) == null) {
    InformationMinerPortTextField.setText("None");
    } else {
    InformationMinerPortTextField.setText(existing_miners.get(MinerSelectionBox.getSelectedIndex()).get("port"));
    }
    */

    PrivilegedLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    PrivilegedLabel.setText("Privileged: ");

    ASICsLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ASICsLabel.setText("ASICs:");

    PrivilegedTextField.setEditable(false);
    /*
    if (existing_miners.get(MinerSelectionBox.getSelectedIndex()) ==null) {
    PrivilegedTextField.setText("None");
    } else {
    String privileged = api_Commands.parseArgs(existing_miners.get(MinerSelectionBox.getSelectedIndex()).get("ip"), existing_miners.get(MinerSelectionBox.getSelectedIndex()).get("port"), "privileged");
    String status = api_Commands.getKeys(privileged, "STATUS");
    if (status.equals("E")) {
        PrivilegedTextField.setText("False");
    } else {
        PrivilegedTextField.setText("True");
    }
    }
    */

    ASICsTextField.setEditable(false);

    PGAsLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    PGAsLabel.setText("PGAs:");

    PGAsTextField.setEditable(false);

    PoolCountLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    PoolCountLabel.setText("Pool Count:");

    PoolCountTextField.setEditable(false);

    MinerVersionLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerVersionLabel.setText("Version:");

    MinerVersionTextField.setEditable(false);

    MinerStrategyLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerStrategyLabel.setText("Strategy:");

    MinerStrategyTextField.setEditable(false);

    ACSChain1Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ACSChain1Label.setText("ACS Chain 1:");

    ACSChain1TextField.setEditable(false);

    ACSChain2Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ACSChain2Label.setText("ACS Chain 2:");

    ACSChain3Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ACSChain3Label.setText("ACS Chain 3:");

    ACSChain4Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ACSChain4Label.setText("ACS Chain 4:");

    ACSChain2TextField.setEditable(false);

    ACSChain3TextField.setEditable(false);

    ACSChain4TextField.setEditable(false);

    BytesSentLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    BytesSentLabel.setText("Bytes Sent:");

    BytesRecvLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    BytesRecvLabel.setText("Bytes Recv:");

    BytesSentTextField.setEditable(false);

    BytesRecvTextField.setEditable(false);

    HWErrorPercentLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    HWErrorPercentLabel.setText("HW Error  %:");

    HWErrorPercentageTextField.setEditable(false);

    HWErrorsLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    HWErrorsLabel.setText("HW Errors:");

    HWErrorsTextField.setEditable(false);

    ACSChainInformationLabel.setText("For ACS chains: x = Not Well; o = Well");

    MinerGenericInformationRefreshButton.setText("Refresh");
    MinerGenericInformationRefreshButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            MinerGenericInformationRefreshButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout InformationPanelLayout = new javax.swing.GroupLayout(InformationPanel);
    InformationPanel.setLayout(InformationPanelLayout);
    InformationPanelLayout.setHorizontalGroup(InformationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(InformationPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(InformationPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(InformationPanelLayout.createSequentialGroup()
                                            .addComponent(ACSChainInformationLabel).addGap(51, 51, 51))
                                    .addGroup(InformationPanelLayout.createSequentialGroup()
                                            .addGroup(InformationPanelLayout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addGroup(InformationPanelLayout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                            .addComponent(MinerSelectionBoxLabel)
                                                            .addComponent(InformationMinerIPLabel)
                                                            .addComponent(ASICsLabel,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addComponent(PGAsLabel)
                                                            .addComponent(PoolCountLabel)
                                                            .addComponent(MinerVersionLabel))
                                                    .addComponent(PrivilegedLabel,
                                                            javax.swing.GroupLayout.Alignment.LEADING))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addGroup(InformationPanelLayout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                    .addComponent(ACSChain3TextField,
                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(ACSChain2TextField,
                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(ACSChain4TextField)
                                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                            InformationPanelLayout.createSequentialGroup()
                                                                    .addGroup(InformationPanelLayout
                                                                            .createParallelGroup(
                                                                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                                                                    false)
                                                                            .addComponent(MinerVersionTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addComponent(
                                                                                    InformationMinerIPTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addComponent(PrivilegedTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                    173, Short.MAX_VALUE)
                                                                            .addComponent(ASICsTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addComponent(PGAsTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addComponent(PoolCountTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addComponent(MinerSelectionBox,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                                    0,
                                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                    Short.MAX_VALUE))
                                                                    .addGroup(InformationPanelLayout
                                                                            .createParallelGroup(
                                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addGroup(InformationPanelLayout
                                                                                    .createSequentialGroup()
                                                                                    .addPreferredGap(
                                                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                                    .addGroup(
                                                                                            InformationPanelLayout
                                                                                                    .createParallelGroup(
                                                                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                                                                            false)
                                                                                                    .addGroup(
                                                                                                            InformationPanelLayout
                                                                                                                    .createSequentialGroup()
                                                                                                                    .addGroup(
                                                                                                                            InformationPanelLayout
                                                                                                                                    .createParallelGroup(
                                                                                                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                                                                                                    .addComponent(
                                                                                                                                            BytesRecvLabel)
                                                                                                                                    .addComponent(
                                                                                                                                            HWErrorPercentLabel)
                                                                                                                                    .addComponent(
                                                                                                                                            HWErrorsLabel)
                                                                                                                                    .addComponent(
                                                                                                                                            MinerStrategyLabel))
                                                                                                                    .addGap(18,
                                                                                                                            18,
                                                                                                                            18)
                                                                                                                    .addGroup(
                                                                                                                            InformationPanelLayout
                                                                                                                                    .createParallelGroup(
                                                                                                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                                                                                                            false)
                                                                                                                                    .addComponent(
                                                                                                                                            HWErrorsTextField,
                                                                                                                                            javax.swing.GroupLayout.Alignment.TRAILING)
                                                                                                                                    .addComponent(
                                                                                                                                            HWErrorPercentageTextField)
                                                                                                                                    .addComponent(
                                                                                                                                            BytesRecvTextField)
                                                                                                                                    .addComponent(
                                                                                                                                            MinerStrategyTextField,
                                                                                                                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                                                                            172,
                                                                                                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                                                                    .addGroup(
                                                                                                            InformationPanelLayout
                                                                                                                    .createSequentialGroup()
                                                                                                                    .addGroup(
                                                                                                                            InformationPanelLayout
                                                                                                                                    .createParallelGroup(
                                                                                                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                                                                                                            false)
                                                                                                                                    .addComponent(
                                                                                                                                            InformationMinerPortLabel,
                                                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                                                            89,
                                                                                                                                            Short.MAX_VALUE)
                                                                                                                                    .addComponent(
                                                                                                                                            BytesSentLabel,
                                                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                                                            Short.MAX_VALUE))
                                                                                                                    .addGap(18,
                                                                                                                            18,
                                                                                                                            18)
                                                                                                                    .addGroup(
                                                                                                                            InformationPanelLayout
                                                                                                                                    .createParallelGroup(
                                                                                                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                                                                                                    .addComponent(
                                                                                                                                            BytesSentTextField)
                                                                                                                                    .addComponent(
                                                                                                                                            InformationMinerPortTextField)))))
                                                                            .addGroup(InformationPanelLayout
                                                                                    .createSequentialGroup()
                                                                                    .addGap(31, 31, 31)
                                                                                    .addComponent(
                                                                                            MinerGenericInformationRefreshButton))))
                                                    .addComponent(ACSChain1TextField,
                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 458,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGap(41, 41, 41)))
                            .addComponent(ACSChain1Label).addComponent(ACSChain2Label)
                            .addComponent(ACSChain3Label).addComponent(ACSChain4Label))));
    InformationPanelLayout.setVerticalGroup(InformationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(InformationPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MinerSelectionBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(MinerSelectionBoxLabel)
                            .addComponent(MinerGenericInformationRefreshButton))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(InformationMinerIPLabel)
                            .addComponent(InformationMinerIPTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(InformationMinerPortLabel).addComponent(InformationMinerPortTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(PrivilegedLabel).addComponent(BytesSentLabel)
                            .addComponent(BytesSentTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(PrivilegedTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ASICsLabel)
                            .addComponent(ASICsTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BytesRecvLabel)
                            .addComponent(BytesRecvTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(PGAsLabel)
                            .addComponent(PGAsTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(HWErrorsLabel)
                            .addComponent(HWErrorsTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(PoolCountLabel)
                            .addComponent(PoolCountTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(HWErrorPercentLabel).addComponent(HWErrorPercentageTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MinerVersionLabel)
                            .addComponent(MinerVersionTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(MinerStrategyLabel).addComponent(MinerStrategyTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ACSChain1Label).addComponent(ACSChain1TextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ACSChain2Label).addComponent(ACSChain2TextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ACSChain3Label).addComponent(ACSChain3TextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(InformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ACSChain4Label).addComponent(ACSChain4TextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18).addComponent(ACSChainInformationLabel).addGap(41, 41, 41)));

    MinerInformationTabbedPane.addTab("Information", InformationPanel);

    MinerHashRatesPanel.add(MinerSelectionBox);

    HashRatesCurrentMiner.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    HashRatesCurrentMiner.setText("Current Miner:");

    MinerCurrentHashLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerCurrentHashLabel.setText("Current Hash:");

    MinerCurrentHashTextField.setEditable(false);

    MinerAverageHashLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerAverageHashLabel.setText("Average Hash:");

    MinerAverageHashTextField.setEditable(false);

    MinerFoundBlocksLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerFoundBlocksLabel.setText("Found Blocks:");

    MinerAcceptedLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerAcceptedLabel.setText("Accepted:");

    MinerRejectedLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerRejectedLabel.setText("Rejected:");

    MinerBestShareLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerBestShareLabel.setText("Best Share:");

    MinerNetworkBlocksLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerNetworkBlocksLabel.setText("Network Blocks:");

    MinerFoundBlocksTextField.setEditable(false);

    MinerAcceptedTextField.setEditable(false);

    MinerRejectedTextField.setEditable(false);

    MinerBestShareTextField.setEditable(false);

    MinerNetworkBlocksTextField.setEditable(false);

    MinerSelectionBox1.setModel(new javax.swing.DefaultComboBoxModel(miners.toArray()));

    org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, MinerSelectionBox,
            org.jdesktop.beansbinding.ELProperty.create("${selectedItem}"), MinerSelectionBox1,
            org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
    bindingGroup.addBinding(binding);

    MinerHashRatesRefreshButton.setText("Refresh");
    MinerHashRatesRefreshButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            MinerHashRatesRefreshButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout MinerHashRatesPanelLayout = new javax.swing.GroupLayout(MinerHashRatesPanel);
    MinerHashRatesPanel.setLayout(MinerHashRatesPanelLayout);
    MinerHashRatesPanelLayout.setHorizontalGroup(MinerHashRatesPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MinerHashRatesPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(HashRatesCurrentMiner).addComponent(MinerCurrentHashLabel)
                            .addComponent(MinerAverageHashLabel).addComponent(MinerFoundBlocksLabel)
                            .addComponent(MinerAcceptedLabel).addComponent(MinerRejectedLabel)
                            .addComponent(MinerBestShareLabel).addComponent(MinerNetworkBlocksLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(MinerHashRatesPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(MinerCurrentHashTextField)
                                    .addComponent(MinerAverageHashTextField)
                                    .addComponent(MinerFoundBlocksTextField)
                                    .addComponent(MinerAcceptedTextField).addComponent(MinerRejectedTextField)
                                    .addComponent(MinerBestShareTextField)
                                    .addComponent(MinerNetworkBlocksTextField,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                            .addGroup(MinerHashRatesPanelLayout.createSequentialGroup()
                                    .addComponent(MinerSelectionBox1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            173, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(MinerHashRatesRefreshButton)))
                    .addContainerGap(440, Short.MAX_VALUE)));
    MinerHashRatesPanelLayout.setVerticalGroup(MinerHashRatesPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MinerHashRatesPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(HashRatesCurrentMiner)
                            .addComponent(MinerSelectionBox1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(MinerHashRatesRefreshButton))
                    .addGap(21, 21, 21)
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MinerCurrentHashLabel).addComponent(MinerCurrentHashTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MinerAverageHashLabel).addComponent(MinerAverageHashTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MinerFoundBlocksLabel).addComponent(MinerFoundBlocksTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MinerAcceptedLabel).addComponent(MinerAcceptedTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MinerRejectedLabel).addComponent(MinerRejectedTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MinerBestShareLabel).addComponent(MinerBestShareTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(MinerHashRatesPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(MinerNetworkBlocksLabel).addComponent(MinerNetworkBlocksTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    MinerInformationTabbedPane.addTab("Hash Rates", MinerHashRatesPanel);

    TemperatureCurrentMinerLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    TemperatureCurrentMinerLabel.setText("Current Miner:");

    MinerTemp1Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerTemp1Label.setText("Temp 1:");

    MinerTemp2Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerTemp2Label.setText("Temp 2:");

    MinerTemp3Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerTemp3Label.setText("Temp 3:");

    MinerTemp4Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerTemp4Label.setText("Temp 4:");

    MinerTempAvgLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerTempAvgLabel.setText("Temp Avg:");

    MinerTempMaxLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerTempMaxLabel.setText("Temp Max");

    MinerTemp1TextField.setEditable(false);

    MinerTemp2TextField.setEditable(false);

    MinerTemp3TextField.setEditable(false);

    MinerTemp4TextField.setEditable(false);

    MinerTempAvgTextField.setEditable(false);

    MinerTextMaxTextField.setEditable(false);

    MinerSelectionBox2.setModel(new javax.swing.DefaultComboBoxModel(miners.toArray()));

    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, MinerSelectionBox1,
            org.jdesktop.beansbinding.ELProperty.create("${selectedItem}"), MinerSelectionBox2,
            org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
    bindingGroup.addBinding(binding);

    MinerTemperaturesRefreshButton.setText("Refresh");
    MinerTemperaturesRefreshButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            MinerTemperaturesRefreshButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout MinerTemperaturePanelLayout = new javax.swing.GroupLayout(MinerTemperaturePanel);
    MinerTemperaturePanel.setLayout(MinerTemperaturePanelLayout);
    MinerTemperaturePanelLayout.setHorizontalGroup(MinerTemperaturePanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MinerTemperaturePanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(MinerTemperaturePanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(TemperatureCurrentMinerLabel).addComponent(MinerTemp1Label)
                            .addComponent(MinerTemp2Label).addComponent(MinerTemp3Label)
                            .addComponent(MinerTemp4Label).addComponent(MinerTempAvgLabel)
                            .addComponent(MinerTempMaxLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(MinerTemperaturePanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(MinerTemperaturePanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(MinerTemp1TextField).addComponent(MinerTemp2TextField)
                                    .addComponent(MinerTemp3TextField).addComponent(MinerTemp4TextField)
                                    .addComponent(MinerTempAvgTextField).addComponent(MinerTextMaxTextField,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                            .addGroup(MinerTemperaturePanelLayout.createSequentialGroup()
                                    .addComponent(MinerSelectionBox2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            173, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(MinerTemperaturesRefreshButton)))
                    .addContainerGap(448, Short.MAX_VALUE)));
    MinerTemperaturePanelLayout.setVerticalGroup(
            MinerTemperaturePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(MinerTemperaturePanelLayout.createSequentialGroup().addContainerGap()
                            .addGroup(MinerTemperaturePanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(TemperatureCurrentMinerLabel)
                                    .addComponent(MinerSelectionBox2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(MinerTemperaturesRefreshButton))
                            .addGap(21, 21, 21)
                            .addGroup(MinerTemperaturePanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerTemp1Label).addComponent(MinerTemp1TextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(MinerTemperaturePanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerTemp2Label).addComponent(MinerTemp2TextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(MinerTemperaturePanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerTemp3Label).addComponent(MinerTemp3TextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(MinerTemperaturePanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerTemp4Label).addComponent(MinerTemp4TextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(MinerTemperaturePanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerTempAvgLabel).addComponent(MinerTempAvgTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(MinerTemperaturePanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerTempMaxLabel).addComponent(MinerTextMaxTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    MinerInformationTabbedPane.addTab("Temperatures", MinerTemperaturePanel);

    FansCurrentMinerLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    FansCurrentMinerLabel.setText("Current Miner:");

    MinerFan1Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerFan1Label.setText("Fan 1:");

    MinerFan2Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerFan2Label.setText("Fan 2:");

    MinerFan3Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerFan3Label.setText("Fan 3:");

    MinerFan4Label.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    MinerFan4Label.setText("Fan 4:");

    MinerFan1TextField.setEditable(false);

    MinerFan2TextField.setEditable(false);

    MinerFan3TextField.setEditable(false);

    MinerFan4TextField.setEditable(false);

    MinerSelectionBox3.setModel(new javax.swing.DefaultComboBoxModel(miners.toArray()));

    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, MinerSelectionBox2,
            org.jdesktop.beansbinding.ELProperty.create("${selectedItem}"), MinerSelectionBox3,
            org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
    bindingGroup.addBinding(binding);

    MinerFanSpeedsRefreshButton.setText("Refresh");
    MinerFanSpeedsRefreshButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            MinerFanSpeedsRefreshButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout MinerFansPanelLayout = new javax.swing.GroupLayout(MinerFansPanel);
    MinerFansPanel.setLayout(MinerFansPanelLayout);
    MinerFansPanelLayout.setHorizontalGroup(MinerFansPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MinerFansPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(MinerFansPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(MinerFansPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(MinerFan3Label, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(MinerFan2Label, javax.swing.GroupLayout.Alignment.TRAILING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(MinerFan1Label, javax.swing.GroupLayout.Alignment.TRAILING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(MinerFan4Label, javax.swing.GroupLayout.Alignment.TRAILING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE))
                            .addComponent(FansCurrentMinerLabel))
                    .addGap(18, 18, 18)
                    .addGroup(MinerFansPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(MinerFansPanelLayout.createSequentialGroup()
                                    .addComponent(MinerSelectionBox3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            173, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(MinerFanSpeedsRefreshButton))
                            .addGroup(MinerFansPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(MinerFan4TextField, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(MinerFan3TextField, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(MinerFan2TextField, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(MinerFan1TextField, javax.swing.GroupLayout.Alignment.LEADING,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)))
                    .addContainerGap(442, Short.MAX_VALUE)));
    MinerFansPanelLayout.setVerticalGroup(
            MinerFansPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(MinerFansPanelLayout.createSequentialGroup().addContainerGap()
                            .addGroup(MinerFansPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(FansCurrentMinerLabel)
                                    .addComponent(MinerSelectionBox3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(MinerFanSpeedsRefreshButton))
                            .addGap(21, 21, 21)
                            .addGroup(MinerFansPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerFan1Label)
                                    .addComponent(MinerFan1TextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(MinerFansPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerFan2TextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(MinerFan2Label))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(MinerFansPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerFan3Label).addComponent(MinerFan3TextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(MinerFansPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(MinerFan4Label).addComponent(MinerFan4TextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    MinerInformationTabbedPane.addTab("Fans", MinerFansPanel);

    CustomAPICommandCurrentMiner.setText("Current Miner:");

    CustomCommandEntryLabel.setText("Enter Custom Command:");

    CustomCommandOutputTextArea.setEditable(false);
    CustomCommandOutputTextArea.setColumns(20);
    CustomCommandOutputTextArea.setRows(5);
    CustomCommandOutputScrollPane.setViewportView(CustomCommandOutputTextArea);

    CustomCommandOutputLabel.setText("Output:");

    CustomCommandSubmitButton.setText("Submit");
    CustomCommandSubmitButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            CustomCommandSubmitButtonActionPerformed(evt);
        }
    });

    CustomCommandJsonCheckBox.setText("Check for JSON Output");
    CustomCommandJsonCheckBox.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyPressed(java.awt.event.KeyEvent evt) {
            CustomCommandJsonCheckBoxKeyPressed(evt);
        }
    });

    CustomCommandMinerSelectionBox.setModel(new javax.swing.DefaultComboBoxModel(miners.toArray()));

    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, MinerSelectionBox3,
            org.jdesktop.beansbinding.ELProperty.create("${selectedItem}"), CustomCommandMinerSelectionBox,
            org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
    bindingGroup.addBinding(binding);

    javax.swing.GroupLayout CustomAPICommandPanelLayout = new javax.swing.GroupLayout(CustomAPICommandPanel);
    CustomAPICommandPanel.setLayout(CustomAPICommandPanelLayout);
    CustomAPICommandPanelLayout.setHorizontalGroup(CustomAPICommandPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CustomAPICommandPanelLayout.createSequentialGroup().addGap(22, 22, 22)
                    .addGroup(CustomAPICommandPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(CustomCommandOutputScrollPane).addComponent(CustomCommandOutputLabel)
                            .addGroup(CustomAPICommandPanelLayout.createSequentialGroup()
                                    .addComponent(CustomCommandEntryLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(CustomCommandEntryTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 121,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18).addComponent(CustomCommandJsonCheckBox)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(CustomCommandSubmitButton))
                            .addGroup(CustomAPICommandPanelLayout.createSequentialGroup()
                                    .addComponent(CustomAPICommandCurrentMiner)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(CustomCommandMinerSelectionBox,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 173,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    CustomAPICommandPanelLayout.setVerticalGroup(CustomAPICommandPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CustomAPICommandPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(CustomAPICommandPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(CustomAPICommandCurrentMiner).addComponent(
                                    CustomCommandMinerSelectionBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(20, 20, 20)
                    .addGroup(CustomAPICommandPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(CustomCommandEntryLabel)
                            .addComponent(CustomCommandEntryTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(CustomCommandSubmitButton).addComponent(CustomCommandJsonCheckBox))
                    .addGap(18, 18, 18).addComponent(CustomCommandOutputLabel).addGap(7, 7, 7)
                    .addComponent(CustomCommandOutputScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 234,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    MinerInformationTabbedPane.addTab("Custom Command", CustomAPICommandPanel);

    //System.out.println(existing_miners.toString());
    MinerVitalStatsTextPane.setContentType("text/html");
    MinerVitalStatsTextPane.setEditable(false);
    MinerVitalStatsTextPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            MinerVitalStatsTextPanePropertyChange(evt);
        }
    });
    jScrollPane2.setViewportView(MinerVitalStatsTextPane);

    jLabel1.setFont(new java.awt.Font("DejaVu Sans", 3, 14)); // NOI18N
    jLabel1.setText("Vital Miner Statistics");

    VitalStatsRefreshButton.setText("Refresh");
    VitalStatsRefreshButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            VitalStatsRefreshButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout MinerVitalsPanelLayout = new javax.swing.GroupLayout(MinerVitalsPanel);
    MinerVitalsPanel.setLayout(MinerVitalsPanelLayout);
    MinerVitalsPanelLayout.setHorizontalGroup(
            MinerVitalsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(MinerVitalsPanelLayout.createSequentialGroup().addContainerGap()
                            .addGroup(MinerVitalsPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(MinerVitalsPanelLayout.createSequentialGroup()
                                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    645, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(VitalStatsRefreshButton))
                                    .addComponent(jLabel1))
                            .addContainerGap(93, Short.MAX_VALUE)));
    MinerVitalsPanelLayout.setVerticalGroup(MinerVitalsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MinerVitalsPanelLayout.createSequentialGroup().addGap(16, 16, 16).addComponent(jLabel1)
                    .addGap(18, 18, 18)
                    .addGroup(MinerVitalsPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 306,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(VitalStatsRefreshButton))
                    .addContainerGap(229, Short.MAX_VALUE)));

    MinerInformationTabbedPane.addTab("Vitals", MinerVitalsPanel);

    javax.swing.GroupLayout MinerInformationPanelLayout = new javax.swing.GroupLayout(MinerInformationPanel);
    MinerInformationPanel.setLayout(MinerInformationPanelLayout);
    MinerInformationPanelLayout.setHorizontalGroup(
            MinerInformationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(MinerInformationTabbedPane));
    MinerInformationPanelLayout.setVerticalGroup(
            MinerInformationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(MinerInformationPanelLayout.createSequentialGroup().addContainerGap()
                            .addComponent(MinerInformationTabbedPane, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    615, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    MainTabbedPane.addTab("Miners", MinerInformationPanel);

    BTCConversionRateLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    BTCConversionRateLabel.setText("BTC Conversion Rate:");

    NetworkDifficultyLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    NetworkDifficultyLabel.setText("Network Difficulty:");

    EstimatedPayoutLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    EstimatedPayoutLabel.setText("Estimated Payout:");

    NetworkDifficultyTextField.setEditable(false);

    BTCConversionRateTextField.setEditable(false);
    BTCConversionRateTextField.setText("Not configured yet");

    EstimatedPayoutTextField.setEditable(false);

    CurrentBlockHashLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    CurrentBlockHashLabel.setText("Current Block Hash:");

    CurrentBlockHashTextField.setEditable(false);

    CurrentBlockTimeLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    CurrentBlockTimeLabel.setText("Current Block Time:");

    CurrentBlockTimeTextField.setEditable(false);

    GenericInformationCurrentMinerLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    GenericInformationCurrentMinerLabel.setText("Current Miner:");

    MinerSelectionBox5.setModel(new javax.swing.DefaultComboBoxModel(miners.toArray()));

    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, CustomCommandMinerSelectionBox,
            org.jdesktop.beansbinding.ELProperty.create("${selectedItem}"), MinerSelectionBox5,
            org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
    bindingGroup.addBinding(binding);

    BitcoinInformationRefreshButton.setText("Refresh");
    BitcoinInformationRefreshButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            BitcoinInformationRefreshButtonActionPerformed(evt);
        }
    });

    GenericInformationCoinbaseUserLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    GenericInformationCoinbaseUserLabel.setText("Current Coinbase User:");

    existing_coinbase = currentCoinbase();
    ;
    ArrayList<String> coinbase_users = new ArrayList<>();
    if (existing_coinbase == null) {
        coinbase_users.add("No Users");
    } else {
        for (int i = 0; i < existing_coinbase.size(); i++) {
            coinbase_users.add(existing_coinbase.get(i).get("email"));
        }
    }
    GenericInformationCoinbaseUserSelectionBox
            .setModel(new javax.swing.DefaultComboBoxModel(coinbase_users.toArray()));
    GenericInformationCoinbaseUserSelectionBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            GenericInformationCoinbaseUserSelectionBoxActionPerformed(evt);
        }
    });

    GenericInformationAbbreviatedPreferredCurrencyLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    GenericInformationAbbreviatedPreferredCurrencyLabel
            .addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                public void propertyChange(java.beans.PropertyChangeEvent evt) {
                    GenericInformationAbbreviatedPreferredCurrencyLabelPropertyChange(evt);
                }
            });

    GenericInformationAbbreviatedPreferredCurrencyLabel2.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N

    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            GenericInformationAbbreviatedPreferredCurrencyLabel,
            org.jdesktop.beansbinding.ELProperty.create("${text}"),
            GenericInformationAbbreviatedPreferredCurrencyLabel2,
            org.jdesktop.beansbinding.BeanProperty.create("text"));
    bindingGroup.addBinding(binding);

    javax.swing.GroupLayout BTCGenericInformationPanelLayout = new javax.swing.GroupLayout(
            BTCGenericInformationPanel);
    BTCGenericInformationPanel.setLayout(BTCGenericInformationPanelLayout);
    BTCGenericInformationPanelLayout.setHorizontalGroup(BTCGenericInformationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(BTCGenericInformationPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(BTCGenericInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(EstimatedPayoutLabel).addComponent(BTCConversionRateLabel)
                            .addComponent(NetworkDifficultyLabel).addComponent(CurrentBlockHashLabel)
                            .addComponent(GenericInformationCurrentMinerLabel)
                            .addComponent(CurrentBlockTimeLabel)
                            .addComponent(GenericInformationCoinbaseUserLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(BTCGenericInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(BTCGenericInformationPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(CurrentBlockHashTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 559,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(BTCGenericInformationPanelLayout.createSequentialGroup()
                                            .addComponent(MinerSelectionBox5,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 173,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(BitcoinInformationRefreshButton))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                            BTCGenericInformationPanelLayout.createSequentialGroup()
                                                    .addGroup(BTCGenericInformationPanelLayout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.TRAILING)
                                                            .addComponent(EstimatedPayoutTextField,
                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                            .addComponent(BTCConversionRateTextField))
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addGroup(BTCGenericInformationPanelLayout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                    false)
                                                            .addComponent(
                                                                    GenericInformationAbbreviatedPreferredCurrencyLabel,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(
                                                                    GenericInformationAbbreviatedPreferredCurrencyLabel2,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE, 89,
                                                                    Short.MAX_VALUE))
                                                    .addGap(184, 184, 184))
                                    .addComponent(NetworkDifficultyTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 280,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(CurrentBlockTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    280, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(GenericInformationCoinbaseUserSelectionBox,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 255,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap()));
    BTCGenericInformationPanelLayout.setVerticalGroup(BTCGenericInformationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(BTCGenericInformationPanelLayout.createSequentialGroup().addGap(3, 3, 3)
                    .addGroup(BTCGenericInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(GenericInformationCurrentMinerLabel)
                            .addComponent(MinerSelectionBox5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BitcoinInformationRefreshButton))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(BTCGenericInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(GenericInformationCoinbaseUserLabel)
                            .addComponent(GenericInformationCoinbaseUserSelectionBox,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(7, 7, 7)
                    .addGroup(BTCGenericInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(NetworkDifficultyTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(NetworkDifficultyLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(BTCGenericInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(CurrentBlockHashTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(CurrentBlockHashLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(BTCGenericInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(CurrentBlockTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(CurrentBlockTimeLabel))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(BTCGenericInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(BTCConversionRateTextField, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(BTCConversionRateLabel)
                            .addComponent(GenericInformationAbbreviatedPreferredCurrencyLabel,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 27,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(BTCGenericInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(GenericInformationAbbreviatedPreferredCurrencyLabel2,
                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addGroup(BTCGenericInformationPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(EstimatedPayoutLabel).addComponent(EstimatedPayoutTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(372, 372, 372)));

    BitcoinInformationTabbedPane.addTab("Generic Information", BTCGenericInformationPanel);

    CoinbaseAPILabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    CoinbaseAPILabel.setText("Buy, Sell, Trade BTC Here");

    CoinbaseAPICurrentUserLabel.setText("Current Coinbase User");

    CoinbaseAPIUserSelectionBox.setModel(new javax.swing.DefaultComboBoxModel(existingCoinbase().toArray()));

    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE,
            GenericInformationCoinbaseUserSelectionBox,
            org.jdesktop.beansbinding.ELProperty.create("${selectedItem}"), CoinbaseAPIUserSelectionBox,
            org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
    bindingGroup.addBinding(binding);

    javax.swing.GroupLayout CoinbaseAPIPanelLayout = new javax.swing.GroupLayout(CoinbaseAPIPanel);
    CoinbaseAPIPanel.setLayout(CoinbaseAPIPanelLayout);
    CoinbaseAPIPanelLayout.setHorizontalGroup(
            CoinbaseAPIPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(CoinbaseAPIPanelLayout.createSequentialGroup().addContainerGap()
                            .addGroup(CoinbaseAPIPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(CoinbaseAPILabel, javax.swing.GroupLayout.PREFERRED_SIZE, 351,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(CoinbaseAPIPanelLayout.createSequentialGroup()
                                            .addComponent(CoinbaseAPICurrentUserLabel)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(CoinbaseAPIUserSelectionBox, 0,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addContainerGap(469, Short.MAX_VALUE)));
    CoinbaseAPIPanelLayout.setVerticalGroup(CoinbaseAPIPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CoinbaseAPIPanelLayout.createSequentialGroup().addGap(18, 18, 18)
                    .addComponent(CoinbaseAPILabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(CoinbaseAPIPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(CoinbaseAPICurrentUserLabel).addComponent(CoinbaseAPIUserSelectionBox,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(526, Short.MAX_VALUE)));

    BitcoinInformationTabbedPane.addTab("Coinbase API", CoinbaseAPIPanel);

    EligiusStatusLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N

    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, EligiusUsernameSelectionBox,
            org.jdesktop.beansbinding.ELProperty.create("${selectedItem}"), EligiusStatusLabel,
            org.jdesktop.beansbinding.BeanProperty.create("text"));
    bindingGroup.addBinding(binding);

    /*
    org.planetcrypto.bitcoin.PlanetCryptoNetworkMethods parser = new org.planetcrypto.bitcoin.PlanetCryptoNetworkMethods();
    ArrayList<String> eligius_names = cfg.getEligius();
    //System.out.println(eligius_names);
    EligiusUsernameSelectionBox.setModel(new javax.swing.DefaultComboBoxModel(eligius_names.toArray()));
    String eligius_name = EligiusUsernameSelectionBox.getSelectedItem().toString();
            
    if (eligius_name.startsWith("Eligius not configured")) {
    EligiusHashRateInformationTable.setModel(new javax.swing.table.DefaultTableModel(
        new Object [][] {
            {"12 Hours", null, null},
            {"3 Hours", null, null},
            {"22.5 Minutes", null, null},
            {"256 Seconds", null, null},
            {"128 Seconds", null, null}
        },
        new String [] {
            "Interval", "Hashrate", "Weighted Shares"
        }
    ) {
        Class[] types = new Class [] {
            java.lang.String.class, java.lang.String.class, java.lang.Integer.class
        };
        boolean[] canEdit = new boolean [] {
            false, false, false
        };
            
        public Class getColumnClass(int columnIndex) {
            return types [columnIndex];
        }
            
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit [columnIndex];
        }
    });
    } else {
    String hashrates = parser.getHashRate("&username=" + eligius_name);
    EligiusHashRateInformationTable.setModel(new javax.swing.table.DefaultTableModel(
        new Object [][] {
            {"12 Hours", parser.getHashRateIntervals(hashrates, "av43200").get(0), parser.getHashRateIntervals(hashrates, "av43200").get(1)},
            {"3 Hours", parser.getHashRateIntervals(hashrates, "av10800").get(0), parser.getHashRateIntervals(hashrates, "av10800").get(1)},
            {"22.5 Minutes", parser.getHashRateIntervals(hashrates, "av1350").get(0), parser.getHashRateIntervals(hashrates, "av1350").get(1)},
            {"256 Seconds", parser.getHashRateIntervals(hashrates, "av256").get(0), parser.getHashRateIntervals(hashrates, "av256").get(1)},
            {"128 Seconds", parser.getHashRateIntervals(hashrates, "av128").get(0), parser.getHashRateIntervals(hashrates, "av128").get(1)}
        },
        new String [] {
            "Interval", "Hashrate", "Weighted Shares"
        }
    ) {
        Class[] types = new Class [] {
            java.lang.String.class, java.lang.String.class, java.lang.Integer.class
        };
        boolean[] canEdit = new boolean [] {
            false, false, false
        };
            
        public Class getColumnClass(int columnIndex) {
            return types [columnIndex];
        }
            
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit [columnIndex];
        }
    });
    }
    cfg.closeAll();
    EligiusHashRateInformationScrollPane.setViewportView(EligiusHashRateInformationTable);
    */
    EligiusPoolInformationRefreshButtonActionPerformed(null);

    /*
    Thread t = new Thread(new Runnable() {
    @Override
    public void run() {
        eligius_name = EligiusUsernameSelectionBox.getSelectedItem().toString();
        if (eligius_name.startsWith("Eligius not configured")) {
            EligiusPayoutInformationTable.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {"bal", null},
                    {"ec", null},
                    {"everpaid", null},
                    {"lbal", null},
                    {"lec", null}
                },
                new String [] {
                    "", "Amount"
                }
            ) {
                Class[] types = new Class [] {
                    java.lang.String.class, java.lang.String.class, java.lang.Integer.class
                };
                boolean[] canEdit = new boolean [] {
                    false, false, false
                };
            
                public Class getColumnClass(int columnIndex) {
                    return types [columnIndex];
                }
            
                public boolean isCellEditable(int rowIndex, int columnIndex) {
                    return canEdit [columnIndex];
                }}
            );
        } else {
            String stats = parser.getUserStat("&username=" + eligius_name);
            EligiusPayoutInformationTable.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                    {"bal", parser.getUserStats(stats, "bal")},
                    {"ec", parser.getUserStats(stats, "ec")},
                    {"everpaid", parser.getUserStats(stats, "everpaid")},
                    {"lbal", parser.getUserStats(stats, "lbal")},
                    {"lec", parser.getUserStats(stats, "lec")}
                },
                new String [] {
                    "", "Amount"
                }
            ) {
                Class[] types = new Class [] {
                    java.lang.String.class, java.lang.String.class, java.lang.Integer.class
                };
                boolean[] canEdit = new boolean [] {
                    false, false, false
                };
            
                public Class getColumnClass(int columnIndex) {
                    return types [columnIndex];
                }
            
                public boolean isCellEditable(int rowIndex, int columnIndex) {
                    return canEdit [columnIndex];
                }}
            );
            BFGMinerAPICoinbase coinbase = new BFGMinerAPICoinbase();
            String rate = coinbase.getContent("https://coinbase.com/api/v1/currencies/exchange_rates", "btc_to_usd");
            String payout = EligiusPayoutInformationTable.getValueAt(0, 1).toString().replace(" BTC", "");
            BTCConversionRateTextField.setText(rate);
            EstimatedPayoutTextField.setText(String.valueOf(Float.parseFloat(rate)* Float.parseFloat(payout)));
            
        }
        //BFGMinerAPICoinbase coinbase = new BFGMinerAPICoinbase();
        //BTCConversionRateTextField.setText(coinbase.getContent("https://coinbase.com/api/v1/currencies/exchange_rates", "btc_to_usd"));
        //if (EligiusPayoutInformationTable.getValueAt(0, 1) != null) {
            //    System.out.println(EligiusPayoutInformationTable.getValueAt(0, 1).toString());
            //} else {
            //    System.out.println("No Value yet");
            //}
        EligiusPayoutInformationTable.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                EligiusPayoutInformationTablePropertyChange(evt);
            }
        });
        EligiusPayoutInformationPayoutScrollPane.setViewportView(EligiusPayoutInformationTable);
    }
    });
    t.start();
    */
    //EligiusPayoutInformationTableAncestorRemoved(null);

    EligiusPoolInformationRefreshButton.setText("Refresh");
    EligiusPoolInformationRefreshButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EligiusPoolInformationRefreshButtonActionPerformed(evt);
        }
    });

    EligiousPayoutKeyInformationTextPane.setFont(new Font("Dialog", Font.PLAIN, 14));
    EligiousPayoutKeyInformationTextPane.setContentType("text/html");
    EligiousPayoutKeyInformationTextPane.setText(
            "<html><ul><li><em><b>bal</b></em> - Current unpaid balance including estimates for the current round</li>"
                    + "<li><em><b>ec</b></em> - Sum of CPPSRB shelved shares and SMPPS extra credit (if applicable) including estimates for the current round</li>"
                    + "<li><em><b>everpaid</b></em> - Total actually paid (and verifyable in the blockchain) to this miner</li>"
                    + "<li><em><b>lbal</b></em> - Unpaid balance as of the last block (no estimates)</li>"
                    + "<li><em><b>lec</b></em> - Sum of CPPSRB shelved shares and SMPPS extra credit (if applicable) as of the last block (no estimates)</li></ul></html>");
    EligiousPayoutKeyInformationTextPane.setEditable(false);
    EligiusPayoutKeyInformationScrollPane.setViewportView(EligiousPayoutKeyInformationTextPane);

    existing_eligius = currentEligius();
    EligiusUsernameSelectionBox.setModel(new javax.swing.DefaultComboBoxModel(existing_eligius.toArray()));
    EligiusUsernameSelectionBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EligiusUsernameSelectionBoxActionPerformed(evt);
        }
    });

    EligiusUsernameClipboardCopyButton.setText("Copy To Clipboard");
    EligiusUsernameClipboardCopyButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EligiusUsernameClipboardCopyButtonActionPerformed(evt);
        }
    });

    EligiusPoolCurrentUsernameLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 12)); // NOI18N
    EligiusPoolCurrentUsernameLabel.setText("Eligius Username:");

    EligiusOpenBrowserButton.setText("Open Eligius in Browser");
    EligiusOpenBrowserButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            EligiusOpenBrowserButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout EligiusPoolInformationPanelLayout = new javax.swing.GroupLayout(
            EligiusPoolInformationPanel);
    EligiusPoolInformationPanel.setLayout(EligiusPoolInformationPanelLayout);
    EligiusPoolInformationPanelLayout.setHorizontalGroup(EligiusPoolInformationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EligiusPoolInformationPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(EligiusPoolInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(EligiusPayoutKeyInformationScrollPane,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 695,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(EligiusPoolInformationPanelLayout.createSequentialGroup()
                                    .addComponent(EligiusPayoutInformationPayoutScrollPane,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(EligiusPoolInformationRefreshButton))
                            .addComponent(EligiusHashRateInformationScrollPane,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(EligiusPoolInformationPanelLayout.createSequentialGroup()
                                    .addGroup(EligiusPoolInformationPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    false)
                                            .addGroup(EligiusPoolInformationPanelLayout.createSequentialGroup()
                                                    .addComponent(EligiusStatusLabel,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 408,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE)
                                                    .addComponent(EligiusUsernameClipboardCopyButton))
                                            .addGroup(EligiusPoolInformationPanelLayout.createSequentialGroup()
                                                    .addComponent(EligiusPoolCurrentUsernameLabel)
                                                    .addGap(3, 3, 3).addComponent(EligiusUsernameSelectionBox,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 459,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(EligiusOpenBrowserButton)))
                    .addGap(14, 14, 14)));
    EligiusPoolInformationPanelLayout.setVerticalGroup(EligiusPoolInformationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(EligiusPoolInformationPanelLayout.createSequentialGroup().addGap(13, 13, 13)
                    .addGroup(EligiusPoolInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(EligiusUsernameSelectionBox, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(EligiusPoolCurrentUsernameLabel))
                    .addGap(16, 16, 16)
                    .addGroup(EligiusPoolInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(EligiusStatusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 18,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(EligiusUsernameClipboardCopyButton)
                            .addComponent(EligiusOpenBrowserButton))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(EligiusHashRateInformationScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE,
                            113, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(EligiusPoolInformationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(EligiusPayoutInformationPayoutScrollPane,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 126,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(EligiusPoolInformationRefreshButton))
                    .addGap(18, 18, 18).addComponent(EligiusPayoutKeyInformationScrollPane,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));

    BitcoinInformationTabbedPane.addTab("Pool Information", EligiusPoolInformationPanel);

    javax.swing.GroupLayout BTCInformationPaneLayout = new javax.swing.GroupLayout(BTCInformationPane);
    BTCInformationPane.setLayout(BTCInformationPaneLayout);
    BTCInformationPaneLayout.setHorizontalGroup(
            BTCInformationPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(BitcoinInformationTabbedPane));
    BTCInformationPaneLayout.setVerticalGroup(
            BTCInformationPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(BitcoinInformationTabbedPane));

    MainTabbedPane.addTab("Bitcoin Information", BTCInformationPane);

    MinerConfigurationPanel.addFocusListener(new java.awt.event.FocusAdapter() {
        public void focusGained(java.awt.event.FocusEvent evt) {
            MinerConfigurationPanelFocusGained(evt);
        }
    });

    ConfigurationPromptLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    ConfigurationPromptLabel
            .setText("Please fill in the following form to configure this interface. Changes are persistent.");

    ConfigurationRemoveMinerButton.setText("Remove Miner");
    ConfigurationRemoveMinerButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ConfigurationRemoveMinerButtonActionPerformed(evt);
        }
    });

    ConfigurationAddMinerButton.setText("Add Miner");
    ConfigurationAddMinerButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ConfigurationAddMinerButtonActionPerformed(evt);
        }
    });

    ConfigurationAddMinerNameLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ConfigurationAddMinerNameLabel.setText("Miner Name:");

    ConfigurationAddMinerIPLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ConfigurationAddMinerIPLabel.setText("Miner IP:");

    ConfigurationMinerPortLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ConfigurationMinerPortLabel.setText("Miner Port:");

    ConfigurationAddMinersLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    ConfigurationAddMinersLabel.setText("Add Miners");

    ConfigurationRemoveMinersLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    ConfigurationRemoveMinersLabel.setText("Remove Miners");

    ConfigurationRemoveMinerNameLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ConfigurationRemoveMinerNameLabel.setText("Miner Name:");

    ConfigurationCurrentMinersLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    ConfigurationCurrentMinersLabel.setText("Current Miners:");

    ConfigurationRemoveMinerIPLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ConfigurationRemoveMinerIPLabel.setText("or Miner IP:");

    ConfigurationResolveHostAddressLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ConfigurationResolveHostAddressLabel.setText("Resolve host address:");

    ConfigurationResolveHostAddressButton.setText("Get IP");
    ConfigurationResolveHostAddressButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ConfigurationResolveHostAddressButtonActionPerformed(evt);
        }
    });

    ConfigurationCurrentMinersTextPane.setEditable(false);
    ConfigurationCurrentMinersTextPane.setFont(new Font("Monospaced", 0, 12)); // NOI18N
    ConfigurationCurrentMinersTextPane.setContentType("text/html");
    org.planetcrypto.bitcoin.PlanetCryptoBitcoinUserConfiguration current_miners_configuration = new org.planetcrypto.bitcoin.PlanetCryptoBitcoinUserConfiguration();
    ConfigurationCurrentMinersTextPane.setText(current_miners_configuration.currentMiners());
    current_miners_configuration.closeAll();
    ConfigurationCurrentMinersTextPane.setEditable(false);
    ConfigurationCurrentMinersScrollPane.setViewportView(ConfigurationCurrentMinersTextPane);

    javax.swing.GroupLayout MinerConfigurationPanelLayout = new javax.swing.GroupLayout(
            MinerConfigurationPanel);
    MinerConfigurationPanel.setLayout(MinerConfigurationPanelLayout);
    MinerConfigurationPanelLayout.setHorizontalGroup(MinerConfigurationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MinerConfigurationPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(MinerConfigurationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(MinerConfigurationPanelLayout.createSequentialGroup()
                                    .addComponent(ConfigurationRemoveMinerNameLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(ConfigurationRemoveMinerNameTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 123,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(ConfigurationRemoveMinerIPLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(ConfigurationRemoveMinerIPTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 129,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(ConfigurationRemoveMinerButton))
                            .addComponent(ConfigurationPromptLabel).addComponent(ConfigurationAddMinersLabel)
                            .addComponent(ConfigurationRemoveMinersLabel)
                            .addComponent(ConfigurationCurrentMinersLabel)
                            .addGroup(MinerConfigurationPanelLayout.createSequentialGroup()
                                    .addGroup(MinerConfigurationPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                                    MinerConfigurationPanelLayout.createSequentialGroup()
                                                            .addComponent(ConfigurationResolveHostAddressLabel)
                                                            .addPreferredGap(
                                                                    javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                            .addComponent(
                                                                    ConfigurationResolveHostAddressTextField,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 168,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addPreferredGap(
                                                                    javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                            .addComponent(
                                                                    ConfigurationResolveHostAddressButton))
                                            .addGroup(MinerConfigurationPanelLayout.createSequentialGroup()
                                                    .addComponent(ConfigurationAddMinerNameLabel)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(ConfigurationAddMinerNameTextField,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 126,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(21, 21, 21)
                                                    .addComponent(ConfigurationAddMinerIPLabel)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(ConfigurationAddMinerIPTextField,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 129,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(ConfigurationMinerPortLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(ConfigurationMinerPortTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 61,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(43, 43, 43).addComponent(ConfigurationAddMinerButton))
                            .addComponent(ConfigurationCurrentMinersScrollPane,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 333,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    MinerConfigurationPanelLayout.setVerticalGroup(MinerConfigurationPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(MinerConfigurationPanelLayout.createSequentialGroup().addGap(16, 16, 16)
                    .addComponent(ConfigurationPromptLabel)
                    .addGroup(MinerConfigurationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(MinerConfigurationPanelLayout.createSequentialGroup().addGap(16, 16, 16)
                                    .addComponent(ConfigurationAddMinersLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(MinerConfigurationPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(ConfigurationAddMinerNameLabel)
                                            .addComponent(ConfigurationAddMinerNameTextField,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(ConfigurationAddMinerIPLabel)
                                            .addComponent(ConfigurationAddMinerIPTextField,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(ConfigurationMinerPortLabel)
                                            .addComponent(ConfigurationMinerPortTextField,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(MinerConfigurationPanelLayout.createSequentialGroup().addGap(37, 37, 37)
                                    .addComponent(ConfigurationAddMinerButton)))
                    .addGap(35, 35, 35)
                    .addGroup(MinerConfigurationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ConfigurationResolveHostAddressLabel)
                            .addComponent(ConfigurationResolveHostAddressTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ConfigurationResolveHostAddressButton))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(ConfigurationRemoveMinersLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(MinerConfigurationPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ConfigurationRemoveMinerNameLabel)
                            .addComponent(ConfigurationRemoveMinerNameTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ConfigurationRemoveMinerIPLabel)
                            .addComponent(ConfigurationRemoveMinerIPTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ConfigurationRemoveMinerButton))
                    .addGap(25, 25, 25).addComponent(ConfigurationCurrentMinersLabel).addGap(33, 33, 33)
                    .addComponent(ConfigurationCurrentMinersScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE,
                            209, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    ConfigurationTabbedPane.addTab("Miners", MinerConfigurationPanel);

    ConfigurationAlarmSettingsPromptLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    ConfigurationAlarmSettingsPromptLabel.setText("Configure Alarm Settings Here.");

    ConfigurationMinerTemperatureAlarmLabel.setText("Temperature:");

    ConfigurationMinerFanSpeedAlarmLabel.setText("Fan Speed:");

    ConfigurationMinerHashRateAlarmLabel.setText("Hash Rate:");

    MinerSelectionForAlarmsBox.setModel(new javax.swing.DefaultComboBoxModel(miners.toArray()));

    binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(
            org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, MinerSelectionBox5,
            org.jdesktop.beansbinding.ELProperty.create("${selectedItem}"), MinerSelectionForAlarmsBox,
            org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
    bindingGroup.addBinding(binding);

    AlarmsCurrentMinerLabel.setText("Current Miner:");

    ConfigurationAlarmsHWErrPercentLabel.setText("Hardware Errors:");

    ConfigurationMinerTempAlarmTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

    ConfigurationFanSpeedAlarmTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

    ConfigurationMinerHashRateAlarmTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

    ConfigurationMinerHardwareErrPercentAlarmTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

    ConfigurationDegreesCelsiusLabel.setText("C");

    ConfigurationFanRPMLabel.setText("RPM");

    ConfigurationHashRatePostfixComboBox
            .setModel(new javax.swing.DefaultComboBoxModel(new String[] { "TH/s", "GH/s", "MH/s" }));
    ConfigurationHashRatePostfixComboBox.setSelectedIndex(1);

    ConfigurationHWErrorPercentLabel.setText("%");

    ConfigurationMinerTempAlarmUpdateButton.setText("Update");
    ConfigurationMinerTempAlarmUpdateButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ConfigurationMinerTempAlarmUpdateButtonActionPerformed(evt);
        }
    });

    ConfigurationMinerFanSpeedAlarmUpdateButton.setText("Update");
    ConfigurationMinerFanSpeedAlarmUpdateButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ConfigurationMinerFanSpeedAlarmUpdateButtonActionPerformed(evt);
        }
    });

    ConfigurationMinerHashRateAlarmUpdateButton.setText("Update");
    ConfigurationMinerHashRateAlarmUpdateButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ConfigurationMinerHashRateAlarmUpdateButtonActionPerformed(evt);
        }
    });

    ConfigurationMinerHardwareErrPercentAlarmUpdateButton.setText("Update");
    ConfigurationMinerHardwareErrPercentAlarmUpdateButton
            .addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    ConfigurationMinerHardwareErrPercentAlarmUpdateButtonActionPerformed(evt);
                }
            });

    ConfigurationCurrentMinerAlarmsTextPane.setContentType(("text/html"));
    /*StringBuffer current_alarms = new StringBuffer();
    String temp = new String();
    Object temp_type = new Object();
    HashMap<String, Object> temp_alarms = new HashMap<>();
    current_alarms.append(CurrentAlarmsHeader);
    System.out.println(existing_miners.toString());
    for (int i = 0; i < existing_miners.size(); i++) {
    temp = existing_miners.get(i).get("name");
    if (temp.equals("No Miners")) {
        current_alarms.append(newrow);
        for (int j = 0; j < 5; j++) {
            current_alarms.append("None");
            if (j == 4) {
                break;
            }
            current_alarms.append(newcolumn);
        }
        current_alarms.append(closerow);
        current_alarms.append(VitalStatsFooter);
        System.out.println(current_alarms.toString());
        break;
    }
    temp_alarms = cfg.getAlarms(temp);
    if (temp_alarms == null) {
        current_alarms.append(newrow);
        current_alarms.append(temp);
        current_alarms.append(newcolumn);
        for (int j = 0; j < 4; j++) {
            current_alarms.append("None");
            if (j == 3) {
                break;
            }
            current_alarms.append(newcolumn);
        }
        current_alarms.append(closerow);
        current_alarms.append(VitalStatsFooter);
        System.out.println(current_alarms.toString());
        break;
    }
    current_alarms.append(newrow);
    current_alarms.append(temp);
    current_alarms.append(newcolumn);
    current_alarms.append(temp_alarms.get("fan"));
    current_alarms.append(newcolumn);
    current_alarms.append(temp_alarms.get("temp"));
    current_alarms.append(newcolumn);
    temp_type = temp_alarms.get("hash_rate_type");
    temp_type = (temp_type == null) ? "GH/s" : temp_type.toString();
    current_alarms.append(temp_alarms.get("hash_rate") + " " + temp_type);
    current_alarms.append(newcolumn);
    current_alarms.append(temp_alarms.get("hw_err"));
    current_alarms.append(closerow);
    current_alarms.append(VitalStatsFooter);
    }
    ConfigurationCurrentMinerAlarmsTextPane.setText(current_alarms.toString());
    */
    ConfigurationCurrentMinerAlarmsTextPanePropertyChange(null);
    ConfigurationCurrentMinerAlarmsTextPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            ConfigurationCurrentMinerAlarmsTextPanePropertyChange(evt);
        }
    });
    ConfigurationCurrentMinerAlarmsScrollPane.setViewportView(ConfigurationCurrentMinerAlarmsTextPane);

    ConfigurationCurrentMinerAlarmsLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 12)); // NOI18N
    ConfigurationCurrentMinerAlarmsLabel.setText("Current alarms:");

    javax.swing.GroupLayout ConfigurationAlarmPanelLayout = new javax.swing.GroupLayout(
            ConfigurationAlarmPanel);
    ConfigurationAlarmPanel.setLayout(ConfigurationAlarmPanelLayout);
    ConfigurationAlarmPanelLayout.setHorizontalGroup(ConfigurationAlarmPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ConfigurationAlarmPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(ConfigurationAlarmPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ConfigurationCurrentMinerAlarmsScrollPane,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 371,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(ConfigurationAlarmPanelLayout.createSequentialGroup()
                                    .addGroup(ConfigurationAlarmPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(ConfigurationAlarmSettingsPromptLabel,
                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(ConfigurationAlarmPanelLayout.createSequentialGroup()
                                                    .addGroup(ConfigurationAlarmPanelLayout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                                                    false)
                                                            .addComponent(ConfigurationAlarmsHWErrPercentLabel,
                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(
                                                                    ConfigurationMinerTemperatureAlarmLabel,
                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(ConfigurationMinerFanSpeedAlarmLabel,
                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(ConfigurationMinerHashRateAlarmLabel,
                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE)
                                                            .addComponent(AlarmsCurrentMinerLabel,
                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                    Short.MAX_VALUE))
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addGroup(ConfigurationAlarmPanelLayout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                            .addComponent(MinerSelectionForAlarmsBox,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 173,
                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                            .addGroup(ConfigurationAlarmPanelLayout
                                                                    .createSequentialGroup()
                                                                    .addGroup(ConfigurationAlarmPanelLayout
                                                                            .createParallelGroup(
                                                                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                                                                    false)
                                                                            .addComponent(
                                                                                    ConfigurationMinerHardwareErrPercentAlarmTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                    129, Short.MAX_VALUE)
                                                                            .addComponent(
                                                                                    ConfigurationMinerHashRateAlarmTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addComponent(
                                                                                    ConfigurationFanSpeedAlarmTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addComponent(
                                                                                    ConfigurationMinerTempAlarmTextField,
                                                                                    javax.swing.GroupLayout.Alignment.LEADING))
                                                                    .addPreferredGap(
                                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                    .addGroup(ConfigurationAlarmPanelLayout
                                                                            .createParallelGroup(
                                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                                            .addComponent(
                                                                                    ConfigurationDegreesCelsiusLabel)
                                                                            .addComponent(
                                                                                    ConfigurationFanRPMLabel)
                                                                            .addComponent(
                                                                                    ConfigurationHashRatePostfixComboBox,
                                                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                                                            .addComponent(
                                                                                    ConfigurationHWErrorPercentLabel))))))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(ConfigurationAlarmPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(ConfigurationMinerHashRateAlarmUpdateButton)
                                            .addComponent(ConfigurationMinerHardwareErrPercentAlarmUpdateButton)
                                            .addComponent(ConfigurationMinerTempAlarmUpdateButton)
                                            .addComponent(ConfigurationMinerFanSpeedAlarmUpdateButton)))
                            .addComponent(ConfigurationCurrentMinerAlarmsLabel))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    ConfigurationAlarmPanelLayout.setVerticalGroup(ConfigurationAlarmPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ConfigurationAlarmPanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(ConfigurationAlarmSettingsPromptLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(ConfigurationAlarmPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(AlarmsCurrentMinerLabel).addComponent(MinerSelectionForAlarmsBox,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(ConfigurationAlarmPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ConfigurationMinerTemperatureAlarmLabel)
                            .addComponent(ConfigurationMinerTempAlarmTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ConfigurationDegreesCelsiusLabel)
                            .addComponent(ConfigurationMinerTempAlarmUpdateButton))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(ConfigurationAlarmPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ConfigurationMinerFanSpeedAlarmLabel)
                            .addComponent(ConfigurationFanSpeedAlarmTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ConfigurationFanRPMLabel)
                            .addComponent(ConfigurationMinerFanSpeedAlarmUpdateButton))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(ConfigurationAlarmPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ConfigurationMinerHashRateAlarmLabel)
                            .addComponent(ConfigurationMinerHashRateAlarmTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ConfigurationHashRatePostfixComboBox,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ConfigurationMinerHashRateAlarmUpdateButton))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(ConfigurationAlarmPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(ConfigurationAlarmsHWErrPercentLabel)
                            .addComponent(ConfigurationMinerHardwareErrPercentAlarmTextField,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ConfigurationHWErrorPercentLabel)
                            .addComponent(ConfigurationMinerHardwareErrPercentAlarmUpdateButton))
                    .addGap(18, 18, 18).addComponent(ConfigurationCurrentMinerAlarmsLabel).addGap(18, 18, 18)
                    .addComponent(ConfigurationCurrentMinerAlarmsScrollPane,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    ConfigurationTabbedPane.addTab("Alarms", ConfigurationAlarmPanel);

    ConfigurationEligiusLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    ConfigurationEligiusLabel.setText("Eligius");

    ConfigurationMiningPoolPromptLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 18)); // NOI18N
    ConfigurationMiningPoolPromptLabel.setText("Use this tab to configure mining pools");

    ConfigurationEligiusUsernameLabel.setText("Eligius Username*:");

    ConfigurationEligiusHelpPromptLabel.setFont(new java.awt.Font("Monospaced", 0, 10)); // NOI18N
    ConfigurationEligiusHelpPromptLabel.setText("*For more information about these fields, please see help*");

    ConfigurationEligiusUsernameAddButton.setText("Add");
    ConfigurationEligiusUsernameAddButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ConfigurationEligiusUsernameAddButtonActionPerformed(evt);
        }
    });

    ConfigurationEligiusUsernameRemoveButton.setText("Remove");
    ConfigurationEligiusUsernameRemoveButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            ConfigurationEligiusUsernameRemoveButtonActionPerformed(evt);
        }
    });

    ConfigurationEligiusExampleLabel.setFont(new java.awt.Font("DejaVu Serif", 0, 10)); // NOI18N
    ConfigurationEligiusExampleLabel.setText(
            "*User name is the same as Mining Address for example: \"1EXfBqvLTyFbL6Dr5CG1fjxNKEPSezg7yF\"");

    javax.swing.GroupLayout ConfigurationEligiusPoolsPanelLayout = new javax.swing.GroupLayout(
            ConfigurationEligiusPoolsPanel);
    ConfigurationEligiusPoolsPanel.setLayout(ConfigurationEligiusPoolsPanelLayout);
    ConfigurationEligiusPoolsPanelLayout.setHorizontalGroup(ConfigurationEligiusPoolsPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ConfigurationEligiusPoolsPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(ConfigurationEligiusPoolsPanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ConfigurationEligiusPoolsPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(ConfigurationEligiusPoolsPanelLayout.createSequentialGroup()
                                            .addComponent(ConfigurationMiningPoolPromptLabel)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(ConfigurationEligiusHelpPromptLabel))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING,
                                            ConfigurationEligiusPoolsPanelLayout.createSequentialGroup()
                                                    .addComponent(ConfigurationEligiusUsernameLabel)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                    .addComponent(ConfigurationEligiusUsernameTextField,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 256,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(18, 18, 18)
                                                    .addComponent(ConfigurationEligiusUsernameAddButton)
                                                    .addPreferredGap(
                                                            javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                    .addComponent(ConfigurationEligiusUsernameRemoveButton)))
                            .addComponent(ConfigurationEligiusLabel)
                            .addGroup(ConfigurationEligiusPoolsPanelLayout.createSequentialGroup()
                                    .addGap(12, 12, 12).addComponent(ConfigurationEligiusExampleLabel,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 527,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    ConfigurationEligiusPoolsPanelLayout.setVerticalGroup(
            ConfigurationEligiusPoolsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ConfigurationEligiusPoolsPanelLayout.createSequentialGroup().addContainerGap()
                            .addGroup(ConfigurationEligiusPoolsPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(ConfigurationEligiusHelpPromptLabel)
                                    .addComponent(ConfigurationMiningPoolPromptLabel))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(ConfigurationEligiusLabel)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(ConfigurationEligiusPoolsPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(ConfigurationEligiusUsernameLabel)
                                    .addComponent(ConfigurationEligiusUsernameTextField,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(ConfigurationEligiusUsernameAddButton)
                                    .addComponent(ConfigurationEligiusUsernameRemoveButton))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(ConfigurationEligiusExampleLabel)
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    ConfigurationTabbedPane.addTab("Pools", ConfigurationEligiusPoolsPanel);

    ConfigurationCoinExchangePanel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N

    ConfigurationCoinbaseLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    ConfigurationCoinbaseLabel.setText("Configure Coinbase Here");

    ConfigurationCoinbaseCurrencyLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    ConfigurationCoinbaseCurrencyLabel.setText("Preferred Exchange Currency:");

    ConfigurationCoinbaseCurrencyComboBox.setModel(
            new javax.swing.DefaultComboBoxModel(PlanetCryptoBitcoinCoinbaseCurrency.coinbaseCurrencies()));
    /*
    new javax.swing.DefaultComboBoxModel(
    new String[]{ "Select", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN", "BAM", "BBD",
        "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BRL", "BSD", "BTC", "BTN", "BWP",
        "BYR", "BZD", "CAD", "CDF", "CHF", "CLP", "CNY", "COP", "CRC", "CUP", "CVE", "CZK",
        "DJF", "DKK", "DOP", "DZD", "EEK", "EGP", "ERN", "ETB", "EUR", "FJD", "FKP", "GBP", "GEL",
        "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR",
        "ILS", "INR", "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW",
        "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LVL", "LYD", "MAD",
        "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MYR",
        "MZN", "NAD", "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", "PKR",
        "PLN", "PYG", "QAR", "RON", "RSD", "RUB", "RWF", "SAR", "SBD", "SCR", "SDG", "SEK", "SGD",
        "SHP", "SLL", "SOS", "SRD", "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMM", "TND", "TOP",
        "TRY", "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "UY", "UZS", "VEF", "VND", "VUV", "WST",
        "XAF", "XCD", "XOF", "XPF", "YER", "ZAR", "ZMK", "ZWL" }
    */

    CoinbaseInformationLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    CoinbaseInformationLabel.setText("Coinbase User API Information");

    CoinbaseUsernameLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    CoinbaseUsernameLabel.setText("Coinbase Username:");

    CoinbaseAPIKeyLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    CoinbaseAPIKeyLabel.setText("Coinbase API Key:");

    CoinbaseAPISecretKeyLabel.setFont(new java.awt.Font("DejaVu Serif", 1, 12)); // NOI18N
    CoinbaseAPISecretKeyLabel.setText("Coinbase API Secret:");

    AddCoinbaseUsernameButton.setText("Add/Update");
    AddCoinbaseUsernameButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            AddCoinbaseUsernameButtonActionPerformed(evt);
        }
    });

    RemoveCoinbaseUsernameButton.setText("Remove");
    RemoveCoinbaseUsernameButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            RemoveCoinbaseUsernameButtonActionPerformed(evt);
        }
    });

    CurrentCoinbaseConfigurationLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    CurrentCoinbaseConfigurationLabel.setText("Current Coinbase Configuration:");

    CurrentCoinbaseConfigurationTextPane.setEditable(false);
    CurrentCoinbaseConfigurationTextPane.setContentType("text/html"); // NOI18N
    /*
    existing_coinbase = currentCoinbase();
    if (existing_coinbase == null) {
        CurrentCoinbaseConfigurationTextPane.setText("<html><body><p><b>No Configuration</b></p></body></html>");
    } else {
        CurrentCoinbaseConfigurationTextPane.setText(existing_coinbase.toString());
    }
    */
    CurrentCoinbaseConfigurationTextPane.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent evt) {
            CurrentCoinbaseConfigurationTextPanePropertyChange(evt);
        }
    });
    CurrentCoinbaseConfigurationScrollPane.setViewportView(CurrentCoinbaseConfigurationTextPane);

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

    CoinbaseConfigurationInstructionsTextPane.setEditable(false);
    CoinbaseConfigurationInstructionsTextPane.setContentType("text/html"); // NOI18N
    CoinbaseConfigurationInstructionsTextPane.setFont(new java.awt.Font("DejaVu Serif", 0, 12)); // NOI18N
    CoinbaseConfigurationInstructionsTextPane.setText(
            "<html>\n  <head>\n    <style>\n    body {background:#D6D9DF }\n   </style>\n  </head>\n  <body>\n    <ul>\n      <li>At a minimum <b>Coinbase Username</b> and <b>Preferred Exchange Currency</b> are required.</li>\n      <li>To add the minimum required parameters: \n           <ol>\n              <li>Enter the <b>Coinbase Username</b> to add</li>\n              <li>Select your <b>Preferred Exchange Currency</b></li>\n              <li>Click <b>Add/Update</b></li>\n           </ol>\n         </li>\n      <li>To add an API Key:\n           <ol>\n            <li>Enter the <b>Coinbase Username</b> to associate with key</li>\n            <li>Enter <b>Coinbase API Key</b> value</li>\n            <li>Enter <b>Coinbase API Secret</b> Value</li>\n            <li>Select your <b>Preferred Exchange Currency</b></li>\n            <li>Click <b>Add/Update</b></li>\n           </ol>\n         </li>\n      <li>To update/remove configuration associated with a <b>Coinbase Username</b></li>\n         <ol>\n           <li>Enter the <b>Coinbase Username</b> to update</li>\n           <li><b>If removing this configuration, simply click \"Remove\"</b></li>\n           <ul><li><b>Warning: This will remove ALL information from this app associated with this Coinbase Username</b></li></ul>\n           <li><b>If updating this configuration:</b></li>\n           <ul><li>Enter/Select the field to update, and click <b>Add/Update</b></li></ul>\n         </ol>\n    </ul>\n  </body>\n</html>\n");
    CoinbaseConfigurationInstructionsTextPane.setCaretPosition(0);
    CoinbaseConfigurationInstructionsScrollPane.setViewportView(CoinbaseConfigurationInstructionsTextPane);

    CoinbaseConfigurationInstructionsLabel.setFont(new java.awt.Font("DejaVu Serif", 3, 14)); // NOI18N
    CoinbaseConfigurationInstructionsLabel.setText("Configuration Instructions:");

    javax.swing.GroupLayout ConfigurationCoinExchangePanelLayout = new javax.swing.GroupLayout(
            ConfigurationCoinExchangePanel);
    ConfigurationCoinExchangePanel.setLayout(ConfigurationCoinExchangePanelLayout);
    ConfigurationCoinExchangePanelLayout.setHorizontalGroup(ConfigurationCoinExchangePanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ConfigurationCoinExchangePanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(ConfigurationCoinExchangePanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(CurrentCoinbaseConfigurationScrollPane)
                            .addComponent(ConfigurationCoinbaseLabel)
                            .addGroup(ConfigurationCoinExchangePanelLayout.createSequentialGroup()
                                    .addGroup(ConfigurationCoinExchangePanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(ConfigurationCoinExchangePanelLayout
                                                    .createSequentialGroup()
                                                    .addGroup(ConfigurationCoinExchangePanelLayout
                                                            .createParallelGroup(
                                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                                            .addGroup(
                                                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                                                    ConfigurationCoinExchangePanelLayout
                                                                            .createSequentialGroup()
                                                                            .addComponent(
                                                                                    ConfigurationCoinbaseCurrencyLabel)
                                                                            .addGap(18, 18, 18).addComponent(
                                                                                    ConfigurationCoinbaseCurrencyComboBox,
                                                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                                                    263,
                                                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                                            .addGroup(ConfigurationCoinExchangePanelLayout
                                                                    .createParallelGroup(
                                                                            javax.swing.GroupLayout.Alignment.TRAILING,
                                                                            false)
                                                                    .addComponent(
                                                                            CoinbaseConfigurationSeparator1,
                                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                                    .addComponent(CoinbaseInformationLabel,
                                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                                    .addGroup(
                                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                                            ConfigurationCoinExchangePanelLayout
                                                                                    .createSequentialGroup()
                                                                                    .addGroup(
                                                                                            ConfigurationCoinExchangePanelLayout
                                                                                                    .createParallelGroup(
                                                                                                            javax.swing.GroupLayout.Alignment.LEADING,
                                                                                                            false)
                                                                                                    .addComponent(
                                                                                                            CoinbaseUsernameLabel,
                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                            Short.MAX_VALUE)
                                                                                                    .addComponent(
                                                                                                            CoinbaseAPISecretKeyLabel,
                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                            Short.MAX_VALUE)
                                                                                                    .addComponent(
                                                                                                            CoinbaseAPIKeyLabel,
                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                            Short.MAX_VALUE))
                                                                                    .addGap(18, 18, 18)
                                                                                    .addGroup(
                                                                                            ConfigurationCoinExchangePanelLayout
                                                                                                    .createParallelGroup(
                                                                                                            javax.swing.GroupLayout.Alignment.LEADING)
                                                                                                    .addComponent(
                                                                                                            CoinbaseAPIUsernameTextField)
                                                                                                    .addComponent(
                                                                                                            CoinbaseAPIKeyTextField)
                                                                                                    .addComponent(
                                                                                                            CoinbaseAPISecretKeyTextField,
                                                                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                                                                            330,
                                                                                                            Short.MAX_VALUE)))
                                                                    .addComponent(
                                                                            CoinbaseConfigurationSeparator,
                                                                            javax.swing.GroupLayout.Alignment.LEADING)))
                                                    .addGap(0, 0, 0)
                                                    .addComponent(CoinbaseConfigurationVerticalSeparator,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(CurrentCoinbaseConfigurationLabel,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 266,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(32, 32, 32).addComponent(AddCoinbaseUsernameButton)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(RemoveCoinbaseUsernameButton))
                            .addComponent(CoinbaseConfigurationInstructionsLabel)
                            .addComponent(CoinbaseConfigurationInstructionsScrollPane,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, 791, Short.MAX_VALUE))
                    .addContainerGap(17, Short.MAX_VALUE)));
    ConfigurationCoinExchangePanelLayout.setVerticalGroup(ConfigurationCoinExchangePanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ConfigurationCoinExchangePanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(ConfigurationCoinbaseLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(ConfigurationCoinExchangePanelLayout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(ConfigurationCoinExchangePanelLayout.createSequentialGroup()
                                    .addComponent(CoinbaseConfigurationSeparator,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 10,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(CoinbaseInformationLabel)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(ConfigurationCoinExchangePanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(CoinbaseUsernameLabel)
                                            .addComponent(CoinbaseAPIUsernameTextField,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(ConfigurationCoinExchangePanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(CoinbaseAPIKeyLabel)
                                            .addComponent(CoinbaseAPIKeyTextField,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(AddCoinbaseUsernameButton)
                                            .addComponent(RemoveCoinbaseUsernameButton))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(ConfigurationCoinExchangePanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(CoinbaseAPISecretKeyTextField,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(CoinbaseAPISecretKeyLabel))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(ConfigurationCoinExchangePanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(ConfigurationCoinbaseCurrencyLabel)
                                            .addComponent(ConfigurationCoinbaseCurrencyComboBox,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(CoinbaseConfigurationSeparator1,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 10,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(ConfigurationCoinExchangePanelLayout.createSequentialGroup()
                                    .addComponent(CoinbaseConfigurationVerticalSeparator,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 172,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(CurrentCoinbaseConfigurationLabel)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(CurrentCoinbaseConfigurationScrollPane,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(CoinbaseConfigurationInstructionsLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(CoinbaseConfigurationInstructionsScrollPane,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(21, 21, 21)));

    ConfigurationTabbedPane.addTab("Coin Exchange", ConfigurationCoinExchangePanel);

    javax.swing.GroupLayout ConfigurationPanelLayout = new javax.swing.GroupLayout(ConfigurationPanel);
    ConfigurationPanel.setLayout(ConfigurationPanelLayout);
    ConfigurationPanelLayout.setHorizontalGroup(
            ConfigurationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                    javax.swing.GroupLayout.Alignment.TRAILING, ConfigurationPanelLayout.createSequentialGroup()
                            .addContainerGap().addComponent(ConfigurationTabbedPane).addContainerGap()));
    ConfigurationPanelLayout.setVerticalGroup(
            ConfigurationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ConfigurationTabbedPane));

    MainTabbedPane.addTab("Configuration", ConfigurationPanel);

    FileMenu.setText("File");

    FileExitMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q,
            java.awt.event.InputEvent.ALT_MASK));
    FileExitMenuItem.setText("Quit");
    FileExitMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            FileExitMenuItemActionPerformed(evt);
        }
    });
    FileMenu.add(FileExitMenuItem);

    BFGMInerUIMenuBar.add(FileMenu);

    EditMenu.setText("Edit");
    EditMenu.setMnemonic(KeyEvent.VK_E);

    CopyMenuItem.setText("Copy");
    CopyMenuItem.setMnemonic(KeyEvent.VK_C);
    EditMenu.add(CopyMenuItem);

    PasteMenuItem.setText("Paste");
    PasteMenuItem.setMnemonic(KeyEvent.VK_P);
    EditMenu.add(PasteMenuItem);

    BFGMInerUIMenuBar.add(EditMenu);

    HelpMenu.setText("Help");

    AppHelpMenuItem.setText("App Help");
    AppHelpMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            AppHelpMenuItemActionPerformed(evt);
        }
    });
    HelpMenu.add(AppHelpMenuItem);

    AboutMenuItem.setText("About BFGMinerAPI");
    AboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            AboutMenuItemActionPerformed(evt);
        }
    });
    HelpMenu.add(AboutMenuItem);

    BFGMInerUIMenuBar.add(HelpMenu);

    setJMenuBar(BFGMInerUIMenuBar);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(MainTabbedPane, javax.swing.GroupLayout.Alignment.TRAILING));
    layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(MainTabbedPane));

    MainTabbedPane.getAccessibleContext().setAccessibleName("");

    bindingGroup.bind();

    pack();
}

From source file:com.virtusa.isq.vtaf.runtime.SeleniumTestBase.java

/**
 * Get the selected text in webpage to the clipboard and compare the value
 * with the given input./*from  ww w  . j av  a  2s . com*/
 * 
 * @param value
 *            the value
 * @throws Exception
 *             the exception
 */

private void fireEventVerifyValue(final String value) throws Exception {

    String clipBoardText = "";
    Robot robot = getRobot();

    robot.keyPress(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_C);
    robot.keyRelease(KeyEvent.VK_C);
    robot.keyRelease(KeyEvent.VK_CONTROL);

    sleep(retryInterval);
    Transferable trans = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);

    try {
        if (trans != null) {
            clipBoardText = (String) trans.getTransferData(DataFlavor.stringFlavor);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    if (clipBoardText.equals(value)) {

        reportresult(true, "FIRE EVENT : VERIFY VALUE " + value + "", "PASSED", "");
    } else {

        reportresult(true, "FIRE EVENT : VERIFY VALUE " + value + "", "FAILED",
                "FIRE EVENT : VERIFY VALUE : value match expected. Actual : " + clipBoardText + " Expected : "
                        + value + "");
        checkTrue(false, true, "FIRE EVENT : VERIFY VALUE : value match expected. Actual : " + clipBoardText
                + " Expected : " + value + "");
    }
}

From source file:org.simmi.GeneSetHead.java

License:asdf

private void showGeneTable(
        /*final Map<String, Gene> genemap, final List<Gene> genelist, 
        final List<Function> funclist, final List<Set<String>> iclusterlist, final List<Set<String>> uclusterlist,
        final Map<Set<String>, ShareNum> specset,*/ final Map<Set<String>, ClusterInfo> clustInfoMap,
        final Button jb, final TableView<Gene> genetable, final TableView<Function> upper,
        final TableView<GeneGroup> lower, final ToolBar toolbar, final ToolBar btoolbar, final Container comp,
        final JApplet applet, final ComboBox<String> selcomblocal) throws IOException {
    //JSplitPane splitpane = new JSplitPane();
    //splitpane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    //splitpane.setDividerLocation(400);
    //JScrollPane scrollpane = new JScrollPane();

    /*table = new JTable() {
       public String getToolTipText(MouseEvent me) {
    Point p = me.getPoint();/*from ww  w  . java  2 s  .  c  om*/
    int r = rowAtPoint(p);
    int c = columnAtPoint(p);
    if (r >= 0 && r < super.getRowCount()) {
       Object ret = super.getValueAt(r, c);
       if (ret != null) {
          return ret.toString(); // super.getToolTipText( me );
       }
    }
    return "";
       }
    };*/

    //table.setDragEnabled(true);
    try {
        final DataFlavor df = new DataFlavor("text/plain;charset=utf-8");
        // System.err.println( df.getHumanPresentableName() + " " +
        // df.getPrimaryType() + " " + df.getSubType() + " " +
        // df.getMimeType() );
        // DataFlavor df1 = DataFlavor.getTextPlainUnicodeFlavor();
        // System.err.println( df.getHumanPresentableName() + " " +
        // df.getPrimaryType() + " " + df.getSubType() + " " +
        // df.getMimeType() );
        TransferHandler th = new TransferHandler() {
            /**
             * 
             */
            private static final long serialVersionUID = 1L;

            public int getSourceActions(JComponent c) {
                return TransferHandler.COPY_OR_MOVE;
            }

            public boolean canImport(TransferHandler.TransferSupport support) {
                return true;
            }

            protected Transferable createTransferable(JComponent c) {
                return new Transferable() {
                    @Override
                    public Object getTransferData(DataFlavor arg0)
                            throws UnsupportedFlavorException, IOException {
                        Map<String, List<Tegeval>> contigs = new HashMap<>();
                        StringBuilder ret = new StringBuilder();
                        for (Gene gg : gtable.getSelectionModel().getSelectedItems()) {
                            Tegeval tv = gg.tegeval;
                            if (!contigs.containsKey(tv.getContshort())) {
                                List<Tegeval> ltv = new ArrayList<>();
                                ltv.add(tv);
                                contigs.put(tv.getContshort().getName(), ltv);
                            } else {
                                List<Tegeval> ltv = contigs.get(tv.getContshort());
                                ltv.add(tv);
                            }
                            /*
                             * ret.append( ">" + tv.cont + " " +
                             * tv.teg + " " + tv.eval + "\n" );
                             * if( tv.dna != null ) { for( int i
                             * = 0; i < tv.dna.length(); i+=70 )
                             * { ret.append(tv.dna.substring( i,
                             * Math.min(i+70,tv.dna.length())
                             * )+"\n"); } }
                             */
                        }
                        for (String cont : contigs.keySet()) {
                            List<Tegeval> tv = contigs.get(cont);
                            String dna = tv.get(0).getSequence();
                            ret.append(">" + cont + "\n"); // + " " + tv.teg
                            // + " " +
                            // tv.eval +
                            // "\n" );
                            if (dna != null) {
                                for (int i = 0; i < dna.length(); i += 70) {
                                    ret.append(dna.substring(i, Math.min(i + 70, dna.length())) + "\n");
                                }
                            }
                        }
                        for (String cont : contigs.keySet()) {
                            List<Tegeval> ltv = contigs.get(cont);
                            ret.append(">" + cont + "\n"); // + " " + tv.teg
                            // + " " +
                            // tv.eval +
                            // "\n" );
                            for (Tegeval tv : ltv) {
                                ret.append("erm\t#0000ff\t" + tv.start + "\t" + tv.stop + "\n");
                            }
                        }

                        return new ByteArrayInputStream(ret.toString().getBytes());
                    }

                    @Override
                    public DataFlavor[] getTransferDataFlavors() {
                        return new DataFlavor[] { df };
                    }

                    @Override
                    public boolean isDataFlavorSupported(DataFlavor arg0) {
                        if (arg0.equals(df)) {
                            return true;
                        }
                        return false;
                    }
                };
            }

            public boolean importData(TransferHandler.TransferSupport support) {
                Object obj = null;

                System.err.println(support.getDataFlavors().length);
                int b = Arrays.binarySearch(support.getDataFlavors(), DataFlavor.javaFileListFlavor,
                        (o1, o2) -> o1 == o2 ? 1 : 0);

                try {
                    obj = support.getTransferable().getTransferData(DataFlavor.imageFlavor);
                } catch (UnsupportedFlavorException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                try {
                    if (obj != null && obj instanceof File[]) {
                        // File[] ff = (File[])obj;
                        // wbStuff( ff[0].getCanonicalPath() );
                    } else if (obj instanceof Image) {

                    } else {
                        obj = support.getTransferable().getTransferData(DataFlavor.stringFlavor);
                        System.err.println(obj);
                        URL url = null;
                        try {
                            url = new URL((String) obj);
                            Image image = ImageIO.read(url);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                } catch (UnsupportedFlavorException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                return true;
            }
        };
        //table.setTransferHandler(th);
    } catch (ClassNotFoundException e2) {
        e2.printStackTrace();
    }

    final Color darkgreen = new Color(0, 128, 0);
    final Color darkred = new Color(128, 0, 0);
    final Color darkblue = new Color(0, 0, 128);
    final Color darkmag = new Color(128, 0, 128);
    /*table.setDefaultRenderer(Teg.class, new DefaultTableCellRenderer() {
       @Override
       public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    Component label = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if( value == null ) {
       label.setBackground(Color.white);
    } else {
       cellRender();
    }
    return label;
       }
    });*/

    //table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    //table.setAutoCreateRowSorter(true);
    //scrollpane.setViewportView(table);

    Set<String> current = null;
    Set<String> currentko = null;
    InputStream is = GeneSet.class.getResourceAsStream("/kegg_pathways");
    BufferedReader br = new BufferedReader(new InputStreamReader(is));
    String line = br.readLine();
    while (line != null) {
        if (line.startsWith(">")) {
            current = new HashSet<>();
            currentko = new HashSet<>();
            geneset.pathwaymap.put(line.substring(1), current);
            geneset.pathwaykomap.put(line.substring(1), currentko);
        } else if (!line.startsWith("K")) {
            if (current != null) {
                String str = line.split("[\t ]+")[0];
                current.add(str);
            }
        } else {
            if (currentko != null) {
                String str = line.split("[\t ]+")[0];
                currentko.add(str);
            }
        }
        line = br.readLine();
    }
    br.close();

    //FileReader fr = new FileReader("/vg454flx/ko2go.txt");
    /*is = GeneSet.class.getResourceAsStream("/ko2go.txt");
    InputStreamReader isr = new InputStreamReader( is );
    br = new BufferedReader( isr );
    line = br.readLine();
    while (line != null) {
       String[] split = line.split(" = ");
       String[] subsplit = split[1].split(" ");
       Set<String> gos = new HashSet<String>();
       for( String go : subsplit ) {
    gos.add( go );
       }
       ko2go.put( split[0], gos );
       line = br.readLine();
    }
    br.close();*/

    final TextField textfield = new TextField();
    //JComponent topcomp = new JComponent() {};
    //topcomp.setLayout(new BorderLayout());
    //topcomp.add(scrollpane);

    textfield.setPrefSize(350, 25);

    final RadioButton search = new RadioButton("Search");
    final RadioButton filter = new RadioButton("Filter");

    ToggleGroup bgsf = new ToggleGroup();
    search.setToggleGroup(bgsf);
    filter.setToggleGroup(bgsf);
    //ButtonGroup bgsf = new ButtonGroup();
    //bgsf.add( search );
    //bgsf.add( filter );

    filter.setSelected(true);

    //ToolBar topcombo = new ToolBar();
    // topcombo.
    // topcombo.setLayout( new FlowLayout() );

    specombo = new ComboBox<>();
    combo = new ComboBox<>();

    specombo.getItems().add("Select blast species");
    combo.getItems().add("Select pathway");
    btoolbar.getItems().add(combo);
    btoolbar.getItems().add(specombo);
    //topcomp.add(topcombo, BorderLayout.SOUTH);

    //JComponent ttopcom = new JComponent() {};
    //ttopcom.setLayout(new FlowLayout());

    /*            frame.setVisible( true );
             }
          };
          AbstractAction   sharenumaction = new AbstractAction("Update share numbers") {
             @Override
             public void actionPerformed(ActionEvent e) {
    Set<String> specs = getSelspec(GeneSetHead.this, specList, null);
    updateShareNum(specs);
             }
          };
          AbstractAction   importgenesymbolaction = new AbstractAction("Import gene symbols") {
             @Override
             public void actionPerformed(ActionEvent e) {
    JFileChooser fc = new JFileChooser();
    if( fc.showOpenDialog( GeneSetHead.this ) == JFileChooser.APPROVE_OPTION ) {
       try {
          Map<String,String> env = new HashMap<String,String>();
          env.put("create", "true");
          Path path = zipfile.toPath();
          String uristr = "jar:" + path.toUri();
          geneset.zipuri = URI.create( uristr /*.replace("file://", "file:")* );
          geneset.zipfilesystem = FileSystems.newFileSystem( geneset.zipuri, env );
                  
          Path nf = geneset.zipfilesystem.getPath("/smap_short.txt");
          BufferedWriter bw = Files.newBufferedWriter(nf, StandardOpenOption.CREATE);
                  
          InputStream is = new GZIPInputStream( new FileInputStream( fc.getSelectedFile() ) );
          uni2symbol(new InputStreamReader(is), bw, unimap);
                  
          bw.close();
          //long bl = Files.copy( new ByteArrayInputStream( baos.toByteArray() ), nf, StandardCopyOption.REPLACE_EXISTING );
          geneset.zipfilesystem.close();
       } catch (IOException e1) {
          e1.printStackTrace();
       }
    }
             }
          };
                  
          AbstractAction   importidmappingaction = new AbstractAction("Id mapping") {
             @Override
             public void actionPerformed(ActionEvent e) {
    JFileChooser fc = new JFileChooser();
    if( fc.showOpenDialog( GeneSetHead.this ) == JFileChooser.APPROVE_OPTION ) {
       try {
          Map<String,String> env = new HashMap<String,String>();
          env.put("create", "true");
          Path path = zipfile.toPath();
          String uristr = "jar:" + path.toUri();
          geneset.zipuri = URI.create( uristr /*.replace("file://", "file:")/ );
          geneset.zipfilesystem = FileSystems.newFileSystem( geneset.zipuri, env );
                  
          Path nf = geneset.zipfilesystem.getPath("/idmapping_short.dat");
          BufferedWriter bw = Files.newBufferedWriter(nf, StandardOpenOption.CREATE);
                  
          InputStream is = new GZIPInputStream( new FileInputStream( fc.getSelectedFile() ) );
          if( unimap != null ) unimap.clear();
          unimap = idMapping(new InputStreamReader(is), bw, 2, 0, refmap, genmap, gimap);
                  
          bw.close();
          //long bl = Files.copy( new ByteArrayInputStream( baos.toByteArray() ), nf, StandardCopyOption.REPLACE_EXISTING );
          geneset.zipfilesystem.close();
       } catch (IOException e1) {
          e1.printStackTrace();
       }
    }
             }
          };
                  
          final JCheckBoxMenuItem checkbox = new JCheckBoxMenuItem();
          checkbox.setAction(new AbstractAction("Sort by location") {
             @Override
             public void actionPerformed(ActionEvent e) {
    Tegeval.locsort = checkbox.isSelected();
             }
          });
          AbstractAction saveselAction = new AbstractAction("Save selection") {
             @Override
             public void actionPerformed(ActionEvent e) {
    int[] rr = table.getSelectedRows();
    if( rr.length > 0 ) {
       String val = Integer.toString( table.convertRowIndexToModel(rr[0]) );
       for( int i = 1; i < rr.length; i++ ) {
          val += ","+table.convertRowIndexToModel(rr[i]);
       }
       String selname = JOptionPane.showInputDialog("Selection name");
       if( comp instanceof Applet ) {
          try {
             ((GeneSet)comp).saveSel( selname, val);
          } catch (Exception e1) {
             e1.printStackTrace();
          }
       }
    }
             }
          };
                  
          JMenuBar   menubar = new JMenuBar();
          JMenu      menu = new JMenu("Functions");
          menu.add( importidmappingaction );
          menu.add( functionmappingaction );
          menu.add( importgenesymbolaction );
          menu.add( fetchaction );
          menu.add( blast2action );
          menu.add( sharenumaction );
          menu.addSeparator();
          menu.add( checkbox );
          menu.add( saveselAction );
          menu.addSeparator();
          menu.add( genomestataction );
          menu.add( selectsharingaction );
          menu.add( shuffletreeaction );
          menu.add( presabsaction );
          menu.add( freqdistaction );
          menu.add( gcpaction );
          menu.add( matrixaction );
          menu.add( pancoreaction );
          menu.add( blastaction );
          menu.add( koexportaction );
          menu.add( genomesizeaction );
          menu.add( gcaction );
          menu.add( gcskewaction );
          menu.add( mltreemapaction );
          menu.add( sevenaction );
          menu.add( cogaction );
          menu.add( genexyplotaction );
          menu.add( compareplotaction );
          menu.add( syntenygradientaction );
          menu.add( codregaction );
          menu.add( fetchcoreaction );
          menu.add( loadcontiggraphaction );
          menu.add( selectflankingaction );
          menu.add( showflankingaction );
          menu.add( showcontigsaction );
          menu.add( showunresolved );
          menu.add( genephyl );
                  
          menubar.add( menu );
          ttopcom.add( menubar );
                  
          JMenu      view = new JMenu("View");
          menubar.add( view );
                  
          gb = new JRadioButtonMenuItem( new AbstractAction("Genes") {
             @Override
             public void actionPerformed(ActionEvent e) {
    table.setModel( defaultModel );
             }
          });
          view.add( gb );
          ggb = new JRadioButtonMenuItem( new AbstractAction("Gene groups") {
             @Override
             public void actionPerformed(ActionEvent e) {
    table.setModel( groupModel );
             }
                     
          });
          ButtonGroup   bg = new ButtonGroup();
          bg.add( gb );
          bg.add( ggb );
                  
          ggb.setSelected( true );
                  
          view.add( ggb );*/

    //ttopcom.add( shuffletreebutton );
    //ttopcom.add( presabsbutton );
    //ttopcom.add(freqdistbutton);
    //ttopcom.add(matrixbutton);

    toolbar.getItems().add(textfield);
    toolbar.getItems().add(search);
    toolbar.getItems().add(filter);
    toolbar.getItems().add(label);

    selcomblocal.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        String key = newValue;
        if (((GeneSetHead) comp).selectionMap.containsKey(key)) {
            Set<Integer> val = ((GeneSetHead) comp).selectionMap.get(key);
            if (val != null) {
                table.getSelectionModel().clearSelection();
                for (int i : val) {
                    //int r = table.convertRowIndexToView(i);
                    table.getSelectionModel().select(i);
                }
            } else {
                System.err.println("null " + key);
            }
        } else {
            System.err.println("no " + key);
        }
    });
    toolbar.getItems().add(selcomblocal);

    /*syncolorcomb.addItemListener( new ItemListener() {
       @Override
       public void itemStateChanged(ItemEvent e) {
    String spec = (String)syncolorcomb.getSelectedItem();
    //if( spec.length() > 0 )
       }
    });*/
    toolbar.getItems().add(searchcolcomb);
    toolbar.getItems().add(syncolorcomb);
    //topcomp.add(ttopcom, BorderLayout.NORTH);

    table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    table.getSelectionModel().selectedItemProperty().addListener(e -> {
        label.setText(table.getItems().size() + "/" + table.getSelectionModel().getSelectedItems().size());
    });

    gtable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    gtable.getSelectionModel().selectedItemProperty().addListener(e -> {
        label.setText(gtable.getItems().size() + "/" + gtable.getSelectionModel().getSelectedItems().size());
    });

    /*JButton but = new JButton(new AbstractAction("Gene sorter") {
       @Override
       public void actionPerformed(ActionEvent e) {
    try {
       GeneSorter.mynd(genelist, table, "t.scotoductusSA01", contigs);
    } catch (IOException e1) {
       e1.printStackTrace();
    }
       }
    });*/

    final TextField ftextfield = new TextField();
    btoolbar.getItems().add(ftextfield);

    ComboBox<String> scombo = new ComboBox();
    scombo.getItems().add("5S/8S");
    scombo.getItems().add("16S/18S");
    scombo.getItems().add("23S/28S");
    scombo.getSelectionModel().selectedItemProperty().addListener(e -> {
        String name = e.toString().split("/")[0];
        InputStream iss = GeneSet.class.getResourceAsStream("/all" + name + ".fsa");
        InputStreamReader isr = new InputStreamReader(iss);
        BufferedReader brr = new BufferedReader(isr);

        JTextArea textarea = new JTextArea();
        JScrollPane scrollpane = new JScrollPane(textarea);

        try {
            String ln = brr.readLine();
            while (ln != null) {
                textarea.append(ln + "\n");

                ln = brr.readLine();
            }
        } catch (IOException e1) {
            e1.printStackTrace();
        }

        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.add(scrollpane);
        frame.setSize(400, 300);
        frame.setVisible(true);
    });
    btoolbar.getItems().add(scombo);

    Button swsearch = new Button("SW Search");
    swsearch.setOnAction(e -> {
        JComponent c = new JComponent() {
        };
        final JProgressBar pb = new JProgressBar();
        final JTextArea textarea = new JTextArea();
        JButton searchbut = new JButton(new AbstractAction("Blast") {
            @Override
            public void actionPerformed(ActionEvent e) {
                final String fasta = textarea.getText();
                final SmithWater sw = new SmithWater();
                final InputStream is = GeneSet.class.getResourceAsStream("/allthermus.aa");
                new Thread() {
                    public void run() {
                        try {
                            sw.fasta_align(new StringReader(fasta), new InputStreamReader(is), pb);
                            List<SmithWater.ALN> alns = sw.getAlignments();
                            SmithWater.ALN first = null;
                            int count = 0;
                            String result = "";
                            Set<String> regnames = new HashSet<String>();
                            for (SmithWater.ALN aln : alns) {
                                if (first == null) {
                                    first = aln;
                                } else if (aln.getScore() < 3.0f * (first.getScore() / 4.0f))
                                    break;
                                result += aln.toString();
                                regnames.add(aln.getShortDestName());

                                if (++count == 10)
                                    break;
                            }
                            textarea.setText(result);

                            for (Gene g : geneset.genelist) {
                                boolean found = false;
                                Tegeval tv = g.tegeval;
                                if (regnames.contains(tv.name)) {
                                    found = true;
                                    break;
                                }
                                if (found) {
                                    gtable.getSelectionModel().select(g);
                                    break;
                                }
                            }
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }
                }.start();
            }
        });
        c.setLayout(new BorderLayout());
        JScrollPane scrollpane = new JScrollPane(textarea);
        c.add(scrollpane);
        c.add(pb, BorderLayout.NORTH);
        c.add(searchbut, BorderLayout.SOUTH);

        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.add(c);
        frame.setSize(400, 300);
        frame.setVisible(true);
    });
    btoolbar.getItems().add(swsearch);
    btoolbar.getItems().add(jb);

    TableColumn<GeneGroup, String> namedesccol = new TableColumn("Desc");
    namedesccol.setCellValueFactory(new PropertyValueFactory<>("name"));
    table.getColumns().add(namedesccol);
    TableColumn<GeneGroup, String> origincol = new TableColumn("Origin");
    origincol.setCellValueFactory(new PropertyValueFactory<>("origin"));
    table.getColumns().add(origincol);
    TableColumn<GeneGroup, String> geneidcol = new TableColumn("Genid");
    geneidcol.setCellValueFactory(new PropertyValueFactory<>("genid"));
    table.getColumns().add(geneidcol);
    TableColumn<GeneGroup, String> refidcol = new TableColumn("Refid");
    refidcol.setCellValueFactory(new PropertyValueFactory<>("refid"));
    table.getColumns().add(refidcol);
    TableColumn<GeneGroup, String> unidcol = new TableColumn("Unid");
    unidcol.setCellValueFactory(new PropertyValueFactory<>("unid"));
    table.getColumns().add(unidcol);
    TableColumn<GeneGroup, String> keggidcol = new TableColumn("Keggid");
    keggidcol.setCellValueFactory(new PropertyValueFactory<>("keggid"));
    table.getColumns().add(keggidcol);
    TableColumn<GeneGroup, String> keggpathcol = new TableColumn("Kegg pathway");
    keggpathcol.setCellValueFactory(new PropertyValueFactory<>("keggPathway"));
    table.getColumns().add(keggpathcol);
    TableColumn<GeneGroup, String> kocol = new TableColumn("KO");
    kocol.setCellValueFactory(new PropertyValueFactory<>("ko"));
    table.getColumns().add(kocol);
    TableColumn<GeneGroup, String> ksymbcol = new TableColumn("Ksymbol");
    ksymbcol.setCellValueFactory(new PropertyValueFactory<>("ksymbol"));
    table.getColumns().add(ksymbcol);
    TableColumn<GeneGroup, String> symbcol = new TableColumn("Symbol");
    symbcol.setCellValueFactory(new PropertyValueFactory<>("symbol"));
    table.getColumns().add(symbcol);
    TableColumn<GeneGroup, String> konamecol = new TableColumn("KO name");
    konamecol.setCellValueFactory(new PropertyValueFactory<>("koname"));
    table.getColumns().add(konamecol);
    TableColumn<GeneGroup, String> pbidcol = new TableColumn("Pbid");
    pbidcol.setCellValueFactory(new PropertyValueFactory<>("pbid"));
    table.getColumns().add(pbidcol);
    TableColumn<GeneGroup, String> eccol = new TableColumn("Ec");
    eccol.setCellValueFactory(new PropertyValueFactory<>("ec"));
    table.getColumns().add(eccol);
    TableColumn<GeneGroup, String> cognamecol = new TableColumn("Cog name");
    cognamecol.setCellValueFactory(new PropertyValueFactory<>("cogname"));
    table.getColumns().add(cognamecol);
    TableColumn<GeneGroup, String> cogcol = new TableColumn("Cog");
    cogcol.setCellValueFactory(new PropertyValueFactory<>("cog"));
    table.getColumns().add(cogcol);
    TableColumn<GeneGroup, String> cogannocol = new TableColumn("Cog annotation");
    cogannocol.setCellValueFactory(new PropertyValueFactory<>("coganno"));
    table.getColumns().add(cogannocol);
    TableColumn<GeneGroup, String> cogsymbcol = new TableColumn("Cog symbol");
    cogsymbcol.setCellValueFactory(new PropertyValueFactory<>("cogsymbol"));
    table.getColumns().add(cogsymbcol);
    TableColumn<GeneGroup, String> cazycol = new TableColumn("Cazy");
    cazycol.setCellValueFactory(new PropertyValueFactory<>("cazy"));
    table.getColumns().add(cazycol);
    TableColumn<GeneGroup, String> prescol = new TableColumn("Present in");
    prescol.setCellValueFactory(new PropertyValueFactory<>("presentin"));
    table.getColumns().add(prescol);

    TableColumn<GeneGroup, Integer> groupindcol = new TableColumn("Group index");
    groupindcol.setCellValueFactory(new PropertyValueFactory<GeneGroup, Integer>("groupIndex"));
    table.getColumns().add(groupindcol);
    TableColumn<GeneGroup, Integer> groupcovcol = new TableColumn("Group coverage");
    groupcovcol.setCellValueFactory(new PropertyValueFactory<GeneGroup, Integer>("groupCoverage"));
    table.getColumns().add(groupcovcol);
    TableColumn<GeneGroup, Integer> groupsizecol = new TableColumn("Group size");
    groupsizecol.setCellValueFactory(new PropertyValueFactory<GeneGroup, Integer>("groupGeneCount"));
    table.getColumns().add(groupsizecol);

    TableColumn<GeneGroup, String> locprefcol = new TableColumn("Loc pref");
    locprefcol.setCellValueFactory(new PropertyValueFactory<>("locpref"));
    table.getColumns().add(locprefcol);
    TableColumn<GeneGroup, String> avgcpcol = new TableColumn("Avg GC%");
    avgcpcol.setCellValueFactory(new PropertyValueFactory<>("avggcp"));
    table.getColumns().add(avgcpcol);
    TableColumn<GeneGroup, String> numloccol = new TableColumn("#Loc");
    numloccol.setCellValueFactory(new PropertyValueFactory<>("numloc"));
    table.getColumns().add(numloccol);
    TableColumn<GeneGroup, String> numlocgroupcol = new TableColumn("#Loc group");
    numlocgroupcol.setCellValueFactory(new PropertyValueFactory<>("numlocgroup"));
    table.getColumns().add(numlocgroupcol);

    TableColumn<GeneGroup, ShareNum> sharenumcol = new TableColumn("Sharing number");
    sharenumcol.setCellValueFactory(new PropertyValueFactory<>("sharingNumber"));
    table.getColumns().add(sharenumcol);
    TableColumn<GeneGroup, String> maxcyccol = new TableColumn("Max cyc");
    maxcyccol.setCellValueFactory(new PropertyValueFactory<>("maxCyc"));
    table.getColumns().add(maxcyccol);

    TableColumn<Gene, String> gnamedesccol = new TableColumn("Desc");
    gnamedesccol.setCellValueFactory(new PropertyValueFactory<>("name"));
    gtable.getColumns().add(gnamedesccol);
    TableColumn<Gene, String> gorigincol = new TableColumn("Origin");
    gorigincol.setCellValueFactory(new PropertyValueFactory<>("origin"));
    gtable.getColumns().add(gorigincol);
    TableColumn<Gene, String> ggeneidcol = new TableColumn("Genid");
    ggeneidcol.setCellValueFactory(new PropertyValueFactory<>("genid"));
    gtable.getColumns().add(ggeneidcol);
    TableColumn<Gene, String> grefidcol = new TableColumn("Refid");
    grefidcol.setCellValueFactory(new PropertyValueFactory<>("refid"));
    gtable.getColumns().add(grefidcol);
    TableColumn<Gene, String> gunidcol = new TableColumn("Unid");
    gunidcol.setCellValueFactory(new PropertyValueFactory<>("unid"));
    gtable.getColumns().add(gunidcol);
    TableColumn<Gene, String> gkeggidcol = new TableColumn("Keggid");
    gkeggidcol.setCellValueFactory(new PropertyValueFactory<>("keggid"));
    gtable.getColumns().add(gkeggidcol);
    TableColumn<Gene, String> gkeggpathcol = new TableColumn("Kegg pathway");
    gkeggpathcol.setCellValueFactory(new PropertyValueFactory<>("keggPathway"));
    gtable.getColumns().add(gkeggpathcol);
    TableColumn<Gene, String> gkocol = new TableColumn("KO");
    gkocol.setCellValueFactory(new PropertyValueFactory<>("ko"));
    gtable.getColumns().add(gkocol);
    TableColumn<Gene, String> gksymbcol = new TableColumn("Ksymbol");
    gksymbcol.setCellValueFactory(new PropertyValueFactory<>("ksymbol"));
    gtable.getColumns().add(gksymbcol);
    TableColumn<Gene, String> gsymbcol = new TableColumn("Symbol");
    gsymbcol.setCellValueFactory(new PropertyValueFactory<>("symbol"));
    gtable.getColumns().add(gsymbcol);
    TableColumn<Gene, String> gkonamecol = new TableColumn("KO name");
    gkonamecol.setCellValueFactory(new PropertyValueFactory<>("koname"));
    gtable.getColumns().add(gkonamecol);
    TableColumn<Gene, String> gpbidcol = new TableColumn("Pbid");
    gpbidcol.setCellValueFactory(new PropertyValueFactory<>("pbid"));
    gtable.getColumns().add(gpbidcol);
    TableColumn<Gene, String> geccol = new TableColumn("Ec");
    geccol.setCellValueFactory(new PropertyValueFactory<>("ec"));
    gtable.getColumns().add(geccol);
    TableColumn<Gene, String> gcognamecol = new TableColumn("Cog name");
    gcognamecol.setCellValueFactory(new PropertyValueFactory<>("cogname"));
    gtable.getColumns().add(gcognamecol);
    TableColumn<Gene, String> gcogcol = new TableColumn("Cog");
    gcogcol.setCellValueFactory(new PropertyValueFactory<>("cog"));
    gtable.getColumns().add(gcogcol);
    TableColumn<Gene, String> gcogannocol = new TableColumn("Cog annotation");
    gcogannocol.setCellValueFactory(new PropertyValueFactory<>("coganno"));
    gtable.getColumns().add(gcogannocol);
    TableColumn<Gene, String> gcogsymbcol = new TableColumn("Cog symbol");
    gcogsymbcol.setCellValueFactory(new PropertyValueFactory<>("cogsymbol"));
    gtable.getColumns().add(gcogsymbcol);
    TableColumn<Gene, String> gcazycol = new TableColumn("Cazy");
    gcazycol.setCellValueFactory(new PropertyValueFactory<>("cazy"));
    gtable.getColumns().add(gcazycol);
    TableColumn<Gene, String> gprescol = new TableColumn("Present in");
    gprescol.setCellValueFactory(new PropertyValueFactory<>("presentin"));
    gtable.getColumns().add(gprescol);

    TableColumn<Gene, Integer> ggroupindcol = new TableColumn("Group index");
    ggroupindcol.setCellValueFactory(new PropertyValueFactory<>("groupIndex"));
    gtable.getColumns().add(ggroupindcol);
    TableColumn<Gene, Integer> ggroupcovcol = new TableColumn("Group coverage");
    ggroupcovcol.setCellValueFactory(new PropertyValueFactory<>("groupCoverage"));
    gtable.getColumns().add(ggroupcovcol);
    TableColumn<Gene, Integer> ggroupsizecol = new TableColumn("Group size");
    ggroupsizecol.setCellValueFactory(new PropertyValueFactory<>("groupGeneCount"));
    gtable.getColumns().add(ggroupsizecol);

    TableColumn<Gene, String> glocprefcol = new TableColumn("Loc pref");
    glocprefcol.setCellValueFactory(new PropertyValueFactory<>("locpref"));
    gtable.getColumns().add(glocprefcol);
    TableColumn<Gene, String> gavgcpcol = new TableColumn("Avg GC%");
    gavgcpcol.setCellValueFactory(new PropertyValueFactory<>("avggcp"));
    gtable.getColumns().add(gavgcpcol);
    TableColumn<Gene, String> gnumloccol = new TableColumn("#Loc");
    gnumloccol.setCellValueFactory(new PropertyValueFactory<>("numloc"));
    gtable.getColumns().add(gnumloccol);
    TableColumn<Gene, String> gnumlocgroupcol = new TableColumn("#Loc group");
    gnumlocgroupcol.setCellValueFactory(new PropertyValueFactory<>("numlocgroup"));
    gtable.getColumns().add(gnumlocgroupcol);

    TableColumn<Gene, ShareNum> gsharenumcol = new TableColumn("Sharing number");
    gsharenumcol.setCellValueFactory(new PropertyValueFactory<>("sharingNumber"));
    gtable.getColumns().add(gsharenumcol);
    TableColumn<Gene, String> gmaxcyccol = new TableColumn("Max cyc");
    gmaxcyccol.setCellValueFactory(new PropertyValueFactory<>("maxCyc"));
    gtable.getColumns().add(gmaxcyccol);

    /*if( upper != null ) {
       SwingUtilities.invokeLater( new Runnable() {
    public void run() {
       //upper.setContent( botcomp );
       lower.setContent( topcomp );
    }
       });
    } else {
       splitpane.setBottomComponent(botcomp);
       splitpane.setTopComponent(topcomp);
    }
            
    groupModel = new TableModel() {
       @Override
       public int getRowCount() {
    return geneset.allgenegroups == null ? 0 : geneset.allgenegroups.size();
       }
            
       @Override
       public int getColumnCount() {
    return 32+geneset.specList.size();
       }
            
       @Override
       public String getColumnName(int columnIndex) {
    if (columnIndex == 0) {
       return "Desc";
    } else if (columnIndex == 1) {
       return "Origin";
    } else if (columnIndex == 2) {
       return "Genid";
    } else if (columnIndex == 3) {
       return "Refid";
    } else if (columnIndex == 4) {
       return "Unid";
    } else if (columnIndex == 5) {
       return "Keggid";
    } else if (columnIndex == 6) {
       return "Kegg pathway";
    } else if (columnIndex == 7) {
       return "KO";
    } else if (columnIndex == 8) {
       return "KSymbol";
    } else if (columnIndex == 9) {
       return "Symbol";
    } else if (columnIndex == 10) {
       return "KO name";
    } else if (columnIndex == 11) {
       return "Pdbid";
    } else if (columnIndex == 12) {
       return "EC";
    } else if (columnIndex == 13) {
       return "Cog name";
    } else if (columnIndex == 14) {
       return "Cog";
    } else if (columnIndex == 15) {
       return "Cog annotation";
    } else if (columnIndex == 16) {
       return "Cog symbol";
    } else if (columnIndex == 17) {
       return "Cazy";
    } else if (columnIndex == 18) {
       return "Present in";
    } else if (columnIndex == 19) {
       return "Group index";
    } else if (columnIndex == 20) {
       return "Group coverage";
    } else if (columnIndex == 21) {
       return "Group size";
    } else if (columnIndex == 22) {
       return "Locprev";
    } else if (columnIndex == 23) {
       return "Avg GC%";
    } else if (columnIndex == 24) {
       return "# of locus";
    } else if (columnIndex == 25) {
       return "# of loc in group";
    } else if (columnIndex == 26) {
       return "max length";
    } else if (columnIndex == 27) {
       return "sharing number";
    } else if (columnIndex == 28) {
       return "# Cyc";
    } else if (columnIndex == 29) {
       return "16S Corr";
    } else if (columnIndex == 30) {
       return "SingalP";
    } else if (columnIndex == 31) {
       return "TransM";
    } else {
       String spec = geneset.specList.get( columnIndex - 32 );
       if( spec != null ) {
          if( spec.toLowerCase().contains("thermus") ) {
             int i = spec.indexOf('_');
             return spec.substring(i+1, spec.length());
          } else return spec;
       }
       return "";
    }
    /* else if (columnIndex == 19) {
       return "T.tSG0";
    } else if (columnIndex == 20) {
       return "T.tJL18";
    } else if (columnIndex == 21) {
       return "T.tHB8";
    } else if (columnIndex == 22) {
       return "T.tHB27";
    } else if (columnIndex == 23) {
       return "T.scotoSA01";
    } else if (columnIndex == 24) {
       return "T.aqua";
    } else if (columnIndex == 25) {
       return "T.eggert";
    } else if (columnIndex == 26) {
       return "T.island";
    } else if (columnIndex == 27) {
       return "T.antan";
    } else if (columnIndex == 28) {
       return "T.scoto346";
    } else if (columnIndex == 29) {
       return "T.scoto1572";
    } else if (columnIndex == 30) {
       return "T.scoto252";
    } else if (columnIndex == 31) {
       return "T.scoto2101";
    } else if (columnIndex == 32) {
       return "T.scoto2127";
    } else if (columnIndex == 33) {
       return "T.scoto4063";
    } else if (columnIndex == 34) {
       return "T.oshimai";
    } else if (columnIndex == 35) {
       return "T.brockianus";
    } else if (columnIndex == 36) {
       return "T.filiformis";
    } else if (columnIndex == 37) {
       return "T.igniterrae";
    } else if (columnIndex == 38) {
       return "T.kawarayensis";
    } else if (columnIndex == 39) {
       return "T.arciformis";
    } else if (columnIndex == 40) {
       return "T.spCCB";
    } else if (columnIndex == 41) {
       return "T.spRLM";
    } else if (columnIndex == 42) {
       return "T.oshimaiJL2";
    } else if (columnIndex == 43) {
       return "MT.silvianus";
    } else if (columnIndex == 44) {
       return "MT.ruber";
    } else if (columnIndex == 45) {
       return "M.hydro";
    } else if (columnIndex == 46) {
       return "O.profu";
    }*
            
    //return "";
       }
            
       @Override
       public Class<?> getColumnClass(int columnIndex) {
    if( columnIndex == 19 || columnIndex == 20 || columnIndex == 28 )
       return Double.class;
    else if(columnIndex == 10 || (columnIndex >= 17 && columnIndex <= 28) )
       return Integer.class;
    else if (columnIndex >= 32)
       return Teg.class;
    return String.class;
       }
            
       @Override
       public boolean isCellEditable(int rowIndex, int columnIndex) {
    return false;
       }
            
       @Override
       public Object getValueAt(int rowIndex, int columnIndex) {
    GeneGroup gg = geneset.allgenegroups.get(rowIndex);
    if (columnIndex == 0) {
       return gg.getCommonName();
    } else if (columnIndex == 1) {
       return gg.getCommonOrigin();
    } else if (columnIndex == 2) {
       return null;//gene.genid;
    } else if (columnIndex == 3) {
       return gg.getCommonRefId();
    } else if (columnIndex == 4) {
       return gg.getCommonUnId();
    } else if (columnIndex == 5) {
       return gg.getKeggid();
    } else if (columnIndex == 6) {
       return gg.getKeggPathway();
    } else if (columnIndex == 7) {
       return gg.getCommonKO();
    } else if (columnIndex == 8) {
       return gg.getCommonKSymbol();
    } else if (columnIndex == 9) {
       return gg.getCommonSymbol(); //ko2name != null ? ko2name.get( gg.getCommonKO() ) : null;
    } else if (columnIndex == 10) {
       String ret = geneset.ko2name != null ? geneset.ko2name.get( gg.getCommonKO() ) : null;
       if( ret == null ) {
          String symbol = gg.getCommonSymbol();
          if( symbol != null ) {
             if( symbol.length() <= 5 ) ret = symbol;
          }
       }
       return ret;
    } else if (columnIndex == 11) {
       return null;//gene.pdbid;
    } else if (columnIndex == 12) {
       return gg.getCommonEc();
    } else if (columnIndex == 13) {
       Cog cog = gg.getCommonCog( geneset.cogmap );
       if( cog != null ) {
          if( cog.name == null ) cog.name = geneset.cogidmap.get( cog.id );
          return cog.name;
       }
       return null;
    } else if (columnIndex == 14) {
       Cog cog = gg.getCommonCog( geneset.cogmap );
       return cog != null ? cog.id : null;
    } else if (columnIndex == 15) {
       Cog cog = gg.getCommonCog( geneset.cogmap );
       return cog != null ? cog.annotation : null;
    } else if (columnIndex == 16) {
       Cog cog = gg.getCommonCog( geneset.cogmap );
       return cog != null ? cog.genesymbol : null;
    } else if (columnIndex == 17) {
       return gg.getCommonCazy( geneset.cazymap );
    } else if (columnIndex == 18) {
       return gg.getSpecies().size();
    } else if (columnIndex == 19) {
       return gg.groupIndex;
    } else if (columnIndex == 20) {
       return gg.getGroupCoverage();
    } else if (columnIndex == 21) {
       return gg.getGroupGeneCount();
    } else if (columnIndex == 22) {
       return null;//gene.proximityGroupPreservation;
    } else if (columnIndex == 23) {
       return gg.getAvgGCPerc();
    } else if (columnIndex == 24) {
       return gg.genes.size();
    } else if (columnIndex == 25) {
       return gg.getGroupCount();
    } else if (columnIndex == 26) {
       return gg.getMaxLength();
    } else if (columnIndex == 27) {
       return geneset.specset.get( gg.getSpecies() );
    } else if (columnIndex == 28) {
       return gg.getMaxCyc();
    } else if (columnIndex == 29) {
       return gg.getGroupCoverage() == 39 && gg.getGroupCount() == 39 ? 0 : -1;
    } else if (columnIndex == 30) {
       return gg.getCommonSignalP();
    } else if (columnIndex == 31) {
       return gg.getCommonTransM();
    } else {
       String spec = geneset.specList.get( columnIndex - 32 );
       Teginfo ret = geneset.getGroupTes( gg, spec );
       return ret;
       //return null;
    }
    //return columnIndex >= 11 ? null : "";
       }
            
       @Override
       public void setValueAt(Object aValue, int rowIndex, int columnIndex) {}
            
       @Override
       public void addTableModelListener(TableModelListener l) {}
            
       @Override
       public void removeTableModelListener(TableModelListener l) {}
    };
    defaultModel = new TableModel() {
       @Override
       public int getRowCount() {
    int gs = geneset.genelist.size();
    return gs;
       }
            
       @Override
       public int getColumnCount() {
    return 26+geneset.specList.size();
       }
            
       @Override
       public String getColumnName(int columnIndex) {
    if (columnIndex == 0) {
       return "Desc";
    } else if (columnIndex == 1) {
       return "Origin";
    } else if (columnIndex == 2) {
       return "Genid";
    } else if (columnIndex == 3) {
       return "Refid";
    } else if (columnIndex == 4) {
       return "Unid";
    } else if (columnIndex == 5) {
       return "Keggid";
    } else if (columnIndex == 6) {
       return "KOid";
    } else if (columnIndex == 7) {
       return "KSymbol";
    } else if (columnIndex == 8) {
       return "Symbol";
    } else if (columnIndex == 9) {
       return "KOname";
    } else if (columnIndex == 10) {
       return "Pdbid";
    } else if (columnIndex == 11) {
       return "ecid";
    } else if (columnIndex == 12) {
       return "COG";
    } else if (columnIndex == 13) {
       return "COG name";
    } else if (columnIndex == 14) {
       return "Present in";
    } else if (columnIndex == 15) {
       return "Group index";
    } else if (columnIndex == 16) {
       return "Group coverage";
    } else if (columnIndex == 17) {
       return "Group size";
    } else if (columnIndex == 18) {
       return "Locprev";
    } else if (columnIndex == 19) {
       return "Avg GC%";
    } else if (columnIndex == 20) {
       return "# of locus";
    } else if (columnIndex == 21) {
       return "# of loc in group";
    } else if (columnIndex == 22) {
       return "max length";
    } else if (columnIndex == 23) {
       return "sharing number";
    } else if (columnIndex == 24) {
       return "# Cyc";
    } else if (columnIndex == 25) {
       return "16S Corr";
    } else {
       return geneset.specList.get( columnIndex - 26 );
    } /*else if (columnIndex == 19) {
       return "T.tSG0";
    } else if (columnIndex == 20) {
       return "T.tJL18";
    } else if (columnIndex == 21) {
       return "T.tHB8";
    } else if (columnIndex == 22) {
       return "T.tHB27";
    } else if (columnIndex == 23) {
       return "T.scotoSA01";
    } else if (columnIndex == 24) {
       return "T.aqua";
    } else if (columnIndex == 25) {
       return "T.eggert";
    } else if (columnIndex == 26) {
       return "T.island";
    } else if (columnIndex == 27) {
       return "T.antan";
    } else if (columnIndex == 28) {
       return "T.scoto346";
    } else if (columnIndex == 29) {
       return "T.scoto1572";
    } else if (columnIndex == 30) {
       return "T.scoto252";
    } else if (columnIndex == 31) {
       return "T.scoto2101";
    } else if (columnIndex == 32) {
       return "T.scoto2127";
    } else if (columnIndex == 33) {
       return "T.scoto4063";
    } else if (columnIndex == 34) {
       return "T.oshimai";
    } else if (columnIndex == 35) {
       return "T.brockianus";
    } else if (columnIndex == 36) {
       return "T.filiformis";
    } else if (columnIndex == 37) {
       return "T.igniterrae";
    } else if (columnIndex == 38) {
       return "T.kawarayensis";
    } else if (columnIndex == 39) {
       return "T.arciformis";
    } else if (columnIndex == 40) {
       return "T.spCCB";
    } else if (columnIndex == 41) {
       return "T.spRLM";
    } else if (columnIndex == 42) {
       return "T.oshimaiJL2";
    } else if (columnIndex == 43) {
       return "MT.silvianus";
    } else if (columnIndex == 44) {
       return "MT.ruber";
    } else if (columnIndex == 45) {
       return "M.hydro";
    } else if (columnIndex == 46) {
       return "O.profu";
    }*
       }
            
       @Override
       public Class<?> getColumnClass(int columnIndex) {
    if( columnIndex == 16 || columnIndex == 19 || columnIndex == 25 )
       return Double.class;
    else if(columnIndex >= 13 && columnIndex <= 24)
       return Integer.class;
    else if (columnIndex >= 26)
       return Teg.class;
    return String.class;
       }
            
       @Override
       public boolean isCellEditable(int rowIndex, int columnIndex) {
    return false;
       }
            
       @Override
       public Object getValueAt(int rowIndex, int columnIndex) {
    Gene gene = geneset.genelist.get(rowIndex);
    if (columnIndex == 0) {
       GeneGroup gg = gene.getGeneGroup();
       return gg != null ? gene.getGeneGroup().getCommonName() : null;
    } else if (columnIndex == 1) {
       return gene.getSpecies();
    } else if (columnIndex == 2) {
       return gene.genid;
    } else if (columnIndex == 3) {
       return gene.refid;
    } else if (columnIndex == 4) {
       return gene.uniid;
    } else if (columnIndex == 5) {
       return gene.keggid;
    } else if (columnIndex == 6) {
       GeneGroup gg = gene.getGeneGroup();
       return gg != null ? gg.getCommonKO() : null;
    } else if (columnIndex == 7) {
       GeneGroup gg = gene.getGeneGroup();
       return gg != null ? gg.getCommonKSymbol() : null;
    } else if (columnIndex == 8) {
       GeneGroup gg = gene.getGeneGroup();
       return gg != null ? gg.getCommonSymbol() : null; //gene.symbol
    } else if (columnIndex == 9) {
       GeneGroup gg = gene.getGeneGroup();
       return gg != null ? gg.getCommonKOName( geneset.ko2name ) : null;
    } else if (columnIndex == 10) {
       return gene.pdbid;
    } else if (columnIndex == 11) {
       return gene.ecid;
    } else if (columnIndex == 12) {
       Cog cog = gene.getGeneGroup() != null ? gene.getGeneGroup().getCommonCog( geneset.cogmap ) : null;
       if( cog != null ) return cog.id;
       return null;
    } else if (columnIndex == 13) {
       Cog cog = gene.getGeneGroup() != null ? gene.getGeneGroup().getCommonCog( geneset.cogmap ) : null;
       if( cog != null ) return cog.name;
       return null;
    } else if (columnIndex == 14) {
       return gene.getGeneGroup().getSpecies().size();
    } else if (columnIndex == 15) {
       return gene.getGroupIndex();
    } else if (columnIndex == 16) {
       return gene.getGroupCoverage();
    } else if (columnIndex == 17) {
       return gene.getGroupGenCount();
    } else if (columnIndex == 18) {
       return gene.proximityGroupPreservation;
    } else if (columnIndex == 19) {
       return gene.getGCPerc();
    } else if (columnIndex == 20) {
       /*int val = 0;
       for (String str : gene.species.keySet()) {
          val += gene.species.get(str).tset.size();
       }*
       return 1;
    } else if (columnIndex == 21) {
       return gene.getGroupCount();
    } else if (columnIndex == 22) {
       return gene.getMaxLength();
    } else if (columnIndex == 23) {
       GeneGroup gg = gene.getGeneGroup();
       if( gg != null && gg.getSpecies() != null ) {
          return geneset.specset.get( gg.getSpecies() );
       }
       return null;
    } else if (columnIndex == 24) {
       gene.getMaxCyc();
    } else if (columnIndex == 25) {
       return gene.getGroupCoverage() == 35 && gene.getGroupCount() == 35 ? gene.corr16s : -1;
    } else {
       /*String spec = specList.get( columnIndex-26 );
       /*if( spec.contains("timidus") ) {
          System.err.println();
       }*
       //Teginfo set = gene.species.equals(spec) ? gene.teginfo : null;
       if( gene.getSpecies().equals( spec ) ) {
          return gene.tegeval;
       } else {
          return gene.getGeneGroup().species.get( spec );
       }*
               
       return null;
    }
    return columnIndex >= 17 ? null : "";
       }
            
       @Override
       public void setValueAt(Object aValue, int rowIndex, int columnIndex) {}
            
       @Override
       public void addTableModelListener(TableModelListener l) {}
            
       @Override
       public void removeTableModelListener(TableModelListener l) {}
    };
    table.setModel( groupModel );*/
    //table.setModel( defaultModel );

    /*
     * Comparator<Tegeval> wrapMe = new Comparator<Tegeval>() { public int
     * compare(Tegeval o1, Tegeval o2) { return o1.compareTo(o2); } };
     * DefaultRowSorter<TableModel, Integer> rowsorter =
     * (DefaultRowSorter<TableModel,Integer>)table.getRowSorter(); for( int
     * i = 10; i < 23; i++ ) { rowsorter.setComparator(i,
     * NullComparators.atEnd(wrapMe)); }
     */

    /*table.getRowSorter().addRowSorterListener( new RowSorterListener() {
       @Override
       public void sorterChanged(RowSorterEvent e) {
    for (String cstr : geneset.contigmap.keySet()) {
       Sequence c = geneset.contigmap.get(cstr);
       //c.count = 0;
       c.loc = 0.0;
    }
            
    if( table.getModel() == defaultModel ) {
       for (Gene g : geneset.genelist) {
          Tegeval tv = g.tegeval;
             // int first = tv.cont.indexOf('_');
             // int sec = tv.cont.indexOf('_',first+1);
          Sequence cont = tv.getContshort(); // tv.cont.substring(0,sec);
          if( cont != null && geneset.contigmap.containsKey(cont.getName()) ) {
             Sequence c = geneset.contigmap.get(cont.getName());
             //c.count++;
             int val = table.convertRowIndexToView(g.index);
             c.loc += (double) val;
          }
       }
    }
    for( JSplitPane gsplitpane : splitpaneList ) {
       gsplitpane.repaint();
    }
       }
    });*/

    ftable = upper;
    ftable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    /*ftable = new JTable() {
       public String getToolTipText(MouseEvent me) {
    Point p = me.getPoint();
    int r = rowAtPoint(p);
    int c = columnAtPoint(p);
    if (r >= 0 && r < super.getRowCount()) {
       Object ret = super.getValueAt(r, c);
       if (ret != null) {
          return ret.toString(); // super.getToolTipText( me );
       }
    }
    return "";
       }
    };*/

    ContextMenu fpopup = new ContextMenu();
    MenuItem amigo = new MenuItem("Amigo lookup");
    amigo.setOnAction(e -> {
        String go = ftable.getSelectionModel().getSelectedItem().getGo();
        try {
            // GeneSetHead.this.getAppletContext().
            Desktop.getDesktop()
                    .browse(new URI("http://amigo.geneontology.org/cgi-bin/amigo/term_details?term=" + go));
        } catch (IOException e1) {
            e1.printStackTrace();
        } catch (URISyntaxException e1) {
            e1.printStackTrace();
        }
    });
    fpopup.getItems().add(amigo);
    MenuItem keggl = new MenuItem("KEGG lookup");
    keggl.setOnAction(e -> {
        String kegg = ftable.getSelectionModel().getSelectedItem().getKegg();
        try {
            Desktop.getDesktop().browse(new URI("http://www.genome.jp/dbget-bin/www_bget?rn:" + kegg));
        } catch (IOException e1) {
            e1.printStackTrace();
        } catch (URISyntaxException e1) {
            e1.printStackTrace();
        }
    });
    fpopup.getItems().add(keggl);
    MenuItem ecl = new MenuItem("EC lookup");
    ecl.setOnAction(e -> {
        String ec = ftable.getSelectionModel().getSelectedItem().getEc();
        try {
            Desktop.getDesktop().browse(new URI("http://enzyme.expasy.org/EC/" + ec));
        } catch (IOException e1) {
            e1.printStackTrace();
        } catch (URISyntaxException e1) {
            e1.printStackTrace();
        }
    });
    fpopup.getItems().add(ecl);
    fpopup.getItems().add(new SeparatorMenuItem());

    MenuItem excelreport = new MenuItem("Excel report");
    excelreport.setOnAction(e -> {
        Workbook workbook = new XSSFWorkbook();
        Sheet sheet = workbook.createSheet("enzyme");
        int k = 0;
        for (Function f : ftable.getSelectionModel().getSelectedItems()) {
            //String ec = (String)ftable.getValueAt(r, 1);
            //String go = (String)ftable.getValueAt(r, 0);

            //int i = ftable.getSelectionModel().convertRowIndexToModel(r);
            //Function f = geneset.funclist.get(i);
            for (GeneGroup gg : f.getGeneGroups()) {
                for (String spec : gg.getSpecies()) {
                    Teginfo ti = gg.getGenes(spec);

                    Row row = sheet.createRow(k++);
                    Cell ecell = row.createCell(0);
                    ecell.setCellValue("EC:" + f.getEc());
                    Cell ncell = row.createCell(1);
                    ncell.setCellValue(f.getName());
                    Cell spell = row.createCell(2);
                    spell.setCellValue(spec);
                    Cell seqcell = row.createCell(3);
                    seqcell.setCellValue(ti.tset.size());
                }
                /*for( Gene g :gg.genes ) {
                   Row    row = sheet.createRow(k++);
                   Cell    ecell = row.createCell(0);
                   ecell.setCellValue( "EC:"+f.ec );
                   Cell    ncell = row.createCell(1);
                   ncell.setCellValue( f.name );
                   Cell    spell = row.createCell(2);
                   spell.setCellValue( g.getSpecies() );
                   Cell    seqcell = row.createCell(3);
                   seqcell.setCellValue( g.tegeval.getAlignedSequence().toString() );
                }*/
            }
            sheet.createRow(k++);
        }

        try {
            Path tempfile = Files.createTempFile("enzyme", ".xlsx");
            OutputStream os = Files.newOutputStream(tempfile);
            workbook.write(os);
            os.close();

            Desktop.getDesktop().open(tempfile.toFile());
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    });
    fpopup.getItems().add(excelreport);
    ftable.setContextMenu(fpopup);

    ContextMenu popup = new ContextMenu();
    MenuItem splitaction = new MenuItem("Split");
    splitaction.setOnAction(e -> {
        Dialog<Set<GeneGroup>> dialog = new Dialog<>();
        dialog.setResizable(true);

        GridPane grid = new GridPane();
        grid.setHgap(10);
        grid.setVgap(10);
        grid.setPadding(new Insets(20, 20, 10, 10));

        TextField len = new TextField();
        len.setPromptText("0.5");
        TextField id = new TextField();
        id.setPromptText("0.5");

        grid.add(new Label("%Length:"), 0, 0);
        grid.add(len, 1, 0);
        grid.add(new Label("%Identity:"), 0, 1);
        grid.add(id, 1, 1);

        final ListView<GeneGroup> list = new ListView<>();
        list.setPrefWidth(400);
        grid.add(list, 0, 2, 2, 1);

        final GeneGroup gg = table.getSelectionModel().getSelectedItem();
        list.setItems(FXCollections.singletonObservableList(gg));

        Label groupsize = new Label("" + gg.genes.size());
        grid.add(groupsize, 0, 3, 2, 1);

        len.textProperty().addListener((observable, oldValue, newValue) -> {
            if (!newValue.equals(oldValue)) {
                double d = 0;
                try {
                    d = Double.parseDouble(newValue);
                } catch (Exception ex) {
                }

                if (d > 0) {
                    Set<GeneGroup> ggmap = new HashSet<>();
                    Map<String, Integer> blosumMap = JavaFasta.getBlosumMap(false);
                    for (Gene gene : gg.genes) {
                        if (ggmap.stream().flatMap(f -> f.genes.stream()).noneMatch(p -> gene == p)) {
                            Set<Gene> ggset = new HashSet<>();
                            Sequence seq1 = gene.tegeval.getAlignedSequence();
                            for (Gene cgene : gg.genes) {
                                Sequence seq2 = cgene.tegeval.getAlignedSequence();
                                int[] tscore = GeneCompare.blosumValue(seq1, seq1, seq2, blosumMap);
                                int sscore = GeneCompare.blosumValue(seq1, seq2, blosumMap);

                                double dval = (double) (sscore - tscore[1]) / (double) (tscore[0] - tscore[1]);
                                if (dval > d) {
                                    ggset.add(cgene);
                                }
                            }
                            System.err.println(ggset.size());

                            Set<GeneGroup> osubgg = ggmap.stream().filter(f -> {
                                Set<Gene> gs = new HashSet<>(ggset);
                                gs.retainAll(f.genes);
                                return gs.size() > 0;
                            }).collect(Collectors.toSet());
                            GeneGroup subgg;
                            if (osubgg.size() > 0) {
                                Iterator<GeneGroup> git = osubgg.iterator();
                                subgg = git.next();
                                while (git.hasNext()) {
                                    GeneGroup remgg = git.next();
                                    subgg.addGenes(remgg.genes);
                                    ggmap.remove(remgg);
                                }
                            } else {
                                subgg = new GeneGroup();
                                subgg.setCogMap(gg.getCogMap());
                                subgg.setKonameMap(gg.getKonameMap());
                                subgg.setSpecSet(gg.getSpecSet());
                                ggmap.add(subgg);
                            }
                            subgg.addGenes(ggset);
                        }
                    }
                    Set<GeneGroup> sgg = ggmap.stream().collect(Collectors.toSet());

                    List<GeneGroup> lgg = new ArrayList(sgg);
                    list.setItems(FXCollections.observableList(lgg));
                    dialog.setResultConverter(param -> sgg);
                }
            }
        });

        dialog.getDialogPane().setContent(grid);
        dialog.getDialogPane().getButtonTypes().add(ButtonType.OK);
        dialog.getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
        Optional<Set<GeneGroup>> ogg = dialog.showAndWait();

        ogg.ifPresent(c -> {
            geneset.allgenegroups.remove(gg);
            geneset.allgenegroups.addAll(c);

            Map<String, String> env = new HashMap<>();
            env.put("create", "true");
            try {
                geneset.zipfilesystem = FileSystems.newFileSystem(geneset.zipuri, env);
                for (Path root : geneset.zipfilesystem.getRootDirectories()) {
                    Files.walk(root).filter(f -> f.toString().startsWith("/aligned"))
                            .filter(f -> f.toString().endsWith(".aa")).filter(f -> {
                                String filename = f.getFileName().toString();
                                return gg.genes.stream().anyMatch(g -> {
                                    String fnid = filename.substring(0, filename.length() - 3);
                                    return g.name.equals(fnid);
                                });
                            }).forEach(p -> {
                                try {
                                    Files.deleteIfExists(p);
                                } catch (IOException e1) {
                                    e1.printStackTrace();
                                }
                            });
                    /*for( Gene g : gg.genes ) {
                       if( g.keggpathway != null ) {
                          String sub = g.keggpathway.substring(0,3);
                          Path subf = root.resolve(sub);
                          if( Files.exists(subf) ) {
                             String[] split = g.keggpathway.split(" ");
                             for( String s : split ) {
                      Path pimg = subf.resolve(s+".png");
                      if( Files.exists(pimg) ) {
                         showKeggPathway( sub, pimg );
                      }
                             }
                          }
                       }
                    }*/
                    final Path p = root.resolve("/aligned");
                    c.stream().forEach(fgg -> {
                        Path np = p.resolve(fgg.genes.iterator().next().getName());
                        try {
                            Writer w = Files.newBufferedWriter(np);
                            fgg.getFasta(w, false);
                            w.close();
                        } catch (IOException e1) {
                            e1.printStackTrace();
                        }
                    });
                    break;
                }
                geneset.zipfilesystem.close();
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        });
    });
    popup.getItems().add(splitaction);
    MenuItem joinaction = new MenuItem("Join");

    popup.getItems().add(joinaction);
    popup.getItems().add(new SeparatorMenuItem());
    MenuItem showkegg = new MenuItem("Show KEGG pathway");
    showkegg.setOnAction(e -> {
        GeneGroup gg = table.getSelectionModel().getSelectedItem();

        Map<String, String> env = new HashMap<>();
        env.put("create", "true");

        /*String uristr = "jar:" + geneset.zippath.toUri();
        URI zipuri = URI.create( uristr /*.replace("file://", "file:")* );
        final List<Path>   lbi = new ArrayList<>();*/
        boolean shown = false;
        try {
            geneset.zipfilesystem = FileSystems.newFileSystem(geneset.zipuri, env);
            for (Path root : geneset.zipfilesystem.getRootDirectories()) {
                for (Gene g : gg.genes) {
                    if (g.keggpathway != null) {
                        String sub = g.keggpathway.substring(0, 3);
                        Path subf = root.resolve(sub);
                        if (Files.exists(subf)) {
                            String[] split = g.keggpathway.split(" ");
                            for (String s : split) {
                                Path pimg = subf.resolve(s + ".png");
                                if (Files.exists(pimg)) {
                                    showKeggPathway(sub, pimg);
                                    shown = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                break;
            }
            geneset.zipfilesystem.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        if (!shown) {
            for (Gene g : gg.genes) {
                if (g.keggpathway != null) {
                    String[] keggsplit = g.keggpathway.split(";");
                    Arrays.stream(keggsplit).map(s -> s.split(":")[0]).findFirst().ifPresent(c -> {
                        try {
                            Desktop.getDesktop().browse(
                                    URI.create("http://www.genome.jp/dbget-bin/www_bget?map" + c.substring(2)));
                        } catch (IOException e1) {
                            e1.printStackTrace();
                        }
                    });
                }
            }
        }
    });
    popup.getItems().add(showkegg);
    MenuItem plasmid = new MenuItem("Plasmid");
    plasmid.setOnAction(e -> {
        Gene g = gtable.getSelectionModel().getSelectedItem();
        Sequence contig = g.tegeval.getContshort();
        String contigstr = contig.toString();
        contig.plasmid = !geneset.plasmids.contains(contigstr);
        if (contig.plasmid)
            geneset.plasmids.add(contigstr);
        else
            geneset.plasmids.remove(contigstr);

        try {
            Map<String, String> env = new HashMap<>();
            env.put("create", "true");
            //Path path = zipfile.toPath();
            String uristr = "jar:" + geneset.zippath.toUri();
            geneset.zipuri = URI.create(uristr /*.replace("file://", "file:")*/ );
            geneset.zipfilesystem = FileSystems.newFileSystem(geneset.zipuri, env);

            //fs = FileSystems.newFileSystem( uri, env );
            //FileSystem fs = FileSystems.newFileSystem(uri, env);

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            for (String contigname : geneset.plasmids) {
                baos.write((contigname + "\n").getBytes());
            }

            Path nf = geneset.zipfilesystem.getPath("/plasmids.txt");
            long bl = Files.copy(new ByteArrayInputStream(baos.toByteArray()), nf,
                    StandardCopyOption.REPLACE_EXISTING);
            //System.err.println( "eeerm " + bl );
            geneset.zipfilesystem.close();

            /*Writer writer = Files.newBufferedWriter(nf, StandardCharsets.UTF_8, StandardOpenOption.CREATE);
            for( String phage : phageset ) {
               writer.write( phage + "\n" );
            }
            writer.close();*/

            //writer.write("hello");
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    });
    popup.getItems().add(plasmid);
    MenuItem designate = new MenuItem("Designate");
    designate.setOnAction(e -> {
        SwingUtilities.invokeLater(() -> {
            JComboBox<String> descombo = new JComboBox<>(
                    geneset.deset.toArray(new String[geneset.deset.size()]));
            descombo.setEditable(true);
            JOptionPane.showMessageDialog(GeneSetHead.this, descombo);
            String val = descombo.getSelectedItem().toString();
            geneset.deset.add(val);
            for (Gene g : gtable.getSelectionModel().getSelectedItems()) {
                g.tegeval.designation = val;
                if (g.id != null) {
                    geneset.designations.put(g.id, val);
                } else {
                    System.err.println(g.refid);
                }
                //ta.append( g.tegeval.id + "\n" );
            }

            try {
                Map<String, String> env = new HashMap<String, String>();
                env.put("create", "true");
                //Path path = zipfile.toPath();
                String uristr = "jar:" + geneset.zippath.toUri();
                geneset.zipuri = URI.create(uristr /*.replace("file://", "file:")*/ );
                geneset.zipfilesystem = FileSystems.newFileSystem(geneset.zipuri, env);

                //fs = FileSystems.newFileSystem( uri, env );
                //FileSystem fs = FileSystems.newFileSystem(uri, env);

                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                for (String geneid : geneset.designations.keySet()) {
                    String design = geneset.designations.get(geneid);
                    baos.write((geneid + "\t" + design + "\n").getBytes());
                }

                Path nf = geneset.zipfilesystem.getPath("/designations.txt");
                long bl = Files.copy(new ByteArrayInputStream(baos.toByteArray()), nf,
                        StandardCopyOption.REPLACE_EXISTING);
                //System.err.println( "eeerm " + bl );
                geneset.zipfilesystem.close();

                /*Writer writer = Files.newBufferedWriter(nf, StandardCharsets.UTF_8, StandardOpenOption.CREATE);
                for( String phage : phageset ) {
                    writer.write( phage + "\n" );
                }
                writer.close();*/

                //writer.write("hello");
            } catch (IOException e1) {
                e1.printStackTrace();
            }

            /*JFrame frame = new JFrame("Ids");
            frame.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
            frame.setSize(800, 600);
            JTextArea   ta = new JTextArea();
            JScrollPane sp = new JScrollPane( ta );
            frame.add( sp );
                    
            frame.setVisible( true );*/
        });
    });
    popup.getItems().add(designate);
    MenuItem koname = new MenuItem("KO to name");
    koname.setOnAction(e -> {
        Set<String> koids = new HashSet<>();
        for (Gene g : geneset.genelist) {
            if (g.koid != null && g.koid.length() > 0
                    && !(geneset.ko2name != null && geneset.ko2name.containsKey(g.koid)))
                koids.add(g.koid);
        }

        try {
            Map<String, String> ko2name = new HashMap<>();
            int cnt = 0;
            for (String koid : koids) {
                URL url = new URL("http://www.kegg.jp/dbget-bin/www_bget?ko:" + koid);
                InputStream is0 = url.openStream();
                StringBuilder sb = new StringBuilder();
                BufferedReader br0 = new BufferedReader(new InputStreamReader(is0));
                String line0 = br0.readLine();
                while (line0 != null) {
                    sb.append(line0);
                    line0 = br0.readLine();
                }
                br0.close();

                int i = sb.indexOf("<nobr>Name</nobr>");
                if (i != -1) {
                    int k = sb.indexOf(":hidden\">");
                    if (k != -1) {
                        k = sb.indexOf(":hidden\">", k + 9);
                        if (k != -1) {
                            String koname0 = sb.substring(k + 9, sb.indexOf("<br>", k));
                            ko2name.put(koid, koname0);

                            System.err.println(koid + "\t" + koname0);
                        }
                    }
                }

                System.err.println(ko2name.size() + " " + koids.size());
                //if( cnt++ > 20 ) break;
            }

            FileWriter fw = new FileWriter("~ko2name.txt");
            for (String koid : ko2name.keySet()) {
                fw.write(koid + "\t" + ko2name.get(koid) + "\n");
            }
            fw.close();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
    });
    popup.getItems().add(koname);
    popup.getItems().add(new SeparatorMenuItem());
    MenuItem genegainloss = new MenuItem("Gene gain/loss");
    genegainloss.setOnAction(e -> {
        Map<Node, List<GeneGroup>> nodeGainMap = new HashMap<>();
        Map<Node, List<GeneGroup>> nodeLossMap = new HashMap<>();

        /*String treestr = "";
        JFileChooser fc = new JFileChooser();
        if( fc.showOpenDialog( applet ) == JFileChooser.APPROVE_OPTION ) {
           File file = fc.getSelectedFile();
           try {
              byte[] bb = Files.readAllBytes( Paths.get(file.toURI()) );
              treestr = new String( bb );
           } catch (IOException e1) {
              e1.printStackTrace();
           }
        }*/

        Serifier serifier = getConcatenatedSequences(false, true);
        String tree = serifier.getFastTree(serifier.lseq, geneset.user, false);

        TreeUtil tu = new TreeUtil();
        Node n = tu.parseTreeRecursive(tree, false);

        TableModel model = new TableModel() {
            @Override
            public int getRowCount() {
                return geneset.getSpecies().size();
            }

            @Override
            public int getColumnCount() {
                return 1;
            }

            @Override
            public String getColumnName(int columnIndex) {
                return null;
            }

            @Override
            public Class<?> getColumnClass(int columnIndex) {
                return String.class;
            }

            @Override
            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return false;
            }

            @Override
            public Object getValueAt(int rowIndex, int columnIndex) {
                return geneset.getSpecies().get(rowIndex);
            }

            @Override
            public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
            }

            @Override
            public void addTableModelListener(TableModelListener l) {
            }

            @Override
            public void removeTableModelListener(TableModelListener l) {
            }
        };
        JTable table = new JTable(model);
        table.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
        JScrollPane scroll = new JScrollPane(table);
        FlowLayout flowlayout = new FlowLayout();
        JComponent c = new JComponent() {
        };
        c.setLayout(flowlayout);
        c.add(scroll);
        JOptionPane.showMessageDialog(comp, c);

        List<String> rootgroup = new ArrayList<>();
        int[] rr = table.getSelectedRows();
        for (int r : rr) {
            rootgroup.add((String) table.getValueAt(r, 0));
        }

        //String[] sobj = {"mt.ruber", "mt.silvanus", "o.profundus", "m.hydrothermalis"};
        Node newnode = tu.getParent(n, new HashSet<>(rootgroup));
        tu.rerootRecur(n, newnode);

        File f = new File("/home/sigmar/gain_list.txt");
        try {
            PrintStream ps = new PrintStream(f);
            geneset.assignGain(newnode, nodeGainMap, ps);
            ps.close();
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        }

        f = new File("/home/sigmar/loss_list.txt");
        try {
            PrintStream ps = new PrintStream(f);
            geneset.assignLoss(newnode, nodeLossMap, ps);
            ps.close();
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        }
    });
    popup.getItems().add(genegainloss);
    MenuItem concattree = new MenuItem("Concatenate tree");
    concattree.setOnAction(e -> {
        Serifier serifier = getConcatenatedSequences(false, true);

        boolean succ = true;
        if (comp instanceof Applet) {
            try {
                JSObject win = JSObject.getWindow((Applet) comp);
                StringWriter sw = new StringWriter();
                serifier.writeFasta(serifier.lseq, sw, null);
                sw.close();
                win.call("fasttree", new Object[] { sw.toString() });
            } catch (NoSuchMethodError | Exception e1) {
                e1.printStackTrace();
                succ = false;
            }
        }

        /*if( !succ ) {
           String             tree = serifier.getFastTree();
           if( cs.connections().size() > 0 ) {
        cs.sendToAll( tree );
            } else if( Desktop.isDesktopSupported() ) {
        cs.message = tree;
        //String uristr = "http://webconnectron.appspot.com/Treedraw.html?tree="+URLEncoder.encode( tree, "UTF-8" );
        String uristr = "http://webconnectron.appspot.com/Treedraw.html?ws=127.0.0.1:8887";
              try {
          Desktop.getDesktop().browse( new URI(uristr) );
              } catch (IOException | URISyntaxException e1) {
          e1.printStackTrace();
              }
            }
           System.err.println( tree );
        }*/
        showAlignedSequences(comp, serifier);
    });
    popup.getItems().add(concattree);
    MenuItem majocons = new MenuItem("Majority rule consensus");
    majocons.setOnAction(e -> {
        Serifier serifier = new Serifier();

        Set<GeneGroup> genegroups = new HashSet<GeneGroup>();
        if (!isGeneview()) {
            genegroups.addAll(table.getSelectionModel().getSelectedItems());
        } else {
            for (Gene gg : gtable.getSelectionModel().getSelectedItems()) {
                genegroups.add(gg.getGeneGroup());
            }
        }

        TreeUtil treeutil = new TreeUtil();
        Map<Set<String>, NodeSet> nmap = new HashMap<Set<String>, NodeSet>();
        for (GeneGroup ggroup : genegroups) {
            //List<Sequence>   seqlist = new ArrayList<Sequence>();

            for (Tegeval tv : ggroup.getTegevals()) {
                String spec = tv.getContshort().getSpec();
                Sequence seq = tv.getAlignedSequence();

                //Sequence seq = new Sequence( spec, null );
                //if( seqstr != null && seqstr.length() > 0 ) seq.append( seqstr );
                serifier.addSequence(seq);
            }

            String tree = serifier.getFastTree(serifier.lseq, geneset.user, false);
            Node n = treeutil.parseTreeRecursive(tree, false);
            treeutil.setLoc(0);
            n.nodeCalcMap(nmap);
        }

        Node guidetree = null;

        /*********************************** Serifier serifier = getConcatenatedSequences();
        String tree = serifier.getFastTree();
        guidetree = treeutil.parseTreeRecursive( tree, false );*/

        Node root = DataTable.majoRuleConsensus(treeutil, nmap, guidetree, false);
        String tree = root.toString();

        if (geneset.cs.connections().size() > 0) {
            geneset.cs.sendToAll(tree);
        } else if (Desktop.isDesktopSupported()) {
            geneset.cs.message = tree;
            //String uristr = "http://webconnectron.appspot.com/Treedraw.html?tree="+URLEncoder.encode( tree, "UTF-8" );
            String uristr = "http://webconnectron.appspot.com/Treedraw.html?ws=127.0.0.1:8887";
            try {
                Desktop.getDesktop().browse(new URI(uristr));
            } catch (IOException | URISyntaxException e1) {
                e1.printStackTrace();
            }
        }
    });
    popup.getItems().add(majocons);
    MenuItem addsim = new MenuItem("Add similar");
    addsim.setOnAction(e -> {
        /*int r = table.getSelectedRow();
        int c = table.getSelectedColumn();
                
        Object o = table.getValueAt(r, c);
                
        if (c >= 18) {
           for (int i = 0; i < table.getRowCount(); i++) {
              Object no = table.getValueAt(i, c);
              if (no != null && !table.isRowSelected(i))
          table.addRowSelectionInterval(i, i);
           }
        } else {
           for (int i = 0; i < table.getRowCount(); i++) {
              Object no = table.getValueAt(i, c);
              if (o.equals(no) && !table.isRowSelected(i))
          table.addRowSelectionInterval(i, i);
           }
        }*/
    });
    popup.getItems().add(addsim);
    MenuItem selsim = new MenuItem("Select similar");
    selsim.setOnAction(e -> {
        /*int r = table.getSelectedRow();
        int c = table.getSelectedColumn();
                
        Object o = table.getValueAt(r, c);
                
        table.removeRowSelectionInterval(0, table.getRowCount() - 1);
        if (c >= 18) {
           for (int i = 0; i < table.getRowCount(); i++) {
              Object no = table.getValueAt(i, c);
              if (no != null)
          table.addRowSelectionInterval(i, i);
           }
        } else {
           for (int i = 0; i < table.getRowCount(); i++) {
              Object no = table.getValueAt(i, c);
              if (o.equals(no))
          table.addRowSelectionInterval(i, i);
           }
        }*/
    });
    popup.getItems().add(selsim);
    MenuItem tabtxt = new MenuItem("Table text");
    tabtxt.setOnAction(e -> {
        /*JTextArea ta = new JTextArea();
        ta.setDragEnabled(true);
        JScrollPane scrollpane = new JScrollPane(ta);
                
        StringBuilder sb = new StringBuilder();
        int[] rr = table.getSelectedRows();
        for (int r : rr) {
           for (int c = 0; c < table.getColumnCount() - 1; c++) {
              Object o = table.getValueAt(r, c);
              if (c > 18) {
          if (o != null) {
             String val = o.toString();
             int k = val.indexOf(' ');
             sb.append(val.substring(0, k));
             sb.append("\t" + val.substring(k + 1));
          } else
             sb.append("\t");
              } else {
          if (o != null) {
             sb.append(o.toString());
          }
              }
              sb.append("\t");
           }
           Object o = table.getValueAt(r, table.getColumnCount() - 1);
           if (o != null) {
              String val = o.toString();
              int k = val.indexOf(' ');
              sb.append(val.substring(0, k));
              sb.append("\t" + val.substring(k + 1));
           } else
              sb.append("\t");
           sb.append("\n");
        }
                
        ta.setText(sb.toString());
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.add(scrollpane);
        frame.setSize(400, 300);
        frame.setVisible(true);*/
    });
    popup.getItems().add(tabtxt);
    popup.getItems().add(new SeparatorMenuItem());
    MenuItem ncbil = new MenuItem("NCBI lookup");
    ncbil.setOnAction(e -> {
        /*int r = table.getSelectedRow();
        if (r >= 0) {
           String ref = (String) table.getValueAt(r, 2);
           try {
              Desktop.getDesktop().browse(new URI("http://www.ncbi.nlm.nih.gov/gene?term=" + ref));
           } catch (IOException e1) {
              e1.printStackTrace();
           } catch (URISyntaxException e1) {
              e1.printStackTrace();
           }
        }*/
    });
    popup.getItems().add(ncbil);
    table.setContextMenu(popup);
    gtable.setContextMenu(popup);

    TableColumn<Function, String> gocol = new TableColumn("GO");
    gocol.setCellValueFactory(new PropertyValueFactory<>("go"));
    ftable.getColumns().add(gocol);
    TableColumn<Function, String> ecfcol = new TableColumn("EC");
    ecfcol.setCellValueFactory(new PropertyValueFactory<>("ec"));
    ftable.getColumns().add(ecfcol);
    TableColumn<Function, String> metacyccol = new TableColumn("MetaCyc");
    metacyccol.setCellValueFactory(new PropertyValueFactory<>("metacyc"));
    ftable.getColumns().add(metacyccol);
    TableColumn<Function, String> keggcol = new TableColumn("KEGG");
    keggcol.setCellValueFactory(new PropertyValueFactory<>("kegg"));
    ftable.getColumns().add(keggcol);
    TableColumn<Function, String> funcovcol = new TableColumn("Funciton coverage");
    funcovcol.setCellValueFactory(new PropertyValueFactory<>("speciesCount"));
    ftable.getColumns().add(funcovcol);
    TableColumn<Function, String> numprotcol = new TableColumn("Number of proteins");
    numprotcol.setCellValueFactory(new PropertyValueFactory<>("groupCount"));
    ftable.getColumns().add(numprotcol);

    TableColumn<Function, String> namecol = new TableColumn("Name");
    namecol.setCellValueFactory(new PropertyValueFactory<>("name"));
    ftable.getColumns().add(namecol);
    TableColumn<Function, String> namespacecol = new TableColumn("Namespace");
    namespacecol.setCellValueFactory(new PropertyValueFactory<>("namespace"));
    ftable.getColumns().add(namespacecol);
    TableColumn<Function, String> desccol = new TableColumn("Desc");
    desccol.setCellValueFactory(new PropertyValueFactory<>("desc"));
    ftable.getColumns().add(desccol);

    ftable.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    //ftable.setAutoCreateRowSorter(true);
    /*ftablemodel = new TableModel() {
       @Override
       public int getRowCount() {
    return geneset.funclist.size();
       }
            
       @Override
       public int getColumnCount() {
    return 9;
       }
            
       @Override
       public String getColumnName(int columnIndex) {
    if (columnIndex == 0)
       return "GO";
    else if (columnIndex == 1)
       return "EC";
    else if (columnIndex == 2)
       return "MetaCyc";
    else if (columnIndex == 3)
       return "KEGG";
    else if (columnIndex == 4)
       return "Function coverage";
    else if (columnIndex == 5)
       return "Number of proteins";
    else if (columnIndex == 6)
       return "Name";
    else if (columnIndex == 7)
       return "Namespace";
    else if (columnIndex == 8)
       return "Def";
    return "";
       }
            
       @Override
       public Class<?> getColumnClass(int columnIndex) {
    if( columnIndex == 4 || columnIndex == 5 )
       return Integer.class;
    return String.class;
       }
            
       @Override
       public boolean isCellEditable(int rowIndex, int columnIndex) {
    return false;
       }
            
       @Override
       public Object getValueAt(int rowIndex, int columnIndex) {
    Function func = geneset.funclist.get(rowIndex);
    if( columnIndex == 0 )
       return func.go;
    else if( columnIndex == 1 )
       return func.ec;
    else if( columnIndex == 2 )
       return func.metacyc;
    else if( columnIndex == 3 )
       return func.kegg;
    else if( columnIndex == 4 )
       return func.getSpeciesCount();
    else if( columnIndex == 5 )
       return table.getModel() == groupModel ? func.getGroupSize() : func.getGeneCount();
    else if( columnIndex == 6 )
       return func.name;
    else if( columnIndex == 7 )
       return func.namespace;
    else if( columnIndex == 8 )
       return func.desc;
    return null;
       }
            
       @Override
       public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
       }
            
       @Override
       public void addTableModelListener(TableModelListener l) {
       }
            
       @Override
       public void removeTableModelListener(TableModelListener l) {
       }
    };
    ftable.setModel( ftablemodel );
    fscrollpane.setViewportView(ftable);*/

    updateFilter(ftable, null);
    updateFilter(table, label);

    combo.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        String sel = newValue;
        filterset.clear();
        if (geneset.pathwaymap.containsKey(sel)) {
            Set<String> enz = geneset.pathwaymap.get(sel);
            for (Function f : geneset.funclist) {
                if (f.getEc() != null && enz.contains(f.getEc())) {
                    filterset.add(f.index);
                }
            }
        }
        updateFilter(ftable, null);
    });

    specombo.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        String sel = newValue;
        genefilterset.clear();
        for (Gene g : geneset.genelist) {
            Tegeval tv = g.tegeval;
            if (sel.equals(tv.teg)) {
                //System.out.println(g.name + " " + sp + " " + sel + "  " + tv.eval);
                genefilterset.add(g.index);
            }
        }
        updateFilter(table, label);
    });

    MenuItem findcon = new MenuItem("Find conserved terms");
    findcon.setOnAction(e -> {
        Set<Integer> res = new HashSet<>();
        for (Function f : geneset.funclist) {
            if (f.getGeneGroups() != null) {
                Set<String> check = new HashSet<>();
                for (GeneGroup g : f.getGeneGroups()) {
                    //Gene g = genemap.get(str);
                    if (g.species != null) {
                        if (check.isEmpty())
                            check.addAll(g.species.keySet());
                        else if (!(check.size() == g.species.size() && check.containsAll(g.species.keySet()))) {
                            check.clear();
                            break;
                        }
                    }
                }
                if (!check.isEmpty())
                    res.add(f.index);
            }
        }
        filterset.clear();
        for (int i : res) {
            filterset.add(i);
        }
        updateFilter(ftable, null);
    });
    fpopup.getItems().add(findcon);
    fpopup.getItems().add(new SeparatorMenuItem());

    MenuItem showgen = new MenuItem("Show genes");
    showgen.setOnAction(e -> {
        genefilterset.clear();
        Set<GeneGroup> sset = new HashSet<>();
        for (Function f : (ObservableList<Function>) ftable.getSelectionModel().getSelectedItems()) {
            if (!isGeneview()) {
                sset.addAll(f.getGeneGroups());
                /*if( sset != null ) for (GeneGroup gg : sset) {
                   //Gene g = genemap.get(s);
                   genefilterset.add(gg.index);
                }*/
            } else {
                /*Set<Gene> sset = f.getGeneentries();
                for (Gene g : sset) {
                   //Gene g = genemap.get(s);
                   genefilterset.add(g.index);
                }*/
            }
        }

        //int[] rows = sset.stream().mapToInt( gg -> sortedData.indexOf(gg) ).toArray();
        //table.getSelectionModel().selectIndices(rows[0], rows);

        filteredData.setPredicate(genegroup -> {
            return sset.contains(genegroup);
        });
        if (label != null)
            label.setText(
                    table.getItems().size() + "/" + table.getSelectionModel().getSelectedIndices().size());
    });
    fpopup.getItems().add(showgen);

    table.getSelectionModel().selectedItemProperty().addListener(e -> {
        // table.clearSelection();
        tableisselecting = true;
        if (!ftableisselecting && filterset.isEmpty()) {
            //ftable.removeRowSelectionInterval(0, ftable.getRowCount() - 1);
            if (!isGeneview()) {
                for (GeneGroup gg : table.getSelectionModel().getSelectedItems()) {
                    for (Function f : gg.getFunctions()) {
                        try {
                            ftable.getSelectionModel().select(f);
                            //int rf = ftable.convertRowIndexToView(f.index);
                            //if( rf >= 0 && rf < ftable.getRowCount() ) ftable.addRowSelectionInterval(rf, rf);
                        } catch (Exception ex) {
                            ex.printStackTrace();
                        }
                    }
                }
            } else {
                for (Gene g : gtable.getSelectionModel().getSelectedItems()) {
                    if (g.funcentries != null) {
                        for (Function f : g.funcentries) {
                            //Function f = funcmap.get(go);
                            try {
                                ftable.getSelectionModel().select(f);
                                //int rf = ftable.convertRowIndexToView(f.index);
                                //if( rf >= 0 && rf < ftable.getRowCount() ) ftable.addRowSelectionInterval(rf, rf);
                            } catch (Exception ex) {
                                ex.printStackTrace();
                            }
                        }
                    }
                }
            }
        }
        tableisselecting = false;
    });

    ftable.setOnKeyPressed(ke -> {
        if (ke.getCode() == KeyCode.ESCAPE) {
            ffilteredData.setPredicate(null);
        }
    });

    table.setOnKeyPressed(ke -> {
        if (ke.getCode() == KeyCode.ESCAPE) {
            GeneGroup selgg = table.getSelectionModel().getSelectedItem();

            List<GeneGroup> sel = new ArrayList<>(filteredData);
            filteredData.setPredicate(null);
            int[] rows = sel.stream().mapToInt(gg -> sortedData.indexOf(gg)).toArray();
            if (rows.length > 0)
                table.getSelectionModel().selectIndices(rows[0], rows);
            if (label != null)
                label.setText(
                        table.getItems().size() + "/" + table.getSelectionModel().getSelectedIndices().size());

            table.scrollTo(selgg);
            //genefilterset.clear();
            //updateFilter(table, genefilter, label);
            //geneset.scrollToSelection( table );
        }
    });

    table.setOnMousePressed(e -> {
        tableisselecting = true;
        if (!ftableisselecting && e.getClickCount() == 2) {
            /*
             * int[] rr = ftable.getSelectedRows(); int minr =
             * ftable.getRowCount(); int maxr = 0; for( int r : rr ) {
             * if( r < minr ) minr = r; if( r > maxr ) maxr = r; }
             * ftable.removeRowSelectionInterval(minr, maxr);
             */
            // ftable.removeRowSelectionInterval(0, filterset.isEmpty()
            // ? ftable.getRowCount()-1 : filterset.size()-1 );

            Set<Function> fset = new HashSet<>();
            filterset.clear();
            if (!isGeneview()) {
                for (GeneGroup gg : table.getSelectionModel().getSelectedItems()) {
                    fset.addAll(gg.getFunctions());
                }
            } else {
                for (Gene g : gtable.getSelectionModel().getSelectedItems()) {
                    if (g.funcentries != null) {
                        for (Function f : g.funcentries) {
                            //Function f = funcmap.get(go);
                            // ftable.getRowSorter().convertRowIndexToView(index)
                            // int rf = ftable.convertRowIndexToView(
                            // f.index );
                            filterset.add(f.index);
                            // ftable.addRowSelectionInterval(rf, rf);
                        }
                    }
                }
            }
            ffilteredData.setPredicate(p -> fset.contains(p));
        }
        tableisselecting = false;
    });

    ftable.setOnMousePressed(e -> {
        ftableisselecting = true;
        Set<GeneGroup> ggset = new HashSet<>();
        if (!tableisselecting && e.getClickCount() == 2) {
            genefilterset.clear();
            for (Function f : (ObservableList<Function>) ftable.getSelectionModel().getSelectedItems()) {
                if (f.getGeneentries() != null) {
                    if (!isGeneview()) {
                        ggset.addAll(f.getGeneGroups());
                    } else {
                        for (Gene g : f.getGeneentries()) {
                            //Gene g = genemap.get(ref);
                            // int rf = table.convertRowIndexToView( g.index
                            // );
                            // table.addRowSelectionInterval(rf, rf);
                            genefilterset.add(g.index);
                        }
                    }
                }
            }
            filteredData.setPredicate(p -> ggset.contains(p));
        }
        ftableisselecting = false;
    });

    ftable.getSelectionModel().selectedItemProperty().addListener(e -> {
        ftableisselecting = true;
        if (!tableisselecting && genefilterset.isEmpty()) {
            table.getSelectionModel().clearSelection();
            //table.removeRowSelectionInterval(0, table.getRowCount() - 1);
            for (Function f : ftable.getSelectionModel().getSelectedItems()) {
                if (f.getGeneentries() != null) {
                    for (Gene g : f.getGeneentries()) {
                        table.getSelectionModel().select(g.getGeneGroup());

                        //Gene g = genemap.get(ref);
                        /*int i = g.getGroupIndex();
                        if( i >= 0 && i <= table.getItems().size() ) {
                           int rf = table.convertRowIndexToView(i);
                           table.addRowSelectionInterval(rf, rf);
                        }*/
                    }
                }
            }
        }
        ftableisselecting = false;
    });

    textfield.setOnKeyPressed(e -> {
        String text = textfield.getText().toLowerCase();
        if (e.getCode() == KeyCode.ENTER) {
            searchi = searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol")
                    ? searchTable(table, text, searchi, e.isAltDown(), 8, 9, 10, 16)
                    : searchTable(table, text, searchi, e.isAltDown(), 0);
        }
    });

    textfield.textProperty().addListener((observable, oldValue, newValue) -> {
        //String text = textfield.getText().toLowerCase();
        String lowerCaseFilter = newValue.toLowerCase();
        Predicate<GeneGroup> p = genegroup -> {
            if (newValue == null || newValue.isEmpty()) {
                return true;
            }

            if (searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol")) {
                if ((genegroup.getCogsymbol() != null
                        && genegroup.getCogsymbol().toLowerCase().contains(lowerCaseFilter))
                        || (genegroup.getSymbol() != null
                                && genegroup.getSymbol().toLowerCase().contains(lowerCaseFilter))
                        || (genegroup.getKoname() != null
                                && genegroup.getKoname().toLowerCase().contains(lowerCaseFilter))) {
                    return true; // Filter matches first name.
                }
            } else {
                if (genegroup.getName().toLowerCase().contains(lowerCaseFilter) || genegroup.genes.stream()
                        .anyMatch(gg -> gg.getName().toLowerCase().contains(lowerCaseFilter))) {
                    return true; // Filter matches first name.
                } /* else if (genegroup.getLastName().toLowerCase().contains(lowerCaseFilter)) {
                    return true; // Filter matches last name.
                  }*/
            }
            return false; // Does not match.
        };
        if (filter.isSelected()) {
            filteredData.setPredicate(p);
            if (label != null)
                label.setText(
                        table.getItems().size() + "/" + table.getSelectionModel().getSelectedIndices().size());
            //if( searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol") ) updateFilter(0, text, table, genefilter, genefilterset, label, 8, 9, 10, 16 );
            //else updateFilter(0, text, table, genefilter, genefilterset, label, 0 );
        } else {
            Optional<GeneGroup> ogg = filteredData.stream().filter(p).findFirst();
            if (ogg.isPresent()) {
                GeneGroup gg = ogg.get();
                table.getSelectionModel().select(gg);
                table.scrollTo(gg);
            }
            //searchi = searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol") ? searchTable( table, text, 0, false, 8, 9, 10, 16 ) : searchTable( table, text, 0, false, 0 );
        }
    });
    /*textfield.getDocument().addDocumentListener(new DocumentListener() {
       public void changedUpdate(DocumentEvent e) {
    String text = textfield.getText().toLowerCase();
    if( filter.isSelected() ) {
       if( searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol") ) updateFilter(0, text, table, genefilter, genefilterset, label, 8, 9, 10, 16 );
       else updateFilter(0, text, table, genefilter, genefilterset, label, 0 );
    } else {
       searchi = searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol") ? searchTable( table, text, 0, false, 8, 9, 10, 16 ) : searchTable( table, text, 0, false, 0 );
    }
       }
            
       public void insertUpdate(DocumentEvent e) {
    String text = textfield.getText().toLowerCase();
    if( filter.isSelected() ) {
       if( searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol") ) updateFilter(1, text, table, genefilter, genefilterset, label, 8, 9, 10, 16);
       else updateFilter(1, text, table, genefilter, genefilterset, label, 0);
    } else {
       searchi = searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol") ? searchTable( table, text, 0, false, 8, 9, 10, 16 ) : searchTable( table, text, 0, false, 0 );
    }
       }
            
       public void removeUpdate(DocumentEvent e) {
    String text = textfield.getText().toLowerCase();
    if( filter.isSelected() ) {
       if( searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol") ) updateFilter(2, text, table, genefilter, genefilterset, label, 8, 9, 10, 16 );
       else updateFilter(2, text, table, genefilter, genefilterset, label, 0);
    } else {
       searchi = searchTable( table, text, 0, false, searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol") ? 7 : 0 );
    }
       }
    });*/

    ftextfield.textProperty().addListener(new javafx.beans.value.ChangeListener<String>() {
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            //String text = textfield.getText().toLowerCase();
            if (filter.isSelected()) {
                ffilteredData.setPredicate(function -> {
                    // If filter text is empty, display all persons.
                    if (newValue == null || newValue.isEmpty()) {
                        return true;
                    }

                    // Compare first name and last name of every person with filter text.
                    String lowerCaseFilter = newValue.toLowerCase();

                    boolean desc = function.getDesc() != null
                            && function.getDesc().toLowerCase().contains(lowerCaseFilter);
                    boolean name = function.getName() != null
                            && function.getName().toLowerCase().contains(lowerCaseFilter);
                    boolean go = function.getGo() != null
                            && function.getGo().toLowerCase().contains(lowerCaseFilter);
                    boolean ec = function.getEc() != null
                            && function.getEc().toLowerCase().contains(lowerCaseFilter);

                    if (desc || name || go || ec) {
                        return true; // Filter matches first name.
                    } /* else if (genegroup.getLastName().toLowerCase().contains(lowerCaseFilter)) {
                         return true; // Filter matches last name.
                      }*/
                    return false; // Does not match.
                });
            } else {
                //searchi = searchcolcomb.getSelectionModel().getSelectedItem().equals("Symbol") ? searchTable( table, text, 0, false, 8, 9, 10, 16 ) : searchTable( table, text, 0, false, 0 );
            }
        }
    });
    /*ftextfield.getDocument().addDocumentListener(new DocumentListener() {
       public void changedUpdate(DocumentEvent e) {
    updateFilter(0, ftextfield.getText(), ftable, rowfilter, filterset, null, 6);
       }
            
       public void insertUpdate(DocumentEvent e) {
    updateFilter(1, ftextfield.getText(), ftable, rowfilter, filterset, null, 6);
       }
            
       public void removeUpdate(DocumentEvent e) {
    updateFilter(2, ftextfield.getText(), ftable, rowfilter, filterset, null, 6);
       }
    });*/
    MenuItem kegggl = new MenuItem("KEGG gene lookup");
    kegggl.setOnAction(e -> {
        Gene g = gtable.getSelectionModel().getSelectedItem();
        try {
            Desktop.getDesktop().browse(new URI("http://www.genome.jp/dbget-bin/www_bget?" + g.keggid));
        } catch (IOException e1) {
            e1.printStackTrace();
        } catch (URISyntaxException e1) {
            e1.printStackTrace();
        }
    });
    popup.getItems().add(kegggl);
    MenuItem showgenes = new MenuItem("Show genes with same sharing");
    showgenes.setOnAction(e -> {
        genefilterset.clear();
        GeneGroup gg = table.getSelectionModel().getSelectedItem();
        for (GeneGroup g : geneset.allgenegroups) {
            if (gg.species != null && g.species != null) {
                Set<String> ggset = gg.species.keySet();
                Set<String> gset = g.species.keySet();

                if (gset.size() == ggset.size() && gset.containsAll(ggset)) {
                    genefilterset.add(g.index);
                }
            }
        }
        updateFilter(table, label);
    });
    popup.getItems().add(showgenes);
    MenuItem showshared = new MenuItem("Show shared function");
    showshared.setOnAction(e -> {
        filterset.clear();
        Set<Function> startfunc = new HashSet<Function>();
        if (isGeneview()) {
            for (Gene gg : gtable.getSelectionModel().getSelectedItems()) {
                if (gg.funcentries != null) {
                    if (startfunc.isEmpty()) {
                        startfunc.addAll(gg.funcentries);
                    } else {
                        startfunc.retainAll(gg.funcentries);
                    }
                }
                /*if (startfunc == null)
                startfunc = new HashSet<Function>(gg.funcentries);
                else {
                startfunc.retainAll(gg.funcentries);
                }*/
            }
        } else {
            for (GeneGroup gg : table.getSelectionModel().getSelectedItems()) {
                Set<Function> fset = gg.getFunctions();
                if (startfunc.isEmpty()) {
                    startfunc.addAll(fset);
                } else {
                    startfunc.retainAll(fset);
                }
            }
        }
        for (Function f : geneset.funclist) {
            filterset.add(f.index);
        }
        updateFilter(ftable, null);
    });
    popup.getItems().add(showshared);
    MenuItem showall = new MenuItem("Show all functions");
    showall.setOnAction(e -> {
        filterset.clear();
        Set<Function> startfunc = null;
        if (isGeneview()) {
            for (Gene gg : gtable.getSelectionModel().getSelectedItems()) {
                if (gg.funcentries != null) {
                    for (Function f : gg.funcentries) {
                        filterset.add(f.index);
                    }
                }
            }
        } else {
            for (GeneGroup gg : table.getSelectionModel().getSelectedItems()) {
                Set<Function> fset = gg.getFunctions();
                for (Function f : fset) {
                    filterset.add(f.index);
                }
            }
        }
        updateFilter(ftable, null);
    });
    popup.getItems().add(showall);
    popup.getItems().add(new SeparatorMenuItem());
    MenuItem showgenegroups = new MenuItem("Show gene groups in proximity");
    showgenegroups.setOnAction(e -> {
        proxi(filteredData, false);
        updateFilter(table, label);
    });
    popup.getItems().add(showgenegroups);
    MenuItem selgenegroups = new MenuItem("Select gene groups in proximity");
    selgenegroups.setOnAction(e -> {
        genefilterset.clear();
        proxi(filteredData, false);
        for (int i : genefilterset) {
            table.getSelectionModel().select(i);
        }
        //table.tableChanged( new TableModelEvent( table.getModel() ) );
        if (label != null)
            label.setText(table.getItems().size() + "/" + table.getSelectionModel().getSelectedItems().size());
        //updateFilter(table, genefilter, label);
    });
    popup.getItems().add(selgenegroups);
    MenuItem selgenes = new MenuItem("Select genes in proximity");
    selgenes.setOnAction(e -> {
        genefilterset.clear();
        proxi(filteredData, true);
        for (int i : genefilterset) {
            table.getSelectionModel().select(i);
        }
        //table.tableChanged( new TableModelEvent( table.getModel() ) );
        if (label != null)
            label.setText(table.getItems().size() + "/" + table.getSelectionModel().getSelectedItems().size());
        //updateFilter(table, genefilter, label);
    });
    popup.getItems().add(selgenes);
    MenuItem addgene = new MenuItem("Add gene groups in proximity");
    addgene.setOnAction(e -> {
        proxi(filteredData, false);
        updateFilter(table, label);
    });
    popup.getItems().add(addgene);
    MenuItem remgene = new MenuItem("Remove gene groups in proximity");
    remgene.setOnAction(e -> {
        ObservableList<Integer> rr = table.getSelectionModel().getSelectedIndices();
        if (genefilterset.isEmpty()) {
            Set<Integer> ii = new HashSet<>();
            for (int r : rr)
                ii.add(r);
            for (int i = 0; i < geneset.genelist.size(); i++) {
                if (!ii.contains(i))
                    genefilterset.add(i);
            }
        }
        proxi(filteredData, false);
        updateFilter(table, label);
    });
    popup.getItems().add(remgene);
    popup.getItems().add(new SeparatorMenuItem());
    MenuItem showrel = new MenuItem("Show related genes");
    showrel.setOnAction(e -> {
        genefilterset.clear();
        relati(gtable, geneset.genelist, genefilterset, geneset.uclusterlist, false);
        updateFilter(gtable, label);
    });
    popup.getItems().add(showrel);
    MenuItem addrel = new MenuItem("Add related genes");
    addrel.setOnAction(e -> {
        relati(gtable, geneset.genelist, genefilterset, geneset.uclusterlist, false);
        updateFilter(gtable, label);
    });
    popup.getItems().add(addrel);
    MenuItem remrel = new MenuItem("Remove related genes");
    remrel.setOnAction(e -> {
        ObservableList<Integer> rr = gtable.getSelectionModel().getSelectedIndices();
        if (genefilterset.isEmpty()) {
            Set<Integer> ii = new HashSet<>();
            for (int r : rr)
                ii.add(r);
            for (int i = 0; i < geneset.genelist.size(); i++) {
                if (!ii.contains(i))
                    genefilterset.add(i);
            }
        }
        relati(gtable, geneset.genelist, genefilterset, geneset.uclusterlist, true);
        updateFilter(table, label);
    });
    popup.getItems().add(remrel);
    popup.getItems().add(new SeparatorMenuItem());
    MenuItem showcloserel = new MenuItem("Show closely related genes");
    showcloserel.setOnAction(e -> {
        genefilterset.clear();
        Set<String> ct = new HashSet<>();
        for (Gene gg : gtable.getSelectionModel().getSelectedItems()) {
            // genefilterset.add( gg.index );
            Tegeval tv = gg.tegeval;
            for (Set<String> uset : geneset.iclusterlist) {
                if (uset.contains(tv.name)) {
                    ct.addAll(uset);
                    break;
                }
            }
        }

        for (Gene g : geneset.genelist) {
            Tegeval tv = g.tegeval;
            if (ct.contains(tv.name)) {
                genefilterset.add(g.index);
                break;
            }
        }

        updateFilter(table, label);
    });
    popup.getItems().add(showcloserel);
    MenuItem showdist = new MenuItem("Show distance matrix");
    showdist.setOnAction(e -> {
        JTextArea textarea = new JTextArea();

        try {
            if (clipboardService == null)
                clipboardService = (ClipboardService) ServiceManager.lookup("javax.jnlp.ClipboardService");
            Action action = new CopyAction("Copy", null, "Copy data",
                    new Integer(KeyEvent.VK_CONTROL + KeyEvent.VK_C));
            textarea.getActionMap().put("copy", action);
            grabFocus = true;
        } catch (Exception ee) {
            ee.printStackTrace();
            System.err.println("Copy services not available.  Copy using 'Ctrl-c'.");
        }
        textarea.setDragEnabled(true);

        JScrollPane scrollpane = new JScrollPane(textarea);
        Gene gg = gtable.getSelectionModel().getSelectedItem();
        if (gg.getSpecies() != null) {
            for (String s : geneset.corrInd) {
                if (s.equals(geneset.corrInd.get(0)))
                    textarea.append(s);
                else
                    textarea.append("\t" + s);
            }

            int i = 0;
            int j = 0;

            int len = 16;
            double[] min = new double[len];
            double[] max = new double[len];

            for (i = 0; i < len; i++) {
                min[i] = Double.MAX_VALUE;
                max[i] = 0.0;
            }

            double[] corrarr = gg.corrarr;
            boolean symmetrize = true;
            if (symmetrize) {
                for (i = 0; i < len; i++) {
                    for (int k = i + 1; k < len; k++) {
                        corrarr[i * len + k] = (corrarr[k * len + i] + corrarr[i * len + k]) / 2.0;
                        corrarr[k * len + i] = corrarr[i * len + k];
                    }
                }
            }

            for (i = 0; i < len; i++) {
                for (int k = 0; k < len; k++) {
                    if (corrarr[i * len + k] < min[i])
                        min[i] = corrarr[i * len + k];
                    if (corrarr[i * len + k] > max[i])
                        max[i] = corrarr[i * len + k];
                }

                /*for (int k = 0; k < len; k++) {
                   corrarr[i * 16 + k] = corrarr[i * 16 + k] - min;
                }*/
            }

            i = 0;
            for (double d : corrarr) {
                double dval = d;
                if (i % len == 0)
                    textarea.append("\n" + dval);
                else
                    textarea.append("\t" + dval);

                i++;
            }
            textarea.append("\n");

            i = 0;
            for (double d : corrarr) {
                double dval = Math.exp((d - min[i / len]) / 20.0 + 1.0) / 100.0; // 0.0 ?
                // 0.0 :
                // 100.0/d;
                if (i % len == 0)
                    textarea.append("\n" + dval);
                else
                    textarea.append("\t" + dval);

                i++;
            }
            double[] newcorr = Arrays.copyOf(corrarr, corrarr.length);
            textarea.append("\nD matrix\n");
            i = 0;
            for (double d : corrarr) {
                double dval = max[i / len] - d;
                newcorr[i] = dval;
                if (i % len == 0)
                    textarea.append("\n" + dval);
                else
                    textarea.append("\t" + dval);

                i++;
            }

            TreeUtil treeutil = new TreeUtil();
            treeutil.neighborJoin(newcorr, geneset.corrInd, null, true, true);
        }

        /*
         * int[] rr = table.getSelectedRows(); for( int r : rr ) { int
         * cr = table.convertRowIndexToModel(r); Gene gg =
         * genelist.get(cr); if( gg.species != null ) { textarea.append(
         * gg.name + ":\n" ); for( String sp : gg.species.keySet() ) {
         * Teginfo stv = gg.species.get( sp ); for( Tegeval tv :
         * stv.tset ) { textarea.append( ">" + tv.cont + " " + tv.teg +
         * " " + tv.eval + "\n" ); for( int i = 0; i < tv.seq.length();
         * i+=70 ) { int end = Math.min(i+70,tv.seq.length());
         * textarea.append( tv.seq.substring(i, end)+"\n" ); //new
         * String( tv.seq, i, Math.min(i+70,tv.seq.length()) )+"\n"); }
         * //textarea.append( ">" + tv.cont + " " + tv.teg + " " +
         * tv.eval + "\n" + tv.seq + "\n" ); } } } }
         */
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.add(scrollpane);
        frame.setSize(400, 300);
        frame.setVisible(true);
    });

    /*
     * final List<String> reglist = new ArrayList<String>(); final
     * Map<String,Gene> regidx = new TreeMap<String,Gene>();
     * 
     * for( Gene g : geneset.genelist ) { if( g.species != null ) { for( String key
     * : g.species.keySet() ) { Set<Tegeval> stv = g.species.get(key); for(
     * Tegeval tv : stv ) { regidx.put(tv.cont, g); } } } }
     * 
     * for( String key : regidx.keySet() ) { reglist.add(key); }
     * 
     * final JTable contigtable = new JTable();
     * contigtable.setAutoCreateRowSorter( true ); contigtable.setModel( new
     * TableModel() {
     * 
     * @Override public int getRowCount() { return reglist.size(); }
     * 
     * @Override public int getColumnCount() { return 1; }
     * 
     * @Override public String getColumnName(int columnIndex) { return
     * "Region"; }
     * 
     * @Override public Class<?> getColumnClass(int columnIndex) { return
     * String.class; }
     * 
     * @Override public boolean isCellEditable(int rowIndex, int
     * columnIndex) { return false; }
     * 
     * @Override public Object getValueAt(int rowIndex, int columnIndex) {
     * return reglist.get(rowIndex); }
     * 
     * @Override public void setValueAt(Object aValue, int rowIndex, int
     * columnIndex) { // TODO Auto-generated method stub
     * 
     * }
     * 
     * @Override public void addTableModelListener(TableModelListener l) {
     * // TODO Auto-generated method stub
     * 
     * }
     * 
     * @Override public void removeTableModelListener(TableModelListener l)
     * { // TODO Auto-generated method stub
     * 
     * } });
     * 
     * contigtable.getSelectionModel().addListSelectionListener( new
     * ListSelectionListener() {
     * 
     * @Override public void valueChanged(ListSelectionEvent e) {
     * genefilterset.clear(); int[] rr = contigtable.getSelectedRows(); for(
     * int r : rr ) { String s = (String)contigtable.getValueAt(r, 0); Gene
     * g = regidx.get( s );
     * 
     * genefilterset.add( g.index ); updateFilter(table, genefilter, label);
     * //int k = table.convertRowIndexToView(g.index); //if( k != -1
     * )table.addRowSelectionInterval(k, k); } } }); JScrollPane
     * contigscroll = new JScrollPane( contigtable );
     * 
     * JSplitPane mainsplit = new JSplitPane( JSplitPane.HORIZONTAL_SPLIT );
     * mainsplit.setLeftComponent( contigscroll );
     * mainsplit.setRightComponent( splitpane );
     */
}