Welcome to the CSC Q&A, where you can get help (and share your knowledge) about computer science!

How to deal with pop up in a flexible manner?

+5 votes
I have set this up to share information with people who are still working on it.
asked Oct 12, 2017 in CSC 285 (F17) by Dat Tran (100 points)

2 Answers

0 votes
Best answer
The way I do it is that:

You set up a boolean in the slide screen to let the user know whether to display the pop up.

And in the show method, you do:

if (popUp) {
        new Dialog("Title of the pop up", DEFAULT_SKIN) {
    // For any one who is confused, if you declare { stuff } in java, it will run it no matter what constructor you use.

        // Add your own button here


protected void result(final Object object) {
    // Set the slide screen with the boolean equal false

Additionally, you want to handle the listener in the button when it is not feasible so that it set to SlideScreen with the boolean = true.

If you use show(stage) it is going to do packing and pausing for you.

Remember to draw things with batch before stage.draw(), otherwise, you are going to have pop up going underneath the picture and stuff.
answered Oct 12, 2017 by Dat Tran (100 points)
0 votes
What's the "protected" in the method result? What does that mean?
answered Oct 12, 2017 by Zineb Zirari (100 points)
It means that you can access it from subclass. It is not that important, you can set it to private if you want to since I don't think you are going to use it anywhere else.