Check if a card with a name is present in a CardLayout
问题 I have a CardLayout in which I add cards only as needed. So, when the need arises to show a particular card (identifed by its name), I need a way to check if a card with that name is already present, so that I can either show or create it accordingly. According to the CardLayout documentation Flips to the component that was added to this layout with the specified name, using addLayoutComponent. If no such component exists, then nothing happens. So, no error will be thrown if I ask it to show