/* Program: Questionnaire
 * Author: Rytis Umbrasas
 * School: Vilnius Lyceum
 * IDE: NetBeans 4.1
 */

import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;

class QuestionAdministrator extends application{
    
    public QuestionEditor QEditor;
    public QuestionsTab qt;
    public ResponsesTab rt;
    private JTabbedPane TabbedPane;
    private JOptionPane AlertMessage;
    
    public QuestionAdministrator() throws IOException{
        responses rsp = new responses();
        
        /*If responses file is not emoty, an alert is shown*/
        if (!rsp.areResponsesClear()){
            AlertMessage = new JOptionPane();
            AlertMessage.showMessageDialog(null, "Responses file is not empty: " +
                    "it is not recommended that you edit the questionnaire, " +
                    "when responses file is not empty.");
        }
            
        TabbedPane = new JTabbedPane();
        
        setupTabbedPane();
        setupBorderLayout();
        addComponent(TabbedPane, 0, 0, 1, 1);
        
        setSize(800, 500);
        setVisible(true);
        
    }
    
    private void setupTabbedPane() throws IOException{
        /*This will make a tabbed pane and add both tabs to it*/
        
        qt = new QuestionsTab();
        TabbedPane.addTab("Questions", qt.QuestionsTabPanel);
        
        rt = new ResponsesTab();
        TabbedPane.addTab("Responses", rt.ResponsesTabPanel);
    }
    
}