This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Does anyone know the difference between a Pane and a Panel. I have noticed that throughout swing, there are many types of pane.... eg JScrollPane, JTabbedPane, JOptionPane etc. Does anyone know why they are called Pane and not Panel? If Pane represents some sort of behaviour then shouldn't there be a Pane interface ? The reason I want to know this, is that I am creating some components that extend JPanel, and don't know whether to use a Pane or a Panel suffix.
I am creating some components that extend JPanel, and don't know whether to use a Pane or a Panel suffix.
First, I don't think it matters a whole lot. Secondly, I would note that Panel begets Applet and that JPanel begets AbstractColorChooserPanel, and I would use either of those as your precedents. In other words, use a more descriptive name (like Applet) or a class name ending in Panel. I can't find any example in the API of a Pane object begotten from the Panel or JPanel classes; however, you might if your class acts more like one of the classes ended in Pane, for example if you are deriving from Panel but your class will ultimately be a fancier form of ScrollPane.