SWT (jface) group (group display)

Source: Internet
Author: User

Demo Code : Copy code The Code is as follows: Package swt_jface.demo9;
Import org. Eclipse. SWT. SWT;
Import org. Eclipse. SWT. layout. filllayout;
Import org. Eclipse. SWT. Widgets. display;
Import org. Eclipse. SWT. Widgets. Group;
Import org. Eclipse. SWT. Widgets. label;
Import org. Eclipse. SWT. Widgets. shell;
Public class groupexamples {

Display display = New Display ();
Shell shell = new shell (Display );
Public groupexamples (){

Group group0 = new group (shell, SWT. null );
Group0.setlayout (New filllayout ());
Label Label = new label (group0, SWT. null );
Label. setalignment (SWT. center );
Label. settext ("a group without title .");

Group group1 = new group (shell, SWT. null );
Group1.settext ("SWT. null ");

Group group2 = new group (shell, SWT. shadow_etched_in );
Group2.settext ("SWT. shadow_etched_in ");
Group Group3 = new group (shell, SWT. shadow_etched_out );
Group3.settext ("SWT. shadow_etched_out ");

Group group4 = new group (shell, SWT. shadow_in );
Group4.settext ("SWT. shadow_in ");

Group group5 = new group (shell, SWT. shadow_out );
Group5.settext ("SWT. shadow_out ");

Group [] groups = new group [] {group0, group1, group2, Group3, group4, group5 };

For (INT I = 0; I <groups. length; I ++ ){
Groups [I]. setbounds (10, 10 + I * 50,300, 40 );
}
Shell. Pack ();
Shell. open ();

While (! Shell. isdisposed ()){
If (! Display. readanddispatch ()){
Display. Sleep ();
}
}
Display. Dispose ();
}
Public static void main (string [] ARGs ){
New groupexamples ();
}
}
Package swt_jface.demo9;
Import org. Eclipse. SWT. SWT;
Import org. Eclipse. SWT. layout. filllayout;
Import org. Eclipse. SWT. Widgets. display;
Import org. Eclipse. SWT. Widgets. Group;
Import org. Eclipse. SWT. Widgets. label;
Import org. Eclipse. SWT. Widgets. shell;
Public class groupexamples {

Display display = New Display ();
Shell shell = new shell (Display );
Public groupexamples (){

Group group0 = new group (shell, SWT. null );
Group0.setlayout (New filllayout ());
Label Label = new label (group0, SWT. null );
Label. setalignment (SWT. center );
Label. settext ("a group without title .");

Group group1 = new group (shell, SWT. null );
Group1.settext ("SWT. null ");

Group group2 = new group (shell, SWT. shadow_etched_in );
Group2.settext ("SWT. shadow_etched_in ");
Group Group3 = new group (shell, SWT. shadow_etched_out );
Group3.settext ("SWT. shadow_etched_out ");

Group group4 = new group (shell, SWT. shadow_in );
Group4.settext ("SWT. shadow_in ");

Group group5 = new group (shell, SWT. shadow_out );
Group5.settext ("SWT. shadow_out ");

Group [] groups = new group [] {group0, group1, group2, Group3, group4, group5 };

For (INT I = 0; I <groups. length; I ++ ){
Groups [I]. setbounds (10, 10 + I * 50,300, 40 );
}
Shell. Pack ();
Shell. open ();

While (! Shell. isdisposed ()){
If (! Display. readanddispatch ()){
Display. Sleep ();
}
}
Display. Dispose ();
}
Public static void main (string [] ARGs ){
New groupexamples ();
}
}

Let's look at another example:

Copy code The Code is as follows: Package swt_jface.demo9;
Import org. Eclipse. SWT. SWT;
Import org. Eclipse. SWT. Graphics. image;
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. display;
Import org. Eclipse. SWT. Widgets. Group;
Import org. Eclipse. SWT. Widgets. label;
Import org. Eclipse. SWT. Widgets. shell;
Import org. Eclipse. SWT. Widgets. text;
Public class bugreport {

Display display = New Display ();
Shell shell = new shell (Display );
Public bugreport (){

Shell. setlayout (New gridlayout (1, true ));
Shell. setimage (new image (display, "C:/icons/bug.gif "));
Shell. settext ("bug report page ");

Group groupbug = new group (shell, SWT. null );
Groupbug. settext ("bug details ");
Groupbug. setlayout (New gridlayout (2, false ));
Groupbug. setlayoutdata (New griddata (griddata. fill_both ));

New label (groupbug, SWT. null). settext ("Priority ");
Combo combo = new combo (groupbug, SWT. Border );
Combo. setlayoutdata (New griddata (griddata. fill_horizontal ));

New label (groupbug, SWT. null). settext ("details ");
Text text = new text (groupbug, SWT. Border | SWT. multi );
Text. setlayoutdata (New griddata (griddata. fill_both ));

Group groupproxy = new group (shell, SWT. null );
Groupproxy. settext ("connection setting ");
Groupproxy. setlayout (New gridlayout (2, false ));
Groupproxy. setlayoutdata (New griddata (griddata. fill_horizontal ));

New label (groupproxy, SWT. null). settext ("proxy host ");
Text texthost = new text (groupproxy, SWT. Single | SWT. Border );
Texthost. setlayoutdata (New griddata (griddata. fill_horizontal ));
New label (groupproxy, SWT. null). settext ("proxy port ");
Text textport = new text (groupproxy, SWT. Single | SWT. Border );
Textport. setlayoutdata (New griddata (griddata. fill_horizontal ));

Button button = new button (shell, SWT. Push );
Button. setlayoutdata (New griddata (griddata. horizontal_align_center ));
// Button. setalignment (SWT. center );
Button. settext ("Submit bug report ");
Shell. Pack ();
Shell. open ();

While (! Shell. isdisposed ()){
If (! Display. readanddispatch ()){
Display. Sleep ();
}
}
Display. Dispose ();
}
Public static void main (string [] ARGs ){
New bugreport ();
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.