Eclipse Plug-in Development

Slides:



Advertisements
Similar presentations
Prof. Yitzchak Rosenthal
Advertisements

Module 2 Navigation.     Homepage Homepage  Navigation pane that holds the Applications and Modules  Click the double down arrow on the right of.
Using Macros and Visual Basic for Applications (VBA) with Excel
®® Microsoft Windows 7 for Power Users Tutorial 2 Customizing Microsoft Windows 7.
110-H1 More VB Tools Creating a Menu: What is a menu? a group of (related) commands displayed at at the top of an application Top level menu Disabled command.
Database Systems 1.  SWT  Updating UI (Why do we need Threads?)  Some Loose Ends 2.
Database Systems, Presented by Rubi Boim 1.
Chapter 13: Advanced GUIs and Graphics J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
1 Standard Widget Toolkit. 2 SWT l a widget toolkit for Java developers l provides a portable API and tight integration with the underlying native OS.
Word Processing Microsoft Office: Exploring Word 2011 for MAC.
Office 2003 Post-Advanced Concepts and Techniques M i c r o s o f t Word Project 8 Working with Macros and Visual Basic for Applications (VBA)
®® Microsoft Windows 7 for Power Users Tutorial 2p2 Customizing Microsoft Windows 7.
Chapter 3 Introduction to Event Handling and Windows Forms Applications.
Graphic User Interfaces Part 1. Typical GUI Screen from Microsoft Word What GUI “components” can you see? –Menus? Buttons? Labels? What else? –Anything.
Microsoft Visual Basic 2012 CHAPTER TWO Program and Graphical User Interface Design.
BIM313 – Advanced Programming Simple Controls 1. Contents Traditional Controls – Labels, Text Boxes, Buttons, Check Boxes, List Boxes, Combo Boxes Advanced.
By Kalman Hazins SWT TUTORIAL By Kalman Hazins
Chapter 13 Advanced GUIs and Graphics. Chapter Objectives Learn about applets Explore the class Graphics Learn about the class Font Explore the class.
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
CSCI 3328 Object Oriented Programming in C# Chapter 2: Introduction to Visual C# Programming 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
Menus,MonthCalender, DateTimePicker, MDI,Tree View, List View,
Chapter 2 More Controls Programming in C#. NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 13 Creating User.
Visual Basic 2005 CHAPTER 2 Program and Graphical User Interface Design.
1 After completing this lesson, you will be able to: Start Word. Explore the Word window. Enter text in a document. Save a document. Close a document and.
Chapter 2 - More Controls More controls – Text boxes - used for user input – Frames - containers to group items – check boxes - user select an option -
Basic WPF Controls Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
XP New Perspectives on Microsoft Windows 2000 Professional Windows 2000 Tutorial 1 1 Microsoft Windows 2000 Professional Tutorial 1 – Exploring the Basics.
Exploring Windows and Essential Computing Concepts 1 Windows Desktop u Windows Basics u Icon u Start Button u My Computer u Network Neighborhood u Recycle.
BZUPAGES.COM Visual Programming Lecture – 6- 7 Miss. SADAF MAJEED SIAL Computer Science Department Bahauddin Zakariya University Multan.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Designer Basics.
Joyelle White January 28, 2008 University of Phoenix EDTC 560 Dr. Eli MS Word 2007 Training.
Microsoft Visual Basic 2010 CHAPTER TWO Program and Graphical User Interface Design.
 2002 Prentice Hall. All rights reserved. 1 Chapter 2 – Introduction to the Visual Studio.NET IDE Outline 2.1Introduction 2.2Visual Studio.NET Integrated.
Creating User Interfaces Chapter 13 CSCI CSCI 1302 – Creating User Interfaces2 Outline Introduction Common Features of Swing GUI Components Buttons.
Event Driven, GUI Avshalom Elmalech Eliahu Khalastchi 2010.
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
Chapter 2 More Controls Programming in C#. NET Objectives Use text boxes, group boxes, check boxes, radio buttons, and picture boxes effectively.
IMS 3253: Controls 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Check Boxes Radio Buttons Date Time Picker Masked.
Customizing Menus and Toolbars CHAPTER 12 Customizing Menus and Toolbars.
Laboratory Exercise # 10 – Microsoft Word Additional Topics Office Productivity Tools 1 Laboratory Exercise # 10 Microsoft Word Additional Topics Objectives:
 2002 Prentice Hall. All rights reserved. 1 Introduction to the Visual Studio.NET IDE Outline Introduction Visual Studio.NET Integrated Development Environment.
Introduction to PowerPoint 2003 Professional Development Training for Classroom Teachers.
Windows Tutorial 3 Personalizing Your Windows Environment
By Kalman Hazins SWT TUTORIAL By Kalman Hazins
Building a User Interface with Forms
Chapter 2 – Introduction to the Visual Studio .NET IDE
Program and Graphical User Interface Design
Introduction to the Visual C# 2005 Express Edition IDE
Chapter 13: Advanced GUIs and Graphics
Program and Graphical User Interface Design
Introduction to Microsoft Windows
DB Programming - Cont Database Systems.
Eclipse Plug-in Development
Microsoft Windows 2000 Professional
Chapter 2 – Introduction to the Visual Studio .NET IDE
AWT Components and Containers
The University of Texas – Pan American
Development The Foundation Window.
Eclipse Plug-in Development
Creating a Title Page C 2012jkc.
European Computer Driving Licence
Introduction to Word Chapter 3
2016 REPORT.
Eclipse Plug-in Development
DB Programming - Cont Database Systems.
Advanced GUIs and Graphics
2016 REPORT.
Presentation transcript:

Eclipse Plug-in Development SWT/JFace Development Part 1 Controls 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Contents Introducing the Widget and Control classes Labels Involving the user with buttons Editing text with SWT Combo and List Sash and SashForm ToolBar and CoolBar Slider, Scale and Spinner ProgressBar and ToolTip Menus Tray and TaskBar Working with events 9/18/2018 Soyatec (http://www.soyatec.com)

Introducing the Widget and Control classes Superclass of all user interface objects Constructor: parent and style Issue notification to listeners Holding Data Dispose Control Superclass of all windowed user interface classes Size, Location and Region Color, Font and Image Visible and Enable 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Label Text or Image Label textLabel= new Label(shell, SWT.NONE); textLabel.setText("Hello, I am a Label."); Label imageLabel = new Label(shell, SWT.BORDER); imageLabel.setImage(display.getSystemImage(SWT.ICON_QUESTION)); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Label Separator SWT.SEPARATOR SWT.HORIZONTAL, SWT.VERTICAL new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL); new Label(shell, SWT.SEPARATOR | SWT.VERTICAL); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Label Label Alignment SWT.LEFT SWT.RIGHT SWT.CENTER Label leftLabel = new Label(shell, SWT.LEFT|SWT.BORDER); leftLabel.setText("Left"); Label centerLabel = new Label(shell, SWT.CENTER | SWT.BORDER); centerLabel.setText("Center"); Label rightLabel = new Label(shell, SWT.BORDER); rightLabel.setText("Right"); rightLabel.setAlignment(SWT.RIGHT); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Label Auto Wrap SWT.WRAP Label noWrapLabel = new Label(shell, SWT.BORDER); noWrapLabel.setText("This is a long Text on label, but no WRAP style set."); Label wrapLabel = new Label(shell, SWT.WRAP | SWT.BORDER); wrapLabel.setText("This is a long Text on label, and the WRAP style is set."); 9/18/2018 Soyatec (http://www.soyatec.com)

Involving the user with buttons Normal Button SWT.NONE SWT.PUSH //Button new Button(shell, SWT.PUSH).setText("Button1"); new Button(shell, SWT.PUSH).setText("Button2"); 9/18/2018 Soyatec (http://www.soyatec.com)

Involving the user with buttons Check Box SWT.CHECK //CheckBox new Button(shell, SWT.CHECK).setText("CheckBox1"); Button checkBox = new Button(shell, SWT.CHECK); checkBox.setText("CheckBox2"); checkBox.setSelection(true); 9/18/2018 Soyatec (http://www.soyatec.com)

Involving the user with buttons Radio Box SWT.RADIO //RadioBox new Button(shell, SWT.RADIO).setText("RadioBox1"); Button radioBox = new Button(shell, SWT.RADIO); radioBox.setText("RadioBox2"); radioBox.setSelection(true); 9/18/2018 Soyatec (http://www.soyatec.com)

Involving the user with buttons Toggle Buttons SWT.TOGGLE //Toggle new Button(shell, SWT.TOGGLE).setText("Toggle1"); Button toggle = new Button(shell, SWT.TOGGLE); toggle.setText("Toggle2"); toggle.setSelection(true); 9/18/2018 Soyatec (http://www.soyatec.com)

Involving the user with buttons Arrows SWT.ARROW SWT.LEFT, SWT.RIGHT, SWT.TOP and SWT.BOTTOM //Arrow new Button(shell, SWT.ARROW|SWT.LEFT); new Button(shell, SWT.ARROW|SWT.RIGHT); new Button(shell, SWT.ARROW|SWT.TOP); new Button(shell, SWT.ARROW|SWT.BOTTOM); 9/18/2018 Soyatec (http://www.soyatec.com)

Involving the user with buttons Selection Listener SWT.DefaultSelection SWT.Selection button.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { // Handle selection event. } public void widgetDefaultSelected(SelectionEvent e) { // is not called }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Editing text with SWT Text SWT.SINGLE SWT.MULTI SWT.WRAP SWT.PASSWORD SWT.SEARCH Text text1 = new Text(shell, SWT.NONE); text1.setText("Default Text"); Text text2 = new Text(shell, SWT.BORDER); text2.setText("Text with border"); Text text3 = new Text(shell, SWT.MULTI |SWT.BORDER); text3.setText("Text with multi lines\nAuto wrapped."); Text text4 = new Text(shell, SWT.PASSWORD |SWT.BORDER); text4.setText("123456"); Text text5 = new Text(shell, SWT.READ_ONLY | SWT.BORDER); text5.setText("Read only Text"); Text text6 = new Text(shell, SWT.SEARCH | SWT.BORDER); text6.setText("Search Text"); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Editing text with SWT Text Default Selection Listener SWT.DefaultSelection text1.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { // Never called for text. } public void widgetDefaultSelected(SelectionEvent e) { // Called when “Enter” pressed }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Editing text with SWT Text Modify Listener SWT.Modify text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { // Called when text changed } }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Editing text with SWT Text Verify Listener SWT.Verify text.addVerifyListener(new VerifyListener() { public void verifyText(VerifyEvent e) { int start = e.start; // Change start index int end = e.end; // Change end index String newValue = e.text; // Changed value if ("d".endsWith(newValue)){ e.doit = false; // Refused changes } }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Combo and List Combo SWT.SIMPLE SWT.DROP_DOWN (default) SWT.READ_ONLY Combo dropDown = new Combo(shell, SWT.DROP_DOWN); for (int i = 0; i < 5; i++) { dropDown.add("drop-down -" + i); } dropDown.select(2); Combo simple = new Combo(shell, SWT.SIMPLE); simple.add("simpe-item-" + i); simple.select(3); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Combo and List Combo Text Listeners SWT.DefaultSelection SWT.Verify SWT.Modify Combo Selection Listener SWT.Selection Combo dropDown = new Combo(shell, SWT.DROP_DOWN); for (int i = 0; i < 5; i++) { dropDown.add("drop-down -" + i); } dropDown.select(2); dropDown.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { //String item = dropDown.getItem(dropDown.getSelectionIndex()); }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Combo and List List SWT.SINGLE SWT.MULTI SWT.READ_ONLY List list1 = new List(shell, SWT.SINGLE | SWT.BORDER); for (int i = 0; i < 5; i++) { list1.add("single-selection-" + i); } list1.select(2); // Selection List list2 = new List(shell, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL); list2.setLayoutData(new RowData(SWT.DEFAULT, 60)); list2.add("multi-selection-" + i); list2.select(2, 3); // Selection 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Combo and List List Selection Listeners SWT.DefaultSelection SWT.Selection list.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { // Selection changed } public void widgetDefaultSelected(SelectionEvent e) { // Double clicked }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Sash and SashForm Sash SWT.VERTICAL SWT.HORIZONTAL SWT.SMOOTH final Sash hSash = new Sash(group1, SWT.HORIZONTAL | SWT.SMOOTH); Rectangle rect = group1.getClientArea(); hSash.setBounds(rect.x, 40, 315, 10); hSash.setBackground(display.getSystemColor(SWT.COLOR_RED)); final Sash vSash = new Sash(group2, SWT.VERTICAL); Rectangle r = group2.getClientArea(); vSash.setBounds(150, r.y, 20, 100); vSash.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { vSash.setBounds(e.x, e.y, e.width, e.height); } }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Sash and SashForm SashFrom setWeights(int[]) SashForm form = new SashForm(shell, SWT.HORIZONTAL | SWT.SMOOTH); form.setSashWidth(2); form.setBackground(display.getSystemColor(SWT.COLOR_RED)); Composite child1 = new Composite(form, SWT.NONE); child1.setLayout(new FillLayout()); new Label(child1, SWT.NONE).setText("Label in pane 1"); Composite child2 = new Composite(form, SWT.NONE); child2.setLayout(new FillLayout()); new Button(child2, SWT.PUSH).setText("Button in pane2"); Composite child3 = new Composite(form, SWT.NONE); child3.setLayout(new FillLayout()); new Label(child3, SWT.PUSH).setText("Label in pane3"); form.setWeights(new int[] { 30, 40, 30 }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) ToolBar and CoolBar ToolBar and ToolItem ToolBar SWT.VERTICAL SWT.HORIZONTAL SWT.FLAT SWT.RIGHT SWT.WRAP ToolItem SWT.PUSH SWT.CHECK SWT.RADIO SWT.DROP_DOWN SWT.SEPARATOR 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) ToolBar and CoolBar ToolBar and ToolItem // Create a horizontal ToolBar. final ToolBar hToolBar = new ToolBar(group1, SWT.HORIZONTAL | SWT.FLAT | SWT.SHADOW_OUT); new ToolItem(hToolBar, SWT.PUSH).setText("Push");// Push style item. new ToolItem(hToolBar, SWT.SEPARATOR);// Separator, show only parent style contains 'SWT.FLAT' new ToolItem(hToolBar, SWT.CHECK).setText("Check1"); // Check style item new ToolItem(hToolBar, SWT.CHECK).setText("Check2"); // Check style item new ToolItem(hToolBar, SWT.SEPARATOR); new ToolItem(hToolBar, SWT.RADIO).setText("Radio1"); // Radio style item new ToolItem(hToolBar, SWT.RADIO).setText("Radio2"); // Radop style item 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) ToolBar and CoolBar Add Drop Down Tools final ToolItem dropDown = new ToolItem(hToolBar, SWT.DROP_DOWN); dropDown.setText("Drop Down"); final Menu menu = new Menu(shell, SWT.POP_UP); for (int i = 0; i < 5; i++) { MenuItem menuItem = new MenuItem(menu, SWT.NONE); menuItem.setImage(taskImage); menuItem.setText("Item " + i); } // Add listener to show the menu for drop down item. dropDown.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { if (SWT.ARROW == event.detail) { Rectangle rect = dropDown.getBounds(); Point pt = new Point(rect.x, rect.y + rect.height); pt = hToolBar.toDisplay(pt); menu.setLocation(pt.x, pt.y); menu.setVisible(true); }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) ToolBar and CoolBar CoolBar and CoolItem CoolBar SWT.VERTICAL SWT.HORIZONTAL SWT.FLAT setLock() setWrapIndices() CoolItem Size SWT.DROP_DOWN 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) ToolBar and CoolBar CoolBar and CoolItem final CoolBar coolBar = new CoolBar(shell, SWT.HORIZONTAL | SWT.FLAT); for (int i = 0; i < 5; i++) { CoolItem item = new CoolItem(coolBar, SWT.DROP_DOWN); Button control = new Button(coolBar, SWT.NONE); control.setImage(taskImage); control.setText("Button - " + i); item.setControl(control); Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT); item.setPreferredSize(item.computeSize(size.x, size.y)); } coolBar.setWrapIndices(new int[] { 1, 3 }); coolBar.pack(); 9/18/2018 Soyatec (http://www.soyatec.com)

Slider, Scale and Spinner SWT.VERTICAL SWT.HORIZONTAL Thumb Slider vSlider = new Slider(shell, SWT.VERTICAL); vSlider.setMaximum(100); vSlider.setThumb(20); Slider hSlider = new Slider(shell, SWT.HORIZONTAL); hSlider.setMaximum(100); hSlider.setSelection(50); hSlider.setThumb(10); 9/18/2018 Soyatec (http://www.soyatec.com)

Slider, Scale and Spinner SWT.VERTICAL SWT.HORIZONTAL Scale vScale = new Scale(shell, SWT.VERTICAL); Scale hScale = new Scale(shell, SWT.HORIZONTAL); 9/18/2018 Soyatec (http://www.soyatec.com)

Slider, Scale and Spinner SWT.READ_ONLY Digits final Spinner spinner = new Spinner(shell, SWT.BORDER); spinner.setMinimum(-10000); spinner.setMaximum(10000); spinner.setDigits(2); spinner.setSelection(-248); 9/18/2018 Soyatec (http://www.soyatec.com)

Slider, Scale and Spinner Maximum Minimum Selection PageIncrement Increment 9/18/2018 Soyatec (http://www.soyatec.com)

ProgressBar, Tray and ToolTip SWT.SMOOTH SWT. INDETERMINATE // SWT.DEFAULT | SWT.SMOOTH final ProgressBar smoothBar = new ProgressBar(shell, SWT.SMOOTH); smoothBar.setMaximum(100); smoothBar.setSelection(30); new Label(shell, SWT.NONE).setText("SWT.SMOOTH"); // SWT.INDETERMINATE new ProgressBar(shell, SWT.INDETERMINATE); new Label(shell, SWT.NONE).setText("SWT.INDETERMINATE"); 9/18/2018 Soyatec (http://www.soyatec.com)

ProgressBar, Tray and ToolTip Tooltip for control shell.setToolTipText("ToolTip Tutorial: this is a simple tooltip text for Shell."); 9/18/2018 Soyatec (http://www.soyatec.com)

ProgressBar and ToolTip Normal tooltip final ToolTip tip = new ToolTip(shell, SWT.NONE); tip.setText("Foxes vs. Dogs"); tip.setMessage("The quick brown fox jumps over the lazy dog."); tip.setAutoHide(false); final Button showTipButton = new Button(shell, SWT.NONE); showTipButton.setText("Show ToolTip"); showTipButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { if (tip.isVisible() || tip.isDisposed()) { return; } Rectangle r = showTipButton.getBounds(); Point pt = showTipButton.toDisplay(r.x + r.width + 50, r.y); tip.setLocation(pt); tip.setVisible(true); }); 9/18/2018 Soyatec (http://www.soyatec.com)

ProgressBar and ToolTip Tooltip like balloon final ToolTip balloon = new ToolTip(shell, SWT.BALLOON | SWT.ICON_INFORMATION); balloon.setText("Foxes vs. Dogs"); balloon.setMessage("The quick brown fox jumps over the lazy dog."); balloon.setAutoHide(true); final Button showTipButton2 = new Button(shell, SWT.NONE); showTipButton2.setText("Show Balloon ToolTip"); showTipButton2.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { if (balloon.isVisible() || balloon.isDisposed()) { return; } Rectangle r = showTipButton2.getBounds(); Point pt = showTipButton2.toDisplay(r.x + r.width, r.y); balloon.setLocation(pt); balloon.setVisible(true); }); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Menus MenuBar SWT.BAR // MenuBar Menu menuBar = new Menu(shell, SWT.BAR); MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE); fileItem.setText("File"); fileItem.setAccelerator('F'); fileItem.setImage(image); // Drop_Down menu will be set as submenu for File menu. Menu fileItemMenu = new Menu(fileItem); new MenuItem(fileItemMenu, SWT.PUSH).setText("Open..."); new MenuItem(fileItemMenu, SWT.PUSH).setText("Exit"); fileItem.setMenu(fileItemMenu); shell.setMenuBar(menuBar); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Menus Context Menu SWT.POP_UP Menu contextMenu = new Menu(shell, SWT.POP_UP | SWT.NO_RADIO_GROUP); MenuItem pushItem = new MenuItem(contextMenu, SWT.PUSH); pushItem.setText("Push item"); pushItem.setImage(image); new MenuItem(contextMenu, SWT.SEPARATOR); … label.setMenu(contextMenu); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Menus Sub Menu SWT.CASCADE MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE); fileItem.setText("File"); fileItem.setAccelerator('F'); fileItem.setImage(image); // Drop_Down menu will be set as submenu for File menu. Menu fileItemMenu = new Menu(fileItem); new MenuItem(fileItemMenu, SWT.PUSH).setText("Open..."); new MenuItem(fileItemMenu, SWT.PUSH).setText("Exit"); fileItem.setMenu(fileItemMenu); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Tray and TaskBar Tray and TrayItem Tray tray = display.getSystemTray(); // Create tray item. TrayItem item = new TrayItem(tray, SWT.NONE); // Set images. item.setImage(image); item.setHighlightImage(image); // Add tool tip. final ToolTip toolTip = new ToolTip(shell, SWT.BALLOON); toolTip.setText("Foxes vs. Dogs"); toolTip.setMessage("A quick brown fox jumps over the lazy dog."); item.setToolTip(toolTip); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Tray and TaskBar TaskBar and TaskItem TaskBar taskBar = display.getSystemTaskBar(); TaskItem item = taskBar.getItem(shell); if (item == null) { item = taskBar.getItem(null); } item.setOverlayImage(display.getSystemImage(SWT.ICON_ERROR)); item.setOverlayText("OK"); item.setProgress(50); item.setProgressState(SWT.PAUSED); 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Working with events Event processing with SWT 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Working with events Typed and untyped listeners TypedEvent and TypedListener Adapters //typed button.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { } public void widgetDefaultSelected(SelectionEvent e) { }); //Untyped button.addListener(SWT.DefaultSelection, new Listener() { public void handleEvent(Event event) { button.addListener(SWT.Selection, new Listener() { 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Working with events Mouse and keyboard events MouseEvent enter exit hover wheel scroll double click move down up KeyEvent character stateMask keyCode 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Working with events Event processing with JFace 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) Working with events Actions and contributions 9/18/2018 Soyatec (http://www.soyatec.com)

Skype: jin.liu.soyatec Email: jin.liu@soyatec.com Any Questions? Skype: jin.liu.soyatec Email: jin.liu@soyatec.com 9/18/2018 Soyatec (http://www.soyatec.com)

Soyatec (http://www.soyatec.com) The end 9/18/2018 Soyatec (http://www.soyatec.com)