Please note I haven't attempted testing this yet, I'm simply preparing to research it more.
I'm creating an address book application, and want to do as follows:
- User clicks on a persons name in a list.
- A new tab opens with editable JTextField / JTextArea / etc.
- User saves / closes tab.
From looking at tutorials on Google, it has been suggested to have a method such as:
public void createPage1()
{
panel1 = new JPanel();
panel1.setLayout(new BorderLayout());
panel1.add(new JButton("North"), BorderLayout.NORTH);
panel1.add(new JButton("South"), BorderLayout.SOUTH);
panel1.add(new JButton("East"), BorderLayout.EAST);
panel1.add(new JButton("West"), BorderLayout.WEST);
panel1.add(new JButton("Center"), BorderLayout.CENTER);
}
There were several of these methods, each creating one tab.
However, my program would allow it to be possible to have an unknown number of tabs open at the same time, all of which contain the exact same components in the same order. This obviously makes another alternative to the one above preferable.
How can this be accomplished?