rendered paste bodypackage jirssi.gui;import java.awt.CardLayout;public class WindowContainer extends JPanel { private static Window noticeWindow; private static CardLayout layout = new CardLayout(); private static List<Window> windowList = new ArrayList<Window>(); private static Session selectedSession; private static Window selectedWindow; private static WindowContainer me; private WindowContainer() { super(layout); noticeWindow = new Window(null ,null , null , IRCDocument.Type.MAIN); windowList.add(noticeWindow); add(noticeWindow , noticeWindow.toString()); EventQueue.invokeLater(new Runnable() { public void run() { show(noticeWindow); } }); } public static WindowContainer getInstance() { if(me == null) me = new WindowContainer(); return me; } public static void removeWindow(Window win) { layout.removeLayoutComponent(win); } public static List<Window> getWindowList() { return windowList; } public static void nextWindow() { layout.next(me); } public static void previousWindow() { layout.previous(me); } public static void show(Window window) { if(window != noticeWindow) { selectedSession = window.getDocument().getSession(); } selectedWindow = window; layout.show(me,window.toString()); } public static Window getSelectedWindow() { return selectedWindow; } public static void setSelectedSession(Session session) { selectedSession = session; } public static void show(int index) { show(windowList.get(index)); } public static Session getSelectedSession() { return selectedSession; } public static void addWindow(Window window) { me.add(window , window.toString()); windowList.add(window); show(window); } public static Window getNoticeWindow() { return noticeWindow; }}