
Новичок
Профиль
Группа: Участник
Сообщений: 11
Регистрация: 6.1.2006
Где: Россия
Репутация: нет Всего: нет
|
| Код | import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.events.ShellEvent; import org.eclipse.swt.events.ShellListener; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Shell;
import com.cloudgarden.resource.SWTResourceManager;
/** * This code was edited or generated using CloudGarden's Jigloo * SWT/Swing GUI Builder, which is free for non-commercial * use. If Jigloo is being used commercially (ie, by a corporation, * company or business for any purpose whatever) then you * should purchase a license for each developer using Jigloo. * Please visit www.cloudgarden.com for details. * Use of Jigloo implies acceptance of these licensing terms. * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE. */ public class MainWindow extends org.eclipse.swt.widgets.Composite {
private Menu menu1; private MenuItem initMenuItem; private MenuItem XMLMenuItem; private MenuItem DedMenuItem; static Display display = null; private boolean inOpen = false;
{ //Register as a resource user - SWTResourceManager will //handle the obtaining and disposing of resources SWTResourceManager.registerResourceUser(this); }
public MainWindow(Composite parent, int style) { super(parent, style); initGUI(); } /** * Initializes the GUI. */ private void initGUI() { try { this.setSize(576, 300); this.setBackground(SWTResourceManager.getColor(192, 192, 192)); FormLayout thisLayout = new FormLayout(); this.setLayout(thisLayout); { menu1 = new Menu(getShell(), SWT.BAR); getShell().setMenuBar(menu1); { initMenuItem = new MenuItem(menu1, SWT.NONE); initMenuItem.setText("Инициализация генератора преобразователя"); initMenuItem.addSelectionListener(new SimpleListener()); } { XMLMenuItem = new MenuItem(menu1, SWT.NONE); XMLMenuItem.setText("Создание XML файла"); XMLMenuItem.addSelectionListener(new SimpleListener()); } { DedMenuItem = new MenuItem(menu1, SWT.NONE); DedMenuItem.setText("Формирование фактов для DedLog"); DedMenuItem.addSelectionListener(new SimpleListener()); } } this.layout(); } catch (Exception e) { e.printStackTrace(); } } /** * Auto-generated main method to display this * org.eclipse.swt.widgets.Composite inside a new Shell. */ public static void main(String[] args) { display = Display.getDefault(); Shell shell = new Shell(display); MainWindow inst = new MainWindow(shell, SWT.NULL); Point size = inst.getSize(); shell.setLayout(new FillLayout()); shell.layout(); if(size.x == 0 && size.y == 0) { inst.pack(); shell.pack(); } else { Rectangle shellBounds = shell.computeTrim(0, 0, size.x, size.y); shell.setSize(shellBounds.width, shellBounds.height); } shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } shell.dispose(); } class SimpleListener implements SelectionListener { private Shell shell1 = new Shell(display); public void widgetSelected(SelectionEvent e) { //хз что писать } public void widgetDefaultSelected(SelectionEvent e) {} } }
|
вот окно которое нужно показать | Код |
import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.FormAttachment; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.SWT;
/** * This code was edited or generated using CloudGarden's Jigloo * SWT/Swing GUI Builder, which is free for non-commercial * use. If Jigloo is being used commercially (ie, by a corporation, * company or business for any purpose whatever) then you * should purchase a license for each developer using Jigloo. * Please visit www.cloudgarden.com for details. * Use of Jigloo implies acceptance of these licensing terms. * A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR * THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED * LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE. */ public class XMLGen extends org.eclipse.swt.widgets.Composite { private Label label1; private Label label2; private Button button3; private Button button2; private Text text2; private Text text1; private Button button1;
/** * Auto-generated method to display this * org.eclipse.swt.widgets.Composite inside a new Shell. */ public static void showGUI() { Display display = Display.getDefault(); Shell shell = new Shell(display); XMLGen inst = new XMLGen(shell, SWT.NULL); Point size = inst.getSize(); shell.setLayout(new FillLayout()); shell.layout(); if(size.x == 0 && size.y == 0) { inst.pack(); shell.pack(); } else { Rectangle shellBounds = shell.computeTrim(0, 0, size.x, size.y); shell.setSize(shellBounds.width, shellBounds.height); } shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
public XMLGen(org.eclipse.swt.widgets.Composite parent, int style) { super(parent, style); initGUI(); }
private void initGUI() { try { this.setLayout(new FormLayout()); this.setSize(376, 188); { label2 = new Label(this, SWT.NONE); label2.setText("\u0412\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0439\u043b"); FormData label2LData = new FormData(); label2LData.width = 80; label2LData.height = 13; label2LData.left = new FormAttachment(0, 1000, 16); label2LData.top = new FormAttachment(0, 1000, 72); label2.setLayoutData(label2LData); } { button3 = new Button(this, SWT.PUSH | SWT.CENTER); button3.setText("\u041e\u0431\u0437\u043e\u0440"); FormData button3LData = new FormData(); button3LData.width = 43; button3LData.height = 23; button3LData.left = new FormAttachment(0, 1000, 303); button3LData.top = new FormAttachment(0, 1000, 92); button3.setLayoutData(button3LData); } { button2 = new Button(this, SWT.PUSH | SWT.CENTER); button2.setText("\u041e\u0431\u0437\u043e\u0440"); FormData button2LData = new FormData(); button2LData.width = 43; button2LData.height = 23; button2LData.left = new FormAttachment(0, 1000, 303); button2LData.top = new FormAttachment(0, 1000, 37); button2.setLayoutData(button2LData); } { text2 = new Text(this, SWT.BORDER); FormData text2LData = new FormData(); text2LData.width = 261; text2LData.height = 13; text2LData.left = new FormAttachment(0, 1000, 14); text2LData.top = new FormAttachment(0, 1000, 94); text2.setLayoutData(text2LData); } { text1 = new Text(this, SWT.BORDER); FormData text1LData = new FormData(); text1LData.width = 261; text1LData.height = 13; text1LData.left = new FormAttachment(0, 1000, 14); text1LData.top = new FormAttachment(0, 1000, 39); text1.setLayoutData(text1LData); } { button1 = new Button(this, SWT.PUSH | SWT.CENTER); button1.setText("\u0421\u043e\u0437\u0434\u0430\u0442\u044c InPut"); FormData button1LData = new FormData(); button1LData.width = 84; button1LData.height = 23; button1LData.left = new FormAttachment(0, 1000, 262); button1LData.top = new FormAttachment(0, 1000, 145); button1.setLayoutData(button1LData); } { label1 = new Label(this, SWT.NONE); label1.setText("\u0424\u0430\u0439\u043b \u0441 \u043f\u0440\u043e\u0434\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b\u043c\u0438 \u0432 \u043a\u043e\u043c\u043f\u0437\u0438\u0442\u043d\u043e\u043c \u0441\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0438"); FormData label1LData = new FormData(); label1LData.width = 332; label1LData.height = 13; label1LData.left = new FormAttachment(0, 1000, 12); label1LData.top = new FormAttachment(0, 1000, 12); label1.setLayoutData(label1LData); } this.layout(); } catch (Exception e) { e.printStackTrace(); } }
}
|
|