FileDocCategorySizeDatePackage
CaptureControlsDialog.javaAPI DocJMF 2.1.1e2986Mon May 12 12:20:32 BST 2003jmapps.jmstudio

CaptureControlsDialog

public class CaptureControlsDialog extends JMDialog

Fields Summary
private DataSource
dataSource
private int
nControlCount
Constructors Summary
public CaptureControlsDialog(Frame parentFrame, DataSource dataSource)



            
        super ( parentFrame, JMFI18N.getResource("jmstudio.capturecontrols.title"), false );

        this.dataSource = dataSource;
        try {
            init();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent event)

        String               strCmd;


        strCmd = event.getActionCommand ();
        if ( strCmd.equals(ACTION_CLOSE) ) {
            setAction ( ACTION_CLOSE );
            setVisible ( false );
        }
    
private voidinit()

        int             i;
        int             nCount = 0;
        Object          arrControls [] = null;
        Component       componentControl;
        JMPanel         panelContent;
        Panel           panel;
        Panel           panelNext;
        Panel           panelButtons;


        this.setLayout ( new BorderLayout() );

        panelContent = new JMPanel ( new BorderLayout() );
        panelContent.setEmptyBorder ( 6, 6, 6, 6 );
        this.add ( panelContent, BorderLayout.CENTER );

        if ( dataSource != null )
            arrControls = dataSource.getControls ();
        if ( arrControls != null )
            nCount = arrControls.length;
        panel = panelContent;
        nControlCount = 0;
        for ( i = 0;  i < nCount;  i++ ) {
            if ( arrControls[i] == null )
                continue;
            if ( !(arrControls[i] instanceof Control) )
                continue;
            componentControl = ((Control)arrControls[i]).getControlComponent ();
            if ( componentControl == null )
                continue;
            nControlCount++;
            panelNext = new Panel ( new BorderLayout(6,6) );
            panelNext.add ( componentControl, BorderLayout.NORTH );
            panel.add ( panelNext, BorderLayout.CENTER );
            panel = panelNext;
        }

        panel = new JMPanel ( new FlowLayout(FlowLayout.CENTER) );
        panelContent.add ( panel, BorderLayout.SOUTH );
        panelButtons = createButtonPanel ( new String[] { ACTION_CLOSE } );
        panel.add ( panelButtons );

        this.pack ();
        this.setResizable ( false );
    
public booleanisEmpty()

        return ( nControlCount < 1 );
    
public voidwindowClosing(java.awt.event.WindowEvent event)

        setAction ( ACTION_CLOSE );
        setVisible ( false );