CardLayout in Java GUI [closed]

I’m practicing in java GUI and I want to make a Restaurant System using the Card Layout to switch between different menus. For example; Food and Drinks. I have a prototype and it works if I click the next button it will go to Drinks and if I click a back button it will go to Food.

Is it acceptable to use a card layout for these features? If I incorporate more logic or features, will it still work, or are there alternative methods to implement these features? I’m new to GUI appreciate your help.

If you have better method please tell me.

  • hard to say without knowing more details… and also opinion-based… but if you want to display different components in one place, most probably CardLayout is one appropriate solution

    – 




  • Can it be done, yes, should it be, that’s a more difficult question. If you have a limited number of, generally related, views, then yes, you could. If you need to pass data between the views or the navigation is more dynamic/conditional, that becomes more difficult and CardLayout really is well suited.

    – 

  • You could have a look at this, this, this, this

    – 

  • Or if you’re feeling really brave this and this which are “proofs of concepts” trying to devices a “view based navigation workflow”

    – 

Leave a Comment