【问题标题】:Searching array return count found搜索数组返回计数找到
【发布时间】:2019-01-26 18:00:04
【问题描述】:

我有一个我正在尝试配置的按钮。我需要它来查看 textArea 并将其与短语列表进行比较,并返回从文本区域中的列表中找到的多个匹配项。任何帮助表示赞赏。谢谢

 verifyJButton = new JButton("Verify"); //Create verify button
 add(verifyJButton); //add button to a box
 verifyJButton.addActionListener(
            new ActionListener()//set action for button
            {
                @Override
                public void actionPerformed(ActionEvent event2)
                {
                    //user pressed verify button
                    for (String keywords = 0; keywords < 

                    }                        
                    JOptionPane.showMessageDialog(label, this, "The spam score for this message is", WIDTH);
                }

【问题讨论】:

  • 您具体遇到了什么问题?
  • 我在帖子中添加了代码。假设我有一个包含“这里”、“那里”、“为”、“为什么”的列表。在界面中,我粘贴了一段随机文本,当我单击验证按钮时,它会查看列表并给我一个数字,告诉我看到列表中的任何单词的次数

标签: java arrays user-interface search actionevent


【解决方案1】:

Java Beginner - Counting number of words in sentence

以上答案可能会帮助您了解如何计算 textArea 中特定单词的计数

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-04
    • 1970-01-01
    • 1970-01-01
    • 2023-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    相关资源
    最近更新 更多