Example usage for java.awt.event WindowEvent WindowEvent

List of usage examples for java.awt.event WindowEvent WindowEvent

Introduction

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

Prototype

public WindowEvent(Window source, int id, Window opposite) 

Source Link

Document

Constructs a WindowEvent object with the specified opposite Window .

Usage

From source file:Main.java

protected void processWindowEvent(WindowEvent e) {
    WindowEvent newEvent = new WindowEvent(this, WindowEvent.WINDOW_FIRST, this);

    super.processWindowEvent(e); // Pass on the event
}

From source file:fs.MainWindow.java

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
    float threshold_entropy = ((Double) jS_ThresholdEntropy.getValue()).floatValue();
    String type_entropy = (String) jCB_PenalizationSE.getSelectedItem();
    float alpha = ((Double) jS_AlphaSE.getValue()).floatValue();
    float q_entropy = ((Double) jS_QEntropySE.getValue()).floatValue();
    float beta = ((float) jSliderBetaSE.getValue() / 100);
    int search_alg = 0;
    //jTA_SelectedFeaturesSE.setText("");
    String path = null;//IOFile.saveFile();
    StringBuffer txt = null;//  ww w.ja v a2 s  .  c  om
    int maxf = (Integer) jS_MaxSetSizeSE.getValue();
    if (q_entropy < 0 || alpha < 0) {
        //entrada de dados invalida.
        JOptionPane.showMessageDialog(null,
                "Error on parameter value: " + "The values of q-entropy and Alpha must be positives.",
                "Application Error", JOptionPane.ERROR_MESSAGE);
        return;
    }
    if (jRB_SFSSE.isSelected()) {
        search_alg = 1;
    } //SFS
    else if (jRB_ESSE.isSelected()) {
        search_alg = 9;
    } //Exhaustive
    else if (jRB_SFFSSE.isSelected()) {
        search_alg = 2;
    } //SFFS

    Vector targets = null;
    if (!jTF_Target.getText().equalsIgnoreCase("")) {
        targets = new Vector();
        String strtargets = jTF_Target.getText();
        String str = "";
        for (int i = 0; i < strtargets.length(); i++) {
            if (strtargets.charAt(i) == ' ') {
                if (!str.equalsIgnoreCase("")) {
                    targets.add(str);
                    str = "";
                }
            } else {
                str += strtargets.charAt(i);
            }
        }
        //para o ultimo target da string
        if (!str.equalsIgnoreCase("")) {
            targets.add(str);
            str = "";
        }
    }

    //inverte os tempos de expressao, de forma que os targets passem
    //a ser os preditores, i.e., os preditores passem a considerar o valor
    //do target no instante de tempo posterior.
    //IOFile.printMatrix(Md);
    if (jCB_TargetsAsPredictors.isSelected()) {
        Md = Preprocessing.InvertColumns(Md);
        //IOFile.printMatrix(Md);
    }

    //vetor com os resultados da selecao de caracteristica.
    //aqui so sera analisada a primeira resposta.
    int resultsetsize = 1;//(Integer)jS_MaxResultListSE.getValue();
    int n = Main.maximumValue(Md, 0, Md.length - 1, 0, Md[0].length - 1) + 1;
    //define o parametro do tipo de dados:
    //1 == temporal
    //2 == steady state
    int datatype = 2;
    if (jRBTimeSeries.isSelected()) {
        datatype = 1;
    }

    recoverednetwork = new AGN(Md.length, Md[0].length, n, datatype);
    recoverednetwork.setTemporalsignal(Mo);
    recoverednetwork.setTemporalsignalquantized(Md);
    if (featurestitles != null) {
        recoverednetwork.setLabelstemporalsignal(featurestitles);
    }
    if (datatitles != null) {
        AGNRoutines.setGeneNames(recoverednetwork, datatitles);
        AGNRoutines.setGeneIds(recoverednetwork, datatitles);
    }
    txt = AGNRoutines.RecoverNetworkfromExpressions(recoverednetwork, null, datatype, //datatype: 1==temporal, 2==steady-state.
            jCB_Periodic.isSelected(), threshold_entropy, type_entropy, alpha, beta, q_entropy, targets, //target indexes
            maxf, search_alg, //1==SFS, 2==SFFS, 3==SFFS_stack(expandindo todos os empates encontrados), 9==Exhaustive.
            jCB_TargetsAsPredictors.isSelected(), resultsetsize, null, 3//stacksize, used only for SFFS_Stack (option 4) == tamanho da expansao dos empatados.
    );
    LogExecucao.gravarResultado(txt.toString());
    jTA_SelectedFeaturesSE.setText(txt.toString());
    //AGNRoutines.ViewAGN(recoverednetwork, true, datatype);

    if (NetworkVisualization != null) {
        jP_NetVis.remove(NetworkVisualization);
    }

    //nova implementacao para visualizacao das redes.
    NetworkVisualization = new PrefusePanel();
    NetworkVisualization.setNetwork(recoverednetwork);
    NetworkVisualization.CreateNetwork();
    jTabbedPane1.setSelectedIndex(jTabbedPane1.getSelectedIndex() + 1);//aba da visualizacao de rede
    jP_NetVis.add(NetworkVisualization, java.awt.BorderLayout.CENTER);
    NetworkVisualization.repaint();
    dispatchEvent(new WindowEvent(this, WindowEvent.COMPONENT_RESIZED, this));
    //para atualizar a janela sem a necessidade de move-la.
}

From source file:fs.MainWindow.java

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
    if (recoverednetwork != null) {
        //AGNRoutines.ViewAGN(recoverednetwork, true, 1);

        NetworkVisualization = new PrefusePanel();
        NetworkVisualization.setNetwork(recoverednetwork);
        NetworkVisualization.CreateNetwork();
        jTabbedPane1.setSelectedIndex(jTabbedPane1.getSelectedIndex() + 1);//aba da visualizacao de rede
        jP_NetVis.add(NetworkVisualization, java.awt.BorderLayout.CENTER);
        NetworkVisualization.repaint();//from w w  w .  j  ava2s . c o  m
        repaint();
        dispatchEvent(new WindowEvent(this, WindowEvent.COMPONENT_RESIZED, this));
    } else {
        JOptionPane.showMessageDialog(this, "Execution Error: Click on Network Inference Button first.",
                "Application Error", JOptionPane.ERROR_MESSAGE);
    }
}

From source file:fs.MainWindow.java

private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
    //abrir arquivos .agn
    String path = IOFile.openAGNFile();
    if (path != null) {
        if (NetworkVisualization != null) {
            jP_NetVis.remove(NetworkVisualization);
        }//from   ww w  .ja v a  2s  .c  om
        recoverednetwork = IOFile.readAGNfromFile(path);
        NetworkVisualization = new PrefusePanel();
        NetworkVisualization.setNetwork(recoverednetwork);
        NetworkVisualization.CreateNetwork();
        jP_NetVis.add(NetworkVisualization, java.awt.BorderLayout.CENTER);
        NetworkVisualization.repaint();
        repaint();
        dispatchEvent(new WindowEvent(this, WindowEvent.COMPONENT_RESIZED, this));
    }
}

From source file:fs.MainWindow.java

private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
    NetworkVisualization.ChangeClassColor();
    NetworkVisualization.repaint();/*from   ww  w . j  a va  2 s . c o  m*/
    repaint();
    dispatchEvent(new WindowEvent(this, WindowEvent.COMPONENT_RESIZED, this));

}