/* ======================================================================
   Parts Copyright 2006 University of Leeds, Oxford University, University of the Highlands and Islands.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

====================================================================== */

package org.bodington.applet.test;

import javax.swing.*;
import java.beans.*;
import java.awt.*;

public class DNDInternalFrame extends javax.swing.JInternalFrame
    {   
	public DNDInternalFrame()
	    {
	    super( "Test Frame", true, false, true, true );
		setSize(400,300);
        
        DNDList left, right;
        left = new DNDList();
        right = new DNDList();

        DefaultListModel lModel = new DefaultListModel();        
        lModel.addElement( "Left Item1");    
        lModel.addElement( "Left Item2");    
        lModel.addElement( "Left Item3");    
        lModel.addElement( "Left Item4");
        
        DefaultListModel rModel = new DefaultListModel();        
        rModel.addElement( "Right Item1");    
        rModel.addElement( "Right Item2");    
        rModel.addElement( "Right Item3");    
        rModel.addElement( "Right Item4");

        JPanel mainPanel = new JPanel();	
        mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.X_AXIS));
        
        mainPanel.add( getListPanel( left, "Left Panel", lModel ) );
        mainPanel.add( getListPanel( right, "Right Panel", rModel ) );
        
        getContentPane().add( mainPanel );
    	}

    private JPanel getListPanel(DNDList list, String labelName, DefaultListModel listModel )
        {          
        JPanel listPanel = new JPanel();        
        JScrollPane scrollPane = new JScrollPane(list);                
        list.setModel(listModel);           
        JLabel nameListName = new JLabel(labelName );                
        listPanel.setLayout( new BorderLayout());        
        listPanel.add(nameListName, BorderLayout.NORTH);        
        listPanel.add( scrollPane, BorderLayout.CENTER);               
        return listPanel;
        }
   }
        
