English 中文(简体)
SWT 植被
原标题:SWT widgets modal/resize query
  • 时间:2011-11-01 13:44:05
  •  标签:
  • java
  • swt

我 new新的东西方框架(今天开始)。 我曾试图利用窗户建造er花板,通过ec子lip子来创建家保。 法典就是这样。

    package com.teamcenter.rac.pse.revisionrules;

import com.teamcenter.rac.kernel.TCComponent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.dialogs.SelectionDialog;


public class SetPackageContentsDialog
    extends SelectionDialog
{

    protected int result;

    protected Shell shell;

    private Text text;

    private Table table;

    /**
     * Constructor
     *
     * @param shell2
     * @param workPackageRevision
     * @param b
     * @param object
     * @unpublished
     */
    public SetPackageContentsDialog( Shell parentShell, TCComponent effectivityGrpRevision, boolean openByNameReqd,
            SetMiscFieldsDialog dialog )
    {
        super( parentShell );
        setTitle( "SWT Dialog" );
    }

    /**
     * Method to bring up the SetMultiEndItemDialog
     *
     * @param shell Shell
     * @unpublished
     */
    public void post( Shell shell )
    {
        if( Thread.currentThread() == shell.getDisplay().getThread() )
        {
            open();
        }
        else
        {
            shell.getDisplay().asyncExec( new Runnable()
            {
                @Override
                public void run()
                {
                    open();
                }
            } );
        }
    }

    /**
     * Open the dialog.
     *
     * @return the result
     */
    @Override
    public int open()
    {
        createContents();
        shell.open();
        shell.layout();
        Display display = getParentShell().getDisplay();
        while( !shell.isDisposed() )
        {
            if( !display.readAndDispatch() )
            {
                display.sleep();
            }
        }
        return result;
    }

    /**
     * Create contents of the dialog.
     */
    private void createContents()
    {
        shell = new Shell( getParentShell(), getShellStyle() );
        shell.setSize( 461, 357 );
        shell.setText( "New Aplooa" );
        shell.setLayout( new GridLayout( 1, false ) );

        Composite composite = new Composite( shell, SWT.NONE );
        composite.setLayout( new GridLayout( 1, false ) );
        GridData gd_composite = new GridData( SWT.LEFT, SWT.CENTER, false, false, 1, 1 );
        gd_composite.widthHint = 445;
        gd_composite.heightHint = 316;
        composite.setLayoutData( gd_composite );

        Composite composite_1 = new Composite( composite, SWT.NONE );
        GridData gd_composite_1 = new GridData( SWT.LEFT, SWT.CENTER, false, false, 1, 2 );
        gd_composite_1.widthHint = 434;
        gd_composite_1.heightHint = 126;
        composite_1.setLayoutData( gd_composite_1 );

        Label lblContentType = new Label( composite_1, SWT.NONE );
        lblContentType.setBounds( 7, 35, 71, 13 );
        lblContentType.setText( "Content Type" );

        Button btnItem = new Button( composite_1, SWT.RADIO );
        btnItem.setBounds( 108, 33, 71, 16 );
        btnItem.setText( "Item" );

        Button btnDataset = new Button( composite_1, SWT.RADIO );
        btnDataset.setBounds( 187, 33, 83, 16 );
        btnDataset.setText( "Dataset" );

        Label lblContentToAdd = new Label( composite_1, SWT.NONE );
        lblContentToAdd.setBounds( 7, 61, 74, 13 );
        lblContentToAdd.setText( "Content to Add" );

        text = new Text( composite_1, SWT.BORDER );
        text.setBounds( 108, 58, 162, 19 );

        Combo combo = new Combo( composite_1, SWT.NONE );
        combo.setBounds( 106, 90, 162, 21 );

        Label lblRelationshipType = new Label( composite_1, SWT.NONE );
        lblRelationshipType.setBounds( 7, 93, 90, 13 );
        lblRelationshipType.setText( "Relationship Type" );

        Button btnObn = new Button( composite_1, SWT.NONE );
        btnObn.addSelectionListener( new SelectionAdapter()
        {
            @Override
            public void widgetSelected( SelectionEvent e )
            {
            }
        } );
        btnObn.setBounds( 274, 52, 46, 30 );
        btnObn.setText( "OBN" );

        Button button = new Button( composite_1, SWT.NONE );
        button.addSelectionListener( new SelectionAdapter()
        {
            @Override
            public void widgetSelected( SelectionEvent e )
            {
            }
        } );
        button.setText( "Paste" );
        button.setBounds( 326, 52, 46, 30 );

        Button button_1 = new Button( composite_1, SWT.NONE );
        button_1.addSelectionListener( new SelectionAdapter()
        {
            @Override
            public void widgetSelected( SelectionEvent e )
            {
            }
        } );
        button_1.setText( "Clear" );
        button_1.setBounds( 378, 52, 46, 30 );

        Label lblWorkpackage = new Label( composite_1, SWT.NONE );
        lblWorkpackage.setBounds( 7, 10, 71, 13 );
        lblWorkpackage.setText( "WorkPackage" );
        new Label( composite, SWT.NONE );

        Composite composite_2 = new Composite( composite, SWT.NONE );
        GridData gd_composite_2 = new GridData( SWT.LEFT, SWT.BOTTOM, false, false, 1, 1 );
        gd_composite_2.heightHint = 156;
        gd_composite_2.widthHint = 435;
        composite_2.setLayoutData( gd_composite_2 );

        table = new Table( composite_2, SWT.BORDER | SWT.FULL_SELECTION );
        table.setBounds( 10, 10, 329, 97 );
        table.setHeaderVisible( true );
        table.setLinesVisible( true );

        TableColumn tblclmnContent = new TableColumn( table, SWT.NONE );
        tblclmnContent.setWidth( 101 );
        tblclmnContent.setText( "Content" );

        TableColumn tblclmnContentType = new TableColumn( table, SWT.NONE );
        tblclmnContentType.setWidth( 113 );
        tblclmnContentType.setText( "Content Type" );

        TableColumn tblclmnRelationshipType = new TableColumn( table, SWT.NONE );
        tblclmnRelationshipType.setWidth( 128 );
        tblclmnRelationshipType.setText( "Relationship Type" );

        Button button_2 = new Button( composite_2, SWT.NONE );
        button_2.addSelectionListener( new SelectionAdapter()
        {
            @Override
            public void widgetSelected( SelectionEvent e )
            {
            }
        } );
        button_2.setText( "ADD" );
        button_2.setBounds( 366, 10, 46, 30 );

        Button button_3 = new Button( composite_2, SWT.NONE );
        button_3.setText( "REMOVE" );
        button_3.setBounds( 366, 56, 46, 30 );

        Button button_4 = new Button( composite_2, SWT.NONE );
        button_4.addSelectionListener( new SelectionAdapter()
        {
            @Override
            public void widgetSelected( SelectionEvent e )
            {

            }
        } );
        button_4.setText( "OK" );
        button_4.setBounds( 143, 114, 46, 30 );

        Button button_5 = new Button( composite_2, SWT.NONE );
        button_5.addSelectionListener( new SelectionAdapter()
        {
            @Override
            public void widgetSelected( SelectionEvent e )
            {

            }
        } );
        button_5.setText( "Cancel" );
        button_5.setBounds( 229, 114, 46, 30 );

    }
}

Now, I have two basic queries. 1.How can I make sure that if I do a resize[ Im dragging the dialog box at one corner] all the components resize appropriately? and 2. How can I make sure that this dialog is not modal? [Currently Im unable to click anywhere].

Im doing some research as we speak, but any pointers will definitely help :).

Thanks, Pavan.

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签