/*
 * This file is part of Jhrome2.
 * 
 * Copyright (C) 2013 Silas Schwarz
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.xcodemt.tabs;

import java.awt.BorderLayout;
import java.awt.GraphicsConfiguration;
import java.awt.HeadlessException;
import java.awt.Window;

import javax.swing.JFrame;
import javax.swing.border.EmptyBorder;

/**
 * The default implementation of {@link ITabbedPaneWindow}.
 *
 * @author andy.edwards
 */
@SuppressWarnings( "serial")
public class XTabbedPaneWindow extends JFrame implements ITabbedPaneWindow {

    public XTabbedPaneWindow() throws HeadlessException {
        super();
        init();
    }

    public XTabbedPaneWindow(GraphicsConfiguration gc) {
        super(gc);
        init();
    }

    public XTabbedPaneWindow(String title, GraphicsConfiguration gc) {
        super(title, gc);
        init();
    }

    public XTabbedPaneWindow(String title) throws HeadlessException {
        super(title);
        init();
    }

    @Override
    public void dispose() {
        tabbedPane.dispose();
        super.dispose();
    }
    TabbedPane tabbedPane;

    private void init() {
        tabbedPane = new TabbedPane();
        tabbedPane.setBorder(new EmptyBorder(3, 3, 3, 3));
        getContentPane().add(tabbedPane, BorderLayout.CENTER);
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.jhrome.IJhromeWindow#getTabbedPane()
     */
    @Override
    public TabbedPane getTabbedPane() {
        return tabbedPane;
    }

    @Override
    public Window getWindow() {
        return this;
    }
    
    public JFrame getJFrame() {
        return this;
    }

    @Override
    public void disposeWindow() {
        dispose();
    }
}
