Example usage for javax.swing JTextField setEditable

List of usage examples for javax.swing JTextField setEditable

Introduction

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

Prototype

@BeanProperty(description = "specifies if the text can be edited")
public void setEditable(boolean b) 

Source Link

Document

Sets the specified boolean to indicate whether or not this TextComponent should be editable.

Usage

From source file:com.dragoniade.deviantart.ui.PreferencesDialog.java

public PreferencesDialog(final DownloaderGUI owner, Properties config) {
    super(owner, "Preferences", true);

    HttpClientParams params = new HttpClientParams();
    params.setVersion(HttpVersion.HTTP_1_1);
    params.setSoTimeout(30000);//from  w  w w.  ja  v a2 s  .c om
    client = new HttpClient(params);
    setProxy(ProxyCfg.parseConfig(config));

    sample = new Deviation();
    sample.setId(15972367L);
    sample.setTitle("Fella Promo");
    sample.setArtist("devart");
    sample.setImageDownloadUrl(DOWNLOAD_URL);
    sample.setImageFilename(Deviation.extractFilename(DOWNLOAD_URL));
    sample.setCollection(new Collection(1L, "MyCollect"));
    setLayout(new BorderLayout());
    panes = new JTabbedPane(JTabbedPane.TOP);

    JPanel genPanel = new JPanel();
    BoxLayout genLayout = new BoxLayout(genPanel, BoxLayout.Y_AXIS);
    genPanel.setLayout(genLayout);
    panes.add("General", genPanel);

    JLabel userLabel = new JLabel("Username");

    userLabel.setToolTipText("The username the account you want to download the favorites from.");

    userField = new JTextField(config.getProperty(Constants.USERNAME));

    userLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    userLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    userField.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    userField.setMaximumSize(new Dimension(Integer.MAX_VALUE, userField.getFont().getSize() * 2));

    genPanel.add(userLabel);
    genPanel.add(userField);

    JPanel radioPanel = new JPanel();
    BoxLayout radioLayout = new BoxLayout(radioPanel, BoxLayout.X_AXIS);
    radioPanel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    radioPanel.setBorder(new EmptyBorder(0, 5, 0, 5));

    radioPanel.setLayout(radioLayout);

    JLabel searchLabel = new JLabel("Search for");
    searchLabel
            .setToolTipText("Select what you want to download from that user: it favorites or it galleries.");
    searchLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    searchLabel.setBorder(new EmptyBorder(0, 5, 0, 5));

    selectedSearch = SEARCH.lookup(config.getProperty(Constants.SEARCH, SEARCH.getDefault().getId()));
    buttonGroup = new ButtonGroup();

    for (final SEARCH search : SEARCH.values()) {
        JRadioButton radio = new JRadioButton(search.getLabel());
        radio.setAlignmentX(JLabel.LEFT_ALIGNMENT);
        radio.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                selectedSearch = search;
            }
        });

        buttonGroup.add(radio);
        radioPanel.add(radio);
        if (search.equals(selectedSearch)) {
            radio.setSelected(true);
        }
    }

    genPanel.add(radioPanel);

    final JTextField sampleField = new JTextField("");
    sampleField.setEditable(false);

    JLabel locationLabel = new JLabel("Download location");
    locationLabel.setToolTipText("The folder pattern where you want the file to be downloaded in.");

    JLabel legendsLabel = new JLabel(
            "<html><body>Field names: %user%, %artist%, %title%, %id%, %filename%, %collection%, %ext%<br></br>Example:</body></html>");
    legendsLabel.setToolTipText("An example of where a file will be downloaded to.");

    locationString = new StringBuilder();
    locationField = new JTextField(config.getProperty(Constants.LOCATION));
    locationField.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
            // TODO Auto-generated method stub

        }

        public void keyReleased(KeyEvent e) {
            File dest = LocationHelper.getFile(locationField.getText(), userField.getText(), sample,
                    sample.getImageFilename());
            locationString.setLength(0);
            locationString.append(dest.getAbsolutePath());
            sampleField.setText(locationString.toString());
            if (useSameForMatureBox.isSelected()) {
                locationMatureString.setLength(0);
                locationMatureString.append(sampleField.getText());
                locationMatureField.setText(locationField.getText());
            }
        }

        public void keyTyped(KeyEvent e) {
        }

    });
    locationField.addMouseListener(new MouseListener() {
        public void mouseReleased(MouseEvent e) {
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseExited(MouseEvent e) {
            sampleField.setText(locationString.toString());
        }

        public void mouseEntered(MouseEvent e) {
            sampleField.setText(locationString.toString());
        }

        public void mouseClicked(MouseEvent e) {
        }
    });
    JLabel locationMatureLabel = new JLabel("Mature download location");
    locationMatureLabel.setToolTipText(
            "The folder pattern where you want the file marked as 'Mature' to be downloaded in.");

    locationMatureString = new StringBuilder();
    locationMatureField = new JTextField(config.getProperty(Constants.MATURE));
    locationMatureField.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
            // TODO Auto-generated method stub

        }

        public void keyReleased(KeyEvent e) {
            File dest = LocationHelper.getFile(locationMatureField.getText(), userField.getText(), sample,
                    sample.getImageFilename());
            locationMatureString.setLength(0);
            locationMatureString.append(dest.getAbsolutePath());
            sampleField.setText(locationMatureString.toString());
        }

        public void keyTyped(KeyEvent e) {
        }

    });

    locationMatureField.addMouseListener(new MouseListener() {
        public void mouseReleased(MouseEvent e) {
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseExited(MouseEvent e) {
            sampleField.setText(locationString.toString());
        }

        public void mouseEntered(MouseEvent e) {
            sampleField.setText(locationMatureString.toString());
        }

        public void mouseClicked(MouseEvent e) {
        }
    });

    useSameForMatureBox = new JCheckBox("Use same location for mature deviation?");
    useSameForMatureBox.setSelected(locationLabel.getText().equals(locationMatureField.getText()));
    useSameForMatureBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            if (useSameForMatureBox.isSelected()) {
                locationMatureField.setEditable(false);
                locationMatureField.setText(locationField.getText());
                locationMatureString.setLength(0);
                locationMatureString.append(locationString);
            } else {
                locationMatureField.setEditable(true);
            }

        }
    });

    File dest = LocationHelper.getFile(locationField.getText(), userField.getText(), sample,
            sample.getImageFilename());
    sampleField.setText(dest.getAbsolutePath());
    locationString.append(sampleField.getText());

    dest = LocationHelper.getFile(locationMatureField.getText(), userField.getText(), sample,
            sample.getImageFilename());
    locationMatureString.append(dest.getAbsolutePath());

    locationLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    locationLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    locationField.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    locationField.setMaximumSize(new Dimension(Integer.MAX_VALUE, locationField.getFont().getSize() * 2));
    locationMatureLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    locationMatureLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    locationMatureField.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    locationMatureField
            .setMaximumSize(new Dimension(Integer.MAX_VALUE, locationMatureField.getFont().getSize() * 2));
    useSameForMatureBox.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    legendsLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    legendsLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    legendsLabel.setMaximumSize(new Dimension(Integer.MAX_VALUE, legendsLabel.getFont().getSize() * 2));
    sampleField.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    sampleField.setMaximumSize(new Dimension(Integer.MAX_VALUE, sampleField.getFont().getSize() * 2));

    genPanel.add(locationLabel);
    genPanel.add(locationField);

    genPanel.add(locationMatureLabel);
    genPanel.add(locationMatureField);
    genPanel.add(useSameForMatureBox);

    genPanel.add(legendsLabel);
    genPanel.add(sampleField);
    genPanel.add(Box.createVerticalBox());

    final KeyListener prxChangeListener = new KeyListener() {

        public void keyTyped(KeyEvent e) {
            proxyChangeState = true;
        }

        public void keyPressed(KeyEvent e) {
        }

        public void keyReleased(KeyEvent e) {
        }
    };

    JPanel prxPanel = new JPanel();
    BoxLayout prxLayout = new BoxLayout(prxPanel, BoxLayout.Y_AXIS);
    prxPanel.setLayout(prxLayout);
    panes.add("Proxy", prxPanel);

    JLabel prxHostLabel = new JLabel("Proxy Host");
    prxHostLabel.setToolTipText("The hostname of the proxy server");
    prxHostField = new JTextField(config.getProperty(Constants.PROXY_HOST));
    prxHostLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    prxHostLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    prxHostField.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    prxHostField.setMaximumSize(new Dimension(Integer.MAX_VALUE, prxHostField.getFont().getSize() * 2));

    JLabel prxPortLabel = new JLabel("Proxy Port");
    prxPortLabel.setToolTipText("The port of the proxy server (Default 80).");

    prxPortSpinner = new JSpinner();
    prxPortSpinner.setModel(new SpinnerNumberModel(
            Integer.parseInt(config.getProperty(Constants.PROXY_PORT, "80")), 1, 65535, 1));

    prxPortLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    prxPortLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    prxPortSpinner.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    prxPortSpinner.setMaximumSize(new Dimension(Integer.MAX_VALUE, prxPortSpinner.getFont().getSize() * 2));

    JLabel prxUserLabel = new JLabel("Proxy username");
    prxUserLabel.setToolTipText("The username used for authentication, if applicable.");
    prxUserField = new JTextField(config.getProperty(Constants.PROXY_USERNAME));
    prxUserLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    prxUserLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    prxUserField.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    prxUserField.setMaximumSize(new Dimension(Integer.MAX_VALUE, prxUserField.getFont().getSize() * 2));

    JLabel prxPassLabel = new JLabel("Proxy username");
    prxPassLabel.setToolTipText("The username used for authentication, if applicable.");
    prxPassField = new JPasswordField(config.getProperty(Constants.PROXY_PASSWORD));
    prxPassLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    prxPassLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    prxPassField.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    prxPassField.setMaximumSize(new Dimension(Integer.MAX_VALUE, prxPassField.getFont().getSize() * 2));

    prxUseBox = new JCheckBox("Use a proxy?");
    prxUseBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            prxChangeListener.keyTyped(null);

            if (prxUseBox.isSelected()) {
                prxHostField.setEditable(true);
                prxPortSpinner.setEnabled(true);
                prxUserField.setEditable(true);
                prxPassField.setEditable(true);

            } else {
                prxHostField.setEditable(false);
                prxPortSpinner.setEnabled(false);
                prxUserField.setEditable(false);
                prxPassField.setEditable(false);
            }
        }
    });

    prxUseBox.setSelected(!Boolean.parseBoolean(config.getProperty(Constants.PROXY_USE)));
    prxUseBox.doClick();
    proxyChangeState = false;

    prxHostField.addKeyListener(prxChangeListener);
    prxUserField.addKeyListener(prxChangeListener);
    prxPassField.addKeyListener(prxChangeListener);
    prxPortSpinner.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            proxyChangeState = true;
        }
    });
    prxPanel.add(prxUseBox);

    prxPanel.add(prxHostLabel);
    prxPanel.add(prxHostField);

    prxPanel.add(prxPortLabel);
    prxPanel.add(prxPortSpinner);

    prxPanel.add(prxUserLabel);
    prxPanel.add(prxUserField);

    prxPanel.add(prxPassLabel);
    prxPanel.add(prxPassField);
    prxPanel.add(Box.createVerticalBox());

    final JPanel advPanel = new JPanel();
    BoxLayout advLayout = new BoxLayout(advPanel, BoxLayout.Y_AXIS);
    advPanel.setLayout(advLayout);
    panes.add("Advanced", advPanel);
    panes.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            JTabbedPane pane = (JTabbedPane) e.getSource();

            if (proxyChangeState && pane.getSelectedComponent() == advPanel) {
                Properties properties = new Properties();
                properties.setProperty(Constants.PROXY_USERNAME, prxUserField.getText().trim());
                properties.setProperty(Constants.PROXY_PASSWORD, new String(prxPassField.getPassword()).trim());
                properties.setProperty(Constants.PROXY_HOST, prxHostField.getText().trim());
                properties.setProperty(Constants.PROXY_PORT, prxPortSpinner.getValue().toString());
                properties.setProperty(Constants.PROXY_USE, Boolean.toString(prxUseBox.isSelected()));
                ProxyCfg prx = ProxyCfg.parseConfig(properties);
                setProxy(prx);
                revalidateSearcher(null);
            }
        }
    });
    JLabel domainLabel = new JLabel("Deviant Art domain name");
    domainLabel.setToolTipText("The deviantART main domain, should it ever change.");

    domainField = new JTextField(config.getProperty(Constants.DOMAIN));
    domainLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    domainLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    domainField.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    domainField.setMaximumSize(new Dimension(Integer.MAX_VALUE, domainField.getFont().getSize() * 2));

    advPanel.add(domainLabel);
    advPanel.add(domainField);

    JLabel throttleLabel = new JLabel("Throttle search delay");
    throttleLabel.setToolTipText(
            "Slow down search query by inserting a pause between them. This help prevent abuse when doing a massive download.");

    throttleSpinner = new JSpinner();
    throttleSpinner.setModel(
            new SpinnerNumberModel(Integer.parseInt(config.getProperty(Constants.THROTTLE, "0")), 5, 60, 1));

    throttleLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    throttleLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    throttleSpinner.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    throttleSpinner.setMaximumSize(new Dimension(Integer.MAX_VALUE, throttleSpinner.getFont().getSize() * 2));

    advPanel.add(throttleLabel);
    advPanel.add(throttleSpinner);

    JLabel searcherLabel = new JLabel("Searcher");
    searcherLabel.setToolTipText("Select a searcher that will look for your favorites.");

    searcherBox = new JComboBox();
    searcherBox.setRenderer(new TogglingRenderer());

    final AtomicInteger index = new AtomicInteger(0);
    searcherBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JComboBox combo = (JComboBox) e.getSource();
            Object selectedItem = combo.getSelectedItem();
            if (selectedItem instanceof SearchItem) {
                SearchItem item = (SearchItem) selectedItem;
                if (item.isValid) {
                    index.set(combo.getSelectedIndex());
                } else {
                    combo.setSelectedIndex(index.get());
                }
            }
        }
    });

    try {
        for (Class<Search> clazz : SearcherClassCache.getInstance().getClasses()) {

            Search searcher = clazz.newInstance();
            String name = searcher.getName();

            SearchItem item = new SearchItem(name, clazz.getName(), true);
            searcherBox.addItem(item);
        }
        String selectedClazz = config.getProperty(Constants.SEARCHER,
                com.dragoniade.deviantart.deviation.SearchRss.class.getName());
        revalidateSearcher(selectedClazz);
    } catch (Exception e1) {
        throw new RuntimeException(e1);
    }

    searcherLabel.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    searcherLabel.setBorder(new EmptyBorder(0, 5, 0, 5));
    searcherBox.setAlignmentX(JLabel.LEFT_ALIGNMENT);
    searcherBox.setMaximumSize(new Dimension(Integer.MAX_VALUE, searcherBox.getFont().getSize() * 2));

    advPanel.add(searcherLabel);
    advPanel.add(searcherBox);

    advPanel.add(Box.createVerticalBox());

    add(panes, BorderLayout.CENTER);

    JButton saveBut = new JButton("Save");

    userField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            JTextField field = (JTextField) input;
            if (field.getText().trim().length() == 0) {
                JOptionPane.showMessageDialog(input, "The user musn't be empty.", "Warning",
                        JOptionPane.WARNING_MESSAGE);
                return false;
            }
            return true;
        }
    });

    locationField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            JTextField field = (JTextField) input;
            String content = field.getText().trim();
            if (content.length() == 0) {
                JOptionPane.showMessageDialog(input, "The location musn't be empty.", "Warning",
                        JOptionPane.WARNING_MESSAGE);
                return false;
            }

            if (!content.contains("%filename%") && !content.contains("%id%")) {
                JOptionPane.showMessageDialog(input,
                        "The location must contains at least a %filename% or an %id% field.", "Warning",
                        JOptionPane.WARNING_MESSAGE);
                return false;
            }
            return true;
        }
    });

    locationMatureField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            JTextField field = (JTextField) input;
            String content = field.getText().trim();
            if (content.length() == 0) {
                JOptionPane.showMessageDialog(input, "The Mature location musn't be empty.", "Warning",
                        JOptionPane.WARNING_MESSAGE);
                return false;
            }

            if (!content.contains("%filename%") && !content.contains("%id%")) {
                JOptionPane.showMessageDialog(input,
                        "The Mature location must contains at least a %username% or an %id% field.", "Warning",
                        JOptionPane.WARNING_MESSAGE);
                return false;
            }
            return true;
        }
    });

    domainField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            JTextField field = (JTextField) input;
            String domain = field.getText().trim();
            if (domain.length() == 0) {
                JOptionPane.showMessageDialog(input, "You must specify the deviantART main domain.", "Warning",
                        JOptionPane.WARNING_MESSAGE);
                return false;
            }

            if (domain.toLowerCase().startsWith("http://")) {
                JOptionPane.showMessageDialog(input,
                        "You must specify the deviantART main domain, not the full URL (aka www.deviantart.com).",
                        "Warning", JOptionPane.WARNING_MESSAGE);
                return false;
            }

            return true;
        }
    });
    locationField.setVerifyInputWhenFocusTarget(true);

    final JDialog parent = this;
    saveBut.addActionListener(new ActionListener() {

        String errorMsg = "The location is invalid or cannot be written to.";

        public void actionPerformed(ActionEvent e) {

            String username = userField.getText().trim();
            String location = locationField.getText().trim();
            String locationMature = locationMatureField.getText().trim();
            String domain = domainField.getText().trim();
            String throttle = throttleSpinner.getValue().toString();
            String searcher = searcherBox.getSelectedItem().toString();

            String prxUse = Boolean.toString(prxUseBox.isSelected());
            String prxHost = prxHostField.getText().trim();
            String prxPort = prxPortSpinner.getValue().toString();
            String prxUsername = prxUserField.getText().trim();
            String prxPassword = new String(prxPassField.getPassword()).trim();

            if (!testPath(location, username)) {
                JOptionPane.showMessageDialog(parent, errorMsg, "Error", JOptionPane.ERROR_MESSAGE);
            }
            if (!testPath(locationMature, username)) {
                JOptionPane.showMessageDialog(parent, errorMsg, "Error", JOptionPane.ERROR_MESSAGE);
            }

            Properties p = new Properties();
            p.setProperty(Constants.USERNAME, username);
            p.setProperty(Constants.LOCATION, location);
            p.setProperty(Constants.MATURE, locationMature);
            p.setProperty(Constants.DOMAIN, domain);
            p.setProperty(Constants.THROTTLE, throttle);
            p.setProperty(Constants.SEARCHER, searcher);
            p.setProperty(Constants.SEARCH, selectedSearch.getId());

            p.setProperty(Constants.PROXY_USE, prxUse);
            p.setProperty(Constants.PROXY_HOST, prxHost);
            p.setProperty(Constants.PROXY_PORT, prxPort);
            p.setProperty(Constants.PROXY_USERNAME, prxUsername);
            p.setProperty(Constants.PROXY_PASSWORD, prxPassword);

            owner.savePreferences(p);
            parent.dispose();
        }
    });

    JButton cancelBut = new JButton("Cancel");
    cancelBut.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            parent.dispose();
        }
    });

    JPanel buttonPanel = new JPanel();
    BoxLayout butLayout = new BoxLayout(buttonPanel, BoxLayout.X_AXIS);
    buttonPanel.setLayout(butLayout);

    buttonPanel.add(saveBut);
    buttonPanel.add(cancelBut);
    add(buttonPanel, BorderLayout.SOUTH);

    pack();
    setResizable(false);
    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
    this.setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2);
    setVisible(true);
}

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

/**
 * @param textField/*from  w  w w.  j a  va 2s.c o  m*/
 * @param border
 * @param fgColor
 * @param bgColor
 * @param isOpaque
 */
public static void changeTextFieldUIForEdit(final JTextField textField, final Border border,
        final Color fgColor, final Color bgColor, final boolean isOpaque) {
    textField.setBorder(border);
    textField.setForeground(fgColor);
    textField.setEditable(true);
    textField.setFocusable(true);
    textField.setOpaque(isOpaque);
    textField.setBackground(bgColor);
}

From source file:edu.ku.brc.af.ui.forms.ViewFactory.java

/**
 * Makes adjusts to the border and the colors to make it "flat" for display mode.
 * @param textField the text field to be flattened
 * @param isTransparent make the background transparent instead of using the viewFieldColor
 *///from   w w  w .  ja  va  2 s  .  com
public static void changeTextFieldUIForDisplay(final JTextField textField, final Color borderColor,
        final boolean isTransparent) {
    Insets insets = textField.getBorder().getBorderInsets(textField);
    if (borderColor != null) {
        textField.setBorder(BorderFactory.createMatteBorder(Math.min(insets.top, 3), Math.min(insets.left, 3),
                Math.min(insets.bottom, 3), Math.min(insets.right, 3), borderColor));
    } else {
        textField.setBorder(BorderFactory.createEmptyBorder(Math.min(insets.top, 3), Math.min(insets.left, 3),
                Math.min(insets.bottom, 3), Math.min(insets.right, 3)));
    }
    textField.setForeground(Color.BLACK);
    textField.setEditable(false);
    //textField.setFocusable(false); // rods - commented out because it makes it so you can't select and copy

    textField.setOpaque(!isTransparent);
    if (isTransparent) {
        textField.setBackground(null);

    } else if (viewFieldColor != null) {
        textField.setBackground(viewFieldColor.getColor());
    }
}

From source file:be.agiv.security.demo.Main.java

private void invokeClaimsAwareService() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    JPanel contentPanel = new JPanel(gridBagLayout);

    final JLabel ipStsLabel = new JLabel("IP-STS:");
    gridBagConstraints.gridx = 0;//from   w  w w . ja  v a2s.  com
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = GridBagConstraints.WEST;
    gridBagConstraints.ipadx = 5;
    gridBagLayout.setConstraints(ipStsLabel, gridBagConstraints);
    contentPanel.add(ipStsLabel);

    final JTextField ipStsTextField = new JTextField(
            "https://auth.beta.agiv.be/ipsts/Services/DaliSecurityTokenServiceConfiguration.svc/IWSTrust13",
            60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(ipStsTextField, gridBagConstraints);
    contentPanel.add(ipStsTextField);

    JLabel realmLabel = new JLabel("Realm:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(realmLabel, gridBagConstraints);
    contentPanel.add(realmLabel);

    JTextField realmTextField = new JTextField(AGIVSecurity.BETA_REALM, 30);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(realmTextField, gridBagConstraints);
    contentPanel.add(realmTextField);

    final CredentialPanel credentialPanel = new CredentialPanel();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(credentialPanel, gridBagConstraints);
    contentPanel.add(credentialPanel);

    final JLabel rStsLabel = new JLabel("R-STS:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = 1;
    gridBagLayout.setConstraints(rStsLabel, gridBagConstraints);
    contentPanel.add(rStsLabel);

    final JTextField rStsTextField = new JTextField(
            "https://auth.beta.agiv.be/sts/Services/SalvadorSecurityTokenServiceConfiguration.svc/IWSTrust13",
            60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(rStsTextField, gridBagConstraints);
    contentPanel.add(rStsTextField);

    JLabel serviceRealmLabel = new JLabel("Service realm:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(serviceRealmLabel, gridBagConstraints);
    contentPanel.add(serviceRealmLabel);

    JTextField serviceRealmTextField = new JTextField(ClaimsAwareServiceFactory.SERVICE_REALM, 60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(serviceRealmTextField, gridBagConstraints);
    contentPanel.add(serviceRealmTextField);

    JLabel urlLabel = new JLabel("Service URL:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(urlLabel, gridBagConstraints);
    contentPanel.add(urlLabel);

    JTextField urlTextField = new JTextField(ClaimsAwareServiceFactory.SERVICE_LOCATION, 60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(urlTextField, gridBagConstraints);
    contentPanel.add(urlTextField);

    final JCheckBox noWsPolicyCheckBox = new JCheckBox("WSDL without WS-Policy");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(noWsPolicyCheckBox, gridBagConstraints);
    contentPanel.add(noWsPolicyCheckBox);

    final JCheckBox useWsSecureConversationCheckBox = new JCheckBox("Use WS-SecureConversation");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(useWsSecureConversationCheckBox, gridBagConstraints);
    contentPanel.add(useWsSecureConversationCheckBox);

    final JCheckBox usePreviousSecurityCheckBox = new JCheckBox("Use previous AGIV Security");
    final JCheckBox cancelPreviousSecureConversationToken = new JCheckBox("Cancel previous conversation token");
    usePreviousSecurityCheckBox.setEnabled(null != this.agivSecurity);
    cancelPreviousSecureConversationToken.setEnabled(false);
    usePreviousSecurityCheckBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            LOG.debug("use previous security: " + usePreviousSecurityCheckBox.isSelected());
            boolean newSecurity = !usePreviousSecurityCheckBox.isSelected();
            ipStsLabel.setEnabled(newSecurity);
            ipStsTextField.setEditable(newSecurity);
            credentialPanel.setEnabled(newSecurity);
            rStsLabel.setEnabled(newSecurity);
            rStsTextField.setEnabled(newSecurity);
            cancelPreviousSecureConversationToken.setEnabled(!newSecurity);
        }
    });
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(usePreviousSecurityCheckBox, gridBagConstraints);
    contentPanel.add(usePreviousSecurityCheckBox);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(cancelPreviousSecureConversationToken, gridBagConstraints);
    contentPanel.add(cancelPreviousSecureConversationToken);

    JPanel expiresPanel = new JPanel();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = 2;
    gridBagLayout.setConstraints(expiresPanel, gridBagConstraints);
    contentPanel.add(expiresPanel);

    JLabel expiresLabelLabel = new JLabel("Secure conversation token expires:");
    expiresLabelLabel.setEnabled(null != this.agivSecurity);
    expiresPanel.add(expiresLabelLabel);

    JLabel expiresLabel = new JLabel();
    expiresLabel.setEnabled(null != this.agivSecurity);
    expiresPanel.add(expiresLabel);
    if (null != this.agivSecurity) {
        if (false == this.agivSecurity.getSecureConversationTokens().isEmpty()) {
            SecurityToken secureConversationToken = this.agivSecurity.getSecureConversationTokens().values()
                    .iterator().next();
            expiresLabel.setText(secureConversationToken.getExpires().toString());
        }
    }

    int dialogResult = JOptionPane.showConfirmDialog(this, contentPanel, "Claims Aware Service",
            JOptionPane.OK_CANCEL_OPTION);
    if (dialogResult == JOptionPane.CANCEL_OPTION) {
        return;
    }

    final String location = urlTextField.getText();
    final String serviceRealm = serviceRealmTextField.getText();
    final String ipStsLocation = ipStsTextField.getText();
    final String rStsLocation = rStsTextField.getText();
    final String username = credentialPanel.getUsername();
    final String password = credentialPanel.getPassword();
    final File pkcs12File = credentialPanel.getPKCS12File();
    final String realm = realmTextField.getText();

    ExecutorService executor = Executors.newFixedThreadPool(1);
    FutureTask<ArrayOfClaimInfo> futureTask = new FutureTask<ArrayOfClaimInfo>(
            new Callable<ArrayOfClaimInfo>() {

                public ArrayOfClaimInfo call() throws Exception {
                    Service service;
                    if (noWsPolicyCheckBox.isSelected()) {
                        service = ClaimsAwareServiceFactory.getInstanceNoWSPolicy();
                    } else {
                        service = ClaimsAwareServiceFactory.getInstance();
                    }
                    IService iservice = service.getWS2007FederationHttpBindingIService(new AddressingFeature());
                    BindingProvider bindingProvider = (BindingProvider) iservice;

                    if (false == usePreviousSecurityCheckBox.isSelected()) {
                        if (null != username) {
                            Main.this.agivSecurity = new AGIVSecurity(ipStsLocation, rStsLocation, realm,
                                    username, password);
                        } else {
                            Main.this.agivSecurity = new AGIVSecurity(ipStsLocation, rStsLocation, realm,
                                    pkcs12File, password);
                        }
                        Main.this.agivSecurity.addSTSListener(Main.this);
                        if (Main.this.proxyEnable) {
                            agivSecurity.setProxy(Main.this.proxyHost, Main.this.proxyPort,
                                    Main.this.proxyType);
                        }
                    }
                    if (cancelPreviousSecureConversationToken.isSelected()) {
                        Main.this.agivSecurity.cancelSecureConversationTokens();
                    }
                    Main.this.agivSecurity.enable(bindingProvider, location,
                            useWsSecureConversationCheckBox.isSelected(), serviceRealm);

                    ArrayOfClaimInfo result = iservice.getData(0);
                    return result;
                }
            }) {

        @Override
        protected void done() {
            try {
                ArrayOfClaimInfo result = get();
                List<ClaimInfo> claims = result.getClaimInfo();
                StringBuffer message = new StringBuffer();
                for (ClaimInfo claim : claims) {
                    message.append(claim.getName());
                    message.append(" = ");
                    message.append(claim.getValue());
                    message.append("\n");
                }

                JOptionPane.showMessageDialog(Main.this, message.toString(), "Claims Aware Service Result",
                        JOptionPane.INFORMATION_MESSAGE);
            } catch (final Exception e) {
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {

                        public void run() {
                            Main.this.statusBar.setErrorStatus(e.getMessage());
                        }
                    });
                } catch (Exception e1) {
                }
                showException(e);
            }
        }
    };
    executor.execute(futureTask);
}

From source file:UI.MainUI.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.jav a2 s  . c  o  m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    fileChooser = new javax.swing.JFileChooser();
    jFrame1 = new MyFrame();
    jPanel5 = new javax.swing.JPanel();
    submitBtn = new javax.swing.JButton();
    filePath = new java.awt.TextField();
    jButton4 = new javax.swing.JButton();
    testLabel = new javax.swing.JLabel();
    fCurrencyComboBox = new javax.swing.JComboBox<>();
    jLabel17 = new javax.swing.JLabel();
    jLabel6 = new javax.swing.JLabel();
    jPanel9 = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    jLabel4 = new javax.swing.JLabel();
    hiddenNeurons = new javax.swing.JSpinner();
    jLabel5 = new javax.swing.JLabel();
    fOutputNeurons = new javax.swing.JSpinner();
    jLabel23 = new javax.swing.JLabel();
    jLabel24 = new javax.swing.JLabel();
    jLabel25 = new javax.swing.JLabel();
    inputNeurons = new javax.swing.JSpinner();
    jProgressBar1 = new JProgressBar(0, 100);
    finishBtn = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    epochInput = new javax.swing.JSpinner();
    jLabel31 = new javax.swing.JLabel();
    jLabel14 = new javax.swing.JLabel();
    jFrame2 = new MyFrame();
    jPanel7 = new javax.swing.JPanel();
    rSubmitBtn = new javax.swing.JButton();
    rFilePath = new java.awt.TextField();
    jButton6 = new javax.swing.JButton();
    testLabel1 = new javax.swing.JLabel();
    rCurrencyComboBox = new javax.swing.JComboBox<>();
    jLabel26 = new javax.swing.JLabel();
    jLabel9 = new javax.swing.JLabel();
    jPanel11 = new javax.swing.JPanel();
    jLabel10 = new javax.swing.JLabel();
    jLabel11 = new javax.swing.JLabel();
    rHiddenNeurons1 = new javax.swing.JSpinner();
    jLabel12 = new javax.swing.JLabel();
    jLabel27 = new javax.swing.JLabel();
    jLabel28 = new javax.swing.JLabel();
    jLabel29 = new javax.swing.JLabel();
    rInputNeurons = new javax.swing.JSpinner();
    rOutputNeurons = new javax.swing.JSpinner();
    rHiddenNeurons2 = new javax.swing.JSpinner();
    rProgressBar = new javax.swing.JProgressBar();
    rFinishBtn = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    rSpinner = new javax.swing.JSpinner();
    jLabel30 = new javax.swing.JLabel();
    jLabel13 = new javax.swing.JLabel();
    buttonGroup1 = new javax.swing.ButtonGroup();
    jScrollPane2 = new javax.swing.JScrollPane();
    jPanel1 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    UIManager.put("TabbedPane.contentAreaColor ", ColorUIResource.BLACK);
    UIManager.put("TabbedPane.selected", ColorUIResource.BLACK);
    UIManager.put("TabbedPane.unselectedBackground", ColorUIResource.BLACK);
    // UIManager.put("TabbedPane.background",ColorUIResource.BLUE);
    UIManager.put("TabbedPane.shadow", ColorUIResource.BLACK);
    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanel3 = new JPanel() {
        public void paintComponent(Graphics g) {
            Image img = Toolkit.getDefaultToolkit()
                    .getImage(MainUI.class.getResource("/resources/NNImage.jpg"));
            g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
        }
    };
    ;
    setUIFont(new javax.swing.plaf.FontUIResource("Segoe UI", Font.PLAIN, 14));
    jPanel14 = new javax.swing.JPanel();
    jTextArea1 = jTextArea1 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel4 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jTextArea4 = new javax.swing.JTextArea();
    jPanel6 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jTextArea5 = new javax.swing.JTextArea();
    jPanel15 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jTextArea3 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel16 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jTextArea6 = new javax.swing.JTextArea();
    jPanel17 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jTextArea7 = new javax.swing.JTextArea();
    jPanel18 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jTextArea8 = new javax.swing.JTextArea();
    jPanel19 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jTextArea9 = new javax.swing.JTextArea();
    jPanel20 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jTextArea10 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel21 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    todayText1 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel22 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    todayText2 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel23 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    todayText3 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel24 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    todayText4 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel25 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jTextArea15 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel26 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    tmrwText1 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel27 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    tmrwText2 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel28 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    tmrwText3 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel29 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    tmrwText4 = new JTextArea() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    statusLabel = new javax.swing.JLabel();
    jPanel8 = new JPanel() {
        public void paintComponent(Graphics g) {
            Image img = Toolkit.getDefaultToolkit()
                    .getImage(MainUI.class.getResource("/resources/NNImage.jpg"));
            g.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
        }
    };
    ;
    jPanel10 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jLabel8 = new javax.swing.JLabel();
    CurrencyComboBox = new JComboBox() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jLabel7 = new javax.swing.JLabel();
    testingDataPath = new JTextField() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    testingBrowseBtn = new javax.swing.JToggleButton();
    forecastBtn = new javax.swing.JButton();
    jScrollPane1 = new JScrollPane() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    Caret caret = new DefaultCaret() {
        public void focusGained(FocusEvent e) {
            setVisible(true);
            setSelectionVisible(true);
        }
    };
    caret.setBlinkRate(UIManager.getInt("TextField.caretBlinkRate"));

    JTextField textField = new JTextField();
    textField.setEditable(false);
    textField.setCaret(caret);
    //textField.setBorder(new LineBorder(Color.BLACK));
    // textField.setBackground(Color.BLUE);

    DefaultCellEditor dce = new DefaultCellEditor(textField);
    forecastTable = new JTable();
    jPanel12 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    jPanel13 = new javax.swing.JPanel();
    jRadioButton2 = new javax.swing.JRadioButton();
    jRadioButton1 = new javax.swing.JRadioButton();
    jPanel2 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    doneButton1 = new javax.swing.JButton();
    jPanel30 = new JPanel() {
        protected void paintComponent(Graphics g) {
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
            super.paintComponent(g);
        }
    };
    ;
    graphBtn = new javax.swing.JButton();
    jButton1 = new javax.swing.JButton();

    fileChooser.setFileFilter(new MyCustomFilter());

    jFrame1.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    jFrame1.setTitle("Train Feed Forward Neural Network");
    jFrame1.setBackground(new java.awt.Color(102, 102, 102));
    jFrame1.setFocusTraversalPolicyProvider(true);
    jFrame1.setIconImage(iconImage);
    jFrame1.setResizable(false);
    jFrame1.setSize(new java.awt.Dimension(580, 420));

    jPanel5.setBackground(new java.awt.Color(38, 50, 56));
    jPanel5.setAlignmentX(0.0F);
    jPanel5.setAlignmentY(0.0F);
    jPanel5.setPreferredSize(new java.awt.Dimension(480, 480));

    submitBtn.setText("Start");
    submitBtn.setOpaque(false);
    submitBtn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            submitBtnActionPerformed(evt);
        }
    });

    filePath.addFocusListener(new java.awt.event.FocusAdapter() {
        public void focusGained(java.awt.event.FocusEvent evt) {
            filePathFocusGained(evt);
        }
    });
    filePath.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            filePathActionPerformed(evt);
        }
    });

    jButton4.setText("Browse");
    jButton4.setOpaque(false);
    jButton4.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton4ActionPerformed(evt);
        }
    });

    fCurrencyComboBox.setBackground(new java.awt.Color(56, 56, 56, 0));
    fCurrencyComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(
            new String[] { "US Dollar", "British Pound", "Euro", "Yen" }));
    fCurrencyComboBox.setOpaque(false);
    fCurrencyComboBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            fCurrencyComboBoxActionPerformed(evt);
        }
    });

    jLabel17.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
    jLabel17.setForeground(new java.awt.Color(255, 255, 255));
    jLabel17.setLabelFor(fCurrencyComboBox);
    jLabel17.setText("Select Currency                                        :");

    jLabel6.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
    jLabel6.setForeground(new java.awt.Color(240, 240, 240));
    jLabel6.setText("Training Data Path:");

    jPanel9.setBackground(new java.awt.Color(51, 51, 51));
    jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Enter Neurons",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 12),
            new java.awt.Color(240, 240, 240))); // NOI18N
    jPanel9.setFont(new java.awt.Font("Segoe UI", 0, 12)); // NOI18N
    jPanel9.setOpaque(false);

    jLabel3.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
    jLabel3.setForeground(new java.awt.Color(240, 240, 240));
    jLabel3.setLabelFor(inputNeurons);
    jLabel3.setText("Input Layer:");
    jLabel3.setToolTipText("");
    jLabel3.setAlignmentY(0.0F);
    jLabel3.setMaximumSize(new java.awt.Dimension(63, 14));
    jLabel3.setMinimumSize(new java.awt.Dimension(63, 14));
    jLabel3.setPreferredSize(new java.awt.Dimension(63, 14));

    jLabel4.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
    jLabel4.setForeground(new java.awt.Color(240, 240, 240));
    jLabel4.setText("Hidden Layer:");

    hiddenNeurons.setModel(new javax.swing.SpinnerNumberModel(1, 1, 500, 1));
    JFormattedTextField format2 = ((JSpinner.DefaultEditor) hiddenNeurons.getEditor()).getTextField();
    format2.addFocusListener(fcsListener);
    hiddenNeurons.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    hiddenNeurons.setOpaque(false);

    jLabel5.setForeground(new java.awt.Color(240, 240, 240));
    jLabel5.setText("Output Layer:");

    fOutputNeurons.setModel(new javax.swing.SpinnerNumberModel(1, null, null, 1));
    JFormattedTextField format3 = ((JSpinner.DefaultEditor) fOutputNeurons.getEditor()).getTextField();
    format3.addFocusListener(fcsListener);
    fOutputNeurons.setEnabled(false);
    fOutputNeurons.setOpaque(false);

    jLabel23.setFont(new java.awt.Font("Kartika", 1, 11)); // NOI18N
    jLabel23.setForeground(new java.awt.Color(255, 153, 102));
    jLabel23.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/ic_info_outline_white_18dp_1x.png"))); // NOI18N
    jLabel23.setToolTipText(
            "<html>Enter number of neurons in input layer<br>equal to number of input.<br>Range 1 - 500</html>");
    jLabel23.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

    jLabel24.setFont(new java.awt.Font("Kartika", 1, 11)); // NOI18N
    jLabel24.setForeground(new java.awt.Color(255, 153, 102));
    jLabel24.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/ic_info_outline_white_18dp_1x.png"))); // NOI18N
    jLabel24.setToolTipText(
            "<html>Enter number of neurons in<br> hidden layer of neural network.<br>Range 1 - 500</html>");

    jLabel25.setFont(new java.awt.Font("Kartika", 1, 11)); // NOI18N
    jLabel25.setForeground(new java.awt.Color(255, 153, 102));
    jLabel25.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/ic_info_outline_white_18dp_1x.png"))); // NOI18N
    jLabel25.setToolTipText(
            "<html>Number of neurons in output layer<br> of NN, equal to number of output.</html>");

    inputNeurons.setModel(new javax.swing.SpinnerNumberModel(1, 1, 500, 1));
    JFormattedTextField format1 = ((JSpinner.DefaultEditor) inputNeurons.getEditor()).getTextField();
    format1.addFocusListener(fcsListener);
    inputNeurons.setToolTipText("");
    inputNeurons.setOpaque(false);

    javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
    jPanel9.setLayout(jPanel9Layout);
    jPanel9Layout.setHorizontalGroup(jPanel9Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup().addGap(36, 36, 36)
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel9Layout.createSequentialGroup()
                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 67,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel23))
                            .addComponent(inputNeurons, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(48, 48, 48)
                    .addGroup(
                            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel9Layout.createSequentialGroup().addComponent(jLabel4)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jLabel24))
                                    .addComponent(hiddenNeurons))
                    .addGap(48, 48, 48)
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(fOutputNeurons, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel9Layout.createSequentialGroup().addComponent(jLabel5)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel25)))
                    .addGap(36, 36, 36)));
    jPanel9Layout.setVerticalGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup().addGap(22, 22, 22).addGroup(jPanel9Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel23, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel24, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel25, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                            javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel9Layout.createSequentialGroup().addGroup(jPanel9Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE, false)
                                    .addComponent(hiddenNeurons).addComponent(fOutputNeurons))
                                    .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(inputNeurons))
                    .addContainerGap()));

    jProgressBar1.setForeground(new java.awt.Color(51, 128, 244));
    jProgressBar1.setStringPainted(true);

    finishBtn.setText("Finish");
    finishBtn.setEnabled(false);
    finishBtn.setOpaque(false);
    finishBtn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            finishBtnActionPerformed(evt);
        }
    });

    jLabel1.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
    jLabel1.setForeground(new java.awt.Color(255, 255, 255));
    jLabel1.setLabelFor(epochInput);
    jLabel1.setText("Number of Epoch");

    epochInput.setModel(new javax.swing.SpinnerNumberModel(500, 1, 50000, 500));
    JFormattedTextField format0 = ((JSpinner.DefaultEditor) epochInput.getEditor()).getTextField();
    format0.addFocusListener(fcsListener);
    epochInput.setOpaque(false);

    jLabel31.setFont(new java.awt.Font("Kartika", 1, 11)); // NOI18N
    jLabel31.setForeground(new java.awt.Color(255, 153, 102));
    jLabel31.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/ic_info_outline_white_18dp_1x.png"))); // NOI18N
    jLabel31.setToolTipText(
            "<html>Number of Iteration to train over training data.<br>Range 1 - 50,000</html>");
    jLabel31.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

    jLabel14.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
    jLabel14.setForeground(new java.awt.Color(255, 255, 255));
    jLabel14.setText("         :");

    javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(jPanel5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    jPanel5Layout.createSequentialGroup().addGap(224, 224, 224)
                            .addComponent(testLabel, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGap(49, 49, 49))
            .addGroup(jPanel5Layout.createSequentialGroup().addGap(63, 63, 63)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                    .addComponent(submitBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                            finishBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel5Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jProgressBar1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(
                                            jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout
                                            .createSequentialGroup().addGroup(jPanel5Layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.LEADING, false)
                                                    .addGroup(jPanel5Layout.createSequentialGroup()
                                                            .addComponent(jLabel1)
                                                            .addPreferredGap(
                                                                    javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                            .addComponent(jLabel31).addGap(82, 82, 82)
                                                            .addComponent(jLabel14))
                                                    .addComponent(jLabel17,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                                            Short.MAX_VALUE))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGroup(jPanel5Layout
                                                    .createParallelGroup(
                                                            javax.swing.GroupLayout.Alignment.LEADING, false)
                                                    .addComponent(fCurrencyComboBox, 0, 137, Short.MAX_VALUE)
                                                    .addComponent(epochInput)))
                                    .addGroup(jPanel5Layout.createSequentialGroup().addGroup(jPanel5Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel5Layout.createSequentialGroup()
                                                    .addComponent(jLabel6).addGap(0, 0, Short.MAX_VALUE))
                                            .addComponent(filePath, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addContainerGap(43, Short.MAX_VALUE)));
    jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup().addGap(39, 39, 39)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel17).addComponent(fCurrencyComboBox,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel5Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(epochInput, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addGroup(jPanel5Layout.createSequentialGroup()
                                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(3, 3, 3)))
                            .addComponent(jLabel31, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jButton4).addGroup(
                                    jPanel5Layout.createSequentialGroup().addComponent(jLabel6).addGap(2, 2, 2)
                                            .addComponent(filePath, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGap(29, 29, 29)
                    .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(finishBtn).addComponent(submitBtn))
                    .addGap(18, 18, 18)
                    .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(56, 56, 56).addComponent(testLabel)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());
    jFrame1.getContentPane().setLayout(jFrame1Layout);
    jFrame1Layout.setHorizontalGroup(jFrame1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 580, Short.MAX_VALUE)
            .addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE)));
    jFrame1Layout.setVerticalGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 425, Short.MAX_VALUE)
            .addGroup(jFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, 425, Short.MAX_VALUE)));

    jFrame1.setLocationRelativeTo(null);

    jFrame2.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    jFrame2.setTitle("Train Recurrent Neural Network");
    jFrame2.setBackground(new java.awt.Color(102, 102, 102));
    jFrame2.setIconImage(iconImage);
    jFrame2.setResizable(false);
    jFrame2.setSize(new java.awt.Dimension(601, 460));

    jPanel7.setBackground(new java.awt.Color(38, 50, 56));
    jPanel7.setAlignmentX(0.0F);
    jPanel7.setAlignmentY(0.0F);
    jPanel7.setFocusCycleRoot(true);
    jPanel7.setFocusTraversalPolicy(newPolicy);
    jPanel7.setPreferredSize(new java.awt.Dimension(590, 460));

    rSubmitBtn.setText("Start");
    rSubmitBtn.setOpaque(false);
    rSubmitBtn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            rSubmitBtnActionPerformed(evt);
        }
    });

    rFilePath.addFocusListener(new java.awt.event.FocusAdapter() {
        public void focusGained(java.awt.event.FocusEvent evt) {
            rFilePathFocusGained(evt);
        }
    });
    rFilePath.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            rFilePathActionPerformed(evt);
        }
    });

    jButton6.setText("Browse");
    jButton6.setOpaque(false);
    jButton6.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton6ActionPerformed(evt);
        }
    });

    rCurrencyComboBox.setBackground(new java.awt.Color(56, 56, 56, 0));
    rCurrencyComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(
            new String[] { "US Dollar", "British Pound", "Euro", "Yen" }));
    rCurrencyComboBox.setOpaque(false);
    rCurrencyComboBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            rCurrencyComboBoxActionPerformed(evt);
        }
    });

    jLabel26.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
    jLabel26.setForeground(new java.awt.Color(255, 255, 255));
    jLabel26.setText("Select Currency                                           :");

    jLabel9.setForeground(new java.awt.Color(240, 240, 240));
    jLabel9.setText("Training Data Path:");

    jPanel11.setBackground(new java.awt.Color(51, 51, 51));
    jPanel11.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Enter Neurons",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 12),
            new java.awt.Color(255, 255, 255))); // NOI18N
    jPanel11.setOpaque(false);

    jLabel10.setForeground(new java.awt.Color(240, 240, 240));
    jLabel10.setText("Input Layer:");
    jLabel10.setToolTipText("");
    jLabel10.setAlignmentY(0.0F);
    jLabel10.setMaximumSize(new java.awt.Dimension(63, 14));
    jLabel10.setMinimumSize(new java.awt.Dimension(63, 14));
    jLabel10.setPreferredSize(new java.awt.Dimension(63, 14));

    jLabel11.setForeground(new java.awt.Color(240, 240, 240));
    jLabel11.setText("Hidden Layer:");

    rHiddenNeurons1.setModel(new javax.swing.SpinnerNumberModel(1, 1, 500, 1));
    JFormattedTextField format5 = ((JSpinner.DefaultEditor) rHiddenNeurons1.getEditor()).getTextField();
    format5.addFocusListener(fcsListener);
    rHiddenNeurons1.setNextFocusableComponent(rHiddenNeurons2);
    rHiddenNeurons1.setOpaque(false);

    jLabel12.setForeground(new java.awt.Color(240, 240, 240));
    jLabel12.setText("Output Layer:");

    jLabel27.setFont(new java.awt.Font("Kartika", 1, 11)); // NOI18N
    jLabel27.setForeground(new java.awt.Color(255, 153, 102));
    jLabel27.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/ic_info_outline_white_18dp_1x.png"))); // NOI18N
    jLabel27.setToolTipText(
            "<html>Enter number of neurons in input layer<br>equal to number of input.<br>Range 1 - 500</html>");
    jLabel27.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

    jLabel28.setFont(new java.awt.Font("Kartika", 1, 11)); // NOI18N
    jLabel28.setForeground(new java.awt.Color(255, 153, 102));
    jLabel28.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/ic_info_outline_white_18dp_1x.png"))); // NOI18N
    jLabel28.setToolTipText(
            "<html>Enter number of neurons in<br> hidden layer of neural network.<br>Range 1 - 500</html>");

    jLabel29.setFont(new java.awt.Font("Kartika", 1, 11)); // NOI18N
    jLabel29.setForeground(new java.awt.Color(255, 153, 102));
    jLabel29.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/ic_info_outline_white_18dp_1x.png"))); // NOI18N
    jLabel29.setToolTipText(
            "<html>Number of neurons in output layer<br> of NN, equal to number of output.</html>");

    rInputNeurons.setModel(new javax.swing.SpinnerNumberModel(1, 1, 500, 1));
    JFormattedTextField format4 = ((JSpinner.DefaultEditor) rInputNeurons.getEditor()).getTextField();
    format4.addFocusListener(fcsListener);
    rInputNeurons.setNextFocusableComponent(rHiddenNeurons1);
    rInputNeurons.setOpaque(false);

    rOutputNeurons.setModel(new javax.swing.SpinnerNumberModel(1, null, null, 1));
    JFormattedTextField format7 = ((JSpinner.DefaultEditor) rOutputNeurons.getEditor()).getTextField();
    format7.addFocusListener(fcsListener);
    rOutputNeurons.setEnabled(false);
    rOutputNeurons.setNextFocusableComponent(rFilePath);
    rOutputNeurons.setOpaque(false);

    rHiddenNeurons2.setModel(new javax.swing.SpinnerNumberModel(1, 1, 500, 1));
    JFormattedTextField format6 = ((JSpinner.DefaultEditor) rHiddenNeurons2.getEditor()).getTextField();
    format6.addFocusListener(fcsListener);
    rHiddenNeurons2.setNextFocusableComponent(rOutputNeurons);
    rHiddenNeurons2.setOpaque(false);

    javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
    jPanel11.setLayout(jPanel11Layout);
    jPanel11Layout.setHorizontalGroup(jPanel11Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup().addGap(34, 34, 34)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel11Layout.createSequentialGroup()
                                    .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 67,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel27))
                            .addComponent(rInputNeurons, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(52, 52, 52)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel11Layout.createSequentialGroup().addComponent(jLabel11)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel28))
                            .addComponent(rHiddenNeurons2, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(rHiddenNeurons1, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(52, 52, 52)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel11Layout.createSequentialGroup().addComponent(jLabel12)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLabel29))
                            .addComponent(rOutputNeurons, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(38, 38, 38)));
    jPanel11Layout.setVerticalGroup(jPanel11Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup().addGap(22, 22, 22).addGroup(jPanel11Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel27, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel28, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel29, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                            javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addGroup(
                            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel11Layout.createSequentialGroup().addGroup(jPanel11Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(rHiddenNeurons1).addComponent(rOutputNeurons))
                                            .addPreferredGap(
                                                    javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(rHiddenNeurons2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(28, 28, 28))
                                    .addGroup(jPanel11Layout.createSequentialGroup()
                                            .addComponent(rInputNeurons, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    Short.MAX_VALUE)))));

    rProgressBar.setForeground(new java.awt.Color(51, 128, 244));
    rProgressBar.setStringPainted(true);

    rFinishBtn.setText("Finish");
    rFinishBtn.setEnabled(false);
    rFinishBtn.setOpaque(false);
    rFinishBtn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            rFinishBtnActionPerformed(evt);
        }
    });

    jLabel2.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
    jLabel2.setForeground(new java.awt.Color(255, 255, 255));
    jLabel2.setLabelFor(rSpinner);
    jLabel2.setText("Number of Epoch");

    rSpinner.setModel(new javax.swing.SpinnerNumberModel(500, 1, 50000, 500));
    JFormattedTextField format8 = ((JSpinner.DefaultEditor) rSpinner.getEditor()).getTextField();
    format8.addFocusListener(fcsListener);
    rSpinner.setOpaque(false);

    jLabel30.setFont(new java.awt.Font("Kartika", 1, 11)); // NOI18N
    jLabel30.setForeground(new java.awt.Color(255, 153, 102));
    jLabel30.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/resources/ic_info_outline_white_18dp_1x.png"))); // NOI18N
    jLabel30.setToolTipText(
            "<html>Number of Iteration to train over training data.<br>Range 1 - 50,000</html>");
    jLabel30.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

    jLabel13.setFont(new java.awt.Font("Segoe UI", 0, 13)); // NOI18N
    jLabel13.setForeground(new java.awt.Color(255, 255, 255));
    jLabel13.setText("          :");

    javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
    jPanel7.setLayout(jPanel7Layout);
    jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel7Layout
                    .createSequentialGroup().addGap(58, 58, 58).addGroup(jPanel7Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                                    jPanel7Layout.createSequentialGroup().addGap(224, 224, 224)
                                            .addComponent(testLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addGap(210, 210, 210))
                            .addGroup(jPanel7Layout.createSequentialGroup().addComponent(jLabel9).addGap(0, 0,
                                    Short.MAX_VALUE))
                            .addGroup(jPanel7Layout.createSequentialGroup().addGroup(jPanel7Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel7Layout.createSequentialGroup().addComponent(jLabel26)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addGroup(jPanel7Layout.createSequentialGroup().addComponent(jLabel2)
                                            .addPreferredGap(
                                                    javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                            .addComponent(jLabel30).addGap(88, 88, 88)
                                            .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 44,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(111, 111, 111)))
                                    .addGroup(jPanel7Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(rCurrencyComboBox,
                                                    javax.swing.GroupLayout.Alignment.TRAILING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(rSpinner, javax.swing.GroupLayout.Alignment.TRAILING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 120,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout
                                    .createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
                                    .addComponent(rSubmitBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(rFinishBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                    jPanel7Layout.createSequentialGroup()
                                            .addComponent(rFilePath, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 95,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(rProgressBar, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGap(70, 70, 70)));
    jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup().addGap(39, 39, 39)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel26).addComponent(rCurrencyComboBox,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel7Layout.createSequentialGroup().addGroup(jPanel7Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel7Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(rSpinner).addComponent(jLabel13))
                                    .addComponent(jLabel2)).addGap(17, 17, 17)
                                    .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 137,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(18, 18, 18).addComponent(jLabel9))
                            .addComponent(jLabel30, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton6).addComponent(rFilePath,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(29, 29, 29)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(rSubmitBtn)
                            .addComponent(rFinishBtn, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addGap(24, 24, 24)
                    .addComponent(rProgressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 15,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(testLabel1).addContainerGap(49, Short.MAX_VALUE)));

    javax.swing.GroupLayout jFrame2Layout = new javax.swing.GroupLayout(jFrame2.getContentPane());
    jFrame2.getContentPane().setLayout(jFrame2Layout);
    jFrame2Layout
            .setHorizontalGroup(jFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGap(0, 601, Short.MAX_VALUE)
                    .addGroup(jFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jFrame2Layout.createSequentialGroup()
                                    .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 601,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, Short.MAX_VALUE))));
    jFrame2Layout.setVerticalGroup(jFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 460, Short.MAX_VALUE)
            .addGroup(jFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jFrame2Layout.createSequentialGroup()
                            .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(0, 0, Short.MAX_VALUE))));

    Vector<Component> order = new Vector<Component>(10);
    order.add(rCurrencyComboBox);
    order.add(format8);
    order.add(format4);
    order.add(format5);
    order.add(format6);
    order.add(rFilePath);
    order.add(jButton6);
    order.add(rSubmitBtn);

    newPolicy = new MyOwnFocusTraversalPolicy(order);
    jPanel7.setFocusTraversalPolicy(newPolicy);

    jFrame2.setLocationRelativeTo(null);

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    setTitle("Exchange Rate Forecast");
    setIconImage(iconImage);

    jPanel1.setOpaque(false);
    jPanel1.setPreferredSize(new java.awt.Dimension(1360, 610));

    jTabbedPane1.setBackground(new java.awt.Color(204, 204, 204));
    jTabbedPane1.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
    jTabbedPane1.setAlignmentX(0.0F);
    jTabbedPane1.setAlignmentY(0.0F);
    jTabbedPane1.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
    jTabbedPane1.setOpaque(true);

    jPanel3.setBackground(new java.awt.Color(255, 204, 0));
    jPanel3.setForeground(new java.awt.Color(255, 255, 255));

    jPanel14.setBackground(new java.awt.Color(56, 56, 56, 30));
    jPanel14.setForeground(new java.awt.Color(255, 255, 255));
    jPanel14.setOpaque(false);

    jTextArea1.setEditable(false);
    jTextArea1.setBackground(new java.awt.Color(38, 50, 56, 220));
    jTextArea1.setColumns(20);
    jTextArea1.setFont(new java.awt.Font("Segoe UI Semilight", 0, 28)); // NOI18N
    jTextArea1.setForeground(new java.awt.Color(255, 255, 255));
    jTextArea1.setRows(5);
    jTextArea1.setText("Forecasting Foreign Exchange Rate Using Neural Network");
    jTextArea1.setAlignmentX(2.0F);
    jTextArea1.setAlignmentY(2.0F);
    jTextArea1.setAutoscrolls(false);
    jTextArea1.setCaretColor(new java.awt.Color(204, 255, 102));
    jTextArea1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
    jTextArea1.setDisabledTextColor(new java.awt.Color(255, 255, 255));
    jTextArea1.setEnabled(false);
    jTextArea1.setFocusable(false);
    jTextArea1.setMargin(new java.awt.Insets(10, 10, 10, 10));
    jTextArea1.setOpaque(false);
    jTextArea1.setRequestFocusEnabled(false);
    jTextArea1.setSelectedTextColor(new java.awt.Color(255, 0, 0));
    jTextArea1.setSelectionColor(new java.awt.Color(255, 51, 51));
    jTextArea1.setSelectionEnd(0);
    jTextArea1.setSelectionStart(0);
    jTextArea1.setVerifyInputWhenFocusTarget(false);

    jPanel4.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel4.setForeground(new java.awt.Color(255, 255, 255));
    jPanel4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    jPanel4.setInheritsPopupMenu(true);
    jPanel4.setOpaque(false);
    jPanel4.setPreferredSize(new java.awt.Dimension(400, 58));
    jPanel4.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseExited(java.awt.event.MouseEvent evt) {
            jPanel4MouseExited(evt);
        }

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jPanel4MouseClicked(evt);
        }

        public void mouseEntered(java.awt.event.MouseEvent evt) {
            jPanel4MouseEntered(evt);
        }
    });

    jTextArea4.setEditable(false);
    jTextArea4.setBackground(new java.awt.Color(255, 255, 255, 180));
    jTextArea4.setColumns(20);
    jTextArea4.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    jTextArea4.setForeground(new java.awt.Color(255, 255, 255));
    jTextArea4.setRows(5);
    jTextArea4.setText("Feed Forward Neural Network");
    jTextArea4.setAlignmentX(2.0F);
    jTextArea4.setAlignmentY(2.0F);
    jTextArea4.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    jTextArea4.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
    jTextArea4.setDisabledTextColor(new java.awt.Color(51, 51, 51));
    jTextArea4.setEnabled(false);
    jTextArea4.setFocusable(false);
    jTextArea4.setOpaque(false);
    jTextArea4.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseExited(java.awt.event.MouseEvent evt) {
            jTextArea4MouseExited(evt);
        }

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jTextArea4MouseClicked(evt);
        }

        public void mouseEntered(java.awt.event.MouseEvent evt) {
            jTextArea4MouseEntered(evt);
        }
    });

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout
            .setHorizontalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup().addGap(175, 175, 175)
                            .addComponent(jTextArea4, javax.swing.GroupLayout.PREFERRED_SIZE, 245,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(114, Short.MAX_VALUE)));
    jPanel4Layout
            .setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel4Layout.createSequentialGroup().addGap(16, 16, 16).addComponent(jTextArea4,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(16, 16, 16)));

    jPanel6.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel6.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    jPanel6.setInheritsPopupMenu(true);
    jPanel6.setOpaque(false);
    jPanel6.setPreferredSize(new java.awt.Dimension(400, 58));
    jPanel6.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseExited(java.awt.event.MouseEvent evt) {
            jPanel6MouseExited(evt);
        }

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jPanel6MouseClicked(evt);
        }

        public void mouseEntered(java.awt.event.MouseEvent evt) {
            jPanel6MouseEntered(evt);
        }
    });

    jTextArea5.setEditable(false);
    jTextArea5.setBackground(new java.awt.Color(255, 255, 255, 180));
    jTextArea5.setColumns(20);
    jTextArea5.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    jTextArea5.setForeground(new java.awt.Color(51, 51, 51));
    jTextArea5.setRows(5);
    jTextArea5.setText("Recurrent Neural Network");
    jTextArea5.setAlignmentX(2.0F);
    jTextArea5.setAlignmentY(2.0F);
    jTextArea5.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    jTextArea5.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
    jTextArea5.setDisabledTextColor(new java.awt.Color(51, 51, 51));
    jTextArea5.setEnabled(false);
    jTextArea5.setFocusable(false);
    jTextArea5.setOpaque(false);
    jTextArea5.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseExited(java.awt.event.MouseEvent evt) {
            jTextArea5MouseExited(evt);
        }

        public void mouseClicked(java.awt.event.MouseEvent evt) {
            jTextArea5MouseClicked(evt);
        }

        public void mouseEntered(java.awt.event.MouseEvent evt) {
            jTextArea5MouseEntered(evt);
        }
    });

    javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
    jPanel6.setLayout(jPanel6Layout);
    jPanel6Layout.setHorizontalGroup(jPanel6Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                    .addContainerGap(181, Short.MAX_VALUE).addComponent(jTextArea5,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(113, 113, 113)));
    jPanel6Layout
            .setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup().addGap(16, 16, 16).addComponent(jTextArea5,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(16, 16, 16)));

    jPanel15.setBackground(new java.awt.Color(38, 50, 56, 220));
    jPanel15.setForeground(new java.awt.Color(51, 51, 51));
    jPanel15.setDoubleBuffered(false);
    jPanel15.setEnabled(false);
    jPanel15.setFocusable(false);
    jPanel15.setOpaque(false);

    jTextArea3.setEditable(false);
    jTextArea3.setBackground(new java.awt.Color(38, 50, 56, 0));
    jTextArea3.setColumns(20);
    jTextArea3.setFont(new java.awt.Font("Segoe UI", 0, 20)); // NOI18N
    jTextArea3.setForeground(new java.awt.Color(255, 255, 255));
    jTextArea3.setRows(5);
    jTextArea3.setText("CURRENCY");
    jTextArea3.setDisabledTextColor(new java.awt.Color(255, 255, 255));
    jTextArea3.setEnabled(false);
    jTextArea3.setOpaque(false);

    javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15);
    jPanel15.setLayout(jPanel15Layout);
    jPanel15Layout.setHorizontalGroup(jPanel15Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel15Layout.createSequentialGroup()
                    .addContainerGap(237, Short.MAX_VALUE).addComponent(jTextArea3,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(183, 183, 183)));
    jPanel15Layout
            .setVerticalGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel15Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(jTextArea3,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel16.setBackground(new java.awt.Color(1, 87, 155, 220));
    jPanel16.setDoubleBuffered(false);
    jPanel16.setEnabled(false);
    jPanel16.setFocusable(false);
    jPanel16.setOpaque(false);

    jTextArea6.setEditable(false);
    jTextArea6.setColumns(20);
    jTextArea6.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    jTextArea6.setForeground(new java.awt.Color(255, 255, 255));
    jTextArea6.setRows(5);
    jTextArea6.setText("USD / INR");
    jTextArea6.setDisabledTextColor(new java.awt.Color(255, 255, 255));
    jTextArea6.setEnabled(false);
    jTextArea6.setOpaque(false);

    javax.swing.GroupLayout jPanel16Layout = new javax.swing.GroupLayout(jPanel16);
    jPanel16.setLayout(jPanel16Layout);
    jPanel16Layout
            .setHorizontalGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel16Layout.createSequentialGroup().addGap(244, 244, 244)
                                    .addComponent(jTextArea6, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(192, Short.MAX_VALUE)));
    jPanel16Layout
            .setVerticalGroup(jPanel16Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel16Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(jTextArea6,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel17.setBackground(new java.awt.Color(1, 87, 155, 220));
    jPanel17.setDoubleBuffered(false);
    jPanel17.setEnabled(false);
    jPanel17.setFocusable(false);
    jPanel17.setOpaque(false);

    jTextArea7.setEditable(false);
    jTextArea7.setColumns(20);
    jTextArea7.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    jTextArea7.setForeground(new java.awt.Color(255, 255, 255));
    jTextArea7.setRows(5);
    jTextArea7.setText("GBP / INR");
    jTextArea7.setDisabledTextColor(new java.awt.Color(255, 255, 255));
    jTextArea7.setEnabled(false);
    jTextArea7.setOpaque(false);

    javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17);
    jPanel17.setLayout(jPanel17Layout);
    jPanel17Layout
            .setHorizontalGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel17Layout.createSequentialGroup().addGap(244, 244, 244)
                                    .addComponent(jTextArea7, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(192, Short.MAX_VALUE)));
    jPanel17Layout
            .setVerticalGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel17Layout.createSequentialGroup().addGap(11, 11, 11)
                            .addComponent(jTextArea7, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
                            .addGap(11, 11, 11)));

    jPanel18.setBackground(new java.awt.Color(1, 87, 155, 220));
    jPanel18.setDoubleBuffered(false);
    jPanel18.setEnabled(false);
    jPanel18.setFocusable(false);
    jPanel18.setOpaque(false);

    jTextArea8.setEditable(false);
    jTextArea8.setColumns(20);
    jTextArea8.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    jTextArea8.setForeground(new java.awt.Color(255, 255, 255));
    jTextArea8.setRows(5);
    jTextArea8.setText("EUR / INR");
    jTextArea8.setDisabledTextColor(new java.awt.Color(255, 255, 255));
    jTextArea8.setEnabled(false);
    jTextArea8.setOpaque(false);

    javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18);
    jPanel18.setLayout(jPanel18Layout);
    jPanel18Layout
            .setHorizontalGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel18Layout.createSequentialGroup().addGap(244, 244, 244)
                                    .addComponent(jTextArea8, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(192, Short.MAX_VALUE)));
    jPanel18Layout
            .setVerticalGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel18Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(jTextArea8,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel19.setBackground(new java.awt.Color(1, 87, 155, 220));
    jPanel19.setForeground(new java.awt.Color(255, 255, 255));
    jPanel19.setDoubleBuffered(false);
    jPanel19.setEnabled(false);
    jPanel19.setFocusable(false);
    jPanel19.setOpaque(false);

    jTextArea9.setEditable(false);
    jTextArea9.setColumns(20);
    jTextArea9.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    jTextArea9.setForeground(new java.awt.Color(255, 255, 255));
    jTextArea9.setRows(5);
    jTextArea9.setText("YEN / INR");
    jTextArea9.setDisabledTextColor(new java.awt.Color(255, 255, 255));
    jTextArea9.setEnabled(false);
    jTextArea9.setOpaque(false);

    javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19);
    jPanel19.setLayout(jPanel19Layout);
    jPanel19Layout
            .setHorizontalGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel19Layout.createSequentialGroup().addGap(244, 244, 244)
                                    .addComponent(jTextArea9, javax.swing.GroupLayout.PREFERRED_SIZE, 98,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(192, Short.MAX_VALUE)));
    jPanel19Layout
            .setVerticalGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel19Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(jTextArea9,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel20.setBackground(new java.awt.Color(38, 50, 56, 220));
    jPanel20.setForeground(new java.awt.Color(51, 51, 51));
    jPanel20.setDoubleBuffered(false);
    jPanel20.setEnabled(false);
    jPanel20.setFocusable(false);
    jPanel20.setOpaque(false);

    jTextArea10.setEditable(false);
    jTextArea10.setBackground(new java.awt.Color(38, 50, 56, 0));
    jTextArea10.setColumns(20);
    jTextArea10.setFont(new java.awt.Font("Segoe UI", 0, 20)); // NOI18N
    jTextArea10.setForeground(new java.awt.Color(255, 255, 255));
    jTextArea10.setRows(5);
    jTextArea10.setText("TODAY");
    jTextArea10.setDisabledTextColor(new java.awt.Color(255, 255, 255));
    jTextArea10.setEnabled(false);
    jTextArea10.setOpaque(false);

    javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20);
    jPanel20.setLayout(jPanel20Layout);
    jPanel20Layout
            .setHorizontalGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel20Layout.createSequentialGroup().addGap(101, 101, 101)
                            .addComponent(jTextArea10, javax.swing.GroupLayout.PREFERRED_SIZE, 78,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(85, Short.MAX_VALUE)));
    jPanel20Layout.setVerticalGroup(jPanel20Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel20Layout
                    .createSequentialGroup().addGap(11, 11, 11).addComponent(jTextArea10,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(11, 11, 11)));

    jPanel21.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel21.setDoubleBuffered(false);
    jPanel21.setEnabled(false);
    jPanel21.setFocusable(false);
    jPanel21.setOpaque(false);

    todayText1.setEditable(false);
    todayText1.setBackground(new java.awt.Color(255, 255, 255, 0));
    todayText1.setColumns(20);
    todayText1.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    todayText1.setRows(5);
    todayText1.setText("    --");
    todayText1.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    todayText1.setEnabled(false);
    todayText1.setOpaque(false);

    javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
    jPanel21.setLayout(jPanel21Layout);
    jPanel21Layout
            .setHorizontalGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel21Layout.createSequentialGroup().addGap(102, 102, 102)
                            .addComponent(todayText1, javax.swing.GroupLayout.PREFERRED_SIZE, 71,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(91, Short.MAX_VALUE)));
    jPanel21Layout
            .setVerticalGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel21Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(todayText1,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel22.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel22.setDoubleBuffered(false);
    jPanel22.setEnabled(false);
    jPanel22.setFocusable(false);
    jPanel22.setOpaque(false);

    todayText2.setEditable(false);
    todayText2.setBackground(new java.awt.Color(255, 255, 255, 0));
    todayText2.setColumns(20);
    todayText2.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    todayText2.setRows(5);
    todayText2.setText("    --");
    todayText2.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    todayText2.setEnabled(false);
    todayText2.setOpaque(false);

    javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
    jPanel22.setLayout(jPanel22Layout);
    jPanel22Layout
            .setHorizontalGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel22Layout.createSequentialGroup().addGap(102, 102, 102)
                            .addComponent(todayText2, javax.swing.GroupLayout.PREFERRED_SIZE, 71,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(91, Short.MAX_VALUE)));
    jPanel22Layout
            .setVerticalGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel22Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(todayText2,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel23.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel23.setDoubleBuffered(false);
    jPanel23.setEnabled(false);
    jPanel23.setFocusable(false);
    jPanel23.setOpaque(false);

    todayText3.setEditable(false);
    todayText3.setBackground(new java.awt.Color(255, 255, 255, 0));
    todayText3.setColumns(20);
    todayText3.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    todayText3.setRows(5);
    todayText3.setText("    --");
    todayText3.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    todayText3.setEnabled(false);
    todayText3.setOpaque(false);

    javax.swing.GroupLayout jPanel23Layout = new javax.swing.GroupLayout(jPanel23);
    jPanel23.setLayout(jPanel23Layout);
    jPanel23Layout
            .setHorizontalGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel23Layout.createSequentialGroup().addGap(102, 102, 102)
                            .addComponent(todayText3, javax.swing.GroupLayout.PREFERRED_SIZE, 71,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(91, Short.MAX_VALUE)));
    jPanel23Layout
            .setVerticalGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel23Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(todayText3,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel24.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel24.setDoubleBuffered(false);
    jPanel24.setEnabled(false);
    jPanel24.setFocusable(false);
    jPanel24.setOpaque(false);

    todayText4.setEditable(false);
    todayText4.setBackground(new java.awt.Color(255, 255, 255, 0));
    todayText4.setColumns(20);
    todayText4.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    todayText4.setRows(5);
    todayText4.setText("    --");
    todayText4.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    todayText4.setEnabled(false);
    todayText4.setOpaque(false);

    javax.swing.GroupLayout jPanel24Layout = new javax.swing.GroupLayout(jPanel24);
    jPanel24.setLayout(jPanel24Layout);
    jPanel24Layout
            .setHorizontalGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel24Layout.createSequentialGroup().addGap(102, 102, 102)
                            .addComponent(todayText4, javax.swing.GroupLayout.PREFERRED_SIZE, 71,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(91, Short.MAX_VALUE)));
    jPanel24Layout
            .setVerticalGroup(jPanel24Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel24Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(todayText4,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel25.setBackground(new java.awt.Color(38, 50, 56, 220));
    jPanel25.setForeground(new java.awt.Color(51, 51, 51));
    jPanel25.setDoubleBuffered(false);
    jPanel25.setEnabled(false);
    jPanel25.setFocusable(false);
    jPanel25.setOpaque(false);

    jTextArea15.setEditable(false);
    jTextArea15.setBackground(new java.awt.Color(38, 50, 56, 0));
    jTextArea15.setColumns(20);
    jTextArea15.setFont(new java.awt.Font("Segoe UI", 0, 20)); // NOI18N
    jTextArea15.setForeground(new java.awt.Color(255, 255, 255));
    jTextArea15.setRows(5);
    jTextArea15.setText("TOMORROW");
    jTextArea15.setDisabledTextColor(new java.awt.Color(255, 255, 255));
    jTextArea15.setEnabled(false);
    jTextArea15.setOpaque(false);
    jTextArea15.setRequestFocusEnabled(false);
    jTextArea15.setVerifyInputWhenFocusTarget(false);

    javax.swing.GroupLayout jPanel25Layout = new javax.swing.GroupLayout(jPanel25);
    jPanel25.setLayout(jPanel25Layout);
    jPanel25Layout
            .setHorizontalGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel25Layout.createSequentialGroup()
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jTextArea15, javax.swing.GroupLayout.PREFERRED_SIZE, 132,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel25Layout.setVerticalGroup(jPanel25Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel25Layout
                    .createSequentialGroup().addGap(11, 11, 11).addComponent(jTextArea15,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(11, 11, 11)));

    jPanel26.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel26.setDoubleBuffered(false);
    jPanel26.setEnabled(false);
    jPanel26.setFocusable(false);
    jPanel26.setOpaque(false);

    tmrwText1.setEditable(false);
    tmrwText1.setBackground(new java.awt.Color(255, 255, 255, 0));
    tmrwText1.setColumns(20);
    tmrwText1.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    tmrwText1.setRows(5);
    tmrwText1.setText("      --");
    tmrwText1.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    tmrwText1.setEnabled(false);
    tmrwText1.setOpaque(false);

    javax.swing.GroupLayout jPanel26Layout = new javax.swing.GroupLayout(jPanel26);
    jPanel26.setLayout(jPanel26Layout);
    jPanel26Layout
            .setHorizontalGroup(jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel26Layout.createSequentialGroup()
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(tmrwText1, javax.swing.GroupLayout.PREFERRED_SIZE, 97,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel26Layout
            .setVerticalGroup(jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel26Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(tmrwText1,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel27.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel27.setDoubleBuffered(false);
    jPanel27.setEnabled(false);
    jPanel27.setFocusable(false);
    jPanel27.setOpaque(false);

    tmrwText2.setEditable(false);
    tmrwText2.setBackground(new java.awt.Color(255, 255, 255, 0));
    tmrwText2.setColumns(20);
    tmrwText2.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    tmrwText2.setRows(5);
    tmrwText2.setText("      --");
    tmrwText2.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    tmrwText2.setEnabled(false);
    tmrwText2.setOpaque(false);

    javax.swing.GroupLayout jPanel27Layout = new javax.swing.GroupLayout(jPanel27);
    jPanel27.setLayout(jPanel27Layout);
    jPanel27Layout
            .setHorizontalGroup(jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel27Layout.createSequentialGroup()
                                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(tmrwText2, javax.swing.GroupLayout.PREFERRED_SIZE, 97,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(85, 85, 85)));
    jPanel27Layout.setVerticalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                    javax.swing.GroupLayout.Alignment.TRAILING,
                    jPanel27Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(tmrwText2,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel28.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel28.setDoubleBuffered(false);
    jPanel28.setEnabled(false);
    jPanel28.setFocusable(false);
    jPanel28.setOpaque(false);

    tmrwText3.setEditable(false);
    tmrwText3.setBackground(new java.awt.Color(255, 255, 255, 0));
    tmrwText3.setColumns(20);
    tmrwText3.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    tmrwText3.setRows(5);
    tmrwText3.setText("      --");
    tmrwText3.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    tmrwText3.setEnabled(false);
    tmrwText3.setOpaque(false);

    javax.swing.GroupLayout jPanel28Layout = new javax.swing.GroupLayout(jPanel28);
    jPanel28.setLayout(jPanel28Layout);
    jPanel28Layout
            .setHorizontalGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel28Layout.createSequentialGroup().addGap(83, 83, 83)
                            .addComponent(tmrwText3, javax.swing.GroupLayout.PREFERRED_SIZE, 97,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel28Layout
            .setVerticalGroup(jPanel28Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel28Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(tmrwText3,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    jPanel29.setBackground(new java.awt.Color(255, 255, 255, 220));
    jPanel29.setDoubleBuffered(false);
    jPanel29.setEnabled(false);
    jPanel29.setFocusable(false);
    jPanel29.setOpaque(false);

    tmrwText4.setEditable(false);
    tmrwText4.setBackground(new java.awt.Color(255, 255, 255, 0));
    tmrwText4.setColumns(20);
    tmrwText4.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
    tmrwText4.setRows(5);
    tmrwText4.setText("      --");
    tmrwText4.setDisabledTextColor(new java.awt.Color(0, 0, 0));
    tmrwText4.setEnabled(false);
    tmrwText4.setOpaque(false);

    javax.swing.GroupLayout jPanel29Layout = new javax.swing.GroupLayout(jPanel29);
    jPanel29.setLayout(jPanel29Layout);
    jPanel29Layout
            .setHorizontalGroup(jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel29Layout.createSequentialGroup().addGap(83, 83, 83)
                            .addComponent(tmrwText4, javax.swing.GroupLayout.PREFERRED_SIZE, 97,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel29Layout
            .setVerticalGroup(jPanel29Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel29Layout.createSequentialGroup().addGap(11, 11, 11).addComponent(tmrwText4,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(11, 11, 11)));

    statusLabel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    statusLabel.setForeground(new java.awt.Color(0, 51, 0));
    statusLabel.setText("Fetching Todays Data From Internet ...");

    javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
    jPanel14.setLayout(jPanel14Layout);
    jPanel14Layout.setHorizontalGroup(jPanel14Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup().addGap(144, 144, 144).addGroup(jPanel14Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel14Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextArea1)
                            .addGroup(jPanel14Layout.createSequentialGroup()
                                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 534,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(10, 10, 10).addComponent(jPanel6,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 539,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel14Layout.createSequentialGroup().addGroup(jPanel14Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jPanel19, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(10, 10, 10)
                                    .addGroup(jPanel14Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    false)
                                            .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jPanel20, javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jPanel23, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(10, 10, 10)
                                    .addGroup(jPanel14Layout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(jPanel28, javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jPanel26, javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jPanel27, javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jPanel29, javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jPanel25, javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                    .addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 600,
                            javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(144, Short.MAX_VALUE)));
    jPanel14Layout.setVerticalGroup(jPanel14Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap(90, Short.MAX_VALUE)
                    .addComponent(jTextArea1, javax.swing.GroupLayout.PREFERRED_SIZE, 60,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(20, 20, 20)
                    .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel14Layout.createSequentialGroup().addGroup(jPanel14Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel14Layout.createSequentialGroup()
                                            .addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(6, 6, 6)
                                            .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jPanel23, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel14Layout
                                            .createSequentialGroup()
                                            .addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jPanel16, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jPanel24, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel14Layout.createSequentialGroup()
                                    .addComponent(jPanel25, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jPanel26, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jPanel27, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jPanel28, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jPanel29, javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jPanel19, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 53,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(20, 20, 20)
                    .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(statusLabel).addGap(24, 24, 24)));

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel14,
                    javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
    jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel14,
                    javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE,
                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));

    jTabbedPane1.addTab("          Home          ", jPanel3);

    jPanel10.setBackground(new java.awt.Color(38, 50, 56, 220));
    jPanel10.setDoubleBuffered(false);
    jPanel10.setEnabled(false);
    jPanel10.setFocusable(false);
    jPanel10.setOpaque(false);

    jLabel8.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    jLabel8.setForeground(new java.awt.Color(255, 255, 255));
    jLabel8.setText("Select Currency:");

    CurrencyComboBox.setBackground(new java.awt.Color(56, 56, 56, 0));
    CurrencyComboBox.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    CurrencyComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(
            new String[] { "US Dollar", "British Pound", "Euro", "Yen" }));
    CurrencyComboBox.setAlignmentX(2.0F);
    CurrencyComboBox.setOpaque(false);

    jLabel7.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    jLabel7.setForeground(new java.awt.Color(255, 255, 255));
    jLabel7.setText("Testing Data:");

    testingDataPath.setBackground(new java.awt.Color(255, 255, 255, 200));
    testingDataPath.setMargin(new java.awt.Insets(2, 4, 2, 2));
    testingDataPath.setOpaque(false);
    testingDataPath.addFocusListener(new java.awt.event.FocusAdapter() {
        public void focusGained(java.awt.event.FocusEvent evt) {
            testingDataPathFocusGained(evt);
        }
    });
    testingDataPath.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            testingDataPathMouseClicked(evt);
        }
    });
    testingDataPath.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            testingDataPathActionPerformed(evt);
        }
    });

    testingBrowseBtn.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    testingBrowseBtn.setText("Browse");
    testingBrowseBtn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            testingBrowseBtnActionPerformed(evt);
        }
    });

    forecastBtn.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    forecastBtn.setText("Forecast");
    forecastBtn.setOpaque(false);
    forecastBtn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            forecastBtnActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
    jPanel10.setLayout(jPanel10Layout);
    jPanel10Layout.setHorizontalGroup(jPanel10Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup().addGap(18, 18, 18)
                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 101,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(CurrencyComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 108,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(31, 31, 31).addComponent(jLabel7)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(testingDataPath, javax.swing.GroupLayout.PREFERRED_SIZE, 280,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(testingBrowseBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 86,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(forecastBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 142,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(20, 20, 20)));
    jPanel10Layout.setVerticalGroup(jPanel10Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup().addGap(22, 22, 22)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(CurrencyComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel7)
                            .addComponent(testingDataPath, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(testingBrowseBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(forecastBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(22, Short.MAX_VALUE)));

    jScrollPane1.setEnabled(false);
    jScrollPane1.setFocusable(false);
    jScrollPane1.setPreferredSize(new java.awt.Dimension(805, 100));

    //forecastTable.getTableHeader().setOpaque(false);
    //forecastTable.getTableHeader().setBackground(new java.awt.Color(0,150,136,220));
    forecastTable.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    forecastTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object[][] { { "", "", "", "" }, { null, null, null, null }, { null, null, null, null },
                    { null, null, null, null } },
            new String[] { "  Date", "  Input", "  Expected Output", "  Actual Output" }) {
        Class[] types = new Class[] { java.lang.String.class, java.lang.String.class, java.lang.String.class,
                java.lang.String.class };
        boolean[] canEdit = new boolean[] { false, true, false, false };

        public Class getColumnClass(int columnIndex) {
            return types[columnIndex];
        }

        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return canEdit[columnIndex];
        }
    });
    forecastTable.setAlignmentX(20.0F);
    forecastTable.setAlignmentY(20.0F);
    forecastTable.setGridColor(new java.awt.Color(153, 153, 153));
    forecastTable.setIntercellSpacing(new java.awt.Dimension(20, 10));
    forecastTable.setRowHeight(30);
    forecastTable.getTableHeader().setResizingAllowed(false);
    forecastTable.getTableHeader().setReorderingAllowed(false);
    forecastTable.addFocusListener(new java.awt.event.FocusAdapter() {
        public void focusLost(java.awt.event.FocusEvent evt) {
            forecastTableFocusLost(evt);
        }
    });
    jScrollPane1.setViewportView(forecastTable);
    if (forecastTable.getColumnModel().getColumnCount() > 0) {
        forecastTable.getColumnModel().getColumn(0).setMinWidth(150);
        forecastTable.getColumnModel().getColumn(0).setPreferredWidth(150);
        forecastTable.getColumnModel().getColumn(0).setMaxWidth(150);
        forecastTable.getColumnModel().getColumn(1).setMinWidth(550);
        forecastTable.getColumnModel().getColumn(1).setPreferredWidth(550);
        forecastTable.getColumnModel().getColumn(1).setMaxWidth(550);
        forecastTable.getColumnModel().getColumn(1).setCellEditor(dce);
    }

    jPanel12.setBackground(new java.awt.Color(38, 50, 56, 220));
    jPanel12.setOpaque(false);

    jPanel13.setBackground(new java.awt.Color(56, 56, 56, 180));
    jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Select Algorithm",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Segoe UI", 0, 12),
            new java.awt.Color(255, 255, 255))); // NOI18N
    jPanel13.setOpaque(false);

    jRadioButton2.setBackground(new java.awt.Color(56, 56, 56, 180));
    buttonGroup1.add(jRadioButton2);
    jRadioButton2.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    jRadioButton2.setForeground(new java.awt.Color(255, 255, 255));
    jRadioButton2.setText("Recurrent Neural Network");
    jRadioButton2.setContentAreaFilled(false);
    jRadioButton2.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jRadioButton2ItemStateChanged(evt);
        }
    });

    jRadioButton1.setBackground(new java.awt.Color(56, 56, 56, 180));
    buttonGroup1.add(jRadioButton1);
    jRadioButton1.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    jRadioButton1.setForeground(new java.awt.Color(255, 255, 255));
    jRadioButton1.setSelected(true);
    jRadioButton1.setText("Feed Forward Neural Network");
    jRadioButton1.setContentAreaFilled(false);
    jRadioButton1.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            jRadioButton1ItemStateChanged(evt);
        }
    });

    javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
    jPanel13.setLayout(jPanel13Layout);
    jPanel13Layout
            .setHorizontalGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                            jPanel13Layout.createSequentialGroup().addGap(95, 95, 95)
                                    .addComponent(jRadioButton1).addGap(102, 102, 102)
                                    .addComponent(jRadioButton2).addContainerGap(116, Short.MAX_VALUE)));
    jPanel13Layout.setVerticalGroup(jPanel13Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                    .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jRadioButton1).addComponent(jRadioButton2))
                    .addGap(0, 0, Short.MAX_VALUE)));

    javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
    jPanel12.setLayout(jPanel12Layout);
    jPanel12Layout.setHorizontalGroup(jPanel12Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap()
                    .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    jPanel12Layout.setVerticalGroup(jPanel12Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap()
                    .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    jPanel2.setBackground(new java.awt.Color(38, 50, 56, 220));
    jPanel2.setOpaque(false);

    doneButton1.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    doneButton1.setText("Train NN");
    doneButton1.setOpaque(false);
    doneButton1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            doneButton1MouseClicked(evt);
        }
    });
    doneButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            doneButton1ActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
                    javax.swing.GroupLayout.Alignment.TRAILING,
                    jPanel2Layout.createSequentialGroup().addGap(28, 28, 28).addComponent(doneButton1,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(21, 21, 21)));
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    jPanel2Layout.createSequentialGroup().addGap(22, 22, 22).addComponent(doneButton1,
                            javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(23, 23, 23)));

    jPanel30.setBackground(new java.awt.Color(38, 50, 56, 220));
    jPanel30.setDoubleBuffered(false);
    jPanel30.setEnabled(false);
    jPanel30.setFocusable(false);
    jPanel30.setOpaque(false);

    graphBtn.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    graphBtn.setText("Plot Graph");
    graphBtn.setOpaque(false);
    graphBtn.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            graphBtnActionPerformed(evt);
        }
    });

    jButton1.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
    jButton1.setText("Reset");
    jButton1.setOpaque(false);
    jButton1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButton1ActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel30Layout = new javax.swing.GroupLayout(jPanel30);
    jPanel30.setLayout(jPanel30Layout);
    jPanel30Layout.setHorizontalGroup(jPanel30Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel30Layout.createSequentialGroup().addContainerGap()
                    .addGroup(jPanel30Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(graphBtn, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap()));
    jPanel30Layout
            .setVerticalGroup(jPanel30Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel30Layout.createSequentialGroup().addGap(22, 22, 22)
                            .addComponent(graphBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(59, 59, 59).addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE,
                                    31, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(22, 22, 22)));

    javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
    jPanel8.setLayout(jPanel8Layout);
    jPanel8Layout.setHorizontalGroup(jPanel8Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup().addGap(148, 148, 148).addGroup(jPanel8Layout
                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1089,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                            .addGroup(jPanel8Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel8Layout.createSequentialGroup()
                                            .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(10, 10, 10)
                                            .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jPanel30, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addContainerGap(134, Short.MAX_VALUE)));
    jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                    jPanel8Layout.createSequentialGroup().addGap(84, 84, 84).addGroup(jPanel8Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel8Layout.createSequentialGroup().addGroup(jPanel8Layout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                    .addGap(11, 11, 11).addComponent(jPanel10,
                                            javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jPanel30, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 376,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(36, 36, 36)));

    jTabbedPane1.addTab("          Forecast          ", jPanel8);

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1,
                    javax.swing.GroupLayout.PREFERRED_SIZE, 1376, javax.swing.GroupLayout.PREFERRED_SIZE));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 614, Short.MAX_VALUE));

    jTabbedPane1.getAccessibleContext().setAccessibleName("Home");

    jScrollPane2.setViewportView(jPanel1);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING,
                    javax.swing.GroupLayout.DEFAULT_SIZE, 1371, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
            jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 586,
            Short.MAX_VALUE));

    pack();
}

From source file:eu.cassandra.training.gui.MainGUI.java

/**
 * Constructor of the Training Module GUI.
 * /*from  www.j av a 2s.  c  o m*/
 * @throws UnsupportedLookAndFeelException
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 * @throws FileNotFoundException
 */
public MainGUI() throws ClassNotFoundException, InstantiationException, IllegalAccessException,
        UnsupportedLookAndFeelException, FileNotFoundException {
    setForeground(new Color(0, 204, 51));

    // Enable the closing of the frame when pressing the x on the upper corner
    // of the window
    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
            Utils.cleanFiles();
            System.exit(0);
        }
    });

    // Cleaning temporary files from the temp folder when starting the GUI.
    // Utils.cleanFiles();

    // Change the platforms look and feel to Nimbus
    LookAndFeel lnf = new javax.swing.plaf.nimbus.NimbusLookAndFeel();
    UIManager.put("NimbusLookAndFeel", Color.GREEN);
    UIManager.setLookAndFeel(lnf);

    // Setting the basic attributes of the Training Module GUI
    setTitle("Training Module (BETA)");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 1228, 799);

    // Creating the menu bar and adding the menu items
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu mnNewMenu = new JMenu("File");
    menuBar.add(mnNewMenu);

    JMenuItem mntmExit = new JMenuItem("Exit");
    mntmExit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Utils.cleanFiles();
            System.exit(0);
        }
    });
    mnNewMenu.add(mntmExit);

    JMenu mnExit = new JMenu("Help");
    menuBar.add(mnExit);

    JMenuItem mntmManual = new JMenuItem("Manual");
    mnExit.add(mntmManual);

    JMenuItem mntmAbout = new JMenuItem("About");
    mnExit.add(mntmAbout);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);

    // Adding the tabbed pane to the content pane
    final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    GroupLayout gl_contentPane = new GroupLayout(contentPane);
    gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addComponent(tabbedPane, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 1202, Short.MAX_VALUE));
    gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_contentPane.createSequentialGroup()
                    .addComponent(tabbedPane, GroupLayout.PREFERRED_SIZE, 736, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(47, Short.MAX_VALUE)));

    // TABS //

    final JPanel importTab = new JPanel();
    tabbedPane.addTab("Import Data", null, importTab, null);
    tabbedPane.setDisplayedMnemonicIndexAt(0, 0);
    tabbedPane.setEnabledAt(0, true);
    importTab.setLayout(null);

    final JPanel trainingTab = new JPanel();
    tabbedPane.addTab("Train Activity Models", null, trainingTab, null);
    tabbedPane.setDisplayedMnemonicIndexAt(1, 1);
    tabbedPane.setEnabledAt(1, false);
    trainingTab.setLayout(null);

    final JPanel createResponseTab = new JPanel();

    tabbedPane.addTab("Create Response Models", null, createResponseTab, null);
    tabbedPane.setEnabledAt(2, false);
    createResponseTab.setLayout(null);

    // RESPONSE MODEL TAB //

    final JPanel responseParametersPanel = new JPanel();
    responseParametersPanel.setLayout(null);
    responseParametersPanel.setBorder(
            new TitledBorder(null, "Response Parameters", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    responseParametersPanel.setBounds(6, 6, 394, 271);
    createResponseTab.add(responseParametersPanel);

    final JPanel activityModelSelectionPanel = new JPanel();
    activityModelSelectionPanel.setLayout(null);
    activityModelSelectionPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Activity Model Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    activityModelSelectionPanel.setBounds(6, 516, 394, 192);
    createResponseTab.add(activityModelSelectionPanel);

    final JPanel responsePanel = new JPanel();
    responsePanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Activity Model Change Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    responsePanel.setBounds(417, 6, 770, 385);
    createResponseTab.add(responsePanel);
    responsePanel.setLayout(new BorderLayout(0, 0));

    final JPanel pricingPreviewPanel = new JPanel();
    pricingPreviewPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Pricing Scheme Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    pricingPreviewPanel.setBounds(417, 438, 770, 259);
    createResponseTab.add(pricingPreviewPanel);
    pricingPreviewPanel.setLayout(new BorderLayout(0, 0));

    final JPanel pricingSchemePanel = new JPanel();
    pricingSchemePanel.setLayout(null);
    pricingSchemePanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Pricing Scheme Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    pricingSchemePanel.setBounds(6, 274, 394, 243);
    createResponseTab.add(pricingSchemePanel);

    // /////////////////
    // RESPONSE TAB //
    // ////////////////

    // RESPONSE PARAMETERS //

    final JLabel lblSensitivity = new JLabel("Sensitivity");
    lblSensitivity.setBounds(10, 28, 78, 16);
    responseParametersPanel.add(lblSensitivity);

    final JSlider sensitivitySlider = new JSlider();
    sensitivitySlider.setPaintLabels(true);
    sensitivitySlider.setSnapToTicks(true);
    sensitivitySlider.setPaintTicks(true);
    sensitivitySlider.setMinorTickSpacing(10);
    sensitivitySlider.setMajorTickSpacing(10);
    sensitivitySlider.setBounds(111, 28, 214, 45);
    responseParametersPanel.add(sensitivitySlider);

    final JLabel lblAwareness = new JLabel("Awareness");
    lblAwareness.setBounds(10, 79, 78, 16);
    responseParametersPanel.add(lblAwareness);

    final JSlider awarenessSlider = new JSlider();
    awarenessSlider.setPaintLabels(true);
    awarenessSlider.setPaintTicks(true);
    awarenessSlider.setMajorTickSpacing(10);
    awarenessSlider.setMinorTickSpacing(10);
    awarenessSlider.setSnapToTicks(true);
    awarenessSlider.setBounds(111, 79, 214, 45);
    responseParametersPanel.add(awarenessSlider);

    final JLabel label_7 = new JLabel("Response Model");
    label_7.setBounds(10, 153, 103, 16);
    responseParametersPanel.add(label_7);

    final JRadioButton optimalCaseRadioButton = new JRadioButton("Optimal Case Scenario");
    responseModelButtonGroup.add(optimalCaseRadioButton);
    optimalCaseRadioButton.setBounds(111, 131, 170, 18);
    responseParametersPanel.add(optimalCaseRadioButton);

    final JRadioButton normalCaseRadioButton = new JRadioButton("Normal Case Scenario");
    normalCaseRadioButton.setSelected(true);
    responseModelButtonGroup.add(normalCaseRadioButton);
    normalCaseRadioButton.setBounds(111, 152, 170, 18);
    responseParametersPanel.add(normalCaseRadioButton);

    final JRadioButton discreteCaseRadioButton = new JRadioButton("Discrete Case Scenario");
    discreteCaseRadioButton.setSelected(true);
    responseModelButtonGroup.add(discreteCaseRadioButton);
    discreteCaseRadioButton.setBounds(111, 173, 170, 18);
    responseParametersPanel.add(discreteCaseRadioButton);

    final JButton previewResponseButton = new JButton("Preview Response Model");
    previewResponseButton.setEnabled(false);
    previewResponseButton.setBounds(24, 198, 157, 28);
    responseParametersPanel.add(previewResponseButton);

    final JButton createResponseButton = new JButton("Create Response Model");
    createResponseButton.setEnabled(false);
    createResponseButton.setBounds(191, 198, 162, 28);
    responseParametersPanel.add(createResponseButton);

    final JButton createResponseAllButton = new JButton("Create Response All");
    createResponseAllButton.setEnabled(false);
    createResponseAllButton.setBounds(111, 232, 157, 28);
    responseParametersPanel.add(createResponseAllButton);

    // SELECT ACTIVITY MODEL //

    final JLabel lblSelectedActivity = new JLabel("Selected Activity");
    lblSelectedActivity.setBounds(10, 21, 130, 16);
    activityModelSelectionPanel.add(lblSelectedActivity);

    JScrollPane activityListScrollPane = new JScrollPane();
    activityListScrollPane.setBounds(20, 39, 355, 143);
    activityModelSelectionPanel.add(activityListScrollPane);

    final JList<String> activitySelectList = new JList<String>();
    activityListScrollPane.setViewportView(activitySelectList);
    activitySelectList.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));

    final JButton commitButton = new JButton("Commit");
    commitButton.setEnabled(false);
    commitButton.setBounds(151, 209, 89, 23);
    pricingSchemePanel.add(commitButton);

    JLabel lblBasicSchema = new JLabel("Basic Schema (Start-End-Value)");
    lblBasicSchema.setBounds(10, 18, 182, 14);
    pricingSchemePanel.add(lblBasicSchema);

    JLabel lblNewSchemastart = new JLabel("New Schema (Start-End-Value)");
    lblNewSchemastart.setBounds(197, 18, 177, 14);
    pricingSchemePanel.add(lblNewSchemastart);

    JScrollPane basicPricingSchemeScrollPane = new JScrollPane();
    basicPricingSchemeScrollPane.setBounds(10, 43, 177, 161);
    pricingSchemePanel.add(basicPricingSchemeScrollPane);

    final JTextPane basicPricingSchemePane = new JTextPane();
    basicPricingSchemeScrollPane.setViewportView(basicPricingSchemePane);
    basicPricingSchemePane.setText("00:00-23:59-0.05");

    JScrollPane newPricingScrollPane = new JScrollPane();
    newPricingScrollPane.setBounds(197, 43, 177, 161);
    pricingSchemePanel.add(newPricingScrollPane);

    final JTextPane newPricingSchemePane = new JTextPane();

    newPricingScrollPane.setViewportView(newPricingSchemePane);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setBounds(682, 390, 265, 33);
    createResponseTab.add(buttonPanel);

    final JButton dailyResponseButton = new JButton("Daily Times");
    dailyResponseButton.setEnabled(false);
    buttonPanel.add(dailyResponseButton);

    final JButton startResponseButton = new JButton("Start Time");

    startResponseButton.setEnabled(false);
    buttonPanel.add(startResponseButton);

    final JPanel exportTab = new JPanel();
    tabbedPane.addTab("Export Models", null, exportTab, null);
    tabbedPane.setEnabledAt(3, false);
    exportTab.setLayout(null);

    // PANELS //

    // DATA IMPORT TAB //

    final JPanel dataFilePanel = new JPanel();
    dataFilePanel
            .setBorder(new TitledBorder(null, "Data File", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    dataFilePanel.setBounds(6, 6, 622, 284);
    importTab.add(dataFilePanel);
    dataFilePanel.setLayout(null);

    final JPanel disaggregationPanel = new JPanel();
    disaggregationPanel.setLayout(null);
    disaggregationPanel.setBorder(
            new TitledBorder(null, "Disaggregation", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    disaggregationPanel.setBounds(629, 6, 567, 284);
    importTab.add(disaggregationPanel);

    final JPanel dataReviewPanel = new JPanel();
    dataReviewPanel.setBorder(
            new TitledBorder(null, "Data Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    dataReviewPanel.setBounds(6, 293, 622, 407);
    importTab.add(dataReviewPanel);
    dataReviewPanel.setLayout(new BorderLayout(0, 0));

    final JPanel consumptionModelPanel = new JPanel();
    consumptionModelPanel.setBounds(629, 293, 567, 407);
    importTab.add(consumptionModelPanel);
    consumptionModelPanel.setBorder(
            new TitledBorder(null, "Consumption Model", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    consumptionModelPanel.setLayout(new BorderLayout(0, 0));

    // TRAINING ACTIVITY TAB //

    final JPanel trainingParametersPanel = new JPanel();
    trainingParametersPanel.setLayout(null);
    trainingParametersPanel.setBorder(
            new TitledBorder(null, "Training Parameters", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    trainingParametersPanel.setBounds(6, 6, 621, 256);
    trainingTab.add(trainingParametersPanel);

    final JPanel applianceSelectionPanel = new JPanel();
    applianceSelectionPanel.setLayout(null);
    applianceSelectionPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Appliance/Activity Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    applianceSelectionPanel.setBounds(630, 6, 557, 256);
    trainingTab.add(applianceSelectionPanel);

    final JPanel expectedPowerPanel = new JPanel();
    expectedPowerPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Expected Power Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    expectedPowerPanel.setBounds(630, 261, 557, 447);
    trainingTab.add(expectedPowerPanel);
    expectedPowerPanel.setLayout(new BorderLayout(0, 0));
    contentPane.setLayout(gl_contentPane);

    // EXPORT TAB //

    JPanel modelExportPanel = new JPanel();
    modelExportPanel.setLayout(null);
    modelExportPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Model Export Selection", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    modelExportPanel.setBounds(10, 11, 596, 267);
    exportTab.add(modelExportPanel);

    final JPanel exportPreviewPanel = new JPanel();
    exportPreviewPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Export Model Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    exportPreviewPanel.setBounds(10, 310, 1187, 387);
    exportTab.add(exportPreviewPanel);
    exportPreviewPanel.setLayout(new BorderLayout(0, 0));

    JPanel exportButtonsPanel = new JPanel();
    exportButtonsPanel.setBounds(322, 279, 536, 33);
    exportTab.add(exportButtonsPanel);

    JPanel connectionPanel = new JPanel();
    connectionPanel.setLayout(null);
    connectionPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Connection Properties", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    connectionPanel.setBounds(606, 11, 581, 267);
    exportTab.add(connectionPanel);

    // COMPONENTS //

    // IMPORT TAB //

    // DATA IMPORT //

    final JLabel lblSource = new JLabel("Data Source:");
    lblSource.setBounds(23, 47, 71, 16);
    dataFilePanel.add(lblSource);

    final JTextField pathField = new JTextField();
    pathField.setEditable(false);
    pathField.setBounds(99, 41, 405, 28);
    dataFilePanel.add(pathField);
    pathField.setColumns(10);

    final JButton dataBrowseButton = new JButton("Browse");
    dataBrowseButton.setBounds(516, 41, 87, 28);
    dataFilePanel.add(dataBrowseButton);

    final JButton resetButton = new JButton("Reset");
    resetButton.setBounds(516, 81, 87, 28);
    dataFilePanel.add(resetButton);

    final JLabel lblDataMeasurementsFrom = new JLabel("Data Measurements From:");
    lblDataMeasurementsFrom.setBounds(23, 90, 154, 16);
    dataFilePanel.add(lblDataMeasurementsFrom);

    final JRadioButton singleApplianceRadioButton = new JRadioButton("Single Appliance");
    singleApplianceRadioButton.setEnabled(false);
    dataMeasurementsButtonGroup.add(singleApplianceRadioButton);
    singleApplianceRadioButton.setBounds(242, 110, 115, 18);
    dataFilePanel.add(singleApplianceRadioButton);

    final JRadioButton installationRadioButton = new JRadioButton("Installation");
    installationRadioButton.setSelected(true);
    installationRadioButton.setEnabled(false);
    dataMeasurementsButtonGroup.add(installationRadioButton);
    installationRadioButton.setBounds(242, 89, 115, 18);
    dataFilePanel.add(installationRadioButton);

    final JLabel labelConsumptionModel = new JLabel("Consumption Model:");
    labelConsumptionModel.setBounds(23, 179, 120, 16);
    dataFilePanel.add(labelConsumptionModel);

    final JButton importDataButton = new JButton("Import Data");
    importDataButton.setEnabled(false);
    importDataButton.setBounds(23, 237, 126, 28);
    dataFilePanel.add(importDataButton);

    final JButton disaggregateButton = new JButton("Disaggregate");
    disaggregateButton.setEnabled(false);
    disaggregateButton.setBounds(216, 237, 147, 28);
    dataFilePanel.add(disaggregateButton);

    final JButton createEventsButton = new JButton("Create Events Dataset");
    createEventsButton.setEnabled(false);
    createEventsButton.setBounds(422, 237, 181, 28);
    dataFilePanel.add(createEventsButton);

    final JTextField consumptionPathField = new JTextField();
    consumptionPathField.setEnabled(false);
    consumptionPathField.setEditable(false);
    consumptionPathField.setColumns(10);
    consumptionPathField.setBounds(99, 197, 405, 28);
    dataFilePanel.add(consumptionPathField);

    final JButton consumptionBrowseButton = new JButton("Browse");
    consumptionBrowseButton.setEnabled(false);
    consumptionBrowseButton.setBounds(516, 197, 87, 28);
    dataFilePanel.add(consumptionBrowseButton);

    JLabel lblTypeOfMeasurements = new JLabel("Type of Measurements");
    lblTypeOfMeasurements.setBounds(23, 141, 154, 16);
    dataFilePanel.add(lblTypeOfMeasurements);

    final JRadioButton activePowerRadioButton = new JRadioButton("Active Power (P)");
    powerButtonGroup.add(activePowerRadioButton);
    activePowerRadioButton.setEnabled(false);
    activePowerRadioButton.setBounds(242, 140, 115, 18);
    dataFilePanel.add(activePowerRadioButton);

    final JRadioButton activeAndReactivePowerRadioButton = new JRadioButton("Active and Reactive Power (P, Q)");
    activeAndReactivePowerRadioButton.setSelected(true);
    powerButtonGroup.add(activeAndReactivePowerRadioButton);
    activeAndReactivePowerRadioButton.setEnabled(false);
    activeAndReactivePowerRadioButton.setBounds(242, 161, 262, 18);
    dataFilePanel.add(activeAndReactivePowerRadioButton);

    // //////////////////
    // DISAGGREGATION //
    // /////////////////

    final JLabel lblAppliancesDetected = new JLabel("Detected Appliances ");
    lblAppliancesDetected.setBounds(18, 33, 130, 16);
    disaggregationPanel.add(lblAppliancesDetected);

    JScrollPane scrollPane_2 = new JScrollPane();
    scrollPane_2.setBounds(145, 31, 396, 231);
    disaggregationPanel.add(scrollPane_2);

    final JList<String> detectedApplianceList = new JList<String>();
    scrollPane_2.setViewportView(detectedApplianceList);
    detectedApplianceList.setEnabled(false);
    detectedApplianceList.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));

    // ////////////////
    // TRAINING TAB //
    // ////////////////

    // TRAINING PARAMETERS //

    final JLabel label_1 = new JLabel("Times Per Day");
    label_1.setBounds(19, 40, 103, 16);
    trainingParametersPanel.add(label_1);

    final JRadioButton timesHistogramRadioButton = new JRadioButton("Histogram");
    timesHistogramRadioButton.setSelected(true);
    timesDailyButtonGroup.add(timesHistogramRadioButton);
    timesHistogramRadioButton.setBounds(160, 38, 87, 18);
    trainingParametersPanel.add(timesHistogramRadioButton);

    final JRadioButton timesNormalRadioButton = new JRadioButton("Normal Distribution");
    timesNormalRadioButton.setEnabled(false);
    timesDailyButtonGroup.add(timesNormalRadioButton);
    timesNormalRadioButton.setBounds(304, 40, 137, 18);
    trainingParametersPanel.add(timesNormalRadioButton);

    JRadioButton timesGaussianRadioButton = new JRadioButton("Gaussian Mixture");
    timesGaussianRadioButton.setEnabled(false);
    timesDailyButtonGroup.add(timesGaussianRadioButton);
    timesGaussianRadioButton.setBounds(478, 38, 137, 18);
    trainingParametersPanel.add(timesGaussianRadioButton);

    final JLabel label_2 = new JLabel("Start Time");
    label_2.setBounds(19, 133, 103, 16);
    trainingParametersPanel.add(label_2);

    final JRadioButton startHistogramRadioButton = new JRadioButton("Histogram");
    startHistogramRadioButton.setSelected(true);
    startTimeButtonGroup.add(startHistogramRadioButton);
    startHistogramRadioButton.setBounds(160, 131, 87, 18);
    trainingParametersPanel.add(startHistogramRadioButton);

    final JRadioButton startNormalRadioButton = new JRadioButton("Normal Distribution");
    // startNormalRadioButton.setEnabled(false);
    startTimeButtonGroup.add(startNormalRadioButton);
    startNormalRadioButton.setBounds(304, 133, 137, 18);
    trainingParametersPanel.add(startNormalRadioButton);

    final JRadioButton startGaussianRadioButton = new JRadioButton("Gaussian Mixture");
    startGaussianRadioButton.setSelected(true);
    startTimeButtonGroup.add(startGaussianRadioButton);
    startGaussianRadioButton.setBounds(478, 131, 137, 18);
    trainingParametersPanel.add(startGaussianRadioButton);

    final JLabel label_3 = new JLabel("Duration");
    label_3.setBounds(19, 86, 103, 16);
    trainingParametersPanel.add(label_3);

    final JRadioButton durationHistogramRadioButton = new JRadioButton("Histogram");
    durationHistogramRadioButton.setSelected(true);
    durationButtonGroup.add(durationHistogramRadioButton);
    durationHistogramRadioButton.setBounds(160, 84, 87, 18);
    trainingParametersPanel.add(durationHistogramRadioButton);

    final JRadioButton durationNormalRadioButton = new JRadioButton("Normal Distribution");
    durationNormalRadioButton.setSelected(true);
    durationButtonGroup.add(durationNormalRadioButton);
    durationNormalRadioButton.setBounds(304, 86, 137, 18);
    trainingParametersPanel.add(durationNormalRadioButton);

    final JRadioButton durationGaussianRadioButton = new JRadioButton("Gaussian Mixture");
    durationButtonGroup.add(durationGaussianRadioButton);
    durationGaussianRadioButton.setBounds(478, 84, 137, 18);
    trainingParametersPanel.add(durationGaussianRadioButton);

    final JButton trainingButton = new JButton("Train");
    trainingButton.setBounds(125, 194, 115, 28);
    trainingParametersPanel.add(trainingButton);

    final JButton trainAllButton = new JButton("Train All");
    trainAllButton.setBounds(366, 194, 115, 28);
    trainingParametersPanel.add(trainAllButton);

    // APPLIANCE SELECTION //

    final JLabel label_4 = new JLabel("Selected Appliance");
    label_4.setBounds(18, 33, 130, 16);
    applianceSelectionPanel.add(label_4);

    JScrollPane scrollPane_1 = new JScrollPane();
    scrollPane_1.setBounds(128, 29, 419, 216);
    applianceSelectionPanel.add(scrollPane_1);

    final JList<String> selectedApplianceList = new JList<String>();
    scrollPane_1.setViewportView(selectedApplianceList);
    selectedApplianceList.setEnabled(false);
    selectedApplianceList.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));

    // DISTRIBUTION SELECTION //

    JPanel distributionSelectionPanel = new JPanel();
    distributionSelectionPanel.setBounds(80, 261, 482, 33);
    trainingTab.add(distributionSelectionPanel);

    final JButton dailyTimesButton = new JButton("Daily Times");
    dailyTimesButton.setEnabled(false);
    distributionSelectionPanel.add(dailyTimesButton);

    final JButton durationButton = new JButton("Duration");
    durationButton.setEnabled(false);
    distributionSelectionPanel.add(durationButton);

    final JButton startTimeButton = new JButton("Start Time");
    startTimeButton.setEnabled(false);
    distributionSelectionPanel.add(startTimeButton);

    final JButton startTimeBinnedButton = new JButton("Start Time Binned");
    startTimeBinnedButton.setEnabled(false);
    distributionSelectionPanel.add(startTimeBinnedButton);

    final JPanel distributionPreviewPanel = new JPanel();
    distributionPreviewPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"),
            "Distribution Preview", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    distributionPreviewPanel.setBounds(6, 299, 621, 409);
    trainingTab.add(distributionPreviewPanel);
    distributionPreviewPanel.setLayout(new BorderLayout(0, 0));

    // //////////////////
    // EXPORT TAB ///////
    // /////////////////

    JLabel exportModelLabel = new JLabel("Select Model");
    exportModelLabel.setBounds(10, 34, 151, 16);
    modelExportPanel.add(exportModelLabel);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(83, 32, 503, 212);
    modelExportPanel.add(scrollPane);

    final JList<String> exportModelList = new JList<String>();
    scrollPane.setViewportView(exportModelList);
    exportModelList.setEnabled(false);
    exportModelList.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));

    // EXPORT TAB //

    final JButton exportDailyButton = new JButton("Daily Times");
    exportDailyButton.setEnabled(false);
    exportButtonsPanel.add(exportDailyButton);

    final JButton exportDurationButton = new JButton("Duration");
    exportDurationButton.setEnabled(false);
    exportButtonsPanel.add(exportDurationButton);

    final JButton exportStartButton = new JButton("Start Time");
    exportStartButton.setEnabled(false);
    exportButtonsPanel.add(exportStartButton);

    final JButton exportStartBinnedButton = new JButton("Start Time Binned");
    exportStartBinnedButton.setEnabled(false);
    exportButtonsPanel.add(exportStartBinnedButton);

    final JButton exportExpectedPowerButton = new JButton("Expected Power");
    exportExpectedPowerButton.setEnabled(false);
    exportButtonsPanel.add(exportExpectedPowerButton);

    JLabel usernameLabel = new JLabel("Username:");
    usernameLabel.setBounds(46, 27, 71, 16);
    connectionPanel.add(usernameLabel);

    final JTextField usernameTextField;
    usernameTextField = new JTextField();
    usernameTextField.setText("user");
    usernameTextField.setColumns(10);
    usernameTextField.setBounds(122, 21, 405, 28);
    connectionPanel.add(usernameTextField);

    final JButton exportButton = new JButton("Export Entity");
    exportButton.setEnabled(false);
    exportButton.setBounds(46, 178, 147, 28);
    connectionPanel.add(exportButton);

    final JButton exportAllBaseButton = new JButton("Export All Base");
    exportAllBaseButton.setEnabled(false);
    exportAllBaseButton.setBounds(203, 178, 177, 28);
    connectionPanel.add(exportAllBaseButton);

    final JButton exportAllResponseButton = new JButton("Export All Response");
    exportAllResponseButton.setEnabled(false);
    exportAllResponseButton.setBounds(390, 178, 181, 28);
    connectionPanel.add(exportAllResponseButton);

    JLabel passwordLabel = new JLabel("Password:");
    passwordLabel.setBounds(46, 62, 71, 16);
    connectionPanel.add(passwordLabel);

    JLabel UrlLabel = new JLabel("URL:");
    UrlLabel.setBounds(46, 105, 71, 16);
    connectionPanel.add(UrlLabel);

    final JTextField urlTextField;
    urlTextField = new JTextField();
    urlTextField.setText("https://160.40.50.233:8443/cassandra/api");
    urlTextField.setColumns(10);
    urlTextField.setBounds(122, 99, 405, 28);
    connectionPanel.add(urlTextField);

    final JButton connectButton = new JButton("Connect");
    connectButton.setEnabled(false);
    connectButton.setBounds(217, 138, 147, 28);
    connectionPanel.add(connectButton);

    final JPasswordField passwordField;
    passwordField = new JPasswordField();
    passwordField.setBounds(122, 60, 405, 28);
    connectionPanel.add(passwordField);

    final JTextField householdNameTextField;
    householdNameTextField = new JTextField();
    householdNameTextField.setEnabled(false);
    householdNameTextField.setBounds(166, 225, 405, 31);
    connectionPanel.add(householdNameTextField);
    householdNameTextField.setColumns(10);

    final JLabel householdNameLabel = new JLabel("Export Household Name:");
    householdNameLabel.setBounds(24, 233, 147, 14);
    connectionPanel.add(householdNameLabel);

    JButton btnOpenPlatform = new JButton("Open Platform");
    btnOpenPlatform.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            try {
                Desktop.getDesktop()
                        .browse(new URL("https://cassandra.iti.gr:8443/cassandra/app.html").toURI());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    btnOpenPlatform.setBounds(401, 138, 147, 28);
    connectionPanel.add(btnOpenPlatform);

    // //////////////////
    // ACTIONS ///////
    // /////////////////

    // IMPORT TAB //

    // DATA IMPORT ////

    dataBrowseButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the browse button to
         * input the data file on the Data File panel of the Import Data tab.
         * 
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            // Opens the browse panel to find the data set file
            JFileChooser fc = new JFileChooser("./");

            // Adds a filter to the type of files acceptable for selection
            fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
            fc.setFileFilter(new MyFilter2());

            int returnVal = fc.showOpenDialog(contentPane);

            // After choosing the file some of the options in the Data File panel
            // are unlocked
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();

                pathField.setText(file.getAbsolutePath());
                importDataButton.setEnabled(true);
                activePowerRadioButton.setEnabled(true);
                activeAndReactivePowerRadioButton.setEnabled(true);
                installationRadioButton.setEnabled(true);
                singleApplianceRadioButton.setEnabled(true);
            }

        }
    });

    consumptionBrowseButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the browse button to
         * input the consumption model file on the Data File panel of the Import
         * Data tab.
         * 
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            // Opens the browse panel to find the consumption model file
            JFileChooser fc = new JFileChooser("./");

            // Adds a filter to the type of files acceptable for selection
            fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
            fc.setFileFilter(new MyFilter());

            int returnVal = fc.showOpenDialog(contentPane);

            // After choosing the file some of the options in the Data File panel
            // are unlocked
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = fc.getSelectedFile();

                consumptionPathField.setText(file.getAbsolutePath());
                createEventsButton.setEnabled(true);
            }

        }
    });

    resetButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the reset button
         * on the Data File panel of the Import Data tab. All the imported and
         * created entities are removed and the Training Module goes back to its
         * initial state.
         * 
         */
        @Override
        public void actionPerformed(ActionEvent e) {

            // Cleaning the Import Data tab components
            pathField.setText("");
            consumptionPathField.setText("");
            importDataButton.setEnabled(false);
            disaggregateButton.setEnabled(false);
            createEventsButton.setEnabled(false);
            installation = new Installation();
            dataBrowseButton.setEnabled(true);
            consumptionBrowseButton.setEnabled(false);
            installationRadioButton.setEnabled(false);
            installationRadioButton.setSelected(true);
            singleApplianceRadioButton.setEnabled(false);
            activePowerRadioButton.setEnabled(false);
            activeAndReactivePowerRadioButton.setEnabled(false);
            activeAndReactivePowerRadioButton.setSelected(true);
            dataReviewPanel.removeAll();
            dataReviewPanel.updateUI();
            consumptionModelPanel.removeAll();
            consumptionModelPanel.updateUI();
            detectedApplianceList.setSelectedIndex(-1);
            detectedAppliances.clear();
            detectedApplianceList.setListData(new String[0]);
            detectedApplianceList.repaint();

            // Cleaning the Training Activity Models tab components
            distributionPreviewPanel.removeAll();
            distributionPreviewPanel.updateUI();
            expectedPowerPanel.removeAll();
            expectedPowerPanel.updateUI();
            selectedApplianceList.setSelectedIndex(-1);
            selectedAppliances.clear();
            selectedApplianceList.setListData(new String[0]);
            selectedApplianceList.repaint();
            timesHistogramRadioButton.setSelected(true);
            durationNormalRadioButton.setSelected(true);
            startGaussianRadioButton.setSelected(true);

            // Cleaning the Create Response Models tab components
            sensitivitySlider.setValue(50);
            awarenessSlider.setValue(50);
            normalCaseRadioButton.setSelected(true);
            previewResponseButton.setEnabled(false);
            createResponseButton.setEnabled(false);
            createResponseAllButton.setEnabled(false);
            pricingPreviewPanel.removeAll();
            pricingPreviewPanel.updateUI();
            responsePanel.removeAll();
            responsePanel.updateUI();
            activitySelectList.setSelectedIndex(-1);
            activityModels.clear();
            activitySelectList.setListData(new String[0]);
            activitySelectList.repaint();
            basicPricingSchemePane.setText("00:00-23:59-0.05");
            newPricingSchemePane.setText("");
            commitButton.setEnabled(false);
            dailyResponseButton.setEnabled(false);
            startResponseButton.setEnabled(false);

            // Cleaning the Export Models tab components
            exportModelList.setSelectedIndex(-1);
            exportModels.clear();
            exportModelList.setListData(new String[0]);
            exportModelList.repaint();
            exportPreviewPanel.removeAll();
            exportPreviewPanel.updateUI();
            exportDailyButton.setEnabled(false);
            exportDurationButton.setEnabled(false);
            exportStartButton.setEnabled(false);
            exportStartBinnedButton.setEnabled(false);
            exportExpectedPowerButton.setEnabled(false);
            exportButton.setEnabled(false);
            exportAllBaseButton.setEnabled(false);
            exportAllResponseButton.setEnabled(false);
            householdNameTextField.setEnabled(false);

            // Disabling the necessary tabs
            tabbedPane.setEnabledAt(1, false);
            tabbedPane.setEnabledAt(2, false);
            tabbedPane.setEnabledAt(3, false);

            // Clearing the arrayList in need
            tempAppliances.clear();
            tempActivities.clear();

            // Removing temporary files
            Utils.cleanFiles();
            trained = false;

        }
    });

    singleApplianceRadioButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Single Appliance
         * radio button on the Data File panel of the Import Data tab.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            consumptionPathField.setEnabled(false);
            consumptionBrowseButton.setEnabled(false);
            consumptionPathField.setText("");
        }
    });

    installationRadioButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Installation
         * radio button on the Data File panel of the Import Data tab.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            consumptionPathField.setEnabled(false);
            consumptionBrowseButton.setEnabled(false);
            consumptionPathField.setText("");
        }
    });

    importDataButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Import Data
         * button on the Data File panel of the Import Data tab.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                // Change the state of some components
                installationRadioButton.setEnabled(false);
                singleApplianceRadioButton.setEnabled(false);
                importDataButton.setEnabled(false);
                dataBrowseButton.setEnabled(false);
                activePowerRadioButton.setEnabled(false);
                activeAndReactivePowerRadioButton.setEnabled(false);

                // Check if both active and reactive activeOnly data set are available
                boolean power = activePowerRadioButton.isSelected();
                int parse = -1;

                // Parsing the measurements file
                try {
                    parse = Utils.parseMeasurementsFile(pathField.getText(), power);
                } catch (IOException e2) {
                    e2.printStackTrace();
                }

                // If everything is OK
                if (parse == -1) {
                    try {
                        // Creating new installation
                        installation = new Installation(pathField.getText(), power);
                    } catch (IOException e2) {
                        e2.printStackTrace();
                    }

                    // Show the measurements in the preview chart
                    ChartPanel chartPanel = null;
                    try {
                        chartPanel = installation.measurementsChart();
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }

                    dataReviewPanel.add(chartPanel, BorderLayout.CENTER);
                    dataReviewPanel.validate();

                    disaggregateButton.setEnabled(false);
                    createEventsButton.setEnabled(false);

                    // Enable the appropriate buttons given source of measurements
                    if (installationRadioButton.isSelected()) {
                        disaggregateButton.setEnabled(true);
                    } else if (singleApplianceRadioButton.isSelected()) {
                        consumptionPathField.setEnabled(true);
                        consumptionBrowseButton.setEnabled(true);

                    }

                    // Add installation to the export models list
                    exportModels.addElement(installation.toString());
                    exportModels.addElement(installation.getPerson().getName());
                    householdNameTextField.setText(installation.getName());

                    // Enable Export Models tab
                    exportModelList.setEnabled(true);
                    exportModelList.setModel(exportModels);
                    tabbedPane.setEnabledAt(3, true);

                }
                // In case of an error during the measurement parsing show the line of
                // error and reset settings.
                else {
                    JFrame error = new JFrame();

                    JOptionPane.showMessageDialog(error,
                            "Parsing measurements file failed. The problem seems to be in line " + parse
                                    + ".Check the selected buttons and the file provided and try again.",
                            "Inane error", JOptionPane.ERROR_MESSAGE);
                    resetButton.doClick();
                }
            } finally {
                root.setCursor(Cursor.getDefaultCursor());
            }
        }
    });

    disaggregateButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Disaggregate
         * button on the Data File panel of the Import Data tab in order to
         * automatically analyse the data set and extract the appliances and
         * activities within.
         */
        @Override
        public void actionPerformed(ActionEvent e) {

            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                // Get auxiliary files containing appliances and activities which are
                // the output of the disaggregation process.
                String filename = pathField.getText();

                File file = new File(filename);

                String folder = file.getParent() + "/";

                String fileNameWithExtension = file.getName();

                String fileName = file.getName().substring(0, file.getName().length() - 4);

                filename = pathField.getText().substring(0, pathField.getText().length() - 4);
                File appliancesFile = new File(Constants.resultFolder + fileName + "ApplianceList.csv");
                File activitiesFile = new File(Constants.resultFolder + fileName + "ActivityList.csv");

                if ((Constants.USE_FILES == false) || (!appliancesFile.exists() && !activitiesFile.exists())) {
                    try {
                        System.out.println("IN!!!");

                        Disaggregate dis = new Disaggregate(folder, fileNameWithExtension);

                        appliancesFile = new File(Constants.resultFolder + fileName + "ApplianceList.csv");
                        activitiesFile = new File(Constants.resultFolder + fileName + "ActivityList.csv");
                    } catch (Exception e2) {
                        System.out.println("Missing File");
                        e2.printStackTrace();
                    }
                }

                // If these exist, disaggregation was successful and the procedure can
                // continue
                if (appliancesFile.exists() && activitiesFile.exists()) {

                    // Read appliance file and start appliance parsing
                    Scanner input = null;
                    try {
                        input = new Scanner(appliancesFile);
                    } catch (FileNotFoundException e1) {
                        e1.printStackTrace();
                    }
                    String nextLine;
                    String[] line;

                    while (input.hasNext()) {
                        nextLine = input.nextLine();
                        line = nextLine.split(",");

                        String name = line[1] + " " + line[0];
                        // String activity = line[1];
                        String activity = name;
                        String[] temp = line[0].split(" ");

                        String type = "";

                        if (temp.length == 1)
                            type = temp[0];
                        else {
                            for (int i = 0; i < temp.length - 1; i++)
                                type += temp[i] + " ";
                            type = type.trim();

                        }

                        boolean refFlag = activity.contains("Refrigeration");
                        boolean wmFlag = name.contains("Washing");

                        double p = 0, q = 0;
                        int distance = 0, duration = 0;

                        if (refFlag) {
                            p = Double.parseDouble(line[2]);
                            q = Double.parseDouble(line[3]);
                            duration = Integer.parseInt(line[4]);
                            distance = Integer.parseInt(line[5]);
                            // For each appliance found in the file, an temporary Appliance
                            // Entity is created.

                            tempAppliances.add(new ApplianceTemp(name, installation.getName(), type, activity,
                                    p, q, duration, distance));
                        } else if (wmFlag) {
                            double[] pValues = new double[line.length / 2 - 1];
                            double[] qValues = new double[line.length / 2 - 1];
                            // For each appliance found in the file, an temporary Appliance
                            // Entity is created.

                            for (int i = 0; i < pValues.length; i++) {
                                pValues[i] = Double.parseDouble(line[2 + 2 * i]);
                                qValues[i] = Double.parseDouble(line[3 + 2 * i]);
                            }

                            tempAppliances.add(new ApplianceTemp(name, installation.getName(), type, activity,
                                    pValues, qValues));
                        } else {
                            p = Double.parseDouble(line[2]);
                            q = Double.parseDouble(line[3]);
                            // For each appliance found in the file, an temporary Appliance
                            // Entity is created.

                            tempAppliances
                                    .add(new ApplianceTemp(name, installation.getName(), type, activity, p, q));
                        }
                    }

                    System.out.println("Appliances:" + tempAppliances.size());

                    input.close();

                    // Read activity file and start activity parsing

                    try {
                        input = new Scanner(activitiesFile);
                    } catch (FileNotFoundException e1) {
                        System.out.println("Problem with activity file.");
                        e1.printStackTrace();
                    }

                    while (input.hasNext()) {
                        nextLine = input.nextLine();
                        line = nextLine.split(",");

                        // System.out.println(Arrays.toString(line));
                        // String name = line[0];
                        // String activity = line[1];
                        String activity = line[1] + " " + line[0];
                        String type = line[1];
                        int start = Integer.parseInt(line[2]);
                        int end = Integer.parseInt(line[3]);

                        // Search for existing activity
                        int activityIndex = findActivity(activity);

                        // if not found, create a new one
                        if (activityIndex == -1) {
                            // System.out.println("In!");
                            ActivityTemp newActivity = new ActivityTemp(activity, type);
                            newActivity.addEvent(start, end);
                            tempActivities.add(newActivity);
                            // System.out.println(tempActivities.toString());

                        }
                        // else add data to the found activity
                        else
                            tempActivities.get(activityIndex).addEvent(start, end);
                    }

                    // This is hard copied for now
                    ArrayList<ActivityTemp> activities = findAllActivity("Refrigeration");
                    for (ActivityTemp activityTemp : activities) {
                        tempActivities.remove(activityTemp);
                        System.out.println("Refrigeration Removed");
                    }

                    int index = findActivity("Standby");
                    if (index != -1) {
                        tempActivities.remove(index);
                        System.out.println("Standby Consumption Removed");
                    }
                    // TODO Add these lines in case we want to remove activities with
                    // small sampling number

                    // System.out.println(tempActivities.size());
                    // for (int i = tempActivities.size() - 1; i >= 0; i--)
                    // if (tempActivities.get(i).getEvents().size() < threshold)
                    // tempActivities.remove(i);

                    // Create an event file for each activity, in order to be able to
                    // use
                    // it for training the behaviour models if asked from the user
                    for (int i = 0; i < tempActivities.size(); i++) {
                        // tempActivities.get(i).status();
                        try {
                            tempActivities.get(i).createEventFile();
                        } catch (IOException e1) {
                            System.out.println("Problem with creating events file.");
                            e1.printStackTrace();
                        }
                    }

                    input.close();

                    // Add each found appliance (after converting temporary appliance to
                    // normal appliance) in the installation Entity, to the detected
                    // appliance and export models list
                    for (ApplianceTemp temp : tempAppliances) {

                        Appliance tempAppliance = temp.toAppliance();

                        installation.addAppliance(tempAppliance);
                        detectedAppliances.addElement(tempAppliance.toString());
                        exportModels.addElement(tempAppliance.toString());

                    }

                    // Add appliances corresponding to each activity, remove activities
                    // without appliances and add activities to the selected activities
                    // list.
                    for (int i = tempActivities.size() - 1; i >= 0; i--) {

                        tempActivities.get(i).setAppliances(findAppliances(tempActivities.get(i)));
                        if (tempActivities.get(i).getAppliances().size() == 0) {
                            tempActivities.remove(i);
                        } else
                            selectedAppliances.addElement(tempActivities.get(i).toString());

                    }

                }
                // In case of an error.
                else {

                    int temp = 8 + ((int) (Math.random() * 2));

                    for (int i = 0; i < temp; i++) {

                        String name = "Appliance " + i;
                        String powerModel = "";
                        String reactiveModel = "";
                        int tempIndex = i % 5;
                        switch (tempIndex) {
                        case 0:
                            powerModel = "{\"n\":1,\"params\":[{\"n\":1,\"values\":[{\"p\":1900,\"d\":1,\"s\":0}]},{\"n\":0,\"values\":[{\"p\":300,\"d\":1,\"s\":0}]}]}";
                            reactiveModel = "{\"n\":1,\"params\":[{\"n\":1,\"values\":[{\"q\":-40,\"d\":1,\"s\":0}]},{\"n\":0,\"values\":[{\"q\":-10,\"d\":1,\"s\":0}]}]}";
                            break;
                        case 1:
                            powerModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"p\" : 140.0, \"d\" : 20, \"s\": 0.0}]}]}";
                            reactiveModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"q\" : 120.0, \"d\" : 20, \"s\": 0.0}]}]}";
                            break;
                        case 2:
                            powerModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"p\" : 95.0, \"d\" : 20, \"s\": 0.0}, {\"p\" :80.0, \"d\" : 18, \"s\": 0.0}, {\"p\" : 0.0, \"d\" : 73, \"s\": 0.0}]}]}]}";
                            reactiveModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"q\" : 0.0, \"d\" : 20, \"s\": 0.0}, {\"q\" : 0.0, \"d\" : 18, \"s\": 0.0}, {\"q\" : 0.0, \"d\" : 73, \"s\": 0.0}]}]}]}";
                            break;
                        case 3:
                            powerModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"p\" : 30.0, \"d\" : 20, \"s\": 0.0}]}]}";
                            reactiveModel = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"q\" : -5.0, \"d\" : 20, \"s\": 0.0}]}]}";
                            break;
                        case 4:
                            powerModel = "{\"n\":1,\"params\":[{\"n\":1,\"values\":[{\"p\":150,\"d\":25,\"s\":0},{\"p\":2000,\"d\":13,\"s\":0},{\"p\":100,\"d\":62,\"s\":0}]}]}";
                            reactiveModel = "{\"n\":1,\"params\":[{\"n\":1,\"values\":[{\"q\":400,\"d\":25,\"s\":0},{\"q\":200,\"d\":13,\"s\":0},{\"q\":300,\"d\":62,\"s\":0}]}]}";
                            break;
                        }

                        Appliance tempAppliance = new Appliance(name, installation.getName(), powerModel,
                                reactiveModel, "Demo/eventsAll" + tempIndex + ".csv");

                        installation.addAppliance(tempAppliance);
                        detectedAppliances.addElement(tempAppliance.toString());
                        selectedAppliances.addElement(tempAppliance.toString());
                        exportModels.addElement(tempAppliance.toString());
                    }
                }

                // Enable all appliance/activity lists
                detectedApplianceList.setEnabled(true);
                detectedApplianceList.setModel(detectedAppliances);
                detectedApplianceList.setSelectedIndex(0);

                tabbedPane.setEnabledAt(1, true);
                selectedApplianceList.setEnabled(true);
                selectedApplianceList.setModel(selectedAppliances);

                // exportModelList.setEnabled(true);
                // exportModelList.setModel(exportModels);
                // tabbedPane.setEnabledAt(3, true);

                // Disable unnecessary buttons.
                disaggregateButton.setEnabled(false);
                createEventsButton.setEnabled(false);
            } finally {
                root.setCursor(Cursor.getDefaultCursor());
            }
        }
    });

    createEventsButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Create Events
         * button on the Data File panel of the Import Data tab. This button is
         * used when there is a single appliance with an known consumption model
         * so that the events can be extracted automatically from the data set.
         * Used for presentation purposes only since is depricated by the
         * disaggregation function.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                // Parse the consumption model file
                File file = new File(consumptionPathField.getText());
                String temp = file.getName();
                temp = temp.replace(".", " ");
                String name = temp.split(" ")[0];

                Appliance appliance = null;
                try {

                    int rand = (int) (Math.random() * 5);

                    appliance = new Appliance(name, consumptionPathField.getText(),
                            consumptionPathField.getText(), "Demo/eventsAll" + rand + ".csv", installation,
                            activePowerRadioButton.isSelected());
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
                // Add appliance to the installation entity
                installation.addAppliance(appliance);

                // Enable all appliance/activity lists
                detectedAppliances.addElement(appliance.toString());
                selectedAppliances.addElement(appliance.toString());
                exportModels.addElement(appliance.toString());

                detectedApplianceList.setEnabled(true);
                detectedApplianceList.setModel(detectedAppliances);
                detectedApplianceList.setSelectedIndex(0);

                tabbedPane.setEnabledAt(1, true);
                selectedApplianceList.setEnabled(true);
                selectedApplianceList.setModel(selectedAppliances);

                // exportModelList.setEnabled(true);
                // exportModelList.setModel(exportModels);
                // tabbedPane.setEnabledAt(3, true);

                // Disable unnecessary buttons.
                disaggregateButton.setEnabled(false);
                createEventsButton.setEnabled(false);
            } finally {
                root.setCursor(Cursor.getDefaultCursor());
            }
        }
    });

    // APPLIANCE DETECTION //
    detectedApplianceList.addListSelectionListener(new ListSelectionListener() {
        /**
         * This function is called when the user selects an appliance from the
         * list of Detected Appliances on the Disaggregation panel of the Import
         * Data tab. Then the corresponding consumption model is presented in the
         * Consumption Model Preview panel.
         */
        @Override
        public void valueChanged(ListSelectionEvent e) {

            consumptionModelPanel.removeAll();
            consumptionModelPanel.updateUI();

            if (detectedAppliances.size() >= 1) {

                String selection = detectedApplianceList.getSelectedValue();

                Appliance current = installation.findAppliance(selection);

                ChartPanel chartPanel = current.consumptionGraph();

                consumptionModelPanel.add(chartPanel, BorderLayout.CENTER);
                consumptionModelPanel.validate();

            }
        }
    });

    // // TRAINING TAB //
    trainingTab.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentShown(ComponentEvent arg0) {
            selectedApplianceList.setSelectedIndex(0);
        }
    });

    trainingButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Train button on
         * the Training Parameters panel of the Train Activity Models tab. It
         * contains the procedure needed to create an activity model based on the
         * event set of the appliance or activity.
         */
        @Override
        public void actionPerformed(ActionEvent e) {

            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            responsePanel.removeAll();
            responsePanel.validate();
            pricingPreviewPanel.removeAll();
            pricingPreviewPanel.validate();
            previewResponseButton.setEnabled(false);
            createResponseButton.setEnabled(false);
            createResponseAllButton.setEnabled(false);
            dailyResponseButton.setEnabled(false);
            startResponseButton.setEnabled(false);

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                // Searching for existing activity or appliance.
                String selection = selectedApplianceList.getSelectedValue();
                ActivityTemp activity = null;

                if (tempActivities.size() > 0)
                    activity = tempActivities.get(findActivity(selection));

                Appliance current = installation.findAppliance(selection);

                String startTime, duration, dailyTimes;

                // Check for the selected distribution methods for training.
                if (timesHistogramRadioButton.isSelected())
                    dailyTimes = "Histogram";
                else if (timesNormalRadioButton.isSelected())
                    dailyTimes = "Normal";
                else
                    dailyTimes = "GMM";

                if (durationHistogramRadioButton.isSelected())
                    duration = "Histogram";
                else if (durationNormalRadioButton.isSelected())
                    duration = "Normal";
                else
                    duration = "GMM";

                if (startHistogramRadioButton.isSelected())
                    startTime = "Histogram";
                else if (startNormalRadioButton.isSelected())
                    startTime = "Normal";
                else
                    startTime = "GMM";

                String[] distributions = { dailyTimes, duration, startTime, "Histogram" };

                // If the selected object from the list is an appliance the training
                // procedure for the appliance begins.
                if (activity == null) {

                    try {
                        installation.getPerson().train(current, distributions);
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }
                }
                // If the selected object from the list is an activity the training
                // procedure for the activity begins.
                else {

                    try {
                        installation.getPerson().train(activity, distributions);
                    } catch (IOException e1) {
                        e1.printStackTrace();
                    }

                }

                // System.out.println("Training OK!");

                distributionPreviewPanel.removeAll();
                distributionPreviewPanel.updateUI();

                expectedPowerPanel.removeAll();
                expectedPowerPanel.updateUI();

                // Show the distribution created on the Distribution Preview Panel
                ActivityModel activityModel = installation.getPerson().findActivity(selection, true);

                if (activityModel == null)
                    activityModel = installation.getPerson().findActivity(current);

                ChartPanel chartPanel = activityModel.createDailyTimesDistributionChart();
                distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER);
                distributionPreviewPanel.validate();

                chartPanel = activityModel.createExpectedPowerChart();
                expectedPowerPanel.add(chartPanel, BorderLayout.CENTER);
                expectedPowerPanel.validate();

                // Add the Activity model to the list of trained Activity models of
                // the Create Response Models tab
                int size = activitySelectList.getModel().getSize();

                if (size > 0) {
                    activityModels = (DefaultListModel<String>) activitySelectList.getModel();
                    if (activityModels.contains(activityModel.getName()) == false)
                        activityModels.addElement(activityModel.getName());
                } else {
                    activityModels = new DefaultListModel<String>();
                    activityModels.addElement(activityModel.getName());
                    activitySelectList.setEnabled(true);
                }

                activitySelectList.setModel(activityModels);

                // Add the trained model to the export list also.
                size = exportModelList.getModel().getSize();
                if (size > 0) {
                    exportModels = (DefaultListModel<String>) exportModelList.getModel();
                    if (exportModels.contains(activityModel.getName()) == false)
                        exportModels.addElement(activityModel.getName());
                } else {
                    exportModels = new DefaultListModel<String>();
                    exportModels.addElement(activityModel.getName());
                    exportModelList.setEnabled(true);
                }

                // Enable some buttons necessary to show the results.
                dailyTimesButton.setEnabled(true);
                durationButton.setEnabled(true);
                startTimeButton.setEnabled(true);
                startTimeBinnedButton.setEnabled(true);

                exportModelList.setModel(exportModels);

                exportDailyButton.setEnabled(true);
                exportDurationButton.setEnabled(true);
                exportStartButton.setEnabled(true);
                exportStartBinnedButton.setEnabled(true);

                tabbedPane.setEnabledAt(2, true);
            }

            finally {
                root.setCursor(Cursor.getDefaultCursor());
                trained = true;
            }
        }
    });

    trainAllButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Train All button on
         * the Training Parameters panel of the Train Activity Models tab. It
         * is iterating the aforementioned training procedure to each of the
         * objects on the list.
         */
        @Override
        public void actionPerformed(ActionEvent e) {

            responsePanel.removeAll();
            responsePanel.validate();
            pricingPreviewPanel.removeAll();
            pricingPreviewPanel.validate();
            previewResponseButton.setEnabled(false);
            createResponseButton.setEnabled(false);
            createResponseAllButton.setEnabled(false);
            dailyResponseButton.setEnabled(false);
            startResponseButton.setEnabled(false);

            for (int i = 0; i < selectedApplianceList.getModel().getSize(); i++) {
                selectedApplianceList.setSelectedIndex(i);
                trainingButton.doClick();
            }
        }
    });

    dailyTimesButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Daily Times button on
         * the Distribution Preview panel of the Train Activity Models tab. It
         * shows the Daily Times Distribution for the selected object from the
         * list if available.
         */
        @Override
        public void actionPerformed(ActionEvent arg0) {

            distributionPreviewPanel.removeAll();
            distributionPreviewPanel.updateUI();

            String selection = selectedApplianceList.getSelectedValue();

            Appliance current = installation.findAppliance(selection);

            ActivityModel activityModel = installation.getPerson().findActivity(selection, true);

            if (activityModel == null)
                activityModel = installation.getPerson().findActivity(current);

            ChartPanel chartPanel = activityModel.createDailyTimesDistributionChart();
            distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER);
            distributionPreviewPanel.validate();

        }
    });

    startTimeBinnedButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Start Time Binned
         * button on the Distribution Preview panel of the Train Activity
         * Models tab. It shows the Start Time Binned Distribution for the
         * selected object from the list if available.
         */
        @Override
        public void actionPerformed(ActionEvent arg0) {

            distributionPreviewPanel.removeAll();
            distributionPreviewPanel.updateUI();

            String selection = selectedApplianceList.getSelectedValue();

            Appliance current = installation.findAppliance(selection);

            ActivityModel activityModel = installation.getPerson().findActivity(selection, true);

            if (activityModel == null)
                activityModel = installation.getPerson().findActivity(current);

            ChartPanel chartPanel = activityModel.createStartTimeBinnedDistributionChart();
            distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER);
            distributionPreviewPanel.validate();

        }
    });

    startTimeButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Start Time
         * button on the Distribution Preview panel of the Train Activity
         * Models tab. It shows the Start Time Distribution for the selected
         * object from the list if available.
         */
        @Override
        public void actionPerformed(ActionEvent arg0) {

            distributionPreviewPanel.removeAll();
            distributionPreviewPanel.updateUI();

            String selection = selectedApplianceList.getSelectedValue();

            Appliance current = installation.findAppliance(selection);

            ActivityModel activityModel = installation.getPerson().findActivity(selection, true);

            if (activityModel == null)
                activityModel = installation.getPerson().findActivity(current);

            ChartPanel chartPanel = activityModel.createStartTimeDistributionChart();
            distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER);
            distributionPreviewPanel.validate();

        }
    });

    durationButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Duration
         * button on the Distribution Preview panel of the Train Activity
         * Models tab. It shows the Duration Distribution for the selected
         * object from the list if available.
         */
        @Override
        public void actionPerformed(ActionEvent arg0) {

            distributionPreviewPanel.removeAll();
            distributionPreviewPanel.updateUI();

            String selection = selectedApplianceList.getSelectedValue();

            Appliance current = installation.findAppliance(selection);

            ActivityModel activityModel = installation.getPerson().findActivity(selection, true);

            if (activityModel == null)
                activityModel = installation.getPerson().findActivity(current);

            ChartPanel chartPanel = activityModel.createDurationDistributionChart();
            distributionPreviewPanel.add(chartPanel, BorderLayout.CENTER);
            distributionPreviewPanel.validate();

        }
    });

    selectedApplianceList.addListSelectionListener(new ListSelectionListener() {
        /**
         * This function is called when the user selects an appliance or activity
         * from the list of Selected Appliances on the Appliance / Activity
         * Selection panel of the Train Activity Models tab. Then an example
         * corresponding consumption model is presented in the Consumption Model
         * Preview panel.
         */
        @Override
        public void valueChanged(ListSelectionEvent arg0) {

            ChartPanel chartPanel = null, chartPanel2 = null, chartPanel3 = null;
            expectedPowerPanel.removeAll();
            expectedPowerPanel.updateUI();
            distributionPreviewPanel.removeAll();
            distributionPreviewPanel.updateUI();

            // If there are any appliances / activities on the list
            if (selectedAppliances.size() >= 1) {

                // Find the corresponding appliance / activity and show its
                // consumption model
                String selection = selectedApplianceList.getSelectedValue();

                Appliance currentAppliance = installation.findAppliance(selection);

                ActivityModel activityModel = installation.getPerson().findActivity(selection, true);

                // If there is also an Activity model trained, show the corresponding
                // distribution charts on the Distribution Preview panel

                if (currentAppliance != null)
                    activityModel = installation.getPerson().findActivity(currentAppliance);

                if (activityModel == null)
                    activityModel = installation.getPerson().findActivity(selection, true);

                if (activityModel != null) {

                    dailyTimesButton.setEnabled(true);
                    durationButton.setEnabled(true);
                    startTimeButton.setEnabled(true);
                    startTimeBinnedButton.setEnabled(true);

                    chartPanel2 = activityModel.createDailyTimesDistributionChart();
                    distributionPreviewPanel.add(chartPanel2, BorderLayout.CENTER);
                    distributionPreviewPanel.validate();
                    distributionPreviewPanel.updateUI();

                    chartPanel3 = activityModel.createExpectedPowerChart();
                    expectedPowerPanel.add(chartPanel3, BorderLayout.CENTER);
                    expectedPowerPanel.validate();
                    expectedPowerPanel.updateUI();

                } else {
                    dailyTimesButton.setEnabled(false);
                    durationButton.setEnabled(false);
                    startTimeButton.setEnabled(false);
                    startTimeBinnedButton.setEnabled(false);
                }
            }

        }
    });

    // RESPONSE TAB //

    createResponseTab.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentHidden(ComponentEvent arg0) {
            activitySelectList.setSelectedIndex(0);

        }

        @Override
        public void componentShown(ComponentEvent arg0) {
            activitySelectList.setSelectedIndex(0);
        }
    });

    previewResponseButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Preview Response
         * button on the Response Parameters panel of the Create Response Models
         * tab. This button is enabled after selecting activity model, response
         * type and pricing for testing and presents a preview of the response
         * model that may be extracted.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                responsePanel.removeAll();

                // Find the selected activity
                ActivityModel activity = installation.getPerson()
                        .findActivity(activitySelectList.getSelectedValue(), false);

                int response = -1;

                // Check for the selected response type
                if (optimalCaseRadioButton.isSelected())
                    response = 0;
                else if (normalCaseRadioButton.isSelected())
                    response = 1;
                else
                    response = 2;

                // Parse the pricing schemes
                double[] basicScheme = Utils.parseScheme(basicPricingSchemePane.getText());
                double[] newScheme = Utils.parseScheme(newPricingSchemePane.getText());

                float awareness = (float) (awarenessSlider.getValue()) / 100;
                float sensitivity = (float) (sensitivitySlider.getValue()) / 100;

                System.out.println("Awareness: " + awareness + " Sensitivity: " + sensitivity);

                // Create a preview chart of the response model
                ChartPanel chartPanel = installation.getPerson().previewResponse(activity, response,
                        basicScheme, newScheme, awareness, sensitivity);

                responsePanel.add(chartPanel, BorderLayout.CENTER);
                responsePanel.validate();

                createResponseButton.setEnabled(true);
                createResponseAllButton.setEnabled(true);
                dailyResponseButton.setEnabled(true);
                startResponseButton.setEnabled(true);
            } finally {
                root.setCursor(Cursor.getDefaultCursor());
            }
        }
    });

    createResponseButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Create Response Model
         * button on the Response Parameters panel of the Create Response Models
         * tab. This button is enabled after preview results of the selected
         * activity model, response type and pricing for testing and creates the
         * response model for the user.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                exportPreviewPanel.removeAll();
                exportPreviewPanel.updateUI();

                int responseType = -1;
                String responseString = "";
                // Check for the selected response type
                if (optimalCaseRadioButton.isSelected()) {
                    responseType = 0;
                    responseString = "Optimal";
                } else if (normalCaseRadioButton.isSelected()) {
                    responseType = 1;
                    responseString = "Normal";
                } else if (discreteCaseRadioButton.isSelected()) {
                    responseType = 2;
                    responseString = "Discrete";
                }

                // Parse the pricing schemes
                double[] basicScheme = Utils.parseScheme(basicPricingSchemePane.getText());
                double[] newScheme = Utils.parseScheme(newPricingSchemePane.getText());

                // Create the response model
                ActivityModel activity = installation.getPerson()
                        .findActivity(activitySelectList.getSelectedValue(), false);

                String response = "";

                float awareness = (float) (awarenessSlider.getValue()) / 100;
                float sensitivity = (float) (sensitivitySlider.getValue()) / 100;

                System.out.println("Awareness: " + awareness + " Sensitivity: " + sensitivity);

                try {
                    response = installation.getPerson().createResponse(activity, responseType, basicScheme,
                            newScheme, awareness, sensitivity);
                } catch (IOException exc) {

                    exc.printStackTrace();
                }

                // Add the response model extracted to the export model list.
                int size = exportModelList.getModel().getSize();
                // System.out.println(size);

                if (size > 0) {
                    exportModels = (DefaultListModel<String>) exportModelList.getModel();

                    String response2 = "", response3 = "";
                    if (responseString.equalsIgnoreCase("Optimal")) {
                        response2 = response.replace(responseString, "Normal");
                        response3 = response.replace(responseString, "Discrete");
                    } else if (responseString.equalsIgnoreCase("Normal")) {
                        response2 = response.replace(responseString, "Optimal");
                        response3 = response.replace(responseString, "Discrete");
                    } else {
                        response2 = response.replace(responseString, "Optimal");
                        response3 = response.replace(responseString, "Normal");
                    }

                    if (exportModels.contains(response2))
                        exportModels.removeElement(response2);
                    if (exportModels.contains(response3))
                        exportModels.removeElement(response3);

                    if (exportModels.contains(response) == false)
                        exportModels.addElement(response);
                } else {
                    exportModels = new DefaultListModel<String>();
                    exportModels.addElement(response);
                    exportModelList.setEnabled(true);
                }
                exportModelList.setModel(exportModels);

                if (manyFlag == false) {

                    JFrame success = new JFrame();

                    JOptionPane.showMessageDialog(success,
                            "The response model " + response + " was created successfully",
                            "Response Model Created", JOptionPane.INFORMATION_MESSAGE);
                }
            }

            finally {
                root.setCursor(Cursor.getDefaultCursor());
            }
        }
    });

    createResponseAllButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Create Response All
         * button on the Response Parameters panel of the Create Response Models
         * tab. This is achieved by iterating the procedure above for all the
         * available activity models in the list.
         */
        @Override
        public void actionPerformed(ActionEvent arg0) {
            manyFlag = true;

            for (int i = 0; i < activitySelectList.getModel().getSize(); i++) {
                activitySelectList.setSelectedIndex(i);
                createResponseButton.doClick();
            }

            JFrame success = new JFrame();

            JOptionPane.showMessageDialog(success, "The response models were created successfully",
                    "Response Models Created", JOptionPane.INFORMATION_MESSAGE);

            manyFlag = false;
        }
    });

    newPricingSchemePane.addKeyListener(new KeyAdapter() {
        @Override
        public void keyTyped(KeyEvent arg0) {
            commitButton.setEnabled(true);
        }
    });

    basicPricingSchemePane.addCaretListener(new CaretListener() {
        @Override
        public void caretUpdate(CaretEvent arg0) {
            commitButton.setEnabled(true);
        }
    });

    commitButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Commit button on the
         * Pricing Scheme panel of the Create Response Models tab. This button is
         * enabled after adding the two pricing schemes that are prerequisites for
         * the creation of a response model.
         */
        @Override
        public void actionPerformed(ActionEvent e) {

            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                boolean basicScheme = false;
                boolean newScheme = false;
                int parseBasic = 0;
                int parseNew = 0;

                pricingPreviewPanel.removeAll();

                // Check if both pricing schemes are entered
                if (basicPricingSchemePane.getText().equalsIgnoreCase("") == false)
                    basicScheme = true;

                if (newPricingSchemePane.getText().equalsIgnoreCase("") == false)
                    newScheme = true;

                // Parse the pricing schemes for errors
                if (basicScheme)
                    parseBasic = Utils.parsePricingScheme(basicPricingSchemePane.getText());

                if (newScheme)
                    parseNew = Utils.parsePricingScheme(newPricingSchemePane.getText());

                // If errors are found then present the line the error may be at
                if (parseBasic != -1) {
                    JFrame error = new JFrame();

                    JOptionPane.showMessageDialog(error,
                            "Basic Pricing Scheme is not defined correctly. Please check your input in line "
                                    + parseBasic + " and try again.",
                            "Inane error", JOptionPane.ERROR_MESSAGE);
                } else if (parseNew != -1) {
                    JFrame error = new JFrame();

                    JOptionPane.showMessageDialog(error,
                            "New Pricing Scheme is not defined correctly. Please check your input in line "
                                    + parseNew + " and try again.",
                            "Inane error", JOptionPane.ERROR_MESSAGE);
                }
                // If no errors are found make a preview chart of the two pricing
                // schemes
                else {
                    if (basicScheme && newScheme) {
                        ChartPanel chartPanel = ChartUtils.parsePricingScheme(basicPricingSchemePane.getText(),
                                newPricingSchemePane.getText());

                        pricingPreviewPanel.add(chartPanel, BorderLayout.CENTER);
                        pricingPreviewPanel.validate();

                        previewResponseButton.setEnabled(true);

                    } else {
                        JFrame error = new JFrame();

                        JOptionPane.showMessageDialog(error,
                                "You have not defined both pricing schemes.Please check your input and try again.",
                                "Inane error", JOptionPane.ERROR_MESSAGE);
                        previewResponseButton.setEnabled(false);
                    }
                }

                responsePanel.removeAll();
                responsePanel.validate();
                createResponseButton.setEnabled(false);
                createResponseAllButton.setEnabled(false);
                dailyResponseButton.setEnabled(false);
                startResponseButton.setEnabled(false);

            }

            finally {
                root.setCursor(Cursor.getDefaultCursor());
            }
        }
    });

    startResponseButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the start time button on
         * the Preview Response panel of the Create Response Models tab. This
         * button is enabled after the user has pressed the Response Preview
         * button in order to see the results of his pricing scheme on a activity
         * model. It shows the changes in the start time distribution.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                responsePanel.removeAll();

                // Find the selected activity
                ActivityModel activity = installation.getPerson()
                        .findActivity(activitySelectList.getSelectedValue(), false);

                int response = -1;

                // Check for the selected response type
                if (optimalCaseRadioButton.isSelected())
                    response = 0;
                else if (normalCaseRadioButton.isSelected())
                    response = 1;
                else
                    response = 2;

                // Parse the pricing schemes
                double[] basicScheme = Utils.parseScheme(basicPricingSchemePane.getText());
                double[] newScheme = Utils.parseScheme(newPricingSchemePane.getText());

                float awareness = (float) (awarenessSlider.getValue()) / 100;
                float sensitivity = (float) (sensitivitySlider.getValue()) / 100;

                System.out.println("Awareness: " + awareness + " Sensitivity: " + sensitivity);

                // Create a preview chart of the response model
                ChartPanel chartPanel = installation.getPerson().previewResponse(activity, response,
                        basicScheme, newScheme, awareness, sensitivity);

                responsePanel.add(chartPanel, BorderLayout.CENTER);
                responsePanel.validate();

                createResponseButton.setEnabled(true);
                createResponseAllButton.setEnabled(true);
                dailyResponseButton.setEnabled(true);
                startResponseButton.setEnabled(true);
            } finally {
                root.setCursor(Cursor.getDefaultCursor());
            }

        }
    });

    dailyResponseButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the start time button on
         * the Preview Response panel of the Create Response Models tab. This
         * button is enabled after the user has pressed the Response Preview
         * button in order to see the results of his pricing scheme on a activity
         * model. It shows the changes in the daily times distribution.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                responsePanel.removeAll();

                // Find the selected activity
                ActivityModel activity = installation.getPerson()
                        .findActivity(activitySelectList.getSelectedValue(), false);

                // Parse the pricing schemes
                double[] basicScheme = Utils.parseScheme(basicPricingSchemePane.getText());
                double[] newScheme = Utils.parseScheme(newPricingSchemePane.getText());

                float awareness = (float) (awarenessSlider.getValue()) / 100;
                float sensitivity = (float) (sensitivitySlider.getValue()) / 100;

                System.out.println("Awareness: " + awareness + " Sensitivity: " + sensitivity);

                // Create a preview chart of the response model
                ChartPanel chartPanel = installation.getPerson().previewDailyResponse(activity, basicScheme,
                        newScheme, awareness, sensitivity);

                responsePanel.add(chartPanel, BorderLayout.CENTER);
                responsePanel.validate();

                createResponseButton.setEnabled(true);
                createResponseAllButton.setEnabled(true);
                dailyResponseButton.setEnabled(true);
                startResponseButton.setEnabled(true);
            } finally {
                root.setCursor(Cursor.getDefaultCursor());
            }

        }
    });

    // EXPORT TAB //

    exportTab.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentShown(ComponentEvent arg0) {
            exportModelList.setSelectedIndex(0);
        }
    });

    exportModelList.addListSelectionListener(new ListSelectionListener() {
        /**
         * This function is called when the user selects an entity from the
         * list of models on the Model Export Selection panel of the Export Models
         * tab. Then the corresponding preview of the entity model is presented in
         * the
         * Export Model Preview panel.
         */
        @Override
        public void valueChanged(ListSelectionEvent arg0) {
            if (tabbedPane.getSelectedIndex() == 3) {
                exportPreviewPanel.removeAll();
                exportPreviewPanel.updateUI();

                // Checking if the list has any object
                if (exportModels.size() > 1) {
                    String selection = exportModelList.getSelectedValue();

                    // Check to see what type of entity is selected (Installation,
                    // Person, Appliance, Activity, Response)
                    Appliance appliance = installation.findAppliance(selection);

                    ActivityModel activity = installation.getPerson().findActivity(selection, false);

                    ResponseModel response = installation.getPerson().findResponse(selection);

                    // Create the appropriate chart for the selected entity and show it.
                    ChartPanel chartPanel = null;

                    if (selection.equalsIgnoreCase(installation.getName())) {

                        try {
                            chartPanel = installation.measurementsChart();

                            exportDailyButton.setEnabled(false);
                            exportDurationButton.setEnabled(false);
                            exportStartButton.setEnabled(false);
                            exportStartBinnedButton.setEnabled(false);
                            if (trained)
                                exportExpectedPowerButton.setEnabled(true);
                            else
                                exportExpectedPowerButton.setEnabled(false);
                        } catch (IOException e1) {
                            e1.printStackTrace();
                        }

                    } else if (selection.equalsIgnoreCase(installation.getPerson().getName())) {

                        chartPanel = installation.getPerson().statisticGraphs();

                        exportDailyButton.setEnabled(false);
                        exportDurationButton.setEnabled(false);
                        exportStartButton.setEnabled(false);
                        exportStartBinnedButton.setEnabled(false);
                        exportExpectedPowerButton.setEnabled(false);

                    } else if (appliance != null) {

                        chartPanel = appliance.consumptionGraph();

                        exportDailyButton.setEnabled(false);
                        exportDurationButton.setEnabled(false);
                        exportStartButton.setEnabled(false);
                        exportStartBinnedButton.setEnabled(false);
                        exportExpectedPowerButton.setEnabled(false);

                    } else if (activity != null) {

                        chartPanel = activity.createDailyTimesDistributionChart();
                        activity.status();
                        exportDailyButton.setEnabled(true);
                        exportDurationButton.setEnabled(true);
                        exportStartButton.setEnabled(true);
                        exportStartBinnedButton.setEnabled(true);
                        exportExpectedPowerButton.setEnabled(true);
                    } else if (response != null) {

                        chartPanel = response.createDailyTimesDistributionChart();

                        exportDailyButton.setEnabled(true);
                        exportDurationButton.setEnabled(true);
                        exportStartButton.setEnabled(true);
                        exportStartBinnedButton.setEnabled(true);
                        exportExpectedPowerButton.setEnabled(true);
                    }

                    exportPreviewPanel.add(chartPanel, BorderLayout.CENTER);
                    exportPreviewPanel.validate();
                }
            }
        }
    });

    exportDailyButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Daily Times
         * button on the Entity Preview panel of the Export Models tab. It shows
         * the Daily Times Distribution for the selected object from the list.
         */
        @Override
        public void actionPerformed(ActionEvent arg0) {

            exportPreviewPanel.removeAll();
            exportPreviewPanel.updateUI();

            String selection = exportModelList.getSelectedValue();

            ActivityModel activity = installation.getPerson().findActivity(selection, false);

            ResponseModel response = installation.getPerson().findResponse(selection);

            ChartPanel chartPanel = null;

            if (activity != null)
                chartPanel = activity.createDailyTimesDistributionChart();

            else
                chartPanel = response.createDailyTimesDistributionChart();

            exportPreviewPanel.add(chartPanel, BorderLayout.CENTER);
            exportPreviewPanel.validate();
        }
    });

    exportStartBinnedButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Start Time Binned
         * button on the Entity Preview panel of the Export Models tab. It shows
         * the Start Time Binned Distribution for the selected object from the
         * list.
         */
        @Override
        public void actionPerformed(ActionEvent arg0) {

            exportPreviewPanel.removeAll();
            exportPreviewPanel.updateUI();

            String selection = exportModelList.getSelectedValue();

            ActivityModel activity = installation.getPerson().findActivity(selection, false);

            ResponseModel response = installation.getPerson().findResponse(selection);

            ChartPanel chartPanel = null;

            if (activity != null)
                chartPanel = activity.createStartTimeBinnedDistributionChart();

            else
                chartPanel = response.createStartTimeBinnedDistributionChart();

            exportPreviewPanel.add(chartPanel, BorderLayout.CENTER);
            exportPreviewPanel.validate();

        }
    });

    exportStartButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Start Time
         * button on the Entity Preview panel of the Export Models tab. It shows
         * the Start Time Distribution for the selected object from the list.
         */
        @Override
        public void actionPerformed(ActionEvent arg0) {

            exportPreviewPanel.removeAll();
            exportPreviewPanel.updateUI();

            String selection = exportModelList.getSelectedValue();

            ActivityModel activity = installation.getPerson().findActivity(selection, false);

            ResponseModel response = installation.getPerson().findResponse(selection);

            ChartPanel chartPanel = null;

            if (activity != null)
                chartPanel = activity.createStartTimeDistributionChart();
            else
                chartPanel = response.createStartTimeDistributionChart();

            exportPreviewPanel.add(chartPanel, BorderLayout.CENTER);
            exportPreviewPanel.validate();

        }
    });

    exportDurationButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Duration
         * button on the Entity Preview panel of the Export Models tab. It shows
         * the Duration Distribution for the selected object from the list.
         */
        @Override
        public void actionPerformed(ActionEvent arg0) {

            exportPreviewPanel.removeAll();
            exportPreviewPanel.updateUI();

            String selection = exportModelList.getSelectedValue();

            ActivityModel activity = installation.getPerson().findActivity(selection, false);

            ResponseModel response = installation.getPerson().findResponse(selection);

            ChartPanel chartPanel = null;

            if (activity != null)
                chartPanel = activity.createDurationDistributionChart();
            else
                chartPanel = response.createDurationDistributionChart();

            exportPreviewPanel.add(chartPanel, BorderLayout.CENTER);
            exportPreviewPanel.validate();

        }
    });

    exportExpectedPowerButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {

            exportPreviewPanel.removeAll();
            exportPreviewPanel.updateUI();

            String selection = exportModelList.getSelectedValue();

            ActivityModel activity = installation.getPerson().findActivity(selection, false);

            ResponseModel response = installation.getPerson().findResponse(selection);

            ChartPanel chartPanel = null;

            if (selection.equalsIgnoreCase(installation.getName()))
                chartPanel = installation.createExpectedPowerChart();
            else if (activity != null)
                chartPanel = activity.createExpectedPowerChart();
            else
                chartPanel = response.createExpectedPowerChart();

            exportPreviewPanel.add(chartPanel, BorderLayout.CENTER);
            exportPreviewPanel.validate();

        }
    });

    connectButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Connect button on the
         * Connection Properties panel of the Export Models tab. It helps the user
         * to connect to his Cassandra Library and export the models he created
         * there.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            boolean result = false;

            // Reads the user credentials and the server to connect to.
            try {
                APIUtilities.setUrl(urlTextField.getText());

                result = APIUtilities.sendUserCredentials(usernameTextField.getText(),
                        passwordField.getPassword());
            } catch (Exception e1) {
                e1.printStackTrace();
            }

            // If the use credentials are correct
            if (result) {
                exportButton.setEnabled(true);
                exportAllBaseButton.setEnabled(true);
                exportAllResponseButton.setEnabled(true);
                householdNameTextField.setEnabled(true);
            }
            // Else a error message appears.
            else {
                JFrame error = new JFrame();

                JOptionPane.showMessageDialog(error, "User Credentials are not correct! Please try again.",
                        "Inane error", JOptionPane.ERROR_MESSAGE);
                passwordField.setText("");
            }

        }
    });

    passwordField.addCaretListener(new CaretListener() {
        @Override
        public void caretUpdate(CaretEvent e) {
            String pass = String.valueOf(passwordField.getPassword());

            if (pass.equals("")) {
                connectButton.setEnabled(false);
            } else
                connectButton.setEnabled(true);
        }
    });

    exportButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Export button on the
         * Connection Properties panel of the Export Models tab. The entity model
         * selected from the list is then exported to the User Library in
         * Cassandra Platform.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                // Parsing the selected entity and find out what type of entity it is.
                String selection = exportModelList.getSelectedValue();

                Appliance appliance = installation.findAppliance(selection);

                ActivityModel activity = installation.getPerson().findActivity(selection, false);

                ResponseModel response = installation.getPerson().findResponse(selection);

                // If it is installation
                if (selection.equalsIgnoreCase(installation.getName())) {
                    String oldName = installation.getName();
                    installation.setName(householdNameTextField.getText());

                    try {
                        installation.setInstallationID(APIUtilities
                                .sendEntity(installation.toJSON(APIUtilities.getUserID()).toString(), "/inst"));

                    } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                        e1.printStackTrace();
                    }

                    installation.setName(oldName);

                    JFrame success = new JFrame();

                    JOptionPane.showMessageDialog(success,
                            "The installation model " + installation.getName() + " was exported successfully",
                            "Installation Model Exported", JOptionPane.INFORMATION_MESSAGE);

                }
                // If it is person
                else if (selection.equalsIgnoreCase(installation.getPerson().getName())) {

                    try {
                        installation.getPerson().setPersonID(APIUtilities.sendEntity(
                                installation.getPerson().toJSON(APIUtilities.getUserID()).toString(), "/pers"));
                    } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                        e1.printStackTrace();
                    }

                    JFrame success = new JFrame();

                    JOptionPane.showMessageDialog(success,
                            "The person model " + installation.getPerson().getName()
                                    + " was exported successfully",
                            "Person Model Exported", JOptionPane.INFORMATION_MESSAGE);

                }
                // If it is appliance
                else if (appliance != null) {

                    try {
                        appliance.setApplianceID(APIUtilities
                                .sendEntity(appliance.toJSON(APIUtilities.getUserID()).toString(), "/app"));

                        APIUtilities.sendEntity(appliance.powerConsumptionModelToJSON().toString(), "/consmod");

                    } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                        e1.printStackTrace();
                    }

                    JFrame success = new JFrame();

                    JOptionPane.showMessageDialog(success,
                            "The appliance model " + appliance.getName() + " was exported successfully",
                            "Appliance Model Exported", JOptionPane.INFORMATION_MESSAGE);

                }
                // If it is activity
                else if (activity != null) {

                    String[] applianceTemp = new String[activity.getAppliancesOf().length];
                    String activityTemp = "";
                    String durationTemp = "";
                    String dailyTemp = "";
                    String startTemp = "";

                    // For each appliance that participates in the activity
                    for (int i = 0; i < activity.getAppliancesOf().length; i++) {

                        Appliance activityAppliance = activity.getAppliancesOf()[i];

                        try {
                            // In case the appliances contained in the Activity model are
                            // not
                            // in the database, we create the object there before sending
                            // the
                            // activity model
                            if (activityAppliance.getApplianceID().equalsIgnoreCase("")) {

                                activityAppliance.setApplianceID(APIUtilities.sendEntity(
                                        activityAppliance.toJSON(APIUtilities.getUserID()).toString(), "/app"));

                                APIUtilities.sendEntity(
                                        activityAppliance.powerConsumptionModelToJSON().toString(), "/consmod");
                            }
                            applianceTemp[i] = activityAppliance.getApplianceID();
                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }

                    }

                    try {

                        String[] appliancesID = applianceTemp;

                        // Creating the JSON of the activity model
                        activity.setActivityModelID(APIUtilities.sendEntity(
                                activity.toJSON(appliancesID, APIUtilities.getUserID()).toString(), "/actmod"));

                        activityTemp = activity.getActivityModelID();

                        // Creating the JSON of the distributions
                        activity.getDailyTimes().setDistributionID(APIUtilities.sendEntity(
                                activity.getDailyTimes().toJSON(activityTemp).toString(), "/distr"));

                        activity.setDailyID(activity.getDailyTimes().getDistributionID());
                        dailyTemp = activity.getDailyID();

                        activity.getDuration().setDistributionID(APIUtilities
                                .sendEntity(activity.getDuration().toJSON(activityTemp).toString(), "/distr"));

                        activity.setDurationID(activity.getDuration().getDistributionID());
                        durationTemp = activity.getDurationID();

                        activity.getStartTime().setDistributionID(APIUtilities
                                .sendEntity(activity.getStartTime().toJSON(activityTemp).toString(), "/distr"));

                        activity.setStartID(activity.getStartTime().getDistributionID());
                        startTemp = activity.getStartID();

                        // Adding the JSON of the distributions to the activity model
                        APIUtilities.updateEntity(
                                activity.toJSON(appliancesID, APIUtilities.getUserID()).toString(), "/actmod",
                                activityTemp);

                    } catch (AuthenticationException | NoSuchAlgorithmException | IOException e1) {

                        e1.printStackTrace();
                    }

                    JFrame success = new JFrame();

                    JOptionPane.showMessageDialog(success,
                            "The activity model " + activity.getName() + " was exported successfully",
                            "Activity Model Exported", JOptionPane.INFORMATION_MESSAGE);

                }
                // If it is response
                else if (response != null) {
                    String[] applianceTemp = new String[response.getAppliancesOf().length];

                    String responseTemp = "";
                    String durationTemp = "";
                    String dailyTemp = "";
                    String startTemp = "";

                    // For each appliance that participates in the activity
                    for (int i = 0; i < response.getAppliancesOf().length; i++) {

                        Appliance responseAppliance = response.getAppliancesOf()[i];

                        try {
                            // In case the appliances contained in the Activity model are
                            // not
                            // in the database, we create the object there before sending
                            // the
                            // activity model
                            if (responseAppliance.getApplianceID().equalsIgnoreCase("")) {

                                responseAppliance.setApplianceID(APIUtilities.sendEntity(
                                        responseAppliance.toJSON(APIUtilities.getUserID()).toString(), "/app"));

                                APIUtilities.sendEntity(
                                        responseAppliance.powerConsumptionModelToJSON().toString(), "/consmod");
                            }
                            applianceTemp[i] = responseAppliance.getApplianceID();
                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }
                    }

                    try {

                        String[] appliancesID = applianceTemp;

                        // Creating the JSON of the response
                        response.setActivityModelID(APIUtilities.sendEntity(
                                response.toJSON(appliancesID, APIUtilities.getUserID()).toString(), "/actmod"));

                        responseTemp = response.getActivityModelID();

                        // Creating the JSON of the distributions
                        response.getDailyTimes().setDistributionID(APIUtilities.sendEntity(
                                response.getDailyTimes().toJSON(responseTemp).toString(), "/distr"));

                        response.setDailyID(response.getDailyTimes().getDistributionID());
                        dailyTemp = response.getDailyID();

                        response.getDuration().setDistributionID(APIUtilities
                                .sendEntity(response.getDuration().toJSON(responseTemp).toString(), "/distr"));

                        response.setDurationID(response.getDuration().getDistributionID());
                        durationTemp = response.getDurationID();

                        response.getStartTime().setDistributionID(APIUtilities
                                .sendEntity(response.getStartTime().toJSON(responseTemp).toString(), "/distr"));

                        response.setStartID(response.getStartTime().getDistributionID());
                        startTemp = response.getStartID();

                        // Adding the JSON of the distributions to the activity model
                        APIUtilities.updateEntity(
                                response.toJSON(appliancesID, APIUtilities.getUserID()).toString(), "/actmod",
                                responseTemp);

                    } catch (AuthenticationException | NoSuchAlgorithmException | IOException e1) {

                        e1.printStackTrace();
                    }

                    JFrame success = new JFrame();

                    JOptionPane.showMessageDialog(success,
                            "The response model " + response.getName() + " was exported successfully",
                            "Response Model Exported", JOptionPane.INFORMATION_MESSAGE);

                }
            }

            finally {
                root.setCursor(Cursor.getDefaultCursor());
            }
        }
    });

    exportAllBaseButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Export All Base
         * button on the Connection Properties panel of the Export Models tab. The
         * export procedure above is iterated through all the entities available
         * on the list except for the response models.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                for (int i = 0; i < exportModelList.getModel().getSize(); i++) {
                    exportModelList.setSelectedIndex(i);

                    String selection = exportModelList.getSelectedValue();

                    Appliance appliance = installation.findAppliance(selection);

                    ActivityModel activity = installation.getPerson().findActivity(selection, false);

                    ResponseModel response = installation.getPerson().findResponse(selection);

                    if (selection.equalsIgnoreCase(installation.getName())) {

                        String oldName = installation.getName();

                        try {

                            installation.setName(householdNameTextField.getText() + " Base");

                            installation.setInstallationID(APIUtilities.sendEntity(
                                    installation.toJSON(APIUtilities.getUserID()).toString(), "/inst"));

                            installation.setName(oldName);
                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }

                    } else if (selection.equalsIgnoreCase(installation.getPerson().getName())) {

                        try {
                            installation.getPerson().setPersonID(APIUtilities.sendEntity(installation
                                    .getPerson().toJSON(installation.getInstallationID()).toString(), "/pers"));
                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }

                    } else if (appliance != null) {

                        try {
                            appliance.setApplianceID(APIUtilities.sendEntity(
                                    appliance.toJSON(installation.getInstallationID().toString()).toString(),
                                    "/app"));

                            APIUtilities.sendEntity(appliance.powerConsumptionModelToJSON().toString(),
                                    "/consmod");

                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }

                    } else if (activity != null) {

                        String[] applianceTemp = new String[activity.getAppliancesOf().length];

                        String personTemp = "";
                        String activityTemp = "";
                        String durationTemp = "";
                        String dailyTemp = "";
                        String startTemp = "";

                        // For each appliance that participates in the activity
                        for (int j = 0; j < activity.getAppliancesOf().length; j++) {

                            Appliance activityAppliance = activity.getAppliancesOf()[j];
                            applianceTemp[j] = activityAppliance.getApplianceID();
                        }

                        personTemp = installation.getPerson().getPersonID();

                        try {

                            activity.setActivityID(APIUtilities
                                    .sendEntity(activity.activityToJSON(personTemp).toString(), "/act"));

                            String[] appliancesID = applianceTemp;

                            activity.setActivityModelID(APIUtilities
                                    .sendEntity(activity.toJSON(appliancesID).toString(), "/actmod"));
                            activityTemp = activity.getActivityModelID();

                            activity.getDailyTimes().setDistributionID(APIUtilities.sendEntity(
                                    activity.getDailyTimes().toJSON(activityTemp).toString(), "/distr"));
                            activity.setDailyID(activity.getDailyTimes().getDistributionID());
                            dailyTemp = activity.getDailyID();

                            activity.getDuration().setDistributionID(APIUtilities.sendEntity(
                                    activity.getDuration().toJSON(activityTemp).toString(), "/distr"));

                            activity.setDurationID(activity.getDuration().getDistributionID());
                            durationTemp = activity.getDurationID();

                            activity.getStartTime().setDistributionID(APIUtilities.sendEntity(
                                    activity.getStartTime().toJSON(activityTemp).toString(), "/distr"));

                            activity.setStartID(activity.getStartTime().getDistributionID());
                            startTemp = activity.getStartID();

                            APIUtilities.updateEntity(activity.toJSON(appliancesID).toString(), "/actmod",
                                    activityTemp);

                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }

                    } else if (response != null) {

                    }
                }

            }

            finally {
                root.setCursor(Cursor.getDefaultCursor());
            }

            JFrame success = new JFrame();

            JOptionPane.showMessageDialog(success, "The installation model " + installation.getName()
                    + " for the base pricing scheme and all the entities contained within were exported successfully",
                    "Installation Model Exported", JOptionPane.INFORMATION_MESSAGE);

        }
    });

    exportAllResponseButton.addActionListener(new ActionListener() {
        /**
         * This function is called when the user presses the Export All Base
         * button on the Connection Properties panel of the Export Models tab. The
         * export procedure above is iterated through all the entities available
         * on the list except for the activity models.
         */
        @Override
        public void actionPerformed(ActionEvent e) {
            Component root = SwingUtilities.getRoot((JButton) e.getSource());

            try {

                root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

                for (int i = 0; i < exportModelList.getModel().getSize(); i++) {
                    exportModelList.setSelectedIndex(i);

                    String selection = exportModelList.getSelectedValue();

                    Appliance appliance = installation.findAppliance(selection);

                    ActivityModel activity = installation.getPerson().findActivity(selection, false);

                    ResponseModel response = installation.getPerson().findResponse(selection);

                    if (selection.equalsIgnoreCase(installation.getName())) {

                        String oldName = installation.getName();

                        try {

                            installation.setName(householdNameTextField.getText() + " Response");

                            installation.setInstallationID(APIUtilities.sendEntity(
                                    installation.toJSON(APIUtilities.getUserID()).toString(), "/inst"));

                            installation.setName(oldName);

                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }

                    } else if (selection.equalsIgnoreCase(installation.getPerson().getName())) {

                        try {
                            installation.getPerson().setPersonID(APIUtilities.sendEntity(installation
                                    .getPerson().toJSON(installation.getInstallationID()).toString(), "/pers"));
                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }

                    } else if (appliance != null) {

                        try {
                            appliance.setApplianceID(APIUtilities.sendEntity(
                                    appliance.toJSON(installation.getInstallationID().toString()).toString(),
                                    "/app"));

                            APIUtilities.sendEntity(appliance.powerConsumptionModelToJSON().toString(),
                                    "/consmod");

                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }

                    } else if (activity != null) {

                    } else if (response != null) {
                        String[] applianceTemp = new String[response.getAppliancesOf().length];

                        String personTemp = "";
                        String responseTemp = "";
                        String durationTemp = "";
                        String dailyTemp = "";
                        String startTemp = "";

                        // For each appliance that participates in the activity
                        for (int j = 0; j < response.getAppliancesOf().length; j++) {

                            Appliance responseAppliance = response.getAppliancesOf()[j];

                            applianceTemp[j] = responseAppliance.getApplianceID();
                        }
                        personTemp = installation.getPerson().getPersonID();

                        try {

                            response.setActivityID(APIUtilities
                                    .sendEntity(response.activityToJSON(personTemp).toString(), "/act"));

                            String[] appliancesID = applianceTemp;

                            response.setActivityModelID(APIUtilities
                                    .sendEntity(response.toJSON(appliancesID).toString(), "/actmod"));
                            responseTemp = response.getActivityModelID();

                            response.getDailyTimes().setDistributionID(APIUtilities.sendEntity(
                                    response.getDailyTimes().toJSON(responseTemp).toString(), "/distr"));
                            response.setDailyID(response.getDailyTimes().getDistributionID());
                            dailyTemp = response.getDailyID();

                            response.getDuration().setDistributionID(APIUtilities.sendEntity(
                                    response.getDuration().toJSON(responseTemp).toString(), "/distr"));

                            response.setDurationID(response.getDuration().getDistributionID());
                            durationTemp = response.getDurationID();

                            response.getStartTime().setDistributionID(APIUtilities.sendEntity(
                                    response.getStartTime().toJSON(responseTemp).toString(), "/distr"));

                            response.setStartID(response.getStartTime().getDistributionID());
                            startTemp = response.getStartID();

                            APIUtilities.updateEntity(response.toJSON(appliancesID).toString(), "/actmod",
                                    responseTemp);

                        } catch (IOException | AuthenticationException | NoSuchAlgorithmException e1) {
                            e1.printStackTrace();
                        }
                    }
                }
            }

            finally {
                root.setCursor(Cursor.getDefaultCursor());
            }

            JFrame success = new JFrame();

            JOptionPane.showMessageDialog(success, "The installation model " + installation.getName()
                    + " for the new pricing scheme and all the entities contained within were exported successfully",
                    "Installation Model Exported", JOptionPane.INFORMATION_MESSAGE);
        }
    });
}

From source file:base.BasePlayer.Main.java

void setMenuBar() {
    //filemenu.addMouseListener(this);

    //toolmenu.addMouseListener(this);
    filemenu = new JMenu("File");
    toolmenu = new JMenu("Tools");
    help = new JMenu("Help");
    about = new JMenu("About");
    menubar = new JMenuBar();
    //help.addMouseListener(this);
    exit = new JMenuItem("Exit");
    manual = new JButton("Online manual");
    manual.addActionListener(new ActionListener() {

        @Override//  w  ww.  java 2s.co m
        public void actionPerformed(ActionEvent arg0) {
            Main.gotoURL("https://baseplayer.fi/BPmanual");
        }

    });
    //   opensamples = new JMenuItem("Add samples");
    zoomout = new JButton("Zoom out");
    back = new JButton("<<");
    forward = new JButton(">>");
    manage = new JButton("Variant Manager");
    openvcfs = new JMenuItem("Add VCFs", open);
    openbams = new JMenuItem("Add BAMs", open);
    average = new JMenuItem("Coverage calculator");
    update = new JMenuItem("Update");
    update.setVisible(false);
    errorlog = new JMenuItem("View log");
    //helpLabel = new JLabel("This is pre-release version of BasePlayer\nContact: help@baseplayer.fi\n\nUniversity of Helsinki");

    addURL = new JMenu("Add from URL");
    urlField = new JTextField("Enter URL");
    addtracks = new JMenuItem("Add tracks");
    fromURL = new JMenuItem("Add track from URL");
    addcontrols = new JMenuItem("Add controls");
    pleiadesButton = new JMenuItem("PLEIADES");
    saveProject = new JMenuItem("Save project");
    saveProjectAs = new JMenuItem("Save project as...");
    openProject = new JMenuItem("Open project");
    clear = new JMenuItem("Clear data");
    clearMemory = new JMenuItem("Clean memory");
    //   welcome = new JMenuItem("Welcome screen");
    filemenu.add(openvcfs);
    filemenu.add(openbams);
    variantCaller = new JMenuItem("Variant Caller");
    tbrowser = new JMenuItem("Table Browser");
    bconvert = new JMenuItem("BED converter");
    peakCaller = new JMenuItem("Peak Caller");
    addtracks = new JMenuItem("Add tracks", open);
    filemenu.add(addtracks);
    addcontrols = new JMenuItem("Add controls", open);
    filemenu.add(addcontrols);
    filemenu.add(fromURL);
    if (pleiades) {
        pleiadesButton.setPreferredSize(buttonDimension);
        pleiadesButton.addActionListener(this);

        filemenu.add(pleiadesButton);
    }

    filemenu.add(new JSeparator());
    openProject = new JMenuItem("Open project", open);
    filemenu.add(openProject);
    saveProject = new JMenuItem("Save project", save);
    filemenu.add(saveProject);
    saveProjectAs = new JMenuItem("Save project as...", save);
    filemenu.add(saveProjectAs);
    filemenu.add(new JSeparator());
    filemenu.add(genome);
    filemenu.add(update);
    filemenu.add(clear);
    filemenu.add(new JSeparator());
    filemenu.add(exit);
    exit.addActionListener(this);
    menubar.add(filemenu);
    manage.addActionListener(this);
    manage.addMouseListener(this);
    update.addActionListener(this);
    average.addActionListener(this);
    average.setEnabled(false);
    average.setToolTipText("No bam/cram files opened");
    tbrowser.addActionListener(this);
    bconvert.addActionListener(this);
    toolmenu.add(tbrowser);
    toolmenu.add(average);
    toolmenu.add(variantCaller);
    toolmenu.add(bconvert);
    fromURL.addMouseListener(this);
    fromURL.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

            final JPopupMenu menu = new JPopupMenu();
            final JTextField area = new JTextField();
            JButton add = new JButton("Fetch");
            JLabel label = new JLabel("Paste track URL below");
            JScrollPane menuscroll = new JScrollPane();
            add.addActionListener(new ActionListener() {

                @Override
                public void actionPerformed(ActionEvent e) {
                    try {
                        String urltext = area.getText().trim();
                        Boolean size = true;
                        if (urltext.contains("pleiades")) {
                            openPleiades(urltext);
                            return;
                        }
                        if (!FileRead.isTrackFile(urltext)) {
                            showError("The file format is not supported.\n"
                                    + "Supported formats: bed, bigwig, bigbed, gff, bedgraph", "Error");
                            return;

                        }
                        if (!urltext.toLowerCase().endsWith(".bw") && !urltext.toLowerCase().endsWith(".bigwig")
                                && !urltext.toLowerCase().endsWith(".bb")
                                && !urltext.toLowerCase().endsWith(".bigbed")) {
                            URL url = null;
                            try {
                                url = new URL(urltext);
                            } catch (Exception ex) {
                                menu.setVisible(false);
                                Main.showError("Please paste whole url (protocol included)", "Error");
                                return;
                            }
                            URL testurl = url;
                            HttpURLConnection huc = (HttpURLConnection) testurl.openConnection();
                            huc.setRequestMethod("HEAD");
                            int responseCode = huc.getResponseCode();

                            if (responseCode != 404) {

                                SeekableStream stream = SeekableStreamFactory.getInstance().getStreamFor(url);
                                TabixReader tabixReader = null;
                                String index = null;

                                try {
                                    if (stream.length() / (double) 1048576 >= Settings.settings
                                            .get("bigFile")) {
                                        size = false;
                                    }
                                    tabixReader = new TabixReader(urltext, urltext + ".tbi", stream);

                                    index = urltext + ".tbi";
                                    testurl = new URL(index);
                                    huc = (HttpURLConnection) testurl.openConnection();
                                    huc.setRequestMethod("HEAD");
                                    responseCode = huc.getResponseCode();

                                    if (responseCode == 404) {
                                        menu.setVisible(false);
                                        Main.showError("Index file (.tbi) not found in the URL.", "Error");

                                        return;
                                    }

                                } catch (Exception ex) {
                                    try {
                                        tabixReader = new TabixReader(urltext,
                                                urltext.substring(0, urltext.indexOf(".gz")) + ".tbi", stream);
                                        index = urltext.substring(0, urltext.indexOf(".gz")) + ".tbi";
                                    } catch (Exception exc) {
                                        menu.setVisible(false);
                                        Main.showError("Could not read tabix file.", "Error");
                                    }
                                }
                                if (tabixReader != null && index != null) {
                                    stream.close();
                                    tabixReader.close();
                                    menu.setVisible(false);
                                    FileRead filereader = new FileRead();
                                    filereader.readBED(urltext, index, size);

                                }

                            } else {
                                menu.setVisible(false);
                                Main.showError("Not a valid URL", "Error");
                            }

                        } else {
                            URL url = null;
                            try {
                                url = new URL(urltext);
                            } catch (Exception ex) {
                                Main.showError("Please paste whole url (protocol included)", "Error");
                                return;
                            }
                            final URL testurl = url;
                            HttpURLConnection huc = (HttpURLConnection) testurl.openConnection();
                            huc.setRequestMethod("HEAD");
                            int responseCode = huc.getResponseCode();

                            if (responseCode != 404) {
                                menu.setVisible(false);
                                FileRead filereader = new FileRead();

                                filereader.readBED(urltext, "nan", true);

                            } else {
                                menu.setVisible(false);
                                Main.showError("Not a valid URL", "Error");
                            }

                        }
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }

                }

            });
            area.setFont(Main.menuFont);
            //area.setText("https://baseplayer.fi/tracks/Mappability_1000Genomes_pilot_mask.bed.gz");
            menu.add(label);
            menu.add(menuscroll);
            menu.add(add);
            area.setPreferredSize(new Dimension(300, Main.defaultFontSize + 8));

            area.setCaretPosition(0);
            area.revalidate();
            menuscroll.getViewport().add(area);
            area.requestFocus();
            menu.pack();

            menu.show(frame, mouseX + 20, fromURL.getY());
        }

    });
    //toolmenu.add(peakCaller);
    variantCaller.setToolTipText("No bam/cram files opened");
    variantCaller.addActionListener(this);
    variantCaller.setEnabled(false);
    peakCaller.setEnabled(true);
    peakCaller.addActionListener(this);
    settings.addActionListener(this);
    clearMemory.addActionListener(this);
    errorlog.addActionListener(this);
    toolmenu.add(clearMemory);
    toolmenu.add(errorlog);
    toolmenu.add(new JSeparator());
    toolmenu.add(settings);
    menubar.add(toolmenu);
    menubar.add(manage);
    area = new JEditorPane();

    String infotext = "<html><h2>BasePlayer</h2>This is a version " + version
            + " of BasePlayer (<a href=https://baseplayer.fi>https://baseplayer.fi</a>)<br/> Author: Riku Katainen <br/> University of Helsinki<br/>"
            + "Tumor Genomics Group (<a href=http://research.med.helsinki.fi/gsb/aaltonen/>http://research.med.helsinki.fi/gsb/aaltonen/</a>) <br/> "
            + "Contact: help@baseplayer.fi <br/> <br/>"

            + "Supported filetype for variants is VCF and VCF.gz (index file will be created if missing)<br/> "
            + "Supported filetypes for reads are BAM and CRAM. Index files required (.bai or .crai). <br/> "
            + "Supported filetypes for additional tracks are BED(.gz), GFF.gz, BedGraph, BigWig, BigBed.<br/> (tabix index required for bgzipped files). <br/><br/> "

            + "For optimal usage, you should have vcf.gz and bam -files for each sample. <br/> "
            + "e.g. in case you have a sample named as sample1, name all files similarly and <br/>"
            + "place in the same folder:<br/>" + "sample1.vcf.gz<br/>" + "sample1.vcf.gz.tbi<br/>"
            + "sample1.bam<br/>" + "sample1.bam.bai<br/><br/>"
            + "When you open sample1.vcf.gz, sample1.bam is recognized and opened<br/>"
            + "on the same track.<br/><br/>"
            + "Instructional videos can be viewed at our <a href=https://www.youtube.com/channel/UCywq-T7W0YPzACyB4LT7Q3g> Youtube channel</a>";
    area = new JEditorPane();
    area.setEditable(false);
    area.setEditorKit(JEditorPane.createEditorKitForContentType("text/html"));
    area.setText(infotext);
    area.setFont(Main.menuFont);
    area.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
            HyperlinkEvent.EventType type = hyperlinkEvent.getEventType();
            final URL url = hyperlinkEvent.getURL();
            if (type == HyperlinkEvent.EventType.ACTIVATED) {
                Main.gotoURL(url.toString());
            }
        }
    });

    about.add(area);
    about.addMouseListener(this);
    help.add(about);
    help.add(manual);
    menubar.add(help);
    JLabel emptylab = new JLabel("  ");
    emptylab.setEnabled(false);
    emptylab.setOpaque(false);
    menubar.add(emptylab);

    chromosomeDropdown.setBorder(BorderFactory.createMatteBorder(1, 0, 1, 1, Color.lightGray));
    chromosomeDropdown.setBorder(BorderFactory.createCompoundBorder(chromosomeDropdown.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));

    chromlabel.setToolTipText("Current chromosome");
    chromlabel.setFocusable(false);
    chromlabel.addMouseListener(this);
    chromlabel.setBackground(Color.white);
    chromlabel.setEditable(false);
    chromlabel.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 0, Color.lightGray));
    chromlabel.setBorder(BorderFactory.createCompoundBorder(chromlabel.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));
    menubar.add(chromlabel);
    chromosomeDropdown.setBackground(Color.white);
    chromosomeDropdown.setToolTipText("Current chromosome");
    menubar.add(chromosomeDropdown);
    JLabel empty3 = new JLabel("  ");
    empty3.setEnabled(false);
    empty3.setOpaque(false);
    menubar.add(empty3);
    menubar.add(back);
    menubar.add(searchField);
    searchField.setForeground(Color.gray);
    searchField.setBorder(BorderFactory.createCompoundBorder(searchField.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));

    searchField.addMouseListener(this);
    menubar.add(back);
    menubar.add(searchField);
    searchField.setForeground(Color.gray);

    back.addMouseListener(this);
    back.setToolTipText("Back");
    forward.addMouseListener(this);
    forward.setToolTipText("Forward");
    back.setEnabled(false);
    forward.setEnabled(false);

    searchField.addMouseListener(this);

    menubar.add(back);
    menubar.add(searchField);
    searchField.setForeground(Color.gray);
    back.addMouseListener(this);
    forward.addMouseListener(this);
    back.setEnabled(false);
    forward.setEnabled(false);
    forward.setMargin(new Insets(0, 2, 0, 2));
    back.setMargin(new Insets(0, 2, 0, 2));
    menubar.add(forward);
    JLabel empty4 = new JLabel("  ");
    empty4.setOpaque(false);
    empty4.setEnabled(false);
    menubar.add(empty4);
    menubar.add(zoomout);
    JLabel empty5 = new JLabel("  ");
    empty5.setEnabled(false);
    empty5.setOpaque(false);
    menubar.add(empty5);
    positionField.setEditable(false);
    positionField.setBackground(new Color(250, 250, 250));

    positionField.setMargin(new Insets(0, 2, 0, 0));
    positionField.setBorder(BorderFactory.createCompoundBorder(widthLabel.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));
    menubar.add(positionField);
    widthLabel.setEditable(false);
    widthLabel.setBackground(new Color(250, 250, 250));
    widthLabel.setMargin(new Insets(0, 2, 0, 0));
    widthLabel.setBorder(BorderFactory.createCompoundBorder(widthLabel.getBorder(),
            BorderFactory.createEmptyBorder(0, 0, 0, 0)));
    JLabel empty6 = new JLabel("  ");
    empty6.setEnabled(false);
    empty6.setOpaque(false);
    menubar.add(empty6);
    menubar.add(widthLabel);
    JLabel empty7 = new JLabel("  ");
    empty7.setOpaque(false);
    empty7.setEnabled(false);
    menubar.add(empty7);
}

From source file:org.neo4j.desktop.ui.Components.java

static JTextField createUnmodifiableTextField(String text, int columns) {
    JTextField textField = new JTextField(text, columns);
    textField.setEditable(false);
    textField.setForeground(Color.GRAY);
    return textField;
}

From source file:org.openconcerto.erp.core.humanresources.payroll.element.FichePayeSQLElement.java

public SQLComponent createComponent() {
    return new BaseSQLComponent(this) {

        private FichePayeModel model;
        private ElementComboBox comboSelProfil, selSalCombo;
        private EditFrame edit = null;
        private ElementComboBox selMois;
        private int dernMois, dernAnnee;
        private JTextField textAnnee;
        JDate dateDu, dateAu;/*from ww w .j av a2  s . co m*/
        private JScrollPane paneTreeLeft;
        private JPanel pDate;
        private JButton buttonValider, buttonGenCompta;

        public void addViews() {

            this.dernMois = 0;
            this.dernAnnee = 0;

            this.setLayout(new GridBagLayout());

            final GridBagConstraints c = new DefaultGridBagConstraints();

            // Tree elt Fiche de Paye On the left
            c.fill = GridBagConstraints.BOTH;
            c.weightx = 1;
            c.weighty = 1;
            c.gridheight = GridBagConstraints.REMAINDER;
            final RubriquePayeTree tree = new RubriquePayeTree();
            tree.expandRow(0);
            this.paneTreeLeft = new JScrollPane(tree);
            // this.add(this.paneTreeLeft, c);

            // Panel Fiche paye on the right
            // Salarie
            JPanel panelRight = new JPanel();
            panelRight.setLayout(new GridBagLayout());
            c.fill = GridBagConstraints.HORIZONTAL;
            c.weightx = 1;
            c.weighty = 0;
            c.gridheight = 1;
            c.gridwidth = 2;
            this.selSalCombo = new ElementComboBox();
            // c.gridx++;
            panelRight.add(this.selSalCombo, c);

            // Mois
            c.gridy++;
            // c.gridx++;
            c.fill = GridBagConstraints.HORIZONTAL;
            c.weightx = 1;
            c.weighty = 0;
            c.gridheight = 1;
            c.gridwidth = 3;
            JLabel labelMois = new JLabel("Fiche de paye du mois de");
            this.selMois = new ElementComboBox(true, 20);
            // this.selMois.setEditable(true);
            // /this.selMois.setEnabled(true);

            JLabel labelDu = new JLabel("Du");
            JLabel labelAu = new JLabel("Au");
            this.dateDu = new JDate();
            this.dateAu = new JDate();

            // JTextField textMois = new JTextField();
            JLabel labelAnnee = new JLabel("Anne");
            this.textAnnee = new JTextField();
            {
                this.pDate = new JPanel();
                this.pDate.setOpaque(false);
                this.pDate.add(labelMois);
                this.pDate.add(this.selMois);
                this.pDate.add(labelAnnee);
                this.pDate.add(this.textAnnee);
                this.pDate.add(labelDu);
                this.pDate.add(this.dateDu);
                this.pDate.add(labelAu);
                this.pDate.add(this.dateAu);
                panelRight.add(this.pDate, c);
            }
            c.gridx += 2;
            c.weightx = 1;
            c.gridwidth = 1;
            c.fill = GridBagConstraints.HORIZONTAL;
            panelRight.add(new JPanel(), c);

            // Action Button
            c.gridx++;
            c.fill = GridBagConstraints.HORIZONTAL;
            c.weightx = 0;
            c.weighty = 0;

            JPanel pButtons = new JPanel();
            pButtons.setOpaque(false);
            JButton buttonUp = new JNiceButton(IListFrame.class.getResource("fleche_haut.png"));
            JButton buttonDown = new JNiceButton(IListFrame.class.getResource("fleche_bas.png"));
            JButton buttonRemove = new JNiceButton(SQLComponent.class.getResource("delete.png"));
            {
                pButtons.add(buttonUp);
                pButtons.add(buttonDown);
                pButtons.add(buttonRemove);
            }
            panelRight.add(pButtons, c);

            // Table
            c.fill = GridBagConstraints.BOTH;
            c.weightx = 1;
            c.weighty = 1;
            c.gridx = 1;
            c.gridy++;
            c.gridwidth = GridBagConstraints.REMAINDER;
            this.model = new FichePayeModel(1);
            final JTable table = new JTable(this.model);
            panelRight.add(new JScrollPane(table), c);
            FichePayeRenderer rend = new FichePayeRenderer();
            table.setDefaultRenderer(String.class, rend);
            table.setDefaultRenderer(Float.class, rend);

            // Import profil
            c.gridx = 1;
            c.gridy++;
            c.weightx = 0;
            c.weighty = 0;
            c.gridwidth = 1;
            c.fill = GridBagConstraints.HORIZONTAL;
            JLabel labelProfil = new JLabel("Importer depuis un profil prdfini");
            panelRight.add(labelProfil, c);
            c.gridwidth = 1;

            this.comboSelProfil = new ElementComboBox();
            // this.comboSelProfil = new ElementComboBox();
            this.comboSelProfil.setListIconVisible(false);
            c.gridx++;
            c.gridwidth = 1;

            // this.comboSelProfil.init(eltProfil.getTable().getField("NOM"), null);
            panelRight.add(this.comboSelProfil, c);

            JButton buttonImportProfil = new JButton("Importer");
            c.gridx++;
            panelRight.add(buttonImportProfil, c);

            // Total Periode
            JPanel panelTotal = new JPanel();
            panelTotal.setBorder(BorderFactory.createTitledBorder("Total priode"));
            panelTotal.setLayout(new GridBagLayout());
            GridBagConstraints cPanel = new DefaultGridBagConstraints();

            // Salaire brut
            JLabel labelBrut = new JLabel(getLabelFor("SAL_BRUT"));
            panelTotal.add(labelBrut, cPanel);
            JTextField textSalBrut = new JTextField(10);
            cPanel.gridx++;
            cPanel.weightx = 0;
            panelTotal.add(textSalBrut, cPanel);
            textSalBrut.setEditable(false);
            textSalBrut.setEnabled(false);

            // acompte
            cPanel.gridx++;
            JLabel labelAcompte = new JLabel(getLabelFor("ACOMPTE"));
            panelTotal.add(labelAcompte, cPanel);
            JTextField textAcompte = new JTextField(10);
            cPanel.gridx++;
            panelTotal.add(textAcompte, cPanel);
            // textAcompte.setEditable(false);
            // textAcompte.setEnabled(false);

            // Conges Acquis
            cPanel.gridx++;
            JLabel labelCongesAcquis = new JLabel(getLabelFor("CONGES_ACQUIS"));
            panelTotal.add(labelCongesAcquis, cPanel);
            JTextField textCongesAcquis = new JTextField(10);
            cPanel.gridx++;
            panelTotal.add(textCongesAcquis, cPanel);

            // cotisation salariale
            cPanel.gridx = 0;
            cPanel.gridy++;
            JLabel labelCotSal = new JLabel(getLabelFor("COT_SAL"));
            panelTotal.add(labelCotSal, cPanel);
            JTextField textCotSal = new JTextField(10);
            cPanel.gridx++;
            panelTotal.add(textCotSal, cPanel);
            textCotSal.setEditable(false);
            textCotSal.setEnabled(false);

            // cotisation patronale
            cPanel.gridx++;
            JLabel labelCotPat = new JLabel(getLabelFor("COT_PAT"));
            panelTotal.add(labelCotPat, cPanel);
            JTextField textCotPat = new JTextField(10);
            cPanel.gridx++;
            panelTotal.add(textCotPat, cPanel);
            textCotPat.setEditable(false);
            textCotPat.setEnabled(false);

            JLabel labelCSG = new JLabel(getLabelFor("CSG"));
            cPanel.gridx++;
            panelTotal.add(labelCSG, cPanel);
            JTextField textCSG = new JTextField(10);
            cPanel.gridx++;
            panelTotal.add(textCSG, cPanel);
            textCSG.setEditable(false);
            textCSG.setEnabled(false);

            // net imposable
            cPanel.gridx = 0;
            cPanel.gridy++;
            JLabel labelNetImp = new JLabel(getLabelFor("NET_IMP"));
            panelTotal.add(labelNetImp, cPanel);
            JTextField textNetImp = new JTextField(10);
            cPanel.gridx++;
            panelTotal.add(textNetImp, cPanel);
            textNetImp.setEditable(false);
            textNetImp.setEnabled(false);

            cPanel.gridx++;
            JLabel labelNetAPayer = new JLabel(getLabelFor("NET_A_PAYER"));
            panelTotal.add(labelNetAPayer, cPanel);
            JTextField textNetAPayer = new JTextField(10);
            cPanel.gridx++;
            panelTotal.add(textNetAPayer, cPanel);
            textNetAPayer.setEditable(false);
            textNetAPayer.setEnabled(false);

            c.gridx = 1;
            c.gridy++;
            c.gridwidth = GridBagConstraints.REMAINDER;
            panelRight.add(panelTotal, c);

            // Cumuls

            c.gridx = 1;
            c.gridy++;
            c.gridwidth = 1;
            c.fill = GridBagConstraints.NONE;
            this.buttonValider = new JButton("Valider");
            // panelRight.add(buttonValider, c);

            c.gridx++;
            c.gridwidth = 1;
            this.buttonGenCompta = new JButton("Generer la comptabilit");
            // panelRight.add(buttonGenCompta, c);

            c.gridx = 0;
            c.gridy = 0;
            c.gridwidth = 1;
            c.gridheight = 1;
            c.fill = GridBagConstraints.BOTH;
            c.weightx = 1;
            c.weighty = 1;
            this.add(new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, this.paneTreeLeft, panelRight), c);

            // Listeners
            this.buttonGenCompta.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    int[] i = new int[1];
                    i[0] = getSelectedID();

                    SQLRow rowMois = getTable().getBase().getTable("MOIS").getRow(selMois.getSelectedId());

                    new GenerationMvtFichePaye(i, rowMois.getString("NOM"), textAnnee.getText());
                }
            });

            this.buttonValider.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    System.err.println("Validation de la fiche de paye");
                    validationFiche();
                }
            });

            buttonUp.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    int newRowSelected = model.upRow(table.getSelectedRow());
                    if (newRowSelected >= 0) {
                        table.setRowSelectionInterval(newRowSelected, newRowSelected);
                    }
                }
            });

            buttonDown.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    int newRowSelected = model.downRow(table.getSelectedRow());
                    if (newRowSelected >= 0) {
                        table.setRowSelectionInterval(newRowSelected, newRowSelected);
                    }
                }
            });

            buttonRemove.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent e) {
                    model.removeRow(table.getSelectedRow());
                }
            });

            tree.addMouseListener(new MouseAdapter() {

                public void mousePressed(MouseEvent mE) {

                    TreePath path = tree.getClosestPathForLocation(mE.getPoint().x, mE.getPoint().y);

                    final Object obj = path.getLastPathComponent();

                    if (obj == null) {
                        return;
                    }

                    if (mE.getClickCount() == 2 && mE.getButton() == MouseEvent.BUTTON1) {

                        if (obj instanceof VariableRowTreeNode) {
                            model.addRowAt(((VariableRowTreeNode) obj).getRow(), table.getSelectedRow());
                        }
                    } else {

                        if (mE.getButton() == 3) {

                            if (obj instanceof VariableRowTreeNode) {

                                final SQLRow row = ((VariableRowTreeNode) obj).getRow();

                                JPopupMenu menuDroit = new JPopupMenu();

                                menuDroit.add(new AbstractAction("Editer") {
                                    public void actionPerformed(ActionEvent e) {

                                        if (edit != null) {
                                            edit.dispose();
                                        }
                                        edit = new EditFrame(Configuration.getInstance().getDirectory()
                                                .getElement(row.getTable()), EditFrame.MODIFICATION);
                                        edit.selectionId(row.getID(), 0);
                                        edit.pack();
                                        edit.setVisible(true);
                                    }
                                });

                                menuDroit.add(new AbstractAction("Nouvelle rubrique") {
                                    public void actionPerformed(ActionEvent e) {

                                        if (edit != null) {
                                            edit.dispose();
                                        }
                                        edit = new EditFrame(Configuration.getInstance().getDirectory()
                                                .getElement(row.getTable()));
                                        edit.pack();
                                        edit.setVisible(true);
                                    }
                                });

                                menuDroit.show(mE.getComponent(), mE.getPoint().x, mE.getPoint().y);

                            }
                        }
                    }
                }
            });

            this.dateDu.addValueListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    if (!dateDu.isEmpty()) {
                        Date d = dateDu.getValue();

                        if (d != null) {
                            Calendar cal = Calendar.getInstance();
                            cal.setTime(d);
                            if (selMois.getSelectedId() > 1
                                    && cal.get(Calendar.MONTH) + 2 != selMois.getSelectedId()) {

                                cal.set(Calendar.DAY_OF_MONTH, 1);
                                cal.set(Calendar.MONTH, selMois.getSelectedId() - 2);
                                System.err.println("Du " + cal.getTime());
                                dateDu.setValue(cal.getTime());
                            }
                        }
                    }
                }
            });

            this.dateAu.addValueListener(new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    if (!dateAu.isEmpty()) {
                        Date d = dateAu.getValue();
                        if (d != null) {
                            Calendar cal = Calendar.getInstance();
                            cal.setTime(d);
                            if (selMois.getSelectedId() > 1
                                    && cal.get(Calendar.MONTH) + 2 != selMois.getSelectedId()) {

                                // TODO checker l'annee
                                // TODO ajouter dans le isValidated du au compris dans le mois
                                // selectionne

                                // Calendar.getInstance().set(Calendar.DAY_OF_MONTH, maxDay);
                                cal.set(Calendar.DAY_OF_MONTH, 1);
                                cal.set(Calendar.MONTH, selMois.getSelectedId() - 2);
                                cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
                                System.err.println("Au " + cal.getTime());
                                dateAu.setValue(cal.getTime());
                            }
                        }
                    }
                }
            });

            this.addRequiredSQLObject(this.textAnnee, "ANNEE");
            this.addRequiredSQLObject(this.selMois, "ID_MOIS");
            this.addSQLObject(this.comboSelProfil, "ID_PROFIL_PAYE");

            this.addSQLObject(textCongesAcquis, "CONGES_ACQUIS");
            this.addSQLObject(textCotPat, "COT_PAT");
            this.addSQLObject(textCotSal, "COT_SAL");
            this.addSQLObject(textCSG, "CSG");
            this.addSQLObject(textNetAPayer, "NET_A_PAYER");
            this.addSQLObject(textNetImp, "NET_IMP");
            this.addSQLObject(textSalBrut, "SAL_BRUT");
            this.addSQLObject(textAcompte, "ACOMPTE");
            this.addSQLObject(this.selSalCombo, "ID_SALARIE");

            this.addRequiredSQLObject(this.dateDu, "DU");
            this.addRequiredSQLObject(this.dateAu, "AU");

            this.selSalCombo.setEditable(false);
            this.selSalCombo.setEnabled(false);
            this.selSalCombo.setButtonsVisible(false);
            // this.selSalCombo.setVisible(false);

            buttonImportProfil.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {

                    model.loadFromProfil(comboSelProfil.getSelectedId());
                }
            });
        }

        private boolean isDateValid() {

            String yearS = this.textAnnee.getText().trim();
            int annee = (yearS.length() == 0) ? 0 : Integer.parseInt(yearS);

            int mois = this.selMois.getSelectedId();
            // System.err.println("anne " + annee + " dernAnnee " + this.dernAnnee + " mois " +
            // mois + " dernMois " + this.dernMois);

            return ((this.dernAnnee == 0) ? true : annee > this.dernAnnee)
                    || ((this.dernMois == 0 || this.dernMois == 13) ? true : mois > this.dernMois);
        }

        @Override
        public synchronized ValidState getValidState() {
            // FIXME add fireValidChange()
            return super.getValidState().and(ValidState.createCached(isDateValid(), "Date invalide"));
        }

        public int insert(SQLRow order) {

            int id = super.insert(order);
            this.model.updateFields(id);
            return id;
        }

        @Override
        public void update() {
            super.update();
            this.model.updateFields(this.getSelectedID());
        }

        @Override
        public void select(SQLRowAccessor r) {

            // System.err.println("SELECT FICHE ID -> " + r.getID());
            super.select(r);

            if (r != null && r.getID() > 1) {
                this.model.setFicheID(r.getID());

                SQLTable tableSal = getTable().getBase().getTable("SALARIE");
                SQLRow rowSal = tableSal.getRow(r.getInt("ID_SALARIE"));

                this.dernMois = rowSal.getInt("DERNIER_MOIS");
                this.dernAnnee = rowSal.getInt("DERNIERE_ANNEE");

                this.selSalCombo.setVisible(((Boolean) r.getObject("VALIDE")).booleanValue());
                this.paneTreeLeft.setVisible(!((Boolean) r.getObject("VALIDE")).booleanValue());
                this.buttonValider.setVisible(!((Boolean) r.getObject("VALIDE")).booleanValue());
                setpDateEnabled(!((Boolean) r.getObject("VALIDE")).booleanValue());
            }
            this.selSalCombo.setEditable(false);
            this.selSalCombo.setEnabled(false);
            this.selMois.setButtonsVisible(false);
            this.selSalCombo.setButtonsVisible(false);
        }

        private void setpDateEnabled(boolean b) {

            // System.err.println("Set date enable --> " + b);
            this.selMois.setEditable(b);
            // this.selMois.setEnabled(b);

            this.textAnnee.setEditable(b);
            this.textAnnee.setEnabled(b);

            this.dateDu.setEditable(b);
            this.dateDu.setEnabled(b);

            this.dateAu.setEditable(b);
            this.dateAu.setEnabled(b);
        }

        private void validationFiche() {

            this.update();
            FichePayeSQLElement.validationFiche(this.getSelectedID());
        }

        protected SQLRowValues createDefaults() {

            System.err.println("**********Set Defaults on FichePaye.date");
            SQLRowValues rowVals = new SQLRowValues(getTable());
            Calendar cal = Calendar.getInstance();
            rowVals.put("ID_MOIS", cal.get(Calendar.MONTH) + 2);
            rowVals.put("ANNEE", cal.get(Calendar.YEAR));

            cal.set(Calendar.DAY_OF_MONTH, 1);
            rowVals.put("DU", new java.sql.Date(cal.getTime().getTime()));

            cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
            rowVals.put("AU", new java.sql.Date(cal.getTime().getTime()));
            return rowVals;
        }

    };
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserProfile.java

/**
 * Builds the panel hosting the user's details.
 * /*from  w  w  w .  j av  a  2  s .com*/
 * @return See above.
 */
private JPanel buildContentPanel() {
    ExperimenterData user = (ExperimenterData) model.getRefObject();
    boolean editable = model.isUserOwner(user);
    if (!editable)
        editable = MetadataViewerAgent.isAdministrator();
    details = EditorUtil.convertExperimenter(user);
    JPanel content = new JPanel();
    content.setBorder(BorderFactory.createTitledBorder("User"));
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    Entry<String, String> entry;
    Iterator<Entry<String, String>> i = details.entrySet().iterator();
    JComponent label;
    JTextField area;
    String key, value;
    content.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    //Add log in name but cannot edit.
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;//end row
    c.fill = GridBagConstraints.HORIZONTAL;
    content.add(buildProfileCanvas(), c);
    c.gridy++;
    c.gridx = 0;
    label = EditorUtil.getLabel(EditorUtil.DISPLAY_NAME, true);
    label.setBackground(UIUtilities.BACKGROUND_COLOR);
    c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
    c.fill = GridBagConstraints.NONE;//reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER;//end row
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    loginArea.setText(user.getUserName());
    loginArea.setEnabled(false);
    loginArea.setEditable(false);
    if (MetadataViewerAgent.isAdministrator() && !model.isSystemUser(user.getId()) && !model.isSelf()) {
        loginArea.setEnabled(true);
        loginArea.getDocument().addDocumentListener(this);
    }
    content.add(loginArea, c);
    while (i.hasNext()) {
        ++c.gridy;
        c.gridx = 0;
        entry = i.next();
        key = entry.getKey();
        value = entry.getValue();
        label = EditorUtil.getLabel(key, EditorUtil.FIRST_NAME.equals(key) || EditorUtil.LAST_NAME.equals(key));
        area = new JTextField(value);
        area.setBackground(UIUtilities.BACKGROUND_COLOR);
        area.setEditable(editable);
        area.setEnabled(editable);
        if (editable)
            area.getDocument().addDocumentListener(this);
        items.put(key, area);
        label.setBackground(UIUtilities.BACKGROUND_COLOR);
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
        c.fill = GridBagConstraints.NONE;//reset to default
        c.weightx = 0.0;
        content.add(label, c);
        c.gridx++;
        content.add(Box.createHorizontalStrut(5), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;//end row
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1.0;
        content.add(area, c);
    }
    c.gridx = 0;
    c.gridy++;
    label = EditorUtil.getLabel(EditorUtil.DEFAULT_GROUP, false);
    c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
    c.fill = GridBagConstraints.NONE;//reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    content.add(groupsBox, c);
    c.gridy++;
    content.add(permissionsPane, c);
    c.gridx = 0;
    c.gridy++;
    label = EditorUtil.getLabel(EditorUtil.GROUP_OWNER, false);
    c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
    c.fill = GridBagConstraints.NONE; //reset to default
    c.weightx = 0.0;
    content.add(label, c);
    c.gridx++;
    content.add(Box.createHorizontalStrut(5), c);
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER; //end row
    c.fill = GridBagConstraints.NONE;
    c.weightx = 1.0;
    content.add(ownerBox, c);
    if (activeBox.isVisible()) {
        c.gridx = 0;
        c.gridy++;
        label = EditorUtil.getLabel(EditorUtil.ACTIVE, false);
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0.0;
        content.add(label, c);
        c.gridx++;
        content.add(Box.createHorizontalStrut(5), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.NONE;
        c.weightx = 1.0;
        content.add(activeBox, c);
    }
    if (adminBox.isVisible()) {
        c.gridx = 0;
        c.gridy++;
        label = EditorUtil.getLabel(EditorUtil.ADMINISTRATOR, false);
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
        c.fill = GridBagConstraints.NONE;
        c.weightx = 0.0;
        content.add(label, c);
        c.gridx++;
        content.add(Box.createHorizontalStrut(5), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.NONE;
        c.weightx = 1.0;
        content.add(adminBox, c);
    }
    c.gridx = 0;
    c.gridy++;
    content.add(Box.createHorizontalStrut(10), c);
    c.gridy++;
    label = UIUtilities.setTextFont(EditorUtil.MANDATORY_DESCRIPTION, Font.ITALIC);
    label.setForeground(UIUtilities.REQUIRED_FIELDS_COLOR);
    c.weightx = 0.0;
    content.add(label, c);
    return content;
}