Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [platform-swt-dev] I'm fresh in using swt

Title: Message
Zeng,
 
Sometime back I posted a URL http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html which contains the sample code for using all the widgets in SWT. Probably this will be the right place to start for. Just check that out. Try out the examples and then do some play around with the code. U'll find SWT easy.
 
Also www.javalobby.com has a section for Tips an Tricks. You can find few good articles there as well.
 
Cheers
- Samir
-----Original Message-----
From: platform-swt-dev-admin@xxxxxxxxxxx [mailto:platform-swt-dev-admin@xxxxxxxxxxx] On Behalf Of Carolyn MacLeod
Sent: Wednesday, 8 December 2004 5:18 AM
To: platform-swt-dev@xxxxxxxxxxx
Subject: Re: [platform-swt-dev] I'm fresh in using swt


Hello.

Here is the SWT "Getting Started" page: http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/platform-swt-home/SWT_Resources.html
You might consider buying a couple of the books listed on this page to learn more about SWT and JFace.
The first book, SWT: The Standard Widget Toolkit, Volume 1is only about SWT. The other 4 books are about eclipse, JFace, and SWT.

Here is an SWT snippet that does what you describe:

import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class ButtonTextLabel {
        public static void main (String [] args) {
                Display display = new Display ();
                Shell shell = new Shell (display);
                shell.setLayout (new GridLayout ());
               
                final Text text = new Text(shell, SWT.SINGLE | SWT.BORDER);
                text.setText("This is the Text");
               
                final Label label = new Label(shell, SWT.NONE);
                label.setText("This is the Label");

                Button push = new Button (shell, SWT.PUSH);
                push.setText ("Push");
                push.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                                label.setText(text.getText());
                        }
                });

                shell.pack ();
                shell.open ();
                while (!shell.isDisposed ()) {
                        if (!display.readAndDispatch ()) display.sleep ();
                }
                display.dispose ();
        }
}

In future, please ask user questions on the SWT newsgroup. The "Getting Started" page, above, has details on how to do that.
Also, JFace questions (like your ApplicationWindow question) need to be asked on the eclipse.platform newsgroup.

Hope this helps,
Carolyn




clipse zeng <clipse.zeng@xxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

12/07/2004 01:37 PM

Please respond to
platform-swt-dev

To
platform-swt-dev@xxxxxxxxxxx
cc
Subject
[platform-swt-dev] I'm fresh in using swt





Hello all,
                I'm fresh in using swt.Authough I have seen many articles and pdfs, I
still have some questions.
                When an widget'action happend, it is quite usual to get some inputs
from the UI ,and then ouput the results on the UI.How can I operate an
widget to get and ouput the information in an action procedure.For
example, a button 'ActionButton' is selected, then the coresponding
selectionAction will excecute. Within the action procedure, I want to
get the string from the Text 'TextB' and display the string in the
wigdet Label 'LabelC'. How? Please give me some examples.
                 I want to use org.eclipse.jface.window.ApplicationWindow to create
my own appliction. Can ApplicationWindow set many Composite?How to?
                Thanks.
Best regards,
Zeng Zhiping
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top