Similar to the interface of QQ user information

xiaoxiao2021-03-30  201

package com.swtdesigner; import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt. widgets *;. import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Text; public class QQ {private StackLayout stackLayout; private Composite yourDataComp; private Composite otherComp; private List selectList; private Composite rightComp; / * * * Launch the application * @Param args * / public static void main (String [] args) {try {qq window = new qq (); window.open ();} catch (exception e) {E.PrintStackTrace () }} / ** * Open the window * / public void open () {display display = display.getdefault (); shell shell = new shell (); shell.setsize (550, 350); shell.set Text ("Personal Settings"); shell.setLayout (New GridLayout ()); {// Split window Sashform Sashform = New Sashform (Shell, Swt.Border); Sashform.SetLayOutdata (New GridData.Fill_both); { // Split the window SelectList = new list (Sashform, SWT.BORDER); selectList.SetItems (new string "{" Personal Information, Contact "}; selectList.Addmouser ()); } {// split the right column of the window rightComp = new Composite (sashForm, SWT.NONE); rightComp.setLayout (stackLayout); yourDataComp = createYourDataComp (rightComp); // create a profile panel otherComp = createOtherComp (rightComp); // Establish continuous mode panel stacklayout.topControl = othercomp; // rightcomp.Layout () // Left and right space ratio Sashform.SetWeights (new int {1, 4});} {// interface button panel Composite Buttoncomp =

new Composite (shell, SWT.BORDER); GridData gridData = new GridData (); gridData.horizontalAlignment = GridData.END; buttonComp.setLayoutData (gridData); // let the button to the right by RowLayout rowLayout = new RowLayout (); rowLayout. Spacing = 15; // button pitch 15 pixels Buttoncomp.setLayout (ROWLAYOUT); // Newly built three buttons New Button (ButtonComp, Swt.none) .Settext; New Button (ButtonComp, Swt.none) .SETTEXT ("Cancel"); New Button (ButtonComp, Swt.none) .Settext ("App));} CreateContents (); shell.Layout (); shell.Open (); while (! shell.isdisposed () ) {if) display.sleep () (display.readAndDispatch (!);}} private Composite createYourDataComp (Composite rightComp) {Composite composite = new Composite (rightComp, SWT.NONE); composite.setLayout (new GridLayout (6, false ))))); // is divided into new label (Composite, SWT.NONE) .SETTETTEXT ("User Number:"); Text Text = New Text (Composite, SWT.READ_ONLY / SWT.BORDER); Text.setLayOutdata (CreateGriddata) GridData.Fill_horizontal, 3)); Composite Photocomp = New Composite, SWT.BO RDER); photoComp.setLayoutData (createGridData (GridData.HORIZONTAL_ALIGN_FILL / GridData.VERTICAL_ALIGN_FILL, 2,4)); photoComp.setLayout (new GridLayout (2, false)); {// pic Composite tempComp = new Composite (photoComp, SWT. BORDER); tempComp.setLayoutData (new GridData (50,50)); Button setPhotoButton = new Button (photoComp, SWT.ARROW | SWT.DOWN); setPhotoButton.setLayoutData (new GridData (GridData.VERTICAL_ALIGN_END)); Button updateButton = new Button (Photocomp, Swt.none); UpdateButton.setLayOutdata (GridData.horzontal_Align_Fill, 2)); UpdateButton.Settext ("Upgrade to Member");} New Label (Composite, Swt.none) .Settext.

Nickname: "); Text attachNameText = new Text (composite, SWT.BORDER); attachNameText.setLayoutData (createGridData (GridData.HORIZONTAL_ALIGN_FILL, 3)); new Label (composite, SWT.NONE) .setText (" Level: ") ; {Composite tempComp = new Composite (composite, SWT.BORDER); gridData gridData = new gridData (GridData.FILL_HORIZONTAL | GridData.BEGINNING); gridData.horizontalSpan = 3; gridData.heightHint = 20; tempComp.setLayoutData (gridData);} New label ("gender:"); Combo Sexcombo = New Combo (Composite, SWT.NONE); New Label (Composite, SWT.NONE) .SETTETTEXT ("Name:"); Text nameText = new Text (composite, SWT.BORDER); nameText.setLayoutData (createGridData (GridData.HORIZONTAL_ALIGN_FILL)); new Label (composite, SWT.NONE) .setText ( "Age:"); Text oldText = new Text (composite, SWT.BORDER); oldText.setLayoutData (createGridData (GridData.HORIZONTAL_ALIGN_FILL)); new Label (composite, SWT.NONE) .setText ( "graduated:"); Text schoolText = new Text (composite, SWT.BORDER); SchoolText.setLayoutd ata (createGridData (GridData.HORIZONTAL_ALIGN_FILL, 3)); new Label (composite, SWT.NONE) .setText ( "Zodiac:"); Text animalText = new Text (composite, SWT.NONE); animalText.setLayoutData (createGridData (GridData .HORIZONTAL_ALIGN_FILL)); new Label (composite, SWT.NONE) .setText ( "Occupation:"); Text careerText = new Text (composite, SWT.BORDER); careerText.setLayoutData (createGridData (GridData.HORIZONTAL_ALIGN_FILL, 3)); New label (Composite, SWT.NONE) .SETTEXT ("Constellation:"); Combo ConstellationCombo = New Combo (Composite, SWT.NON);

转载请注明原文地址:https://www.9cbs.com/read-130496.html

New Post(0)