Ejemplo n.º 1
0
 public void UPDATED() {
   int tI1 = 0;
   String[] AllLines = DICTIONARY.getText().toLowerCase().split("\r\n|\r|\n");
   int[] sizes = CountMinMaxDictionarySizes(AllLines);
   CharCountSlider.setMinimum(sizes[0]);
   CharCountSlider.setMaximum(sizes[1]);
   int value = CharCountSlider.getValue();
   if (CharCountSlider.getMinimum() == value) {
     value = 0;
   }
   boolean AnyValue = (value == 0) ? true : false;
   CountDictionary:
   {
     if (AnyValue) {
       tI1 = AllLines.length;
       break CountDictionary;
     }
     for (int i = 0; i < AllLines.length; i++) {
       if (AllLines[i].length() == value) {
         tI1++;
       } else if (human == false && AllLines[i].length() > value) {
         tI1++;
       }
     }
   }
   if (AnyValue || human == false) {
     tI1 = AllLines.length;
   }
   String[] newPOSS = new String[tI1];
   int rI1 = 0;
   CountGoodies:
   {
     if (AnyValue) {
       newPOSS = AllLines;
       break CountGoodies;
     }
     for (int i = 0; i < AllLines.length; i++) {
       if (AllLines[i].length() == value) {
         newPOSS[rI1] = AllLines[i].toLowerCase();
         rI1++;
       } else if (human == false && AllLines[i].length() > value) {
         newPOSS[rI1] = AllLines[i].toLowerCase();
         rI1++;
       }
     }
   }
   segment:
   {
     if (SEGMENT.getText().length() == 0) {
       break segment;
     }
     int CI1 = 0;
     for (int i = 0; i < newPOSS.length; i++) {
       if (newPOSS[i].contains(SEGMENT.getText())) {
         CI1++;
       }
     }
     int RI1 = 0;
     String[] repPOSS = new String[CI1];
     for (int i = 0; i < newPOSS.length; i++) {
       if (newPOSS[i].contains(SEGMENT.getText())) {
         repPOSS[RI1] = newPOSS[i];
         RI1++;
       }
     }
     newPOSS = repPOSS;
   }
   Charact:
   {
     if (Characters.getText().length() >= 1) {
     } else {
       break Charact;
     }
     int CI1 = 0;
     for (int i = 0; i < newPOSS.length; i++) {
       if (DoesStringContainThese(newPOSS[i], Characters.getText())) {
         CI1++;
       }
     }
     int RI1 = 0;
     String[] repPOSS = new String[CI1];
     for (int i = 0; i < newPOSS.length; i++) {
       if (DoesStringContainThese(newPOSS[i], Characters.getText())) {
         repPOSS[RI1] = newPOSS[i];
         RI1++;
       }
     }
     newPOSS = repPOSS;
   }
   NotCharact:
   {
     int CI1 = 0;
     for (int i = 0; i < newPOSS.length; i++) {
       if (DoesStringNotContainThese(newPOSS[i], NEGCharacters.getText())) {
         CI1++;
       }
     }
     int RI1 = 0;
     String[] repPOSS = new String[CI1];
     for (int i = 0; i < newPOSS.length; i++) {
       if (DoesStringNotContainThese(newPOSS[i], NEGCharacters.getText())) {
         repPOSS[RI1] = newPOSS[i];
         RI1++;
       }
     }
     newPOSS = repPOSS;
   }
   filter:
   {
     if (Filter.getText().length() >= 1) {
     } else {
       break filter;
     }
     int CI1 = 0;
     for (int i = 0; i < newPOSS.length; i++) {
       if (DoesStringMatchFilter(newPOSS[i], Filter.getText())) {
         CI1++;
       }
     }
     int RI1 = 0;
     String[] repPOSS = new String[CI1];
     for (int i = 0; i < newPOSS.length; i++) {
       if (DoesStringMatchFilter(newPOSS[i], Filter.getText())) {
         repPOSS[RI1] = newPOSS[i];
         RI1++;
       }
     }
     newPOSS = repPOSS;
   }
   Finalize:
   {
     String finished = "";
     for (int i = 0; i < newPOSS.length; i++) {
       finished = finished + newPOSS[i] + "\n";
     }
     POSS.setText(finished);
   }
 }
Ejemplo n.º 2
0
  /**
   * 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.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    CharCountSlider = new javax.swing.JSlider();
    CharCount = new javax.swing.JLabel();
    jPanel2 = new javax.swing.JPanel();
    jPanel5 = new javax.swing.JPanel();
    jScrollPane3 = new javax.swing.JScrollPane();
    POSS = new javax.swing.JTextPane();
    jPanel3 = new javax.swing.JPanel();
    jLabel1 = new javax.swing.JLabel();
    SEGMENT = new javax.swing.JTextField();
    jLabel3 = new javax.swing.JLabel();
    CHECK = new javax.swing.JButton();
    Characters = new javax.swing.JTextField();
    jLabel4 = new javax.swing.JLabel();
    NEGCharacters = new javax.swing.JTextField();
    jLabel5 = new javax.swing.JLabel();
    Filter = new javax.swing.JTextField();
    jPanel4 = new javax.swing.JPanel();
    jScrollPane1 = new javax.swing.JScrollPane();
    DICTIONARY = new javax.swing.JTextPane();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    jLabel2.setText("How Many Characters (Zero is any)");

    CharCountSlider.setMaximum(10);
    CharCountSlider.setMinimum(4);
    CharCountSlider.setValue(0);
    CharCountSlider.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseReleased(java.awt.event.MouseEvent evt) {
            CharCountSliderMouseReleased(evt);
          }
        });
    CharCountSlider.addChangeListener(
        new javax.swing.event.ChangeListener() {
          public void stateChanged(javax.swing.event.ChangeEvent evt) {
            CharCountSliderStateChanged(evt);
          }
        });

    CharCount.setText("Any");

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel2)
                    .addGap(18, 18, 18)
                    .addComponent(
                        CharCountSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 367, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        CharCount,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        31,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(
                        jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(CharCount)
                            .addComponent(
                                CharCountSlider,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2))));

    POSS.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            null,
            "Possibilities",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION,
            new java.awt.Font("Courier New", 0, 12))); // NOI18N
    POSS.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
    jScrollPane3.setViewportView(POSS);

    javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(
        jPanel5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel5Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane3)));
    jPanel5Layout.setVerticalGroup(
        jPanel5Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel5Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE)
                    .addContainerGap()));

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
        jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel2Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jPanel5,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addContainerGap()));
    jPanel2Layout.setVerticalGroup(
        jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel2Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jPanel5,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addContainerGap()));

    jLabel1.setText("Contains (SEGMENT)");

    SEGMENT.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            SEGMENTActionPerformed(evt);
          }
        });
    SEGMENT.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyReleased(java.awt.event.KeyEvent evt) {
            SEGMENTKeyReleased(evt);
          }
        });

    jLabel3.setText("Contains (Characters)");

    CHECK.setText("CHECK");
    CHECK.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CHECKActionPerformed(evt);
          }
        });

    Characters.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            CharactersActionPerformed(evt);
          }
        });
    Characters.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyReleased(java.awt.event.KeyEvent evt) {
            CharactersKeyReleased(evt);
          }
        });

    jLabel4.setText("NOT CONTAIN (Characters)");

    NEGCharacters.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            NEGCharactersActionPerformed(evt);
          }
        });
    NEGCharacters.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyReleased(java.awt.event.KeyEvent evt) {
            NEGCharactersKeyReleased(evt);
          }
        });

    jLabel5.setText("Filter");

    Filter.setText("-----");
    Filter.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyReleased(java.awt.event.KeyEvent evt) {
            FilterKeyReleased(evt);
          }
        });

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
        jPanel3Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel3Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        jPanel3Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(
                                jPanel3Layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jLabel3,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        114,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        Characters,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        180,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.TRAILING,
                                jPanel3Layout
                                    .createSequentialGroup()
                                    .addComponent(jLabel1)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        SEGMENT,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        180,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                jPanel3Layout
                                    .createSequentialGroup()
                                    .addComponent(jLabel4)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addComponent(
                                        NEGCharacters,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        154,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        jPanel3Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                jPanel3Layout
                                    .createSequentialGroup()
                                    .addGap(0, 0, Short.MAX_VALUE)
                                    .addComponent(CHECK))
                            .addGroup(
                                jPanel3Layout
                                    .createSequentialGroup()
                                    .addComponent(jLabel5)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(Filter)
                                    .addContainerGap()))));
    jPanel3Layout.setVerticalGroup(
        jPanel3Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel3Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        jPanel3Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(
                                SEGMENT,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5)
                            .addComponent(
                                Filter,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addGroup(
                        jPanel3Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3)
                            .addComponent(
                                Characters,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(
                        jPanel3Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                jPanel3Layout
                                    .createSequentialGroup()
                                    .addGap(0, 8, Short.MAX_VALUE)
                                    .addComponent(CHECK))
                            .addGroup(
                                jPanel3Layout
                                    .createSequentialGroup()
                                    .addGroup(
                                        jPanel3Layout
                                            .createParallelGroup(
                                                javax.swing.GroupLayout.Alignment.BASELINE)
                                            .addComponent(jLabel4)
                                            .addComponent(
                                                NEGCharacters,
                                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGap(0, 0, Short.MAX_VALUE)))));

    DICTIONARY.setBorder(
        javax.swing.BorderFactory.createTitledBorder(
            null,
            "Dictionary",
            javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
            javax.swing.border.TitledBorder.DEFAULT_POSITION,
            new java.awt.Font("Courier New", 0, 12))); // NOI18N
    DICTIONARY.setText(
        "ABYSSAL\nADAMANTITE\nALKHARID\nARDOUGNE\nASGARNIA\nAVANTOE\nBASILISK\nBANSHEE\nBARROWS\nBLOODVELD\nBOBTHECAT\nBRIMHAVEN\nBURTHORPE\nCADANTINE\nCAMELOT\nCANIFIS\nCATHERBY\nCHAOSDRUID\nCHAOSDWARF\nCHOMPYBIRD\nCOCKATRICE\nCRANDOR\nCROMADIURE\nDAGANNOTH\nDORGESHUUN\nDRAGON\nDRAYNOR\nDUSTDEVIL\nDWARFWEED\nEDGEVILLE\nENTRANA\nFALADOR\nFELDIP\nFIREGIANT\nFREMENNIK\nGARGOYLE\nGOBLIN\nGRANDTREE\nGUAMLEAF\nGUTANOTH\nGUTHIX\nHILLGIANT\nHELLHOUND\nHIGHWAYMAN\nHOBGOBLIN\nICEGIANT\nICEQUEEN\nICEWARRIOR\nICEWOLF\nICETROLL\nIRITLEAF\nISAFDAR\nJOGRE\nKALPHITE\nKANDARIN\nKARAMJA\nKELDAGRIM\nKHAZARD\nKWUARM\nLANTADYME\nLLETYA\nLUMBRIDGE\nNECHRYAEL\nMARRENTILL\nMENAPHOS\nMISTHALIN\nMITHRIL\nMOGRE\nMORTTON\nMORYTANIA\nMOSSGIANT\nNIGHTSHADE\nPALADIN\nPHASMATYS\nPORTSARIM\nPRIFDDINAS\nPYREFIEND\nRANARRWEED\nRELLEKKA\nRIMMINGTON\nRUNESCAPE\nRUNITE\nSARADOMIN\nSKELETON\nSNAPDRAGON\nSNAPEGRASS\nSOPHANEM\nSOULLESS\nSPIRITTREE\nTARROMIN\nTAVERLEY\nTERRORBIRD\nTIRANNWN\nTOADFLAX\nTORSTOL\nUGTHANKI\nUNICORN\nVARROCK\nWHIP\nYANILLE\nZAMORAK");
    jScrollPane1.setViewportView(DICTIONARY);

    javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
    jPanel4.setLayout(jPanel4Layout);
    jPanel4Layout.setHorizontalGroup(
        jPanel4Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                javax.swing.GroupLayout.Alignment.TRAILING,
                jPanel4Layout
                    .createSequentialGroup()
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(
                        jScrollPane1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        259,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
    jPanel4Layout.setVerticalGroup(
        jPanel4Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel4Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane1)
                    .addContainerGap()));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                jPanel1,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addComponent(
                                jPanel3,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .addGroup(
                                layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jPanel2,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        Short.MAX_VALUE)
                                    .addGap(18, 18, 18)
                                    .addComponent(
                                        jPanel4,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addComponent(
                        jPanel1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        jPanel3,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addGroup(
                        layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(
                                jPanel4,
                                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))
                    .addContainerGap()));

    pack();
  } // </editor-fold>//GEN-END:initComponents