Welcome to the Ranch
Why are you using the Applet class rather than JApplet? Why have you imported java.io.* which you appear not to be using? Why are you not importing the individual classes?
You ought not to use different classes for the different flags. You ought to use different instances. You could have a FlagDisplay class, and the FlagDisplay class has a
List (or array) of Shape objects. Shape can be an abstract class or an interface, and its can have subtypes called Stripe Rectangle Star etc. Each concrete Shape instance has instructions about how to paint itself, size, location, colour etc.
You can call the paint methods from inside the FlagDisplay class.
You can get the FlagDisplay objects with those strings from a
Map. Much better than a block of of-elses.
My, you can learn a lot if you do this project correctly . . . or make a right mess of it if you don’t
I am not used to using applets, but on a JPanel or similar you would use the paintComponent(Graphics) method, so please confirm that paint(g) is correct.
Now you are not going to do all that at once. Nor should you. Your inclination will be to write a FlagDisplay class and try to get that working, but that is the wrong way to do it. What you want to do is to start from the other end. Get the Shape type working, then get its subtypes working, one by one. Then try putting them together to form a whole flag. I suggest you create a display to
test those things on, with a JPanel on a JFrame. Then you can paint the individual Shape instances and see what they look like.