I have a Swing application with no real design pattern. I want to start learning to design Swing or any types of application properly. Here is the main JFrame
class.
import java.awt.Component;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import org.text.gui.components.tabs.*;
public class TextFrame extends JFrame {
private static final long serialVersionUID = 1289484372051624149L;
public static final String INBOX = "Inbox";
public static final String CONTACT = "Contact";
public static final String SEND = "Send";
private JTabbedPane pane;
public TextFrame() {
initComponents();
layoutComponents();
pack();
setLocationByPlatform(true);
setVisible(true);
}
public Component getTab(String title) {
return pane.getComponentAt(pane.indexOfTab(title));
}
public void setSelectedTab(String title) {
pane.setSelectedComponent(getTab(title));
}
private void initComponents() {
setTitle("Text");
setDefaultCloseOperation(EXIT_ON_CLOSE);
pane = new JTabbedPane();
pane.setPreferredSize(new Dimension(225, 300));
pane.addTab(INBOX, new InboxTab(this));
pane.addTab(CONTACT, new ContactTab(this));
pane.addTab(SEND, new SendTab());
}
private void layoutComponents() {
add(pane);
}
}
The tabs are JPanel
s with some logic in them. Any advice on a design pattern to implement or examples or anything would be greatly appreciated. I hope I included enough information.