That makes sense.
I was trying another bit of coding (it's a bit of a mess, was in a rush so bare with me):
Code:
import processing.core.*;
import interfascia.*;
import guicomponents.*;
public class QuoteOfTheDay extends PApplet
{
GUIController c;
GLabel quoteLbl, languageLbl;
IFButton nextBtn, backBtn, englishBtn, frenchBtn;
BufferedReader quoteReader;
int numOfQuotes = 2;
int currentQuote = 0; //could possibly be static
int numScreens = 0;
boolean screenCreated = false;
String[] quotes = new String[numOfQuotes];
String quote;
String choice= "";
public void setup()
{
size(550, 250);
background(100);
if (numScreens == 0)
{
setupHomeScreen();
}
}
public void draw()
{
}
public void setupHomeScreen()
{
c = new GUIController(this);
languageLbl = new GLabel(this, "Please select English or French", 10, 10, 200, 20);
languageLbl.setBorder(1);
languageLbl.setOpaque(true);
languageLbl.setFont("Arial", 22);
englishBtn = new IFButton("English", 70, 100);
englishBtn.addActionListener(this);
c.add(englishBtn);
frenchBtn = new IFButton("French", 200, 100);
frenchBtn.addActionListener(this);
c.add(frenchBtn);
numScreens++;
}
public void setupMainScreen(String quote)
{
c = new GUIController(this);
//Display the quote in the label
quoteLbl = new GLabel(this, quote, 10, 10, 600, 20);
quoteLbl.setBorder(1);
quoteLbl.setOpaque(true);
quoteLbl.setFont("Arial", 22);
//Set up the button to display the next quote
nextBtn = new IFButton("NEXT", 70, 200);
nextBtn.addActionListener(this);
c.add(nextBtn);
//Set up the button to allow user to go back to home screen
backBtn = new IFButton("BACK", 200, 200);
backBtn.addActionListener(this);
c.add(backBtn);
}
public void actionPerformed(GUIEvent e)
{
if (e.getSource() == englishBtn)
{
quotes = loadStrings("englishQuotes.txt");
choice = "english";
setupMainScreen(quotes[currentQuote]);
}
else if (e.getSource() == frenchBtn)
{
quotes = loadStrings("frenchQuotes.txt");
choice = "french";
setupMainScreen(quotes[currentQuote]);
}
else if (e.getSource() == nextBtn)
{
if (choice.equals(" english"))
{
currentQuote++;
setupMainScreen(quotes[currentQuote]);
}
else
{
currentQuote++;
setupMainScreen(quotes[currentQuote]);
}
}
else if (e.getSource() == backBtn)
{
currentQuote = 0;
numScreens = 0;
setup();
}
}
}
I know there are a lot of things wrong with this. Also when I load the next screen the previous screen's buttons and label are still showing.
I tried background() in the draw() function and calling redraw() when the buttons were pressed but still no luck. I'd say it's something simple I am overlooking.