private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {                                         

        String readPOS;

		readPOS = jTextArea1.getText();

		String []POS;
		POS = readPOS.split("[-.!? ]");

        jTextArea2.append("Part of Speech Result:\n");
		for(int i = 0; i < POS.length; i++)
		{
            if (POS[i].equals("makan")||POS[i].equals("kerja"))
            {
                jTextArea2.append((POS[i] + "/KK" + " | "));
            }
            else if (POS[i].equals("sakit")||POS[i].equals("cantik"))
            {
                jTextArea2.append((POS[i] + "/KS" + " | "));
            }
            else if (POS[i].equals("saya")||POS[i].equals("dia"))
            {
                jTextArea2.append((POS[i] + "/KGN" + " | "));
            }
            else if (POS[i].equals("bapa")||POS[i].equals("isteri")
                    ||POS[i].equals("doktor")||POS[i].equals("encik")||POS[i].equals("nasi"))
            {
                jTextArea2.append((POS[i] + "/KNA" + " | "));
            }
            else if (POS[i].equals("Ali")||POS[i].equals("Dr.")||POS[i].equals("En."))
            {
                jTextArea2.append((POS[i] + "/KNK" + " | "));
            }
            else if (POS[i].equals("dan")||POS[i].equals("atau"))
            {
                jTextArea2.append((POS[i] + "/KPA" + " | "));
            }
            else if (POS[i].equals("nya")||POS[i].equals("an")||POS[i].equals("kah"))
            {
                jTextArea2.append((POS[i] + "/KPC" + " | "));
            }
            else if (POS[i].equals("mengapa")||POS[i].equals("adapun")
                    ||POS[i].equals("aduh")||POS[i].equals("sila"))
            {
                jTextArea2.append((POS[i] + "/KPK" + " | "));
            }
            else 
            jTextArea2.append((POS[i] + "/KNK" + " | "));
         }jTextArea2.append("\n\n\n");
         // TODO add your handling code here:
    }

can i simplify (POS.equals("mengapa")||POS.equals("adapun")
||POS.equals("aduh")||POS.equals("sila"))?? because i still have alot of OR need to put in. By tis problem i can use database??? anyone can tell me? thanks.

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {                                         

        String readPOS;

		readPOS = jTextArea1.getText();

		String []POS;
		POS = readPOS.split("[-.!? ]");

        jTextArea2.append("Part of Speech Result:\n");
		for(int i = 0; i < POS.length; i++)
		{
            if (POS[i].equals("makan")||POS[i].equals("kerja"))
            {
                jTextArea2.append((POS[i] + "/KK" + " | "));
            }
            else if (POS[i].equals("sakit")||POS[i].equals("cantik"))
            {
                jTextArea2.append((POS[i] + "/KS" + " | "));
            }
            else if (POS[i].equals("saya")||POS[i].equals("dia"))
            {
                jTextArea2.append((POS[i] + "/KGN" + " | "));
            }
            else if (POS[i].equals("bapa")||POS[i].equals("isteri")
                    ||POS[i].equals("doktor")||POS[i].equals("encik")||POS[i].equals("nasi"))
            {
                jTextArea2.append((POS[i] + "/KNA" + " | "));
            }
            else if (POS[i].equals("Ali")||POS[i].equals("Dr.")||POS[i].equals("En."))
            {
                jTextArea2.append((POS[i] + "/KNK" + " | "));
            }
            else if (POS[i].equals("dan")||POS[i].equals("atau"))
            {
                jTextArea2.append((POS[i] + "/KPA" + " | "));
            }
            else if (POS[i].equals("nya")||POS[i].equals("an")||POS[i].equals("kah"))
            {
                jTextArea2.append((POS[i] + "/KPC" + " | "));
            }
            else if (POS[i].equals("mengapa")||POS[i].equals("adapun")
                    ||POS[i].equals("aduh")||POS[i].equals("sila"))
            {
                jTextArea2.append((POS[i] + "/KPK" + " | "));
            }
            else 
            jTextArea2.append((POS[i] + "/KNK" + " | "));
         }jTextArea2.append("\n\n\n");
         // TODO add your handling code here:
    }

can i simplify (POS.equals("mengapa")||POS.equals("adapun")
||POS.equals("aduh")||POS.equals("sila"))?? because i still have alot of OR need to put in. By tis problem i can use database??? anyone can tell me? thanks.

You can make a private method that returns true if the input is correct, in the same file that your Listener is defined--

private boolean canAppendKPK(String value){
   return ( value.equals("mengapa")||value.equals("adapun")
                    ||value.equals("aduh")||value.equals("sila") );
}

--so the statement can look like this--

// ...
            else if (canAppendKPK(POS[i]))
            {
                jTextArea2.append((POS[i] + "/KPK" + " | "));
            }
// ...

-- then again, you can help us do a better job by explaining what it is your program is trying to do. Maybe someone can redirect you to a Regex or Validation API that will make things simpler?

You can still use a refactoring tip: Introduce Explaining Variable.

Declare, for each equals(), a bool that contains the result of this operation and use them in the if statement instead of the ugly list of equals() calls.

so.. only have these 2 method to solve this kind of problem?? i think tat still alot of code have to put in one page..

This question has already been answered. Start a new discussion instead.