Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Custom Statusbar


Use FormLayout - descibed in http://www.eclipse.org/articles/Understanding%20Layouts/Understanding%20Layouts.htm

BTW This question is more appropriate for the newsgroup.

Here is an example using FormLayout to align text and three labels:

public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new FormLayout());
        Text text = new Text(shell, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
        Label l1 = new Label(shell, SWT.NONE);
        l1.setText("Label 1");
        Label l2 = new Label(shell, SWT.NONE);
        l2.setText("Label 2");
        Label l3 = new Label(shell, SWT.NONE);
        l3.setText("Label 3");
       
        FormData data = "">new FormData();
        data.left = new FormAttachment(0, 0);
        data.right = new FormAttachment(70, 0);
        text.setLayoutData(data);
       
        data = "">new FormData();
        data.left = new FormAttachment(text);
        data.right = new FormAttachment(80, 0);
        data.top = new FormAttachment(text, 0, SWT.CENTER);
        l1.setLayoutData(data);
       
        data = "">new FormData();
        data.left = new FormAttachment(l1);
        data.right = new FormAttachment(90, 0);
        data.top = new FormAttachment(text, 0, SWT.CENTER);
        l2.setLayoutData(data);
       
        data = "">new FormData();
        data.left = new FormAttachment(l2);
        data.right = new FormAttachment(100, 0);
        data.top = new FormAttachment(text, 0, SWT.CENTER);
        l3.setLayoutData(data);
       
        shell.open();
        while (!shell.isDisposed()) {
                if (!display.readAndDispatch())
                        display.sleep();
        }
        display.dispose();
}


"Kamal Narang" <knarang@xxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

03/07/2002 09:04 AM
Please respond to platform-swt-dev

       
        To:        platform-swt-dev@xxxxxxxxxxx
        cc:        
        Subject:        [platform-swt-dev] Custom Statusbar


I am looking for an example to create a customised Status Bar, which
contains:

a) Text Area as first item (70% of the status bar)
b) followed by 3 labels (10% each)

Kamal

_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev



Back to the top