Link to home
Start Free TrialLog in
Avatar of rossryan
rossryan

asked on

jTextArea not invisible

Hi,

I am trying to set a jTextArea as invisible, but it keeps an outline of the area. How do I get rid of it?

Thanks,
Ryan


public BakaRangerTestTaker(iEvaluation theEvaluation) {
        initComponents();

        this.theEvaluation = theEvaluation;

        jLabel_QuestionText.setVisible(false);
        jRadioButton_Answer.setVisible(false);
        jCheckBox_Answer.setVisible(false);
        jComboBox_Answer.setVisible(false);
        jButton_Next.setVisible(false);
        jButton_Previous.setVisible(false);
        jTextArea_Answer.setVisible(false);
        
    }

Open in new window

Screenshot-3.png
Avatar of Mick Barry
Mick Barry
Flag of Australia image

looks like it may be a border from another component
Avatar of rossryan
rossryan

ASKER

I hope not. Here's a screenshot of the the JPanel, that gets added to the JTabbed...
Screenshot-3.png
need to see the code that sets up the gui

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * BakaRangerResults.java
 *
 * Created on Apr 25, 2010, 8:24:29 PM
 */

package bakaranger;
import java.util.*;
/**
 *
 * @author Ryan
 */
public class BakaRangerTestTaker extends javax.swing.JPanel {

    /** Creates new form BakaRangerResults */
    public BakaRangerTestTaker(iEvaluation theEvaluation) {
        initComponents();

        this.theEvaluation = theEvaluation;

        jLabel_QuestionText.setVisible(false);
        jRadioButton_Answer.setVisible(false);
        jCheckBox_Answer.setVisible(false);
        jComboBox_Answer.setVisible(false);
        jButton_Next.setVisible(false);
        jButton_Previous.setVisible(false);
        jTextArea_Answer.setVisible(false);
        
    }
    private iEvaluation theEvaluation;
    private ArrayList questions;

    private int Count = 0;
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        jButton_Begin = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jRadioButton_Answer = new javax.swing.JRadioButton();
        jLabel_QuestionText = new javax.swing.JLabel();
        jCheckBox_Answer = new javax.swing.JCheckBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea_Answer = new javax.swing.JTextArea();
        jComboBox_Answer = new javax.swing.JComboBox();
        jButton_Next = new javax.swing.JButton();
        jButton_Previous = new javax.swing.JButton();

        setName("Form"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(bakaranger.BakaRangerApp.class).getContext().getResourceMap(BakaRangerTestTaker.class);
        jButton_Begin.setIcon(resourceMap.getIcon("jButton_Begin.icon")); // NOI18N
        jButton_Begin.setText(resourceMap.getString("jButton_Begin.text")); // NOI18N
        jButton_Begin.setName("jButton_Begin"); // NOI18N
        jButton_Begin.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton_BeginMouseClicked(evt);
            }
        });

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jRadioButton_Answer.setName("jRadioButton_Answer"); // NOI18N

        jLabel_QuestionText.setText(resourceMap.getString("jLabel_QuestionText.text")); // NOI18N
        jLabel_QuestionText.setName("jLabel_QuestionText"); // NOI18N

        jCheckBox_Answer.setName("jCheckBox_Answer"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jTextArea_Answer.setColumns(20);
        jTextArea_Answer.setRows(5);
        jTextArea_Answer.setName("jTextArea_Answer"); // NOI18N
        jScrollPane1.setViewportView(jTextArea_Answer);

        jComboBox_Answer.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        jComboBox_Answer.setName("jComboBox_Answer"); // NOI18N

        jButton_Next.setIcon(resourceMap.getIcon("jButton_Next.icon")); // NOI18N
        jButton_Next.setText(resourceMap.getString("jButton_Next.text")); // NOI18N
        jButton_Next.setName("jButton_Next"); // NOI18N
        jButton_Next.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton_NextMouseClicked(evt);
            }
        });

        jButton_Previous.setIcon(resourceMap.getIcon("jButton_Previous.icon")); // NOI18N
        jButton_Previous.setText(resourceMap.getString("jButton_Previous.text")); // NOI18N
        jButton_Previous.setName("jButton_Previous"); // NOI18N
        jButton_Previous.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton_PreviousMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jButton_Previous)
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 454, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jRadioButton_Answer)
                                .addGap(371, 371, 371)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(123, 123, 123)
                                        .addComponent(jLabel_QuestionText))
                                    .addComponent(jComboBox_Answer, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jCheckBox_Answer))
                        .addGap(73, 73, 73)
                        .addComponent(jButton_Next, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(276, 276, 276)
                        .addComponent(jButton_Begin, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(42, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton_Previous)
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jRadioButton_Answer)
                        .addGap(18, 18, 18)
                        .addComponent(jCheckBox_Answer))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addComponent(jLabel_QuestionText)
                        .addGap(30, 30, 30)
                        .addComponent(jComboBox_Answer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(43, 43, 43)
                .addComponent(jButton_Begin, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(23, 23, 23))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton_Next, javax.swing.GroupLayout.DEFAULT_SIZE, 125, Short.MAX_VALUE)
                .addGap(324, 324, 324))
        );
    }// </editor-fold>

    private void jButton_BeginMouseClicked(java.awt.event.MouseEvent evt) {
        questions = theEvaluation.GetQuestions();
        jButton_Begin.setVisible(false);

        CreateQuestion(Count);
        

    }

    private void jButton_NextMouseClicked(java.awt.event.MouseEvent evt) {
       Count++;
       CreateQuestion(Count);
    }

    private void jButton_PreviousMouseClicked(java.awt.event.MouseEvent evt) {
        Count--;
        CreateQuestion(Count);
    }


    private void CreateQuestion(int Index)
    {
        if(Index > 0) {
           jButton_Previous.setVisible(true);
        }
        if(Index < questions.size()) {
            jButton_Next.setVisible(true);
        }
        jLabel_QuestionText.setVisible(true);
        jLabel_QuestionText.setText(((iQuestion)(questions.get(Index))).GetQuestionText());
        


    }

    // Variables declaration - do not modify
    private javax.swing.JButton jButton_Begin;
    private javax.swing.JButton jButton_Next;
    private javax.swing.JButton jButton_Previous;
    private javax.swing.JCheckBox jCheckBox_Answer;
    private javax.swing.JComboBox jComboBox_Answer;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel_QuestionText;
    private javax.swing.JRadioButton jRadioButton_Answer;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextArea jTextArea_Answer;
    // End of variables declaration

}

Open in new window


/*
 * BakaRangerView.java
 */

package bakaranger;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.*;
import java.util.*;
import java.io.*;

/**
 * The application's main frame.
 */





public class BakaRangerView extends FrameView {

    public BakaRangerView(SingleFrameApplication app) {
        super(app);

        initComponents();
        jTabbedPane_Evaluations.setVisible(false);
        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = BakaRangerApp.getApplication().getMainFrame();
            aboutBox = new BakaRangerAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        BakaRangerApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jButton_New = new javax.swing.JButton();
        jButton_Open = new javax.swing.JButton();
        jTabbedPane_Evaluations = new javax.swing.JTabbedPane();
        jButton_Save = new javax.swing.JButton();
        jButton_Close = new javax.swing.JButton();
        jButton_Manage = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        jFileChooser_Evaluation = new javax.swing.JFileChooser();

        mainPanel.setName("mainPanel"); // NOI18N

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(bakaranger.BakaRangerApp.class).getContext().getResourceMap(BakaRangerView.class);
        jButton_New.setIcon(resourceMap.getIcon("jButton_New.icon")); // NOI18N
        jButton_New.setText(resourceMap.getString("jButton_New.text")); // NOI18N
        jButton_New.setName("jButton_New"); // NOI18N
        jButton_New.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton_NewMouseClicked(evt);
            }
        });

        jButton_Open.setIcon(resourceMap.getIcon("jButton_Open.icon")); // NOI18N
        jButton_Open.setText(resourceMap.getString("jButton_Open.text")); // NOI18N
        jButton_Open.setName("jButton_Open"); // NOI18N
        jButton_Open.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton_OpenMouseClicked(evt);
            }
        });

        jTabbedPane_Evaluations.setName("jTabbedPane_Evaluations"); // NOI18N

        jButton_Save.setIcon(resourceMap.getIcon("jButton_Save.icon")); // NOI18N
        jButton_Save.setText(resourceMap.getString("jButton_Save.text")); // NOI18N
        jButton_Save.setName("jButton_Save"); // NOI18N
        jButton_Save.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton_SaveMouseClicked(evt);
            }
        });

        jButton_Close.setIcon(resourceMap.getIcon("jButton_Close.icon")); // NOI18N
        jButton_Close.setText(resourceMap.getString("jButton_Close.text")); // NOI18N
        jButton_Close.setName("jButton_Close"); // NOI18N
        jButton_Close.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton_CloseMouseClicked(evt);
            }
        });

        jButton_Manage.setIcon(resourceMap.getIcon("jButton_Manage.icon")); // NOI18N
        jButton_Manage.setLabel(resourceMap.getString("jButton_Manage.label")); // NOI18N
        jButton_Manage.setName("jButton_Manage"); // NOI18N
        jButton_Manage.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton_ManageMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTabbedPane_Evaluations, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE)
                    .addGroup(mainPanelLayout.createSequentialGroup()
                        .addComponent(jButton_New)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton_Open)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton_Save)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton_Close)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton_Manage)))
                .addContainerGap())
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jButton_Open, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton_Close, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(mainPanelLayout.createSequentialGroup()
                            .addGap(5, 5, 5)
                            .addComponent(jButton_Save, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(mainPanelLayout.createSequentialGroup()
                            .addGap(5, 5, 5)
                            .addComponent(jButton_New, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(jButton_Manage, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jTabbedPane_Evaluations, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
                .addContainerGap())
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(bakaranger.BakaRangerApp.class).getContext().getActionMap(BakaRangerView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 735, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 565, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        jFileChooser_Evaluation.setName("jFileChooser_Evaluation"); // NOI18N
        jFileChooser_Evaluation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jFileChooser_EvaluationActionPerformed(evt);
            }
        });

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>                        

    private void jButton_NewMouseClicked(java.awt.event.MouseEvent evt) {                                         
        JFrame mainFrame = BakaRangerApp.getApplication().getMainFrame();
        BakaRangerEvaluationChooser newForm = new BakaRangerEvaluationChooser(this);
          newForm.setVisible(true);
          newForm.setLocationRelativeTo(mainFrame);
    }                                        

    
    public void AddEvaluation(iEvaluation newEvaluation)
    {

        javax.swing.ImageIcon icon = new javax.swing.ImageIcon(newEvaluation.GetIconFilename());

        int Count = 1;
        String Name = CheckNameFirst(newEvaluation.GetShortEvaluationType(), Count);
        newEvaluation.SetEvaluationFilename(Name);


        BakaRangerTestTaker controls = new BakaRangerTestTaker(newEvaluation);
        


        jTabbedPane_Evaluations.addTab(Name, icon, controls);
        jTabbedPane_Evaluations.setVisible(true);
        
        newEvaluation.SetTabbedPage(jTabbedPane_Evaluations.getTabCount() - 1);
        evaluations.add(newEvaluation);
        jTabbedPane_Evaluations.setSelectedIndex(jTabbedPane_Evaluations.getTabCount() - 1);

    }

    private boolean FilenameExists(String Filename)
    {

         for(int i = 0; i < jTabbedPane_Evaluations.getTabCount(); i++){

        if(jTabbedPane_Evaluations.getTitleAt(i).equals(Filename)){
             return true;
        }

        }
        return false;
        
    }

    
     private String CheckNameFirst(String Name, int Count){
        for(int i = 0; i < jTabbedPane_Evaluations.getTabCount(); i++){

        if(jTabbedPane_Evaluations.getTitleAt(i).equals("New " + Name + ".xml")){
             
             return CheckName(Name, Count);
        }

        }
        return "New " + Name + ".xml";
    }


    private String CheckName(String Name, int Count){
        for(int i = 0; i < jTabbedPane_Evaluations.getTabCount(); i++){

        if(jTabbedPane_Evaluations.getTitleAt(i).equals("New " + Name + "(" + Count + ").xml")){
             Count +=1;
             return CheckName(Name, Count);
        }

        }
        return "New " + Name + "(" + Count + ").xml";
    }
    private ArrayList evaluations = new ArrayList();
    private void jButton_OpenMouseClicked(java.awt.event.MouseEvent evt) {                                          
        jFileChooser_Evaluation.setFileFilter(new XMLfilter());


        File newFile = null;

        if (JFileChooser.APPROVE_OPTION==jFileChooser_Evaluation.showOpenDialog(mainPanel)) {
        newFile = jFileChooser_Evaluation.getSelectedFile();
        if(!newFile.exists()){
            return;
        }
        }
        else {
        return;
        }


        
        String Name = newFile.getName();

        if(FilenameExists(Name)){
          javax.swing.JOptionPane.showMessageDialog(null,"I'm sorry, but BakaRanger only supports opening one copy of a given filename, at a given time.\nIf you absolutely need to open this file at this time, try renaming the file to something else using Explorer.");
          return;
        }




        iEvaluation newEvaluation = new SurveyEvaluation();
        newEvaluation.SetEvaluationFilename(Name);
        newEvaluation.SetEvaluationFilepath(newFile.getParent());
        try
        {
        newEvaluation.Load();
        }
        catch(javax.xml.parsers.ParserConfigurationException e){}
        catch(org.xml.sax.SAXException e){}
        catch(IOException e){}
        //, ,

        jTabbedPane_Evaluations.addTab(Name, null);
        jTabbedPane_Evaluations.setVisible(true);
        //newEvaluation.SetEvaluationFilename(Name);
        
        newEvaluation.SetTabbedPage(jTabbedPane_Evaluations.getTabCount() - 1);
        evaluations.add(newEvaluation);
        jTabbedPane_Evaluations.setSelectedIndex(jTabbedPane_Evaluations.getTabCount() - 1);


    }                                         
    


    public ArrayList GetEvaluations()
    {
        return evaluations;
    }

    public iEvaluation GetEvaluationByTabPage(int Page)
    {
        iEvaluation theEvaluation = new SurveyEvaluation();
        for(int i = 0; i < evaluations.size(); i++)
        {
           if((((iEvaluation)(evaluations.get(i))).GetTabbedPage()) == Page)
           {

           theEvaluation = ((iEvaluation)(evaluations.get(i)));
           break;
           }
        }

        return theEvaluation;

    }


     public iEvaluation GetEvaluationByFilename(String Filename)
    {
        iEvaluation theEvaluation = new SurveyEvaluation();
        for(int i = 0; i < evaluations.size(); i++)
        {
           if((((iEvaluation)(evaluations.get(i))).GetEvaluationFilename()).equals(Filename))
           {

           theEvaluation = ((iEvaluation)(evaluations.get(i)));
           break;
           }

        }

        return theEvaluation;

    }
    private void jButton_ManageMouseClicked(java.awt.event.MouseEvent evt) {                                            
       int s = jTabbedPane_Evaluations.getSelectedIndex();
       if(s < 0)
       {
        return;    
       }
       JFrame mainFrame = BakaRangerApp.getApplication().getMainFrame();
       BakaRangerManager newForm = new BakaRangerManager(this, GetEvaluationByTabPage(s));
       newForm.setVisible(true);
       newForm.setLocationRelativeTo(mainFrame);
    }                                           

    private void jButton_SaveMouseClicked(java.awt.event.MouseEvent evt) {                                          

       int s = jTabbedPane_Evaluations.getSelectedIndex();
       if(s < 0)
       {
        return;
       }


       jFileChooser_Evaluation.setFileFilter(new XMLfilter());
       //jFileChooser_Evaluation.showSaveDialog(mainPanel);
       //File newFile = jFileChooser_Evaluation.getSelectedFile();

       File newFile = null;

        if (JFileChooser.APPROVE_OPTION==jFileChooser_Evaluation.showSaveDialog(mainPanel)) {
        newFile = jFileChooser_Evaluation.getSelectedFile();
        if(!newFile.exists()){
            return;
        }
        }
        else {
        return;
        }



       iEvaluation theEvaluation = GetEvaluationByTabPage(s);
       theEvaluation.SetEvaluationFilename(newFile.getName());
       theEvaluation.SetEvaluationFilepath(newFile.getParent());
       try
       {
            theEvaluation.Save();
       }
       catch (javax.xml.parsers.ParserConfigurationException e) {
       System.err.println("Trouble in Tokyo");
       }
       catch(javax.xml.transform.TransformerException e) {
       System.err.println("Trouble in Tokyo");
       }
       catch(IOException e){
       System.err.println("Trouble in Tokyo");
       }

       jTabbedPane_Evaluations.setTitleAt(s, newFile.getName());
       

       
    }                                         

    private void jFileChooser_EvaluationActionPerformed(java.awt.event.ActionEvent evt) {                                                        
        

    }                                                       

    private void jButton_CloseMouseClicked(java.awt.event.MouseEvent evt) {                                           
        int s = jTabbedPane_Evaluations.getSelectedIndex();
       if(s < 0)
       {
        return;
       }

        iEvaluation theEvaluation = GetEvaluationByTabPage(s);
        evaluations.remove(theEvaluation);
        jTabbedPane_Evaluations.removeTabAt(s);

        if(jTabbedPane_Evaluations.getTabCount() == 0)
        {
            jTabbedPane_Evaluations.setVisible(false);

        }

    }                                          

    // Variables declaration - do not modify                     
    private javax.swing.JButton jButton_Close;
    private javax.swing.JButton jButton_Manage;
    private javax.swing.JButton jButton_New;
    private javax.swing.JButton jButton_Open;
    private javax.swing.JButton jButton_Save;
    private javax.swing.JFileChooser jFileChooser_Evaluation;
    private javax.swing.JTabbedPane jTabbedPane_Evaluations;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    // End of variables declaration                   

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And so it is the scrollpanel's fault.

Thanks,
Ryan