Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8885333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:17:04+00:00 2026-06-14T21:17:04+00:00

I have an array of strings which I’m trying to display (one by one)

  • 0

I have an array of strings which I’m trying to display (one by one) as a slideshow in a Java Swing component. I am also trying to add a delay time between the iterations.

I attempted to do this by using a JTextArea, with an action listener added to it. Here is the code I have right now:

private class myActionListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
        // A BUNCH OF TEXT PROCESSING

        //NOTE: myInfo.getContents() returns an ArrayList<myType>.
        Iterator<myType> iterator = myInfo.getContents().iterator();

        int i = 0;
        while (iterator.hasNext()) {
            myTextArea.setText(iterator.next().toString());
            // to add time betweeen iterations i wanted to use the thread
            // delay method.
        }
    }
}

My code is not working because JTextArea doesn’t have an action listener.

UPDATE
NOTE: Many replies stated that I should use an ActionListener for the JTextArea; However, Eclipse is not showing me that JTextArea has a method called addActionListener.

I’m kind of stuck here, which Java Swing component do you think would be the most suitable in this scenario?

The text in my array may be long, so a one lined label would not be a good choice.

What other alternatives or approaches do I have?

Thank you very much, any help and suggestions are appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:17:05+00:00Added an answer on June 14, 2026 at 9:17 pm

    Use your ActionListener in combination with a javax.Swing.Timer. The ActionListener assigned to the Timer will be called on regular intervals with the specified delay.

    See the timer tutorial for more information

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of strings which I want to display using a ListView.
I have a method which takes an array of strings as parameter and queries
I have an array of strings which I need to order from Z-A: Dim
I have an array of strings which is sorted by default. I want a
In C#, Say you have an array of strings, which contain only characters '0'
I have a cell array of strings (which is actually a list of files
I have an array of strings which need to be taken into a map.
I have an array of strings which i am already showing in my uitableview.
I have an array of strings in which the % symbol is used. Proper
I have an array of strings which are actually names of datasets. I perform

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.