Example usage for java.awt Cursor HAND_CURSOR

List of usage examples for java.awt Cursor HAND_CURSOR

Introduction

In this page you can find the example usage for java.awt Cursor HAND_CURSOR.

Prototype

int HAND_CURSOR

To view the source code for java.awt Cursor HAND_CURSOR.

Click Source Link

Document

The hand cursor type.

Usage

From source file:org.earthtime.UPb_Redux.dateInterpretation.WeightedMeanGraphPanel.java

/**
 *
 * @param imageMode//from  ww w .j a v  a2s.c o  m
 */
public void setImageMode(String imageMode) {
    this.imageMode = imageMode;
    if (imageMode.equalsIgnoreCase("PAN")) {
        weightedMeanCursor = new Cursor((Cursor.HAND_CURSOR));
    } else if (imageMode.equalsIgnoreCase("ZOOM")) {
        weightedMeanCursor = new Cursor((Cursor.CROSSHAIR_CURSOR));
    }
    // force issue
    setCursor(weightedMeanCursor);
}

From source file:Installer.java

public static JLabel linkify(final String text, String URL, String toolTip) {
    URI temp = null;//from ww  w . java 2s.  c  om
    try {
        temp = new URI(URL);
    } catch (Exception e) {
        e.printStackTrace();
    }
    final URI uri = temp;
    final JLabel link = new JLabel();
    link.setText("<HTML><FONT color=\"#000099\">" + text + "</FONT></HTML>");
    if (!toolTip.equals(""))
        link.setToolTipText(toolTip);
    link.setCursor(new Cursor(Cursor.HAND_CURSOR));
    link.addMouseListener(new MouseListener() {
        public void mouseExited(MouseEvent arg0) {
            link.setText("<HTML><FONT color=\"#000099\">" + text + "</FONT></HTML>");
        }

        public void mouseEntered(MouseEvent arg0) {
            link.setText("<HTML><FONT color=\"#000099\"><U>" + text + "</U></FONT></HTML>");
        }

        public void mouseClicked(MouseEvent arg0) {
            if (Desktop.isDesktopSupported()) {
                try {
                    Desktop.getDesktop().browse(uri);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            } else {
                JOptionPane pane = new JOptionPane("Could not open link.");
                JDialog dialog = pane.createDialog(new JFrame(), "");
                dialog.setVisible(true);
            }
        }

        public void mousePressed(MouseEvent e) {
        }

        public void mouseReleased(MouseEvent e) {
        }
    });
    return link;
}

From source file:base.BasePlayer.ClusterTable.java

void drawScreen(Graphics g) {
    try {/*from  w  ww  .j a  v  a 2 s .  c  o  m*/

        buf.setColor(Color.black);
        buf.fillRect(0, 0, this.getWidth(), tablescroll.getViewport().getHeight());
        genemutcount = 0;
        hoverVar = null;
        hoverSample = -1;
        headerHover = -1;
        geneHeaderHover = -1;

        if (!mouseDrag) {
            resizeColumn = -1;
        }
        if (Main.drawCanvas.clusterNodes != null) {
            firstrow = tablescroll.getVerticalScrollBar().getValue() / rowHeight - 1
                    - Main.drawCanvas.clusterNodes.size();

            if (firstrow < 0) {
                firstrow = 0;
            }
            for (int i = 0; i < Main.drawCanvas.clusterNodes.size(); i++) {
                dot = false;

                if ((i + 1 + samplecount + Main.drawCanvas.clusterNodes.size()) * rowHeight < tablescroll
                        .getVerticalScrollBar().getValue()) {
                    continue;
                }

                if (i * rowHeight > tablescroll.getVerticalScrollBar().getValue()
                        + tablescroll.getViewport().getHeight()) {
                    break;
                }

                if (mouseY >= (rowHeight * (i + genemutcount + 1))
                        && mouseY < (rowHeight * (i + genemutcount + 2))) {
                    hoverNode = Main.drawCanvas.clusterNodes.get(i);
                }
                try {
                    buf.setColor(Color.darkGray);
                    buf.drawLine(4,
                            (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue()
                                    + 3,
                            this.getWidth(), (rowHeight * (i + genemutcount + 1))
                                    - tablescroll.getVerticalScrollBar().getValue() + 3);

                    buf.setColor(linecolor);
                    cluster = Main.drawCanvas.clusterNodes.get(i);
                    if (cluster.varnodes.get(0).getTranscripts() != null) {
                        if (!chrom.equals(cluster.varnodes.get(0).getTranscripts().get(0).getChrom())) {
                            chrom = cluster.varnodes.get(0).getTranscripts().get(0).getChrom();
                        }
                    } else {
                        if (!chrom.equals(cluster.varnodes.get(0).getExons().get(0).transcript.getChrom())) {
                            chrom = cluster.varnodes.get(0).getExons().get(0).transcript.getChrom();
                        }
                    }

                    for (int c = 0; c < header.size(); c++) {

                        if (Main.drawCanvas.clusterNodes.get(i).equals(hoverNode)
                                || Main.drawCanvas.clusterNodes.get(i).equals(selectedNode)) {

                            buf.setColor(Color.yellow);
                        } else {
                            buf.setColor(Color.white);
                        }

                        if (c == 0) {

                            buf.drawString("" + cluster.ID, (int) header.get(c)[1] + 5,
                                    (rowHeight * (i + 1 + genemutcount))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                        } else if (c == 1) {
                            buf.drawString("" + cluster.nodecount, (int) header.get(c)[1] + 5,
                                    (rowHeight * (i + 1 + genemutcount))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                        } else if (c == 2) {
                            buf.drawString("" + cluster.width, (int) header.get(c)[1] + 5,
                                    (rowHeight * (i + 1 + genemutcount))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                        } else if (c == 3) {
                            buf.drawString(
                                    chrom + ":"
                                            + MethodLibrary.formatNumber(cluster.varnodes.get(0).getPosition()),
                                    (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                        } else if (c == 4) {
                            buf.drawString(
                                    "" + MethodLibrary.round((cluster.nodecount / (double) cluster.width), 4),
                                    (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                        } else if (c == 5) {
                            if (cluster.varnodes.get(0).getExons() != null) {

                                if (cluster.varnodes.get(0).coding) {
                                    buf.setColor(Color.red);
                                    buf.drawString(
                                            cluster.varnodes.get(0).getExons().get(0).getTranscript()
                                                    .getGenename() + " (Coding)",
                                            (int) header.get(c)[1] + 5,
                                            (rowHeight * (i + 1 + genemutcount))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);

                                } else {
                                    buf.setColor(Color.lightGray);
                                    buf.drawString(
                                            cluster.varnodes.get(0).getExons().get(0).getTranscript()
                                                    .getGenename() + " (UTR)",
                                            (int) header.get(c)[1] + 5,
                                            (rowHeight * (i + 1 + genemutcount))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);

                                }
                            } else if (cluster.varnodes.get(0).isInGene()) {
                                buf.setColor(Color.lightGray);
                                buf.drawString(
                                        cluster.varnodes.get(0).getTranscripts().get(0).getGenename()
                                                + " (Intronic)",
                                        (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            } else {
                                buf.setColor(Color.gray);
                                if (!cluster.varnodes.get(0).getTranscripts().get(0)
                                        .equals(cluster.varnodes.get(0).getTranscripts().get(1))) {
                                    buf.drawString(
                                            cluster.varnodes.get(0).getTranscripts().get(0).getGenename()
                                                    + " ... "
                                                    + cluster.varnodes
                                                            .get(0).getTranscripts().get(1).getGenename(),
                                            (int) header.get(c)[1] + 5,
                                            (rowHeight * (i + 1 + genemutcount))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);

                                } else {
                                    if (cluster.varnodes.get(0).getTranscripts().get(0)
                                            .getEnd() > cluster.varnodes.get(0).getPosition()) {
                                        buf.drawString(
                                                " ... " + cluster.varnodes
                                                        .get(0).getTranscripts().get(0).getGenename(),
                                                (int) header.get(c)[1] + 5,
                                                (rowHeight * (i + 1 + genemutcount))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                    } else {
                                        buf.drawString(
                                                cluster.varnodes.get(0).getTranscripts().get(0).getGenename()
                                                        + " ... ",
                                                (int) header.get(c)[1] + 5,
                                                (rowHeight * (i + 1 + genemutcount))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);

                                    }
                                }
                            }
                        } else if (c == 6) {

                            if (cluster.varnodes.get(0).getBedHits() != null) {
                                bedarray = MethodLibrary.makeTrackArray(cluster.varnodes.get(0), null);
                                for (int b = 0; b < bedarray.length; b++) {
                                    buf.setColor(Color.black);
                                    if (b == bedarray.length - 1) {
                                        buf.fillRect((int) header.get(c + b)[1] + 1,
                                                (rowHeight * (i + genemutcount + 1))
                                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                this.getWidth() - (int) header.get(c + b)[1], rowHeight - 1);
                                    } else {
                                        buf.fillRect((int) header.get(c + b)[1] + 1,
                                                (rowHeight * (i + genemutcount + 1))
                                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                (int) header.get(c + b)[2], rowHeight - 1);

                                    }
                                    buf.setColor(Color.white);
                                    if (bedarray[b] != null) {
                                        buf.drawString(bedarray[b].toString(), (int) header.get(c + b)[1] + 5,
                                                (rowHeight * (i + 1 + genemutcount))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);

                                    }
                                }
                            }
                        }
                        if (c < header.size() - 1 - Main.bedCanvas.bedTrack.size()) {
                            buf.setColor(Color.black);
                            buf.fillRect((int) header.get(c + 1)[1] + 1,
                                    (rowHeight * (i + genemutcount + 1))
                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                    (int) header.get(c + 1)[2], rowHeight - 1);

                        }
                    }
                    buf.setColor(Color.darkGray);
                    buf.drawLine(3, rowHeight + 3, 3, (rowHeight * (i + genemutcount + 2))
                            - tablescroll.getVerticalScrollBar().getValue() + 3);

                    for (int r = 0; r < header.size(); r++) {
                        buf.drawLine((int) header.get(r)[1],
                                (rowHeight * (i + genemutcount + 1))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                (int) header.get(r)[1], (rowHeight * (i + genemutcount + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3);
                    }
                    if (selectedNode != null && selectedNode.equals(cluster)) {

                        hoverSample = -1;
                        genemutcount = aminoarray.size() + 1;
                        listAdd = 1;
                        buf.drawLine(20,
                                (rowHeight * (i + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue()
                                        + 3,
                                this.getWidth(), (rowHeight * (i + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3);
                        drawGeneheader((rowHeight * (i + listAdd + 1))
                                - tablescroll.getVerticalScrollBar().getValue() + 3);

                        for (int s = 0; s < aminoarray.size(); s++) {

                            buf.setColor(Color.darkGray);
                            buf.drawLine(21,
                                    (rowHeight * (i + s + listAdd + 3))
                                            - tablescroll.getVerticalScrollBar().getValue() + 3,
                                    this.getWidth(), (rowHeight * (i + s + listAdd + 3))
                                            - tablescroll.getVerticalScrollBar().getValue() + 3);

                            if (mouseY >= (rowHeight * (i + s + listAdd + 2))
                                    && mouseY < (rowHeight * (i + s + listAdd + 3))) {
                                hoverNode = null;
                                hoverVar = aminoarray.get(s).getNode();
                                hoverString = aminoarray.get(s).getRow();
                                buf.setColor(Color.white);

                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {
                                        hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                .getSample().getIndex();
                                        break;
                                    }
                                }
                            } else {
                                if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("nonsense")) {
                                    buf.setColor(Color.red);
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("missense")) {
                                    buf.setColor(Color.yellow);
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("synonymous")) {
                                    buf.setColor(Color.green);
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("UTR")) {
                                    buf.setColor(Color.lightGray);
                                } else {
                                    buf.setColor(Color.gray);
                                }
                            }
                            if (!aminoarray.get(s).getRow()[1].equals("1")) {

                                buf.drawString("Multiple", 24, (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                            } else {
                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {

                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {

                                        buf.drawString(
                                                aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                        .getSample().getName(),
                                                24,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                        break;
                                    }
                                }

                            }

                            if (hoverVar != null && hoverString.equals(aminoarray.get(s).getRow())) {
                                //TODO
                                textcolor = Color.white;

                            } else {
                                if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("nonsense")) {
                                    textcolor = Color.red;
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("missense")) {
                                    textcolor = Color.yellow;
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("synonymous")) {
                                    textcolor = Color.green;
                                } else if (aminoarray.get(s).getRow()[3].contains("UTR")) {
                                    textcolor = Color.lightGray;
                                } else {
                                    textcolor = Color.gray;
                                }
                            }
                            for (int h = 1; h < 4; h++) {
                                buf.setColor(Color.black);
                                buf.fillRect((int) geneheader.get(h)[1] + 10,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + 4,
                                        (int) geneheader.get(h)[2], rowHeight - 1);
                                buf.setColor(textcolor);
                                buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(h)[1] + 14,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            }

                            if (aminoarray.get(s).getRow()[1].equals("1")) {
                                buf.setColor(Color.black);
                                buf.fillRect((int) geneheader.get(4)[1] + 10,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + 4,
                                        this.getWidth(), rowHeight - 1);
                                buf.setColor(textcolor);

                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {
                                        if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                .isHomozygous()) {
                                            buf.drawString(
                                                    "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                            .get(0).getCalls() + "/"
                                                            + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                                    .get(0).getCoverage()
                                                            + ")",
                                                    (int) geneheader.get(4)[1] + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            if (Control.controlData.controlsOn) {
                                                cases = 2;
                                                casefreq = 2 / (double) (Main.varsamples * 2);
                                            }
                                        } else {
                                            buf.drawString(
                                                    "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                            .get(0).getCalls() + "/"
                                                            + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                                    .get(0).getCoverage()
                                                            + ")",
                                                    (int) geneheader.get(4)[1] + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            if (Control.controlData.controlsOn) {
                                                cases = 1;
                                                casefreq = 1 / (double) (Main.varsamples * 2);
                                            }

                                        }
                                        buf.setColor(Color.black);
                                        buf.fillRect((int) geneheader.get(5)[1] + 1,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                this.getWidth(), rowHeight - 1);
                                        buf.setColor(textcolor);
                                        buf.drawString(
                                                "" + aminoarray.get(s).getNode().vars
                                                        .get(v).getValue().get(0).getQuality(),
                                                (int) geneheader.get(5)[1] + 14,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);

                                    }
                                }
                            }

                            if (Control.controlData.controlsOn) {
                                cases = 0;
                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {
                                        if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                .isHomozygous()) {
                                            cases += Integer.parseInt(aminoarray.get(s).getRow()[1]) * 2;
                                        } else {
                                            cases += Integer.parseInt(aminoarray.get(s).getRow()[1]);
                                        }
                                    }
                                }
                                casefreq = cases / (double) (Main.varsamples * 2);
                            }

                            buf.setColor(textcolor);
                            buf.drawString(aminoarray.get(s).getRow()[4], (int) geneheader.get(6)[1] + 14,
                                    (rowHeight * (i + s + listAdd + 2))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            if (Control.controlData.controlsOn) {
                                buf.setColor(textcolor);

                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {
                                        vararray = aminoarray.get(s).getNode().vars.get(v).getValue();
                                        controlarray = new SampleNode[Control.controlData.fileArray.size()];
                                        if (vararray.get(vararray.size() - 1).alleles != null) {

                                            for (int e = vararray.size() - 1; e > 0; e--) {

                                                if (vararray.get(e).alleles == null) {
                                                    break;
                                                }
                                                controlarray[vararray.get(e).getControlSample()
                                                        .getIndex()] = vararray.get(e);

                                            }
                                        }
                                        for (int e = 0; e < controlarray.length; e++) {
                                            if (Control.controlData.fileArray.get(e).controlOn) {
                                                if (controlarray[e] == null) {
                                                    buf.setColor(Color.black);
                                                    buf.fillRect(
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2)[1] + 11,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue() + 4,
                                                            this.getWidth(), rowHeight - 1);
                                                    buf.setColor(textcolor);
                                                    buf.drawString("0",
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2)[1] + 14,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue()
                                                                    + rowHeight);
                                                    buf.setColor(Color.black);
                                                    buf.fillRect(
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2 + 1)[1]
                                                                    + 11,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue() + 4,
                                                            this.getWidth(), rowHeight - 1);
                                                    buf.setColor(textcolor);
                                                    buf.drawString("-",
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2 + 1)[1]
                                                                    + 14,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue()
                                                                    + rowHeight);

                                                } else {
                                                    buf.setColor(Color.black);
                                                    buf.fillRect(
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2)[1] + 11,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue() + 4,
                                                            this.getWidth(), rowHeight - 1);
                                                    buf.setColor(textcolor);
                                                    buf.drawString(
                                                            "" + MethodLibrary.round(controlarray[e].alleles
                                                                    / (double) controlarray[e].allelenumber, 2),
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2)[1] + 14,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue()
                                                                    + rowHeight);
                                                    buf.setColor(Color.black);
                                                    buf.fillRect(
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2 + 1)[1]
                                                                    + 11,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue() + 4,
                                                            this.getWidth(), rowHeight - 1);
                                                    buf.setColor(textcolor);
                                                    buf.drawString("" + MethodLibrary
                                                            .round(casefreq / (controlarray[e].alleles
                                                                    / (double) controlarray[e].allelenumber), 2)
                                                            + " (p="
                                                            + MethodLibrary.round(
                                                                    VariantHandler.table.fe.getRightTailedP(
                                                                            cases, Main.varsamples * 2 - cases,
                                                                            controlarray[e].alleles,
                                                                            controlarray[e].allelenumber
                                                                                    - controlarray[e].alleles),
                                                                    2)
                                                            + ")",
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2 + 1)[1]
                                                                    + 14,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue()
                                                                    + rowHeight);
                                                }
                                            } else {
                                                buf.setColor(Color.black);
                                                buf.fillRect(
                                                        (int) geneheader.get(this.geneheaderlength + e * 2)[1]
                                                                + 11,
                                                        (rowHeight * (i + s + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + 4,
                                                        this.getWidth(), rowHeight - 1);
                                                buf.setColor(Color.darkGray);
                                                buf.drawString("Apply controls",
                                                        (int) geneheader.get(this.geneheaderlength + e * 2)[1]
                                                                + 14,
                                                        (rowHeight * (i + s + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);
                                                buf.setColor(Color.black);
                                                buf.fillRect(
                                                        (int) geneheader
                                                                .get(this.geneheaderlength + e * 2 + 1)[1] + 11,
                                                        (rowHeight * (i + s + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + 4,
                                                        this.getWidth(), rowHeight - 1);
                                                buf.setColor(Color.darkGray);
                                                buf.drawString("-",
                                                        (int) geneheader
                                                                .get(this.geneheaderlength + e * 2 + 1)[1] + 14,
                                                        (rowHeight * (i + s + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);

                                            }
                                        }
                                    }
                                }
                            } else {
                                buf.setColor(Color.darkGray);

                                for (int e = geneheaderlength; e < geneheader.size(); e++) {
                                    if (geneheader.get(e)[0] instanceof ControlFile) {
                                        buf.drawString("Apply controls", (int) geneheader.get(e)[1] + 14,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                    }
                                }
                                buf.setColor(Color.lightGray);
                            }
                            vararray = null;
                            if (Main.bedCanvas.bedOn) {
                                for (int a = 0; a < aminoarray.size(); a++) {
                                    bedarray = MethodLibrary.makeTrackArray(aminoarray.get(a).getNode(),
                                            aminoarray.get(a).getRow()[5]);
                                    if (bedarray != null) {
                                        for (int b = 0; b < bedarray.length; b++) {
                                            buf.setColor(Color.black);
                                            if (b == bedarray.length - 1) {
                                                buf.fillRect(
                                                        (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + b)[1] + 12,
                                                        (rowHeight * (i + a + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + 4,
                                                        this.getWidth() - (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + b)[1],
                                                        rowHeight - 1);
                                            } else {
                                                buf.fillRect(
                                                        (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + b)[1] + 12,
                                                        (rowHeight * (i + a + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + 4,
                                                        (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + b)[2],
                                                        rowHeight - 1);
                                            }
                                            buf.setColor(Color.white);
                                            if (bedarray[b] != null) {
                                                buf.drawString(bedarray[b].toString(),
                                                        (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + b)[1] + 14,
                                                        (rowHeight * (i + a + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);

                                            }
                                        }
                                    }
                                }
                            }
                            buf.setColor(Color.darkGray);
                            for (int j = 0; j < geneheader.size(); j++) {

                                buf.drawLine((int) geneheader.get(j)[1] + 11,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + 4,
                                        (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + listAdd + 3))
                                                - tablescroll.getVerticalScrollBar().getValue() + 3);
                            }
                            if (selectedVar != null && selectedString.equals(aminoarray.get(s).getRow())
                                    && Integer.parseInt(selectedString[1]) > 1) {
                                //hoverSample = -1;
                                pointer = 0;
                                //TODO

                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(selectedString[5])) {

                                        for (int l = 0; l < aminoarray.get(s).getNode().vars.get(v).getValue()
                                                .size(); l++) {
                                            if (aminoarray.get(s).getNode().vars.get(v).getValue()
                                                    .get(l).alleles != null) {
                                                break;
                                            }
                                            if (mouseY > (rowHeight * (i + s + pointer + 4))
                                                    && mouseY < (rowHeight * (i + s + pointer + 5))) {
                                                textcolor = Color.white;

                                                hoverVar = aminoarray.get(s).getNode();
                                                hoverString = aminoarray.get(s).getRow();
                                                hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue()
                                                        .get(l).getSample().getIndex();
                                            } else {
                                                textcolor = Color.lightGray;
                                            }

                                            //   if(aminoarray.get(s).getNode().getSamples().get(l).getVariation().equals(selectedString[5])) {                           
                                            buf.setColor(textcolor);
                                            buf.drawString(
                                                    aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                                            .getSample().getName(),
                                                    30,
                                                    (rowHeight * (i + s + pointer + 4))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            pointer++;
                                            //   }   

                                            buf.setColor(Color.black);
                                            buf.fillRect((int) geneheader.get(4)[1] + 10,
                                                    (rowHeight * (i + s + pointer + 3))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                                    .isHomozygous()) {
                                                buf.drawString(
                                                        "Hom (" + aminoarray.get(s).getNode().vars.get(v)
                                                                .getValue().get(l).getCalls() + "/"
                                                                + aminoarray.get(s).getNode().vars.get(v)
                                                                        .getValue().get(l).getCoverage()
                                                                + ")",
                                                        (int) geneheader.get(4)[1] + 14,
                                                        (rowHeight * (i + s + pointer + 3))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);

                                            } else {
                                                buf.drawString(
                                                        "Het (" + aminoarray.get(s).getNode().vars.get(v)
                                                                .getValue().get(l).getCalls() + "/"
                                                                + aminoarray.get(s).getNode().vars.get(v)
                                                                        .getValue().get(l).getCoverage()
                                                                + ")",
                                                        (int) geneheader.get(4)[1] + 14,
                                                        (rowHeight * (i + s + pointer + 3))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);
                                            }

                                            buf.setColor(Color.black);
                                            buf.fillRect((int) geneheader.get(5)[1] + 10,
                                                    (rowHeight * (i + s + pointer + 3))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            buf.drawString(
                                                    "" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                            .get(l).getQuality(),
                                                    (int) geneheader.get(5)[1] + 14,
                                                    (rowHeight * (i + s + pointer + 3))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            buf.setColor(Color.darkGray);
                                            for (int j = 4; j < 7; j++) {

                                                buf.drawLine((int) geneheader.get(j)[1] + 11,
                                                        (rowHeight * (i + s + pointer + 3))
                                                                - tablescroll.getVerticalScrollBar().getValue(),
                                                        (int) geneheader.get(j)[1] + 11,
                                                        (rowHeight * (i + s + pointer + 3))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight + 2);
                                            }

                                        }
                                    }
                                }
                                listAdd = Integer.parseInt(selectedString[1]) + 1;
                                genemutcount = aminoarray.size() + listAdd;
                                buf.setColor(Color.darkGray);
                                buf.drawLine(21,
                                        (rowHeight * (i + s + listAdd + 3))
                                                - tablescroll.getVerticalScrollBar().getValue() + 3,
                                        this.getWidth(), (rowHeight * (i + s + listAdd + 3))
                                                - tablescroll.getVerticalScrollBar().getValue() + 3);

                            }

                        }
                    }

                } catch (Exception e) {
                    ErrorLog.addError(e.getStackTrace());
                    e.printStackTrace();
                }

            }
            buf.setColor(Color.darkGray);
            buf.drawLine(4,
                    (rowHeight * (Main.drawCanvas.clusterNodes.size() + genemutcount + 1))
                            - tablescroll.getVerticalScrollBar().getValue() + 3,
                    this.getWidth(), (rowHeight * (Main.drawCanvas.clusterNodes.size() + genemutcount + 1))
                            - tablescroll.getVerticalScrollBar().getValue() + 3);

        }
        drawHeader();

        if (headerHover == -1 && geneHeaderHover == -1) {

            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        } else {
            if (resizeColumn == -1) {
                setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            } else {
                setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
            }
        }

        g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:base.BasePlayer.BedTable.java

void drawScreen(Graphics g) {
    try {//from ww w.  j a  va  2  s  .  com
        buf.setColor(Color.black);

        buf.fillRect(0, 0, this.getWidth(), this.getHeight());
        if (width != this.getWidth()) {
            width = this.getWidth();
            createPolygon();
            resizeTable();
        }

        genemutcount = 0;
        if (!bedtrack.intersect) {
            buf.setColor(Color.white);
            buf.drawString("Press play on bed track to annotate variants", 5, 40);
        } else if (getTableSize() > 0) {

            hoverVar = null;
            hoverSample = -1;
            headerHover = -1;
            geneHeaderHover = -1;
            if (!mouseDrag) {
                resizeColumn = -1;
            }

            if (aminoarray == null) {
                aminoarray = new ArrayList<AminoEntry>();
            }

            firstrow = tablescroll.getVerticalScrollBar().getValue() / rowHeight - samplecount - listAdd
                    - aminoarray.size();

            if (firstrow < 0) {
                firstrow = 0;
            }
            for (int i = firstrow; i < bedarray.size(); i++) {
                dot = false;

                if ((i + 1 + samplecount + listAdd + aminoarray.size()) * rowHeight < tablescroll
                        .getVerticalScrollBar().getValue()) {

                    continue;
                }

                if (i * rowHeight > tablescroll.getVerticalScrollBar().getValue()
                        + tablescroll.getViewport().getHeight()) {

                    break;
                }

                if (mouseY >= (rowHeight * (i + genemutcount + 1))
                        && mouseY < (rowHeight * (i + genemutcount + 2))) {
                    hoverNode = bedarray.get(i);
                }

                try {
                    buf.setColor(Color.darkGray);
                    buf.drawLine(4,
                            (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue()
                                    + 3,
                            this.getWidth(), (rowHeight * (i + genemutcount + 1))
                                    - tablescroll.getVerticalScrollBar().getValue() + 3);

                    if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) {
                        buf.setColor(Color.yellow);
                    } else {
                        buf.setColor(Color.white);
                    }

                    if (bedarray.get(i).getTrack().hasvalues) {
                        buf.drawString(
                                (i + 1) + ".  " + MethodLibrary.shortString(bedarray.get(i).name, 10) + "="
                                        + MethodLibrary.round(bedarray.get(i).value, 3),
                                5, (rowHeight * (i + 1 + genemutcount))
                                        - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                    } else {
                        buf.drawString((i + 1) + ".  " + MethodLibrary.shortString(bedarray.get(i).name, 10), 5,
                                (rowHeight * (i + 1 + genemutcount))
                                        - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                    }
                    buf.setColor(Color.black);
                    buf.fillRect(
                            headerlengths[1][0] + 1, (rowHeight * (i + genemutcount + 1))
                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                            headerlengths[1][1], rowHeight - 1);

                    if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) {
                        buf.setColor(Color.yellow);
                    } else {
                        buf.setColor(Color.white);
                    }
                    mutcountbuffer = new StringBuffer("" + bedarray.get(i).mutations + " ");
                    buf.drawString(mutcountbuffer.toString(), headerlengths[1][0] + 5,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    //      lastpos = Integer.toString(bedarray.get(i).mutations).length() +2;
                    //TODO      textWidth = (int)fm.getStringBounds("", buf).getWidth();

                    //   textWidth = (int)fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                    //   buf.drawString("  ", headerlengths[1][0]+5+textWidth, (rowHeight*(i+1+genemutcount))-tablescroll.getVerticalScrollBar().getValue()+rowHeight);      

                    //   buf.setColor(Color.gray);
                    //   textWidth = (int)fm.getStringBounds(mutcountbuffer.toString() , buf).getWidth();
                    //   buf.drawString(" " +bedarray.get(i).varnodes.size() +" samples",  headerlengths[1][0]+5+textWidth, (rowHeight*(i+1+genemutcount))-tablescroll.getVerticalScrollBar().getValue()+rowHeight);      

                    buf.setColor(Color.black);
                    buf.fillRect(
                            headerlengths[2][0] + 1, (rowHeight * (i + genemutcount + 1))
                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                            this.getWidth(), rowHeight - 1);

                    if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) {
                        buf.setColor(Color.yellow);
                    } else {
                        buf.setColor(Color.white);
                    }

                    buf.drawString(
                            bedarray.get(i).getChrom() + ":"
                                    + MethodLibrary.formatNumber(bedarray.get(i).getPosition() + 1) + "-"
                                    + MethodLibrary.formatNumber(
                                            bedarray.get(i).getPosition() + 1 + bedarray.get(i).getLength()),
                            headerlengths[2][0] + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                    buf.setColor(Color.black);
                    buf.fillRect(
                            headerlengths[3][0] + 1, (rowHeight * (i + genemutcount + 1))
                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                            this.getWidth(), rowHeight - 1);

                    if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) {

                        buf.setColor(Color.yellow);
                    } else {
                        buf.setColor(Color.white);
                    }

                    buf.drawString(MethodLibrary.formatNumber(bedarray.get(i).getLength()),
                            headerlengths[3][0] + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                    buf.setColor(Color.black);
                    buf.fillRect(
                            headerlengths[4][0] + 1, (rowHeight * (i + genemutcount + 1))
                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                            this.getWidth(), rowHeight - 1);

                    if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) {

                        buf.setColor(Color.yellow);
                    } else {
                        buf.setColor(Color.white);
                    }

                    buf.drawString("" + MethodLibrary
                            .round((bedarray.get(i).mutations / (double) bedarray.get(i).getLength()) * 100, 4),
                            headerlengths[4][0] + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                    buf.setColor(Color.black);
                    buf.fillRect(
                            headerlengths[5][0] + 1, (rowHeight * (i + genemutcount + 1))
                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                            this.getWidth(), rowHeight - 1);

                    if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) {

                        buf.setColor(Color.yellow);
                    } else {
                        buf.setColor(Color.white);
                    }
                    firstvisible = 0;
                    if (bedarray.get(i).varnodes != null) {

                        for (int f = 0; f < bedarray.get(i).varnodes.size(); f++) {
                            if (!Main.drawCanvas.hideNode(bedarray.get(i).varnodes.get(f))) {
                                firstvisible = f;
                                break;
                            }
                        }
                        if (bedarray.get(i).varnodes.get(firstvisible).getExons() != null) {

                            if (bedarray.get(i).varnodes.get(firstvisible).coding) {
                                buf.setColor(Color.red);
                                buf.drawString(
                                        bedarray.get(i).varnodes.get(firstvisible).getExons().get(0)
                                                .getTranscript().getGenename() + " (Coding)",
                                        headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            } else {
                                buf.setColor(Color.lightGray);
                                buf.drawString(
                                        bedarray.get(i).varnodes.get(firstvisible).getExons().get(0)
                                                .getTranscript().getGenename() + " (UTR)",
                                        headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            }
                        } else if (bedarray.get(i).varnodes.get(firstvisible).isInGene()) {

                            buf.setColor(Color.lightGray);
                            buf.drawString(
                                    bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0)
                                            .getGenename() + " (Intronic)",
                                    headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                        } else {
                            buf.setColor(Color.gray);

                            if (!bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0).equals(
                                    bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(1))) {

                                buf.drawString(
                                        bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0)
                                                .getGenename()
                                                + " ... "
                                                + bedarray.get(i).varnodes.get(firstvisible).getTranscripts()
                                                        .get(1).getGenename(),
                                        headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            } else {
                                if (bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0)
                                        .getEnd() > bedarray.get(i).varnodes.get(firstvisible).getPosition()) {

                                    buf.drawString(
                                            " ... " + bedarray.get(i).varnodes.get(firstvisible)
                                                    .getTranscripts().get(0).getGenename(),
                                            headerlengths[5][0] + 5,
                                            (rowHeight * (i + 1 + genemutcount))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);
                                } else {
                                    buf.drawString(
                                            bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0)
                                                    .getGenename() + " ... ",
                                            headerlengths[5][0] + 5,
                                            (rowHeight * (i + 1 + genemutcount))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);

                                }
                            }
                        }
                    }

                    buf.setColor(Color.darkGray);
                    buf.drawLine(3, rowHeight + 3, 3, (rowHeight * (i + genemutcount + 2))
                            - tablescroll.getVerticalScrollBar().getValue() + 3);

                    for (int r = 0; r < headerlengths.length; r++) {
                        buf.drawLine(headerlengths[r][0],
                                (rowHeight * (i + genemutcount + 1))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                headerlengths[r][0], (rowHeight * (i + genemutcount + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3);
                    }

                    if (selectedNode != null && selectedNode.equals(bedarray.get(i))) {

                        hoverSample = -1;
                        genemutcount = aminoarray.size() + 1;
                        listAdd = 1;
                        buf.drawLine(20,
                                (rowHeight * (i + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue()
                                        + 3,
                                this.getWidth(), (rowHeight * (i + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3);
                        drawGeneheader((rowHeight * (i + listAdd + 1))
                                - tablescroll.getVerticalScrollBar().getValue() + 3);

                        for (int s = 0; s < aminoarray.size(); s++) {

                            buf.setColor(Color.darkGray);
                            buf.drawLine(21,
                                    (rowHeight * (i + s + listAdd + 3))
                                            - tablescroll.getVerticalScrollBar().getValue() + 3,
                                    this.getWidth(), (rowHeight * (i + s + listAdd + 3))
                                            - tablescroll.getVerticalScrollBar().getValue() + 3);

                            if (mouseY >= (rowHeight * (i + s + listAdd + 2))
                                    && mouseY < (rowHeight * (i + s + listAdd + 3))) {
                                hoverNode = null;
                                hoverVar = aminoarray.get(s).getNode();
                                hoverString = aminoarray.get(s).getRow();
                                buf.setColor(Color.white);

                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {
                                        hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                .getSample().getIndex();
                                        break;
                                    }
                                }

                            } else {
                                if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("nonsense")) {
                                    buf.setColor(Color.red);
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("missense")) {
                                    buf.setColor(Color.yellow);
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("synonymous")) {
                                    buf.setColor(Color.green);
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("UTR")) {
                                    buf.setColor(Color.lightGray);
                                } else {
                                    buf.setColor(Color.gray);
                                }
                            }
                            if (!aminoarray.get(s).getRow()[1].equals("1")) {

                                buf.drawString("Multiple", 24, (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                            } else {
                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {

                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {

                                        buf.drawString(
                                                aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                        .getSample().getName(),
                                                24,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                        break;
                                    }
                                }

                            }

                            if (hoverVar != null && hoverString.equals(aminoarray.get(s).getRow())) {
                                //TODO
                                textcolor = Color.white;

                            } else {
                                if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("nonsense")) {
                                    textcolor = Color.red;
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("missense")) {
                                    textcolor = Color.yellow;
                                } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3])
                                        .equals("synonymous")) {
                                    textcolor = Color.green;
                                } else if (aminoarray.get(s).getRow()[3].contains("UTR")) {
                                    textcolor = Color.lightGray;
                                } else {
                                    textcolor = Color.gray;
                                }
                            }
                            for (int h = 1; h < 4; h++) {
                                buf.setColor(Color.black);
                                buf.fillRect((int) geneheader.get(h)[1] + 10,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + 4,
                                        (int) geneheader.get(h)[2], rowHeight - 1);
                                buf.setColor(textcolor);
                                buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(h)[1] + 14,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            }

                            if (aminoarray.get(s).getRow()[1].equals("1")) {
                                buf.setColor(Color.black);
                                buf.fillRect((int) geneheader.get(4)[1] + 10,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + 4,
                                        this.getWidth(), rowHeight - 1);
                                buf.setColor(textcolor);

                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {
                                        if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                .isHomozygous()) {
                                            buf.drawString(
                                                    "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                            .get(0).getCalls() + "/"
                                                            + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                                    .get(0).getCoverage()
                                                            + ")",
                                                    (int) geneheader.get(4)[1] + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            if (Control.controlData.controlsOn) {
                                                cases = 2;
                                                casefreq = 2 / (double) (Main.varsamples * 2);
                                            }
                                        } else {
                                            buf.drawString(
                                                    "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                            .get(0).getCalls() + "/"
                                                            + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                                    .get(0).getCoverage()
                                                            + ")",
                                                    (int) geneheader.get(4)[1] + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            if (Control.controlData.controlsOn) {
                                                cases = 1;
                                                casefreq = 1 / (double) (Main.varsamples * 2);
                                            }

                                        }
                                        buf.setColor(Color.black);
                                        buf.fillRect((int) geneheader.get(5)[1] + 1,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                this.getWidth(), rowHeight - 1);
                                        buf.setColor(textcolor);
                                        buf.drawString(
                                                "" + aminoarray.get(s).getNode().vars
                                                        .get(v).getValue().get(0).getQuality(),
                                                (int) geneheader.get(5)[1] + 14,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);

                                    }
                                }
                            }

                            if (Control.controlData.controlsOn) {
                                cases = 0;
                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {
                                        if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                .isHomozygous()) {
                                            cases += Integer.parseInt(aminoarray.get(s).getRow()[1]) * 2;
                                        } else {
                                            cases += Integer.parseInt(aminoarray.get(s).getRow()[1]);
                                        }
                                    }
                                }
                                casefreq = cases / (double) (Main.varsamples * 2);
                            }

                            buf.setColor(textcolor);
                            buf.drawString(aminoarray.get(s).getRow()[4], (int) geneheader.get(6)[1] + 14,
                                    (rowHeight * (i + s + listAdd + 2))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            if (Control.controlData.controlsOn) {
                                buf.setColor(textcolor);

                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(aminoarray.get(s).getRow()[5])) {
                                        vararray = aminoarray.get(s).getNode().vars.get(v).getValue();
                                        controlarray = new SampleNode[Control.controlData.fileArray.size()];
                                        if (vararray.get(vararray.size() - 1).alleles != null) {

                                            for (int e = vararray.size() - 1; e > 0; e--) {

                                                if (vararray.get(e).alleles == null) {
                                                    break;
                                                }
                                                controlarray[vararray.get(e).getControlSample()
                                                        .getIndex()] = vararray.get(e);

                                            }
                                        }
                                        for (int e = 0; e < controlarray.length; e++) {
                                            if (Control.controlData.fileArray.get(e).controlOn) {
                                                if (controlarray[e] == null) {
                                                    buf.setColor(Color.black);
                                                    buf.fillRect(
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2)[1] + 11,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue() + 4,
                                                            this.getWidth(), rowHeight - 1);
                                                    buf.setColor(textcolor);
                                                    buf.drawString("0",
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2)[1] + 14,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue()
                                                                    + rowHeight);
                                                    buf.setColor(Color.black);
                                                    buf.fillRect(
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2 + 1)[1]
                                                                    + 11,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue() + 4,
                                                            this.getWidth(), rowHeight - 1);
                                                    buf.setColor(textcolor);
                                                    buf.drawString("-",
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2 + 1)[1]
                                                                    + 14,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue()
                                                                    + rowHeight);

                                                } else {
                                                    buf.setColor(Color.black);
                                                    buf.fillRect(
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2)[1] + 11,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue() + 4,
                                                            this.getWidth(), rowHeight - 1);
                                                    buf.setColor(textcolor);
                                                    buf.drawString(
                                                            "" + MethodLibrary.round(controlarray[e].alleles
                                                                    / (double) controlarray[e].allelenumber, 2),
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2)[1] + 14,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue()
                                                                    + rowHeight);
                                                    buf.setColor(Color.black);
                                                    buf.fillRect(
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2 + 1)[1]
                                                                    + 11,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue() + 4,
                                                            this.getWidth(), rowHeight - 1);
                                                    buf.setColor(textcolor);
                                                    buf.drawString("" + MethodLibrary
                                                            .round(casefreq / (controlarray[e].alleles
                                                                    / (double) controlarray[e].allelenumber), 2)
                                                            + " (p="
                                                            + MethodLibrary.round(
                                                                    VariantHandler.table.fe.getRightTailedP(
                                                                            cases, Main.varsamples * 2 - cases,
                                                                            controlarray[e].alleles,
                                                                            controlarray[e].allelenumber
                                                                                    - controlarray[e].alleles),
                                                                    2)
                                                            + ")",
                                                            (int) geneheader
                                                                    .get(this.geneheaderlength + e * 2 + 1)[1]
                                                                    + 14,
                                                            (rowHeight * (i + s + listAdd + 2)) - tablescroll
                                                                    .getVerticalScrollBar().getValue()
                                                                    + rowHeight);

                                                }
                                            } else {
                                                buf.setColor(Color.black);
                                                buf.fillRect(
                                                        (int) geneheader.get(this.geneheaderlength + e * 2)[1]
                                                                + 11,
                                                        (rowHeight * (i + s + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + 4,
                                                        this.getWidth(), rowHeight - 1);
                                                buf.setColor(Color.darkGray);
                                                buf.drawString("Apply controls",
                                                        (int) geneheader.get(this.geneheaderlength + e * 2)[1]
                                                                + 14,
                                                        (rowHeight * (i + s + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);
                                                buf.setColor(Color.black);
                                                buf.fillRect(
                                                        (int) geneheader
                                                                .get(this.geneheaderlength + e * 2 + 1)[1] + 11,
                                                        (rowHeight * (i + s + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + 4,
                                                        this.getWidth(), rowHeight - 1);
                                                buf.setColor(Color.darkGray);
                                                buf.drawString("-",
                                                        (int) geneheader
                                                                .get(this.geneheaderlength + e * 2 + 1)[1] + 14,
                                                        (rowHeight * (i + s + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);

                                            }

                                        }

                                    }
                                }

                            } else {
                                buf.setColor(Color.darkGray);

                                for (int e = geneheaderlength; e < geneheader.size(); e++) {
                                    if (geneheader.get(e)[0] instanceof ControlFile) {
                                        buf.drawString("Apply controls", (int) geneheader.get(e)[1] + 14,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                    }
                                }
                                buf.setColor(Color.lightGray);
                            }
                            vararray = null;
                            if (Main.bedCanvas.bedOn) {

                                for (int a = 0; a < aminoarray.size(); a++) {

                                    StringBuffer[] bedarraytemp = MethodLibrary.makeTrackArray(
                                            aminoarray.get(a).getNode(), aminoarray.get(a).getRow()[5]);
                                    if (bedarraytemp != null) {
                                        int h = 0;
                                        for (int b = 0; b < bedarraytemp.length; b++) {
                                            if (b == bedtrack.trackIndex) {
                                                continue;
                                            }
                                            buf.setColor(Color.black);
                                            if (b == bedarraytemp.length - 1) {
                                                buf.fillRect(
                                                        (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + h)[1] + 12,
                                                        (rowHeight * (i + a + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + 4,
                                                        this.getWidth() - (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + h)[1],
                                                        rowHeight - 1);
                                            } else {
                                                buf.fillRect(
                                                        (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + h)[1] + 12,
                                                        (rowHeight * (i + a + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + 4,
                                                        (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + h)[2],
                                                        rowHeight - 1);
                                            }
                                            buf.setColor(Color.white);
                                            if (bedarraytemp[b] != null) {
                                                buf.drawString(bedarraytemp[b].toString(),
                                                        (int) geneheader.get(geneheaderlength
                                                                + Control.controlData.fileArray.size() * 2
                                                                + h)[1] + 14,
                                                        (rowHeight * (i + a + listAdd + 2))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);

                                            }
                                            h++;

                                            //   buf.drawLine((int)geneheader.get(geneheaderlength+Control.controlData.fileArray.size()*2+h)[1], (rowHeight*(i+a+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+4, (int)geneheader.get(geneheaderlength+Control.controlData.fileArray.size()*2+h)[1], (rowHeight*(i+a+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+10);   

                                        }
                                    }
                                }
                            }

                            buf.setColor(Color.darkGray);
                            for (int j = 0; j < geneheader.size(); j++) {
                                buf.drawLine((int) geneheader.get(j)[1] + 11,
                                        (rowHeight * (i + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + 4,
                                        (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + listAdd + 3))
                                                - tablescroll.getVerticalScrollBar().getValue() + 3);
                            }
                            if (selectedVar != null && selectedString.equals(aminoarray.get(s).getRow())
                                    && Integer.parseInt(selectedString[1]) > 1) {
                                //hoverSample = -1;
                                pointer = 0;
                                //TODO

                                for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                            .equals(selectedString[5])) {

                                        for (int l = 0; l < aminoarray.get(s).getNode().vars.get(v).getValue()
                                                .size(); l++) {
                                            if (aminoarray.get(s).getNode().vars.get(v).getValue()
                                                    .get(l).alleles != null) {
                                                break;
                                            }
                                            if (mouseY > (rowHeight * (i + s + pointer + 4))
                                                    && mouseY < (rowHeight * (i + s + pointer + 5))) {
                                                textcolor = Color.white;

                                                hoverVar = aminoarray.get(s).getNode();
                                                hoverString = aminoarray.get(s).getRow();
                                                hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue()
                                                        .get(l).getSample().getIndex();
                                            } else {
                                                textcolor = Color.lightGray;
                                            }

                                            //   if(aminoarray.get(s).getNode().getSamples().get(l).getVariation().equals(selectedString[5])) {                           
                                            buf.setColor(textcolor);
                                            buf.drawString(
                                                    aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                                            .getSample().getName(),
                                                    30,
                                                    (rowHeight * (i + s + pointer + 4))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            pointer++;
                                            //   }   

                                            buf.setColor(Color.black);
                                            buf.fillRect((int) geneheader.get(4)[1] + 10,
                                                    (rowHeight * (i + s + pointer + 3))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                                    .isHomozygous()) {
                                                buf.drawString(
                                                        "Hom (" + aminoarray.get(s).getNode().vars.get(v)
                                                                .getValue().get(l).getCalls() + "/"
                                                                + aminoarray.get(s).getNode().vars.get(v)
                                                                        .getValue().get(l).getCoverage()
                                                                + ")",
                                                        (int) geneheader.get(4)[1] + 14,
                                                        (rowHeight * (i + s + pointer + 3))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);

                                            } else {
                                                buf.drawString(
                                                        "Het (" + aminoarray.get(s).getNode().vars.get(v)
                                                                .getValue().get(l).getCalls() + "/"
                                                                + aminoarray.get(s).getNode().vars.get(v)
                                                                        .getValue().get(l).getCoverage()
                                                                + ")",
                                                        (int) geneheader.get(4)[1] + 14,
                                                        (rowHeight * (i + s + pointer + 3))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight);
                                            }

                                            buf.setColor(Color.black);
                                            buf.fillRect((int) geneheader.get(5)[1] + 10,
                                                    (rowHeight * (i + s + pointer + 3))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            buf.drawString(
                                                    "" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                            .get(l).getQuality(),
                                                    (int) geneheader.get(5)[1] + 14,
                                                    (rowHeight * (i + s + pointer + 3))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            buf.setColor(Color.darkGray);
                                            for (int j = 4; j < 7; j++) {

                                                buf.drawLine((int) geneheader.get(j)[1] + 11,
                                                        (rowHeight * (i + s + pointer + 3))
                                                                - tablescroll.getVerticalScrollBar().getValue(),
                                                        (int) geneheader.get(j)[1] + 11,
                                                        (rowHeight * (i + s + pointer + 3))
                                                                - tablescroll.getVerticalScrollBar().getValue()
                                                                + rowHeight + 2);
                                            }

                                        }
                                    }
                                }
                                listAdd = Integer.parseInt(selectedString[1]) + 1;
                                genemutcount = aminoarray.size() + listAdd;
                                buf.setColor(Color.darkGray);
                                buf.drawLine(21,
                                        (rowHeight * (i + s + listAdd + 3))
                                                - tablescroll.getVerticalScrollBar().getValue() + 3,
                                        this.getWidth(), (rowHeight * (i + s + listAdd + 3))
                                                - tablescroll.getVerticalScrollBar().getValue() + 3);

                            }

                        }
                    }
                } catch (Exception e) {
                    ErrorLog.addError(e.getStackTrace());
                    e.printStackTrace();
                }

            }
            buf.setColor(Color.darkGray);
            buf.drawLine(4,
                    (rowHeight * (bedarray.size() + genemutcount + 1))
                            - tablescroll.getVerticalScrollBar().getValue() + 3,
                    this.getWidth(), (rowHeight * (bedarray.size() + genemutcount + 1))
                            - tablescroll.getVerticalScrollBar().getValue() + 3);

        }
        drawHeader();

        if (headerHover == -1 && geneHeaderHover == -1) {

            setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        } else {
            if (resizeColumn == -1) {
                setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            } else {
                setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
            }
        }
        g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:base.BasePlayer.AminoTable.java

void drawScreen(Graphics g) {
    if (!isEnabled()) {
        return;//w  w w . j av a  2  s  .  c  o m
    }

    buf.setColor(Color.black);
    buf.fillRect(0, 0, VariantHandler.tableScroll.getViewport().getWidth(),
            tablescroll.getViewport().getHeight());

    if (VariantHandler.writetofile.isSelected()) {
        buf.setColor(Color.white);
        if (FileRead.output != null && Main.drawCanvas.loading && Draw.variantcalculator) {
            buf.drawString("Writing results to " + FileRead.outputName, 10, 20);
        } else {
            buf.drawString("Press annotate to write results straight to file", 10, 20);
        }
        g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null);
        return;
    }
    //Header Draw   

    genemutcount = 0;
    hoverVar = null;
    hoverSample = -1;
    headerHover = -1;
    geneHeaderHover = -1;

    if (!mouseDrag) {
        resizeColumn = -1;
    }
    firstrow = tablescroll.getVerticalScrollBar().getValue() / rowHeight - samplecount - listAdd
            - aminoarray.size();

    if (firstrow < 0) {
        firstrow = 0;
    }
    for (int i = 0; i < genearray.size(); i++) {
        dot = false;

        if ((i + 1 + samplecount + aminoarray.size() + listAdd) * rowHeight < tablescroll.getVerticalScrollBar()
                .getValue()) {

            continue;
        }

        if (i * rowHeight > tablescroll.getVerticalScrollBar().getValue()
                + tablescroll.getViewport().getHeight()) {
            break;
        }

        if (mouseY >= (rowHeight * (i + genemutcount + 1)) && mouseY < (rowHeight * (i + genemutcount + 2))) {
            hoverNode = genearray.get(i);
        }

        try {
            buf.setColor(Color.darkGray);
            buf.drawLine(4,
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3,
                    this.getWidth(),
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3);

            if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) {
                buf.setColor(Color.yellow);
            } else {
                buf.setColor(Color.white);
            }
            textWidth = (int) fm.getStringBounds("" + (i + 1) + ".  " + genearray.get(i).getName(), buf)
                    .getWidth();
            if (genearray.get(i).intergenic) {
                if (genearray.get(i).varnodes.get(0).getTranscripts() == null) {
                    buf.drawString((i + 1) + ".  " + genearray.get(i).getName(), 5,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);

                } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) {

                    buf.drawString(
                            (i + 1) + ".  " + genearray.get(i).getName() + " ... "
                                    + genearray.get(i).varnodes.get(0).getTranscripts().get(1).getGenename(),
                            5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                } else if (genearray.get(i).varnodes.get(0).getPosition() < genearray.get(i).getStart()) {
                    buf.drawString((i + 1) + ".  " + " ... " + genearray.get(i).getName(), 5,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);

                } else {
                    buf.drawString((i + 1) + ".  " + genearray.get(i).getName() + " ... ", 5,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);

                }
            } else {
                buf.drawString((i + 1) + ".  " + genearray.get(i).getName(), 5,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
            }
            buf.setColor(Color.black);
            buf.fillRect((int) (headerlengths[1][0] + 1),
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4,
                    (int) (headerlengths[1][1]), rowHeight - 1);

            if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) {
                buf.setColor(Color.yellow);
            } else {
                buf.setColor(Color.white);
            }

            mutcountbuffer = new StringBuffer("" + genearray.get(i).mutations + " (");
            buf.drawString(mutcountbuffer.toString(), (int) (headerlengths[1][0] + 5),
                    (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                            + rowHeight);

            if (genearray.get(i).nonsense > 0) {
                buf.setColor(Color.red);
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.drawString("" + genearray.get(i).nonsense, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).nonsense);
                dot = true;
            }
            if (genearray.get(i).missense > 0) {

                if (dot) {
                    buf.setColor(Color.white);
                    textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                    buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    mutcountbuffer.append(", ");
                }

                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.setColor(Color.yellow);
                buf.drawString("" + genearray.get(i).missense, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).missense);
                dot = true;
            }
            if (genearray.get(i).synonymous > 0) {

                if (dot) {
                    buf.setColor(Color.white);
                    textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                    buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    mutcountbuffer.append(", ");
                }
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.setColor(Color.green);
                buf.drawString("" + genearray.get(i).synonymous, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).synonymous);
                dot = true;
            }
            if (genearray.get(i).utr > 0) {

                if (dot) {
                    buf.setColor(Color.white);
                    textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                    buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    mutcountbuffer.append(", ");
                }
                buf.setColor(Color.lightGray);
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.drawString("" + genearray.get(i).utr, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).utr);
                dot = true;
            }
            if (genearray.get(i).intronic > 0) {

                if (dot) {
                    buf.setColor(Color.white);
                    textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                    buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    mutcountbuffer.append(", ");
                }
                buf.setColor(Color.gray);
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.drawString("" + genearray.get(i).intronic, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).intronic);
                dot = true;
            }
            if (genearray.get(i).intergenic) {

                buf.setColor(Color.gray);
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.drawString("" + genearray.get(i).mutations, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append("" + genearray.get(i).mutations);
            }
            buf.setColor(Color.white);
            textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
            buf.drawString(") ", (int) (headerlengths[1][0]) + 5 + textWidth,
                    (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                            + rowHeight);

            buf.setColor(Color.gray);
            textWidth = (int) fm.getStringBounds(mutcountbuffer.toString() + ") ", buf).getWidth();
            if (genearray.get(i).samples.size() == 1) {
                buf.drawString(" 1 sample", (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);

            } else {
                buf.drawString(" " + genearray.get(i).samples.size() + " samples",
                        (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount))
                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
            }
            buf.setColor(Color.black);
            buf.fillRect((int) (headerlengths[2][0]) + 1,
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4,
                    this.getWidth(), rowHeight - 1);

            if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) {
                buf.setColor(Color.yellow);
            } else {
                buf.setColor(Color.white);
            }
            if (genearray.get(i).intergenic) {
                if (genearray.get(i).varnodes.get(0).getTranscripts() == null) {
                    buf.drawString(genearray.get(i).getChrom(), (int) (headerlengths[2][0]) + 5,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);

                } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) {
                    buf.drawString(
                            genearray.get(i).getChrom() + ":"
                                    + MethodLibrary.formatNumber(genearray.get(i).getEnd()) + "-"
                                    + MethodLibrary.formatNumber(genearray.get(i).varnodes.get(0)
                                            .getTranscripts().get(1).getStart()),
                            (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                } else if (genearray.get(i).varnodes.get(0).getPosition() < genearray.get(i).getStart()) {
                    buf.drawString(
                            genearray.get(i).getChrom() + ":1-"
                                    + MethodLibrary.formatNumber(genearray.get(i).varnodes.get(0)
                                            .getTranscripts().get(1).getStart()),
                            (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                } else {
                    buf.drawString(
                            genearray.get(i).getChrom() + ":"
                                    + MethodLibrary.formatNumber(genearray.get(i).getEnd()) + "-end",
                            (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                }
            } else {
                buf.drawString(
                        genearray.get(i).getChrom() + ":"
                                + MethodLibrary.formatNumber(genearray.get(i).getStart()) + "-"
                                + MethodLibrary.formatNumber(genearray.get(i).getEnd()),
                        (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
            }
            buf.setColor(Color.black);
            buf.fillRect((int) (headerlengths[3][0]) + 1,
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4,
                    this.getWidth(), rowHeight - 1);

            if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) {

                buf.setColor(Color.yellow);
            } else {
                buf.setColor(Color.white);
            }
            if (genearray.get(i).intergenic) {
                if (genearray.get(i).varnodes.get(0).getTranscripts() == null) {
                    buf.drawString("-", (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) {
                    buf.drawString(
                            genearray.get(i).getDescription() + ";"
                                    + genearray.get(i).varnodes.get(0).getTranscripts().get(1).getGene()
                                            .getDescription(),
                            (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                }
            } else {
                buf.drawString(genearray.get(i).getDescription(), (int) (headerlengths[3][0]) + 5,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
            }
            buf.setColor(Color.darkGray);
            buf.drawLine(3, rowHeight + 3, 3,
                    (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3);

            for (int r = 0; r < headerlengths.length; r++) {
                buf.drawLine((int) (headerlengths[r][0]),
                        (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue()
                                + 4,
                        (int) (headerlengths[r][0]), (rowHeight * (i + genemutcount + 2))
                                - tablescroll.getVerticalScrollBar().getValue() + 3);
            }

            if (selectedNode != null && selectedNode.equals(genearray.get(i))) {

                hoverSample = -1;
                genemutcount = aminoarray.size() + 1;
                listAdd = 1;
                //      buf.drawLine(10, (rowHeight*(i+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+3, this.getWidth(), (rowHeight*(i+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+3);   
                drawGeneheader(
                        (rowHeight * (i + listAdd + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3);

                for (int s = 0; s < aminoarray.size(); s++) {

                    buf.setColor(Color.darkGray);
                    buf.drawLine(21,
                            (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue()
                                    + 3,
                            this.getWidth(), (rowHeight * (i + s + listAdd + 3))
                                    - tablescroll.getVerticalScrollBar().getValue() + 3);
                    if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("nonsense")) {

                        textcolor = Color.red;
                    } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("missense")) {

                        textcolor = Color.yellow;
                    } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("synonymous")) {
                        textcolor = Color.green;
                    } else if (aminoarray.get(s).getRow()[3].contains("UTR")) {
                        textcolor = Color.lightGray;
                    } else {

                        textcolor = Color.gray;
                    }
                    buf.setColor(textcolor);
                    if (mouseY >= (rowHeight * (i + s + listAdd + 2))
                            && mouseY < (rowHeight * (i + s + listAdd + 3))) {
                        hoverNode = null;
                        hoverVar = aminoarray.get(s).getNode();
                        hoverString = aminoarray.get(s).getRow();
                        buf.setColor(Color.white);
                        hoverSample = -1;

                        if (aminoarray.get(s).getRow()[1].equals("1")) {
                            for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                        .equals(aminoarray.get(s).getRow()[5])) {

                                    hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                            .getSample().getIndex();
                                    hoverSampleNode = aminoarray.get(s).getNode().vars.get(v).getValue().get(0);
                                    hoverBase = aminoarray.get(s).getRow()[5];
                                    break;
                                }
                            }
                        }
                        //      hoverSample = -1;

                    }

                    if (!aminoarray.get(s).getRow()[1].equals("1")) {
                        buf.drawString("Multiple", 24, (rowHeight * (i + s + listAdd + 2))
                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                    } else {
                        for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {

                            if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                    .equals(aminoarray.get(s).getRow()[5])) {

                                buf.drawString(
                                        aminoarray.get(s).getNode().vars.get(v).getValue().get(0).getSample()
                                                .getName(),
                                        24, (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                                break;
                            }
                        }
                    }

                    if (hoverVar != null && hoverString.equals(aminoarray.get(s).getRow())) {
                        //TODO
                        textcolor = Color.white;

                    }

                    for (int h = 1; h < 4; h++) {
                        buf.setColor(Color.black);
                        buf.fillRect((int) geneheader.get(h)[1] + 10,
                                (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                (int) geneheader.get(h)[2], rowHeight - 1);
                        buf.setColor(textcolor);
                        if (h == 3) {
                            if (aminoarray.get(s).getRow()[5].length() == 1) {
                                buf.drawString(
                                        Main.getBase.get(aminoarray.get(s).getNode().getRefBase()) + ">"
                                                + aminoarray.get(s).getRow()[5],
                                        (int) geneheader.get(h)[1] + 14, (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                            } else {
                                buf.drawString(aminoarray.get(s).getRow()[5], (int) geneheader.get(h)[1] + 14,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            }
                            buf.setColor(Color.black);
                            buf.fillRect((int) geneheader.get(4)[1] + 10,
                                    (rowHeight * (i + s + listAdd + 2))
                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                    (int) geneheader.get(4)[2], rowHeight - 1);
                            buf.setColor(textcolor);
                            buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(4)[1] + 14,
                                    (rowHeight * (i + s + listAdd + 2))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                        } else {

                            buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(h)[1] + 14,
                                    (rowHeight * (i + s + listAdd + 2))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                        }
                    }

                    if (aminoarray.get(s).getRow()[1].equals("1")) {
                        buf.setColor(Color.black);
                        buf.fillRect((int) geneheader.get(5)[1] + 10,
                                (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                (int) geneheader.get(5)[2], rowHeight - 1);
                        buf.setColor(textcolor);

                        for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                            if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                    .equals(aminoarray.get(s).getRow()[5])) {
                                if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0).isHomozygous()) {
                                    buf.drawString(
                                            "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                    .getCalls() + "/"
                                                    + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                            .getCoverage()
                                                    + ")",
                                            (int) geneheader.get(5)[1] + 14,
                                            (rowHeight * (i + s + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);
                                    if (Control.controlData.controlsOn) {
                                        cases = 2;
                                        casefreq = 2 / (double) (Main.varsamples * 2 - 2);
                                    }
                                } else {
                                    buf.drawString(
                                            "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                    .getCalls() + "/"
                                                    + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                            .getCoverage()
                                                    + ")",
                                            (int) geneheader.get(5)[1] + 14,
                                            (rowHeight * (i + s + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);
                                    if (Control.controlData.controlsOn) {
                                        cases = 1;
                                        casefreq = 1 / (double) (Main.varsamples * 2 - 1);
                                    }

                                }
                                buf.setColor(Color.black);
                                buf.fillRect((int) geneheader.get(6)[1] + 10,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + 4,
                                        this.getWidth(), rowHeight - 1);
                                buf.setColor(textcolor);
                                buf.drawString(
                                        "" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                .getQuality(),
                                        (int) geneheader.get(6)[1] + 14, (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            }
                        }
                    } else {
                        //TODO piirra mustat boksit
                        buf.setColor(Color.black);
                        buf.fillRect((int) geneheader.get(5)[1] + 10,
                                (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                this.getWidth(), rowHeight - 1);

                        if (Control.controlData.controlsOn) {
                            cases = 0;

                            for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                        .equals(aminoarray.get(s).getRow()[5])) {
                                    for (int j = 0; j < aminoarray.get(s).getNode().vars.get(v).getValue()
                                            .size(); j++) {
                                        if (aminoarray.get(s).getNode().vars.get(v).getValue()
                                                .get(j).alleles != null) {
                                            continue;
                                        }
                                        if (aminoarray.get(s).getNode().vars.get(v).getValue().get(j)
                                                .isHomozygous()) {
                                            cases += 2;
                                        } else {
                                            cases += 1;
                                        }
                                    }
                                }
                            }
                            casefreq = cases / (double) (Main.varsamples * 2 - cases);

                        }
                    }
                    buf.setColor(textcolor);
                    buf.drawString(aminoarray.get(s).getRow()[4], (int) geneheader.get(7)[1] + 14,
                            (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    //      buf.setColor(Color.black);

                    if (Control.controlData.controlsOn) {
                        buf.setColor(textcolor);

                        for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                            if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                    .equals(aminoarray.get(s).getRow()[5])) {
                                vararray = aminoarray.get(s).getNode().vars.get(v).getValue();
                                controlarray = new SampleNode[Control.controlData.fileArray.size()];
                                if (vararray.get(vararray.size() - 1).alleles != null) {

                                    for (int e = vararray.size() - 1; e > 0; e--) {

                                        if (vararray.get(e).alleles == null) {
                                            break;
                                        }

                                        controlarray[vararray.get(e).getControlSample().getIndex()] = vararray
                                                .get(e);

                                    }
                                }

                                for (int e = 0; e < controlarray.length; e++) {
                                    if (Control.controlData.fileArray.get(e).controlOn) {
                                        if (controlarray[e] == null) {
                                            buf.setColor(Color.black);
                                            buf.fillRect(
                                                    (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            buf.drawString("0",
                                                    (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            buf.setColor(Color.black);
                                            buf.fillRect(
                                                    (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1]
                                                            + 11,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            buf.drawString("-",
                                                    (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1]
                                                            + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);

                                        } else {
                                            buf.setColor(Color.black);
                                            buf.fillRect(
                                                    (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            buf.drawString(
                                                    "" + MethodLibrary.round(controlarray[e].alleles
                                                            / (double) controlarray[e].allelenumber, 5),
                                                    (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            buf.setColor(Color.black);
                                            buf.fillRect(
                                                    (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1]
                                                            + 11,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);

                                            buf.drawString(
                                                    "" + MethodLibrary.round(casefreq / (controlarray[e].alleles
                                                            / (double) (controlarray[e].allelenumber
                                                                    - controlarray[e].alleles)),
                                                            2) + " (p="
                                                            + MethodLibrary.round(
                                                                    fe.getRightTailedP(cases,
                                                                            Main.varsamples * 2 - cases,
                                                                            controlarray[e].alleles,
                                                                            controlarray[e].allelenumber
                                                                                    - controlarray[e].alleles),
                                                                    2)
                                                            + ")",
                                                    (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1]
                                                            + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);

                                        }
                                    } else {
                                        buf.setColor(Color.black);
                                        buf.fillRect(
                                                (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                this.getWidth(), rowHeight - 1);
                                        buf.setColor(Color.darkGray);
                                        buf.drawString("Apply controls",
                                                (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                        buf.setColor(Color.black);
                                        buf.fillRect(
                                                (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 11,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                this.getWidth(), rowHeight - 1);
                                        buf.setColor(Color.darkGray);
                                        buf.drawString("-",
                                                (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 14,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                    }
                                }
                            }
                        }
                    } else {
                        buf.setColor(Color.darkGray);

                        for (int e = geneheaderlength; e < geneheader.size(); e++) {
                            if (geneheader.get(e)[0] instanceof ControlFile) {
                                buf.drawString("Apply controls", (int) geneheader.get(e)[1] + 14,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                            }
                        }
                        buf.setColor(Color.lightGray);
                    }
                    vararray = null;
                    //if(Main.bedCanvas.bedOn) {               

                    for (int a = 0; a < aminoarray.size(); a++) {

                        bedarray = MethodLibrary.makeTrackArray(aminoarray.get(a).getNode(),
                                aminoarray.get(a).getRow()[5]);
                        if (bedarray != null) {
                            for (int b = 0; b < bedarray.length; b++) {
                                buf.setColor(Color.black);
                                if (b == bedarray.length - 1) {
                                    buf.fillRect(
                                            (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[1] + 12,
                                            (rowHeight * (i + a + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                                            this.getWidth() - (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[1],
                                            rowHeight - 1);
                                } else {
                                    buf.fillRect(
                                            (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[1] + 12,
                                            (rowHeight * (i + a + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                                            (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[2],
                                            rowHeight - 1);
                                }
                                buf.setColor(Color.white);
                                if (bedarray[b] != null) {
                                    buf.drawString(bedarray[b].toString(),
                                            (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[1] + 14,
                                            (rowHeight * (i + a + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);

                                }
                            }
                        }
                    }

                    /*if(c < header.size()-1-Main.bedCanvas.bedTrack.size()) {
                       buf.setColor(Color.black);
                       buf.fillRect((int)header.get(c+1)[1]+1, (rowHeight*(i+genemutcount+1))-tablescroll.getVerticalScrollBar().getValue()+4, (int)header.get(c)[2], rowHeight-1);   
                                 
                    }*/
                    //   }

                    buf.setColor(Color.darkGray);
                    for (int j = 0; j < geneheader.size(); j++) {

                        buf.drawLine((int) geneheader.get(j)[1] + 11,
                                (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + listAdd + 3))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3);
                    }
                    if (selectedVar != null && selectedString.equals(aminoarray.get(s).getRow())
                            && Integer.parseInt(selectedString[1]) > 1) {
                        pointer = 0;
                        //TODO

                        for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                            if (aminoarray.get(s).getNode().vars.get(v).getKey().equals(selectedString[5])) {

                                for (int l = 0; l < aminoarray.get(s).getNode().vars.get(v).getValue()
                                        .size(); l++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getValue()
                                            .get(l).alleles != null) {
                                        break;
                                    }
                                    if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                            .getSample().annotation) {
                                        continue;
                                    }
                                    if (mouseY > (rowHeight * (i + s + pointer + 4))
                                            && mouseY < (rowHeight * (i + s + pointer + 5))) {
                                        textcolor = Color.white;

                                        hoverVar = aminoarray.get(s).getNode();
                                        hoverString = aminoarray.get(s).getRow();
                                        hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                                .getSample().getIndex();
                                        hoverSampleNode = aminoarray.get(s).getNode().vars.get(v).getValue()
                                                .get(l);
                                        hoverBase = aminoarray.get(s).getRow()[5];
                                    } else {
                                        textcolor = Color.lightGray;
                                    }

                                    //   if(aminoarray.get(s).getNode().getSamples().get(l).getVariation().equals(selectedString[5])) {                           
                                    buf.setColor(textcolor);
                                    buf.drawString(
                                            aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                                    .getSample().getName(),
                                            30,
                                            (rowHeight * (i + s + pointer + 4))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);
                                    pointer++;
                                    //   }   

                                    buf.setColor(Color.black);
                                    buf.fillRect((int) geneheader.get(5)[1] + 10,
                                            (rowHeight * (i + s + pointer + 3))
                                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                                            this.getWidth(), rowHeight - 1);
                                    buf.setColor(textcolor);
                                    if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                            .isHomozygous()) {
                                        buf.drawString(
                                                "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                        .get(l).getCalls() + "/"
                                                        + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                                .get(l).getCoverage()
                                                        + ")",
                                                (int) geneheader.get(5)[1] + 14,
                                                (rowHeight * (i + s + pointer + 3))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);

                                    } else {
                                        buf.drawString(
                                                "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                        .get(l).getCalls() + "/"
                                                        + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                                .get(l).getCoverage()
                                                        + ")",
                                                (int) geneheader.get(5)[1] + 14,
                                                (rowHeight * (i + s + pointer + 3))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                    }
                                    buf.setColor(Color.black);
                                    buf.fillRect((int) geneheader.get(6)[1] + 10,
                                            (rowHeight * (i + s + pointer + 3))
                                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                                            this.getWidth(), rowHeight - 1);
                                    buf.setColor(textcolor);
                                    buf.drawString(
                                            "" + aminoarray.get(s).getNode().vars
                                                    .get(v).getValue().get(l).getQuality(),
                                            (int) geneheader.get(6)[1] + 14,
                                            (rowHeight * (i + s + pointer + 3))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);
                                    buf.setColor(Color.darkGray);
                                    for (int j = 5; j < 7; j++) {

                                        buf.drawLine((int) geneheader.get(j)[1] + 11,
                                                (rowHeight * (i + s + pointer + 3))
                                                        - tablescroll.getVerticalScrollBar().getValue(),
                                                (int) geneheader.get(j)[1] + 11,
                                                (rowHeight * (i + s + pointer + 3))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight + 2);
                                    }
                                }
                            }

                        }
                        listAdd = Integer.parseInt(selectedString[1]) + 1;
                        genemutcount = aminoarray.size() + listAdd;
                        buf.setColor(Color.darkGray);
                        buf.drawLine(21,
                                (rowHeight * (i + s + listAdd + 3))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3,
                                this.getWidth(), (rowHeight * (i + s + listAdd + 3))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3);

                    }

                }
            }
        } catch (Exception e) {
            ErrorLog.addError(e.getStackTrace());
            e.printStackTrace();
        }

    }
    buf.setColor(Color.darkGray);
    buf.drawLine(4,
            (rowHeight * (genearray.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue()
                    + 3,
            this.getWidth(), (rowHeight * (genearray.size() + genemutcount + 1))
                    - tablescroll.getVerticalScrollBar().getValue() + 3);

    drawHeader();
    if (headerHover == -1 && geneHeaderHover == -1) {

        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    } else {
        if (resizeColumn == -1) {
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        } else {
            setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
        }
    }

    g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null);

}

From source file:de.codesourcery.jasm16.ide.ui.views.SourceCodeView.java

protected final void underlineLocation(final ITextRegion region) {
    if (region == null) {
        throw new IllegalArgumentException("region must not be NULL.");
    }/*  w w  w .  j a  v a  2s.  c  o  m*/

    Runnable r = new Runnable() {
        @Override
        public void run() {
            try {
                if (currentUnderlineHighlight == null) {
                    currentUnderlineHighlight = editorPane.getHighlighter().addHighlight(
                            region.getStartingOffset(), region.getEndOffset(),
                            new UnderlineHighlightPainter(Color.BLUE, 1));
                } else {
                    editorPane.getHighlighter().changeHighlight(currentUnderlineHighlight,
                            region.getStartingOffset(), region.getEndOffset());
                }
                editorPane.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                editorPane.repaint();
            } catch (BadLocationException e) {
                LOG.error("underlineLocation(): Bad location " + region, e);
            }
        }
    };
    UIUtils.invokeLater(r);
}

From source file:op.care.bhp.PnlBHP.java

private java.util.List<Component> addFilter() {
    java.util.List<Component> list = new ArrayList<Component>();

    jdcDatum = new JDateChooser(new Date());
    jdcDatum.setFont(new Font("Arial", Font.PLAIN, 18));
    jdcDatum.setMinSelectableDate(BHPTools.getMinDatum(resident));

    jdcDatum.setBackground(Color.WHITE);
    jdcDatum.addPropertyChangeListener(new PropertyChangeListener() {
        @Override/*  www.  ja  va  2s.c om*/
        public void propertyChange(PropertyChangeEvent evt) {
            if (initPhase) {
                return;
            }
            if (evt.getPropertyName().equals("date")) {
                reloadDisplay();
            }
        }
    });
    list.add(jdcDatum);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setBackground(Color.WHITE);
    buttonPanel.setLayout(new HorizontalLayout(5));
    buttonPanel.setBorder(new EmptyBorder(0, 0, 0, 0));

    JButton homeButton = new JButton(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start.png")));
    homeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            jdcDatum.setDate(jdcDatum.getMinSelectableDate());
        }
    });
    homeButton.setPressedIcon(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start_pressed.png")));
    homeButton.setBorder(null);
    homeButton.setBorderPainted(false);
    homeButton.setOpaque(false);
    homeButton.setContentAreaFilled(false);
    homeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JButton backButton = new JButton(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back.png")));
    backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DateMidnight current = new DateMidnight(jdcDatum.getDate());
            DateMidnight min = new DateMidnight(jdcDatum.getMinSelectableDate());
            if (current.equals(min)) {
                return;
            }
            jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), -1));
        }
    });
    backButton
            .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back_pressed.png")));
    backButton.setBorder(null);
    backButton.setBorderPainted(false);
    backButton.setOpaque(false);
    backButton.setContentAreaFilled(false);
    backButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JButton fwdButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play.png")));
    fwdButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DateMidnight current = new DateMidnight(jdcDatum.getDate());
            if (current.equals(new DateMidnight())) {
                return;
            }
            jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), 1));
        }
    });
    fwdButton
            .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play_pressed.png")));
    fwdButton.setBorder(null);
    fwdButton.setBorderPainted(false);
    fwdButton.setOpaque(false);
    fwdButton.setContentAreaFilled(false);
    fwdButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JButton endButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end.png")));
    endButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            jdcDatum.setDate(new Date());
        }
    });
    endButton.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end_pressed.png")));
    endButton.setBorder(null);
    endButton.setBorderPainted(false);
    endButton.setOpaque(false);
    endButton.setContentAreaFilled(false);
    endButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    buttonPanel.add(homeButton);
    buttonPanel.add(backButton);
    buttonPanel.add(fwdButton);
    buttonPanel.add(endButton);

    list.add(buttonPanel);

    //        panelFilter.setContentPane(labelPanel);

    return list;
}

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 ww.j a v a 2 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:com.mirth.connect.client.ui.codetemplate.CodeTemplatePanel.java

private void initComponents() {
    splitPane = new JSplitPane();
    splitPane.setBackground(getBackground());
    splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPane.setBorder(BorderFactory.createEmptyBorder());
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(//from   www .  j a  v  a  2 s.com
            Preferences.userNodeForPackage(Mirth.class).getInt("height", UIConstants.MIRTH_HEIGHT) / 3);
    splitPane.setResizeWeight(0.5);

    topPanel = new JPanel();
    topPanel.setBackground(UIConstants.COMBO_BOX_BACKGROUND);

    final CodeTemplateTreeTableCellEditor templateCellEditor = new CodeTemplateTreeTableCellEditor(this);

    templateTreeTable = new MirthTreeTable("CodeTemplate", new HashSet<String>(
            Arrays.asList(new String[] { "Name", "Description", "Revision", "Last Modified" }))) {

        private TreeTableNode selectedNode;

        @Override
        public boolean isCellEditable(int row, int column) {
            return column == TEMPLATE_NAME_COLUMN;
        }

        @Override
        public TableCellEditor getCellEditor(int row, int column) {
            if (isHierarchical(column)) {
                return templateCellEditor;
            } else {
                return super.getCellEditor(row, column);
            }
        }

        @Override
        protected void beforeSort() {
            updateCurrentNode();
            updateCurrentNode.set(false);

            int selectedRow = templateTreeTable.getSelectedRow();
            selectedNode = selectedRow >= 0
                    ? (TreeTableNode) templateTreeTable.getPathForRow(selectedRow).getLastPathComponent()
                    : null;
        }

        @Override
        protected void afterSort() {
            final TreePath selectedPath = selectPathFromNodeId(selectedNode,
                    (CodeTemplateRootTreeTableNode) templateTreeTable.getTreeTableModel().getRoot());
            if (selectedPath != null) {
                selectTemplatePath(selectedPath);
            }

            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    if (selectedPath != null) {
                        selectTemplatePath(selectedPath);
                    }
                    updateCurrentNode.set(true);
                }
            });
        }
    };

    DefaultTreeTableModel model = new CodeTemplateTreeTableModel();
    model.setColumnIdentifiers(
            Arrays.asList(new String[] { "Name", "Id", "Type", "Description", "Revision", "Last Modified" }));

    CodeTemplateRootTreeTableNode rootNode = new CodeTemplateRootTreeTableNode();
    model.setRoot(rootNode);

    fullModel = new CodeTemplateTreeTableModel();
    fullModel.setColumnIdentifiers(
            Arrays.asList(new String[] { "Name", "Id", "Type", "Description", "Revision", "Last Modified" }));

    CodeTemplateRootTreeTableNode fullRootNode = new CodeTemplateRootTreeTableNode();
    fullModel.setRoot(fullRootNode);

    templateTreeTable.setColumnFactory(new CodeTemplateTableColumnFactory());
    templateTreeTable.setTreeTableModel(model);
    templateTreeTable.setOpenIcon(null);
    templateTreeTable.setClosedIcon(null);
    templateTreeTable.setLeafIcon(null);
    templateTreeTable.setRootVisible(false);
    templateTreeTable.setDoubleBuffered(true);
    templateTreeTable.setDragEnabled(false);
    templateTreeTable.setRowSelectionAllowed(true);
    templateTreeTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    templateTreeTable.setRowHeight(UIConstants.ROW_HEIGHT);
    templateTreeTable.setFocusable(true);
    templateTreeTable.setOpaque(true);
    templateTreeTable.getTableHeader().setReorderingAllowed(true);
    templateTreeTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    templateTreeTable.setEditable(true);
    templateTreeTable.setSortable(true);
    templateTreeTable.setAutoCreateColumnsFromModel(false);
    templateTreeTable.setShowGrid(true, true);
    templateTreeTable.restoreColumnPreferences();
    templateTreeTable.setMirthColumnControlEnabled(true);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        templateTreeTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    templateTreeTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent evt) {
            checkSelection(evt);
        }

        @Override
        public void mouseReleased(MouseEvent evt) {
            checkSelection(evt);
        }

        private void checkSelection(MouseEvent evt) {
            int row = templateTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY()));

            if (row < 0) {
                templateTreeTable.clearSelection();
            }

            if (evt.isPopupTrigger()) {
                if (row != -1) {
                    if (!templateTreeTable.isRowSelected(row)) {
                        templateTreeTable.setRowSelectionInterval(row, row);
                    }
                }
                codeTemplatePopupMenu.show(evt.getComponent(), evt.getX(), evt.getY());
            }
        }
    });

    templateTreeTable.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_DELETE) {
                TreePath selectedPath = templateTreeTable.getTreeSelectionModel().getSelectionPath();
                if (selectedPath != null) {
                    MutableTreeTableNode selectedNode = (MutableTreeTableNode) selectedPath
                            .getLastPathComponent();
                    if (selectedNode instanceof CodeTemplateLibraryTreeTableNode && codeTemplateTasks
                            .getContentPane().getComponent(TASK_CODE_TEMPLATE_LIBRARY_DELETE).isVisible()) {
                        doDeleteLibrary();
                    } else if (selectedNode instanceof CodeTemplateTreeTableNode && codeTemplateTasks
                            .getContentPane().getComponent(TASK_CODE_TEMPLATE_DELETE).isVisible()) {
                        doDeleteCodeTemplate();
                    }
                }
            }
        }
    });

    templateTreeTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting() && !templateTreeTable.getSelectionModel().getValueIsAdjusting()) {
                int selectedRow = templateTreeTable.getSelectedRow();

                boolean saveEnabled = isSaveEnabled();
                boolean adjusting = saveAdjusting.getAndSet(true);

                printTreeTable();

                updateCurrentNode();
                currentSelectedRow = selectedRow;

                if (selectedRow < 0) {
                    if (!adjusting) {
                        switchSplitPaneComponent(blankPanel);
                    }
                } else {
                    TreePath path = templateTreeTable.getPathForRow(selectedRow);
                    if (path != null) {
                        TreeTableNode node = (TreeTableNode) path.getLastPathComponent();

                        if (node instanceof CodeTemplateLibraryTreeTableNode) {
                            setLibraryProperties((CodeTemplateLibraryTreeTableNode) node);
                            switchSplitPaneComponent(libraryPanel);
                        } else if (node instanceof CodeTemplateTreeTableNode) {
                            setCodeTemplateProperties((CodeTemplateTreeTableNode) node);
                            switchSplitPaneComponent(templatePanel);
                        }
                    }
                }

                updateTasks();

                setSaveEnabled(saveEnabled);
                if (!adjusting) {
                    SwingUtilities.invokeLater(new Runnable() {
                        @Override
                        public void run() {
                            saveAdjusting.set(false);
                        }
                    });
                }
            }
        }
    });

    templateTreeTable.addTreeWillExpandListener(new TreeWillExpandListener() {
        @Override
        public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
            treeExpansionChanged();
        }

        @Override
        public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
            treeExpansionChanged();
        }

        private void treeExpansionChanged() {
            updateCurrentNode();
            updateCurrentNode.set(false);
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    updateCurrentNode.set(true);
                }
            });
        }
    });

    templateTreeTableScrollPane = new JScrollPane(templateTreeTable);
    templateTreeTableScrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(0x6E6E6E)));

    templateFilterNotificationLabel = new JLabel();

    templateFilterLabel = new JLabel("Filter:");

    templateFilterField = new JTextField();
    templateFilterField.setToolTipText(
            "Filters (by name) the code templates and libraries that show up in the table above.");

    templateFilterField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent evt) {
            filterChanged(evt);
        }

        @Override
        public void insertUpdate(DocumentEvent evt) {
            filterChanged(evt);
        }

        @Override
        public void changedUpdate(DocumentEvent evt) {
            filterChanged(evt);
        }

        private void filterChanged(DocumentEvent evt) {
            try {
                updateTemplateFilter(evt.getDocument().getText(0, evt.getLength()));
            } catch (BadLocationException e) {
            }
        }
    });

    templateFilterField.addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent evt) {
            updateTemplateFilter(templateFilterField.getText());
        }
    });

    blankPanel = new JPanel();

    libraryPanel = new JPanel();
    libraryPanel.setBackground(splitPane.getBackground());

    libraryLeftPanel = new JPanel();
    libraryLeftPanel.setBackground(libraryPanel.getBackground());

    librarySummaryLabel = new JLabel("Summary:");
    librarySummaryValue = new JLabel();

    libraryDescriptionLabel = new JLabel("Description:");
    libraryDescriptionScrollPane = new MirthRTextScrollPane(null, false, SyntaxConstants.SYNTAX_STYLE_NONE,
            false);

    DocumentListener codeChangeListener = new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent evt) {
            codeChanged();
        }

        @Override
        public void insertUpdate(DocumentEvent evt) {
            codeChanged();
        }

        @Override
        public void changedUpdate(DocumentEvent evt) {
            codeChanged();
        }

        private void codeChanged() {
            if (codeChangeWorker != null) {
                codeChangeWorker.cancel(true);
            }

            int selectedRow = templateTreeTable.getSelectedRow();
            if (selectedRow >= 0) {
                TreePath selectedPath = templateTreeTable.getPathForRow(selectedRow);
                if (selectedPath != null) {
                    codeChangeWorker = new CodeChangeWorker(
                            (String) ((TreeTableNode) selectedPath.getLastPathComponent())
                                    .getValueAt(TEMPLATE_ID_COLUMN));
                    codeChangeWorker.execute();
                }
            }
        }
    };
    libraryDescriptionScrollPane.getDocument().addDocumentListener(codeChangeListener);

    libraryRightPanel = new JPanel();
    libraryRightPanel.setBackground(libraryPanel.getBackground());

    libraryChannelsSelectPanel = new JPanel();
    libraryChannelsSelectPanel.setBackground(libraryRightPanel.getBackground());

    libraryChannelsLabel = new JLabel("<html><b>Channels</b></html>");
    libraryChannelsLabel.setForeground(new Color(64, 64, 64));

    libraryChannelsSelectAllLabel = new JLabel("<html><u>Select All</u></html>");
    libraryChannelsSelectAllLabel.setForeground(Color.BLUE);
    libraryChannelsSelectAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    libraryChannelsSelectAllLabel.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent evt) {
            if (evt.getComponent().isEnabled()) {
                for (int row = 0; row < libraryChannelsTable.getRowCount(); row++) {
                    ChannelInfo channelInfo = (ChannelInfo) libraryChannelsTable.getValueAt(row,
                            LIBRARY_CHANNELS_NAME_COLUMN);
                    channelInfo.setEnabled(true);
                    libraryChannelsTable.setValueAt(channelInfo, row, LIBRARY_CHANNELS_NAME_COLUMN);
                }
                setSaveEnabled(true);
            }
        }
    });

    libraryChannelsDeselectAllLabel = new JLabel("<html><u>Deselect All</u></html>");
    libraryChannelsDeselectAllLabel.setForeground(Color.BLUE);
    libraryChannelsDeselectAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    libraryChannelsDeselectAllLabel.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent evt) {
            if (evt.getComponent().isEnabled()) {
                for (int row = 0; row < libraryChannelsTable.getRowCount(); row++) {
                    ChannelInfo channelInfo = (ChannelInfo) libraryChannelsTable.getValueAt(row,
                            LIBRARY_CHANNELS_NAME_COLUMN);
                    channelInfo.setEnabled(false);
                    libraryChannelsTable.setValueAt(channelInfo, row, LIBRARY_CHANNELS_NAME_COLUMN);
                }
                setSaveEnabled(true);
            }
        }
    });

    libraryChannelsFilterLabel = new JLabel("Filter:");
    libraryChannelsFilterField = new JTextField();
    libraryChannelsFilterField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void removeUpdate(DocumentEvent evt) {
            libraryChannelsTable.getRowSorter().allRowsChanged();
        }

        @Override
        public void insertUpdate(DocumentEvent evt) {
            libraryChannelsTable.getRowSorter().allRowsChanged();
        }

        @Override
        public void changedUpdate(DocumentEvent evt) {
            libraryChannelsTable.getRowSorter().allRowsChanged();
        }
    });

    libraryChannelsTable = new MirthTable();
    libraryChannelsTable.setModel(new RefreshTableModel(new Object[] { "Name", "Id" }, 0));
    libraryChannelsTable.setDragEnabled(false);
    libraryChannelsTable.setRowSelectionAllowed(false);
    libraryChannelsTable.setRowHeight(UIConstants.ROW_HEIGHT);
    libraryChannelsTable.setFocusable(false);
    libraryChannelsTable.setOpaque(true);
    libraryChannelsTable.getTableHeader().setReorderingAllowed(false);
    libraryChannelsTable.setEditable(true);

    OffsetRowSorter libraryChannelsRowSorter = new OffsetRowSorter(libraryChannelsTable.getModel(), 1);
    libraryChannelsRowSorter.setRowFilter(new RowFilter<TableModel, Integer>() {
        @Override
        public boolean include(Entry<? extends TableModel, ? extends Integer> entry) {
            String name = entry.getStringValue(LIBRARY_CHANNELS_NAME_COLUMN);
            return name.equals(NEW_CHANNELS) || StringUtils.containsIgnoreCase(name,
                    StringUtils.trim(libraryChannelsFilterField.getText()));
        }
    });
    libraryChannelsTable.setRowSorter(libraryChannelsRowSorter);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        libraryChannelsTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    libraryChannelsTable.getColumnExt(LIBRARY_CHANNELS_NAME_COLUMN)
            .setCellRenderer(new ChannelsTableCellRenderer());
    libraryChannelsTable.getColumnExt(LIBRARY_CHANNELS_NAME_COLUMN)
            .setCellEditor(new ChannelsTableCellEditor());

    // Hide ID column
    libraryChannelsTable.getColumnExt(LIBRARY_CHANNELS_ID_COLUMN).setVisible(false);

    libraryChannelsScrollPane = new JScrollPane(libraryChannelsTable);

    templatePanel = new JPanel();
    templatePanel.setBackground(splitPane.getBackground());

    templateLeftPanel = new JPanel();
    templateLeftPanel.setBackground(templatePanel.getBackground());

    templateLibraryLabel = new JLabel("Library:");
    templateLibraryComboBox = new JComboBox<String>();
    templateLibraryComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            libraryComboBoxActionPerformed();
        }
    });

    templateTypeLabel = new JLabel("Type:");
    templateTypeComboBox = new JComboBox<CodeTemplateType>(CodeTemplateType.values());
    templateTypeComboBox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            setSaveEnabled(true);
        }
    });

    templateCodeLabel = new JLabel("Code:");
    templateCodeTextArea = new MirthRTextScrollPane(ContextType.GLOBAL_DEPLOY);
    templateCodeTextArea.getDocument().addDocumentListener(codeChangeListener);

    templateAutoGenerateDocumentationButton = new JButton("Update JSDoc");
    templateAutoGenerateDocumentationButton.setToolTipText(
            "<html>Generates/updates a JSDoc at the beginning of your<br/>code, with parameter/return annotations as needed.</html>");
    templateAutoGenerateDocumentationButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            String currentText = templateCodeTextArea.getText();
            String newText = CodeTemplateUtil.updateCode(templateCodeTextArea.getText());
            templateCodeTextArea.setText(newText, false);
            if (!currentText.equals(newText)) {
                setSaveEnabled(true);
            }
        }
    });

    templateRightPanel = new JPanel();
    templateRightPanel.setBackground(templatePanel.getBackground());

    templateContextSelectPanel = new JPanel();
    templateContextSelectPanel.setBackground(templateRightPanel.getBackground());

    templateContextLabel = new JLabel("<html><b>Context</b></html>");
    templateContextLabel.setForeground(new Color(64, 64, 64));

    templateContextSelectAllLabel = new JLabel("<html><u>Select All</u></html>");
    templateContextSelectAllLabel.setForeground(Color.BLUE);
    templateContextSelectAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    templateContextSelectAllLabel.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent evt) {
            TreeTableNode root = (TreeTableNode) templateContextTreeTable.getTreeTableModel().getRoot();
            for (Enumeration<? extends TreeTableNode> groups = root.children(); groups.hasMoreElements();) {
                TreeTableNode group = groups.nextElement();
                ((MutablePair<Integer, String>) group.getUserObject()).setLeft(MirthTriStateCheckBox.CHECKED);
                for (Enumeration<? extends TreeTableNode> children = group.children(); children
                        .hasMoreElements();) {
                    ((MutablePair<Integer, String>) children.nextElement().getUserObject())
                            .setLeft(MirthTriStateCheckBox.CHECKED);
                }
            }
            templateContextTreeTable.updateUI();
            setSaveEnabled(true);
        }
    });

    templateContextDeselectAllLabel = new JLabel("<html><u>Deselect All</u></html>");
    templateContextDeselectAllLabel.setForeground(Color.BLUE);
    templateContextDeselectAllLabel.setCursor(new Cursor(Cursor.HAND_CURSOR));
    templateContextDeselectAllLabel.addMouseListener(new MouseAdapter() {
        public void mouseReleased(MouseEvent evt) {
            TreeTableNode root = (TreeTableNode) templateContextTreeTable.getTreeTableModel().getRoot();
            for (Enumeration<? extends TreeTableNode> groups = root.children(); groups.hasMoreElements();) {
                TreeTableNode group = groups.nextElement();
                ((MutablePair<Integer, String>) group.getUserObject()).setLeft(MirthTriStateCheckBox.UNCHECKED);
                for (Enumeration<? extends TreeTableNode> children = group.children(); children
                        .hasMoreElements();) {
                    ((MutablePair<Integer, String>) children.nextElement().getUserObject())
                            .setLeft(MirthTriStateCheckBox.UNCHECKED);
                }
            }
            templateContextTreeTable.updateUI();
            setSaveEnabled(true);
        }
    });

    final TableCellEditor contextCellEditor = new ContextTreeTableCellEditor(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            setSaveEnabled(true);
        }
    });

    templateContextTreeTable = new MirthTreeTable() {
        @Override
        public TableCellEditor getCellEditor(int row, int column) {
            if (isHierarchical(column)) {
                return contextCellEditor;
            } else {
                return super.getCellEditor(row, column);
            }
        }
    };

    DefaultMutableTreeTableNode rootContextNode = new DefaultMutableTreeTableNode();
    DefaultMutableTreeTableNode globalScriptsNode = new DefaultMutableTreeTableNode(
            new MutablePair<Integer, String>(MirthTriStateCheckBox.CHECKED, "Global Scripts"));
    globalScriptsNode.add(new DefaultMutableTreeTableNode(
            new MutablePair<Integer, ContextType>(MirthTriStateCheckBox.CHECKED, ContextType.GLOBAL_DEPLOY)));
    globalScriptsNode.add(new DefaultMutableTreeTableNode(
            new MutablePair<Integer, ContextType>(MirthTriStateCheckBox.CHECKED, ContextType.GLOBAL_UNDEPLOY)));
    globalScriptsNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.GLOBAL_PREPROCESSOR)));
    globalScriptsNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.GLOBAL_POSTPROCESSOR)));
    rootContextNode.add(globalScriptsNode);
    DefaultMutableTreeTableNode channelScriptsNode = new DefaultMutableTreeTableNode(
            new MutablePair<Integer, String>(MirthTriStateCheckBox.CHECKED, "Channel Scripts"));
    channelScriptsNode.add(new DefaultMutableTreeTableNode(
            new MutablePair<Integer, ContextType>(MirthTriStateCheckBox.CHECKED, ContextType.CHANNEL_DEPLOY)));
    channelScriptsNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.CHANNEL_UNDEPLOY)));
    channelScriptsNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.CHANNEL_PREPROCESSOR)));
    channelScriptsNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.CHANNEL_POSTPROCESSOR)));
    channelScriptsNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.CHANNEL_ATTACHMENT)));
    channelScriptsNode.add(new DefaultMutableTreeTableNode(
            new MutablePair<Integer, ContextType>(MirthTriStateCheckBox.CHECKED, ContextType.CHANNEL_BATCH)));
    rootContextNode.add(channelScriptsNode);
    DefaultMutableTreeTableNode sourceConnectorNode = new DefaultMutableTreeTableNode(
            new MutablePair<Integer, String>(MirthTriStateCheckBox.CHECKED, "Source Connector"));
    sourceConnectorNode.add(new DefaultMutableTreeTableNode(
            new MutablePair<Integer, ContextType>(MirthTriStateCheckBox.CHECKED, ContextType.SOURCE_RECEIVER)));
    sourceConnectorNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.SOURCE_FILTER_TRANSFORMER)));
    rootContextNode.add(sourceConnectorNode);
    DefaultMutableTreeTableNode destinationConnectorNode = new DefaultMutableTreeTableNode(
            new MutablePair<Integer, String>(MirthTriStateCheckBox.CHECKED, "Destination Connector"));
    destinationConnectorNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.DESTINATION_FILTER_TRANSFORMER)));
    destinationConnectorNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.DESTINATION_DISPATCHER)));
    destinationConnectorNode.add(new DefaultMutableTreeTableNode(new MutablePair<Integer, ContextType>(
            MirthTriStateCheckBox.CHECKED, ContextType.DESTINATION_RESPONSE_TRANSFORMER)));
    rootContextNode.add(destinationConnectorNode);

    DefaultTreeTableModel contextModel = new SortableTreeTableModel(rootContextNode);
    contextModel.setColumnIdentifiers(Arrays.asList(new String[] { "Context" }));
    templateContextTreeTable.setTreeTableModel(contextModel);

    templateContextTreeTable.setRootVisible(false);
    templateContextTreeTable.setDragEnabled(false);
    templateContextTreeTable.setRowSelectionAllowed(false);
    templateContextTreeTable.setRowHeight(UIConstants.ROW_HEIGHT);
    templateContextTreeTable.setFocusable(false);
    templateContextTreeTable.setOpaque(true);
    templateContextTreeTable.getTableHeader().setReorderingAllowed(false);
    templateContextTreeTable.setEditable(true);
    templateContextTreeTable.setSortable(false);
    templateContextTreeTable.setShowGrid(true, true);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        templateContextTreeTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    templateContextTreeTable.setTreeCellRenderer(new ContextTreeTableCellRenderer());
    templateContextTreeTable.setOpenIcon(null);
    templateContextTreeTable.setClosedIcon(null);
    templateContextTreeTable.setLeafIcon(null);

    templateContextTreeTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent evt) {
            checkSelection(evt);
        }

        @Override
        public void mouseReleased(MouseEvent evt) {
            checkSelection(evt);
        }

        private void checkSelection(MouseEvent evt) {
            if (templateContextTreeTable.rowAtPoint(new Point(evt.getX(), evt.getY())) < 0) {
                templateContextTreeTable.clearSelection();
            }
        }
    });

    templateContextTreeTable.getTreeTableModel().addTreeModelListener(new TreeModelListener() {
        @Override
        public void treeNodesChanged(TreeModelEvent evt) {
            if (ArrayUtils.isNotEmpty(evt.getChildren())) {
                TreeTableNode node = (TreeTableNode) evt.getChildren()[0];

                if (evt.getTreePath().getPathCount() == 2) {
                    boolean allChildren = true;
                    boolean noChildren = true;
                    for (Enumeration<? extends TreeTableNode> children = node.getParent().children(); children
                            .hasMoreElements();) {
                        TreeTableNode child = children.nextElement();
                        if (((Pair<Integer, ContextType>) child.getUserObject())
                                .getLeft() == MirthTriStateCheckBox.UNCHECKED) {
                            allChildren = false;
                        } else {
                            noChildren = false;
                        }
                    }

                    int value;
                    if (allChildren) {
                        value = MirthTriStateCheckBox.CHECKED;
                    } else if (noChildren) {
                        value = MirthTriStateCheckBox.UNCHECKED;
                    } else {
                        value = MirthTriStateCheckBox.PARTIAL;
                    }

                    ((MutablePair<Integer, String>) node.getParent().getUserObject()).setLeft(value);
                } else if (evt.getTreePath().getPathCount() == 1) {
                    int value = ((Pair<Integer, String>) node.getUserObject()).getLeft();

                    for (Enumeration<? extends TreeTableNode> children = node.children(); children
                            .hasMoreElements();) {
                        ((MutablePair<Integer, ContextType>) children.nextElement().getUserObject())
                                .setLeft(value);
                    }
                }
            }
        }

        @Override
        public void treeNodesInserted(TreeModelEvent evt) {
        }

        @Override
        public void treeNodesRemoved(TreeModelEvent evt) {
        }

        @Override
        public void treeStructureChanged(TreeModelEvent evt) {
        }
    });

    templateContextTreeTableScrollPane = new JScrollPane(templateContextTreeTable);
}

From source file:simMPLS.ui.simulator.JVentanaHija.java

/** Este mtodo se ejecuta cuando se mueve el ratn dentro del rea de simulacin ,
 * en la pantalla de simulacin. Entre otras cosas, cambia el cursor del ratn al pasar
 * sobre un elemento, permite mostrar mens emergentes coherentes con el contexto
 * de donde se encuentra el ratn, etctera.
 * This method is executed when the rapn moves into the area of simulation, on screen 
 * simulation. Among other things, changes the mouse cursor to pass * on an item, can display pop mens consistent with the context 
 * of where the mouse, etcetera is.//w  w w  .  j  av a2 s .c  o  m
 * @since 1.0
 * @param evt El evento que hace que se dispare este mtodo.
 */
private void ratonSobrePanelSimulacion(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_ratonSobrePanelSimulacion
    TTopology topo = escenario.getTopology();
    TTopologyElement et = topo.obtenerElementoEnPosicion(evt.getPoint());
    if (et != null) {
        this.setCursor(new Cursor(Cursor.HAND_CURSOR));
        if (et.getElementType() == TTopologyElement.NODO) {
            TNode nt = (TNode) et;
            if (nt.getPorts().isArtificiallyCongested()) {
                panelSimulacion.setToolTipText(java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
                        .getString("JVentanaHija.Congestion")
                        + nt.getPorts().getCongestionLevel()
                        + java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
                                .getString("JVentanaHija.POrcentaje")
                        + java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
                                .getString("VentanaHija.paraDejarDeCongestionar"));
            } else {
                panelSimulacion.setToolTipText(java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
                        .getString("JVentanaHija.Congestion")
                        + nt.getPorts().getCongestionLevel()
                        + java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
                                .getString("JVentanaHija.POrcentaje")
                        + java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
                                .getString("VentanaHija.paraCongestionar"));
            }
        } else if (et.getElementType() == TTopologyElement.LINK) {
            TLink ent = (TLink) et;
            if (ent.isBroken()) {
                panelSimulacion.setToolTipText(java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
                        .getString("JVentanaHija.EnlaceRoto"));
            } else {
                panelSimulacion.setToolTipText(java.util.ResourceBundle.getBundle("simMPLS/lenguajes/lenguajes")
                        .getString("JVentanaHija.EnlaceFuncionando"));
            }
        }
    } else {
        this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        this.panelSimulacion.setToolTipText(null);
        if (!this.panelSimulacion.obtenerMostrarLeyenda()) {
            this.panelSimulacion.setToolTipText(java.util.ResourceBundle
                    .getBundle("simMPLS/lenguajes/lenguajes").getString("JVentanaHija.VerLeyenda"));
        } else {
            this.panelSimulacion.setToolTipText(java.util.ResourceBundle
                    .getBundle("simMPLS/lenguajes/lenguajes").getString("JVentanaHija.OcultarLeyenda"));
        }
    }
}