private void getPreviousButtonActionPerformed(java.awt.event.ActionEvent evt)
{
List<Tweet> listOfTweets = remoteBean.getMoreTweets(5);
StringBuilder displayStringBuilder = new StringBuilder();
if(listOfTweets != null)
{
for (Tweet tweet : listOfTweet)
{
displayStringBuilder.append(tweet.toString() + "\n");
}
textArea.setText(displayStringBuilder.toString());
}
}
As it stands when i run the code that this method is in and enter a number of tweets they are displayed in the text area of the GUI, when i click the getPrevious button it displays the last 5 tweets stored in the list, I want to add code so that when i click the getPrevious button again it gives the remaining tweets made and if i click again it will say no tweets remaining in the text area.
I know i need to use some sort of loop but i cant get my head around what loop to use or where to write it I have thought about getting the size of the list and using a
if(listOfTweets.Size() > 0)
{
remoteBean.getMoreTweets(5);
for (Tweet tweet : listOfTweet)
{
displayStringBuilder.append(tweet.toString() + "\n");
}
textArea.setText(displayStringBuilder.toString());
}
else
{
textArea.setText("no more tweets");
}
Am I going the right way or am i completely off target