Lecture 6: Components. CS480: Graphical User Interfaces. Dario Salvucci, Drexel University.

Size: px
Start display at page:

Download "Lecture 6: Components. CS480: Graphical User Interfaces. Dario Salvucci, Drexel University."

Transcription

1 Lecture 6: Components CS480: Graphical User Interfaces. Dario Salvucci, Drexel University. 1

2 Widget Week! Look at the most common GUI components see what they do see how they work High-level goal: Get prepared to build a real interface!

3 Swing components Component hierarchy Top-level Containers (frame, dialog, applet, ) java.awt. Window Intermediate Containers (panel, scroll pane, ) Atomic Components (button, list, menu, ) javax.swing. JComponent today s focus

4 Lists Storage for a list of items typically text, or textual representations of complex objects (e.g., 9:00pm) could also be icons Selection single selection single interval multiple interval

5 List View vs. Data Lists have a common interface for dealing with the sequence of data allows data to be shared across lists, tables, etc. JList (list view) ListModel (list data) ListModel interface defines methods for dealing with lists index in [0, size-1] Object getelementat (int index) int getsize (); void addlistdatalistener (ListDataListener l);

6 JList Basic constructor String[] data = {"one", "two", "three", "four"}; JList datalist = new JList (data); sets a basic list model that is unchangeable (no insertions/deletions after creation) model created automatically, and you can access it if you want... for (int i = 0; i < datalist.getmodel().getsize(); i++) { System.out.println (datalist.getmodel().getelementat(i)); }

7 JList Constructor with more powerful list model first, create DefaultListModel allows insertions/deletions at any time listmodel = new DefaultListModel(); listmodel.addelement ( Thing1"); listmodel.addelement ( Thing2"); listmodel.addelement ( Thing3"); listmodel.addelement ( Thing4"); listmodel.remove (index); then, create JList based on this list model list = new JList (listmodel);

8 JList List selection complex class ListSelectionModel handles selection intervals, etc. What we ll need to know list = new JList (listmodel); list.setselectionmode (ListSelectionModel.SINGLE_SELECTION); <or> (ListSelectionModel.SINGLE_INTERVAL_SELECTION); <or> (ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

9 JList Handling selection events (on the JList view) list.addlistselectionlistener (new MyListSelectionListener()); public class MyListSelectionListener implements ListSelectionListener { public void valuechanged (ListSelectionEvent e) { if (e.getvalueisadjusting() == false) { if (list.getselectedindex() == -1) { // No selection } else { // Selection, update text field. } } } } // What you might use in the above functions listmodel.addelement ( ); listmodel.insertelementat ( ); listmodel.remove ( );

10 Tables Close cousins to our good friends, Lists Typical case two-dimensional grid uneditable to display tabular information editable to manage tabular information usually alpha-numeric text But many possibilities...

11 Basic table Simple example Object[][] data = { {"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)}, {"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)}, {"Kathy", "Walrath", "Chasing toddlers", new Integer(2), new Boolean(false)}, {"Mark", "Andrews", "Speed reading", new Integer(20), new Boolean(true)}, {"Angela", "Lih", "Teaching high school", new Integer(4), new Boolean(false)} }; String[] columnnames = {"First Name, "Last Name, "Sport, "# of Years, } JTable table = new JTable(data, columnnames); Problems: all cells are editable Strings, full array is pre-initialized

12 Table model As for lists, tables have Model vs. View Create model first, then create view with this model MyTableModel mymodel = new MyTableModel(); JTable table = new JTable(myModel); Table models typically extend AbstractTableModel (next slide )

13 Table model TableDemo.java example class MyTableModel extends AbstractTableModel { final String[] columnnames =...//same as before... final Object[][] data =...//same as before... public int getcolumncount() { return columnnames.length; }... public Object getvalueat(int row, int col) { return data[row][col]; } public boolean iscelleditable(int row, int col) { //Note that the data/cell address is constant, //no matter where the cell appears onscreen. if (col < 2) { return false; } else { return true; } }...

14 Table view Resizing columns TableColumn column = null; for (int i = 0; i < 5; i++) { column = table.getcolumnmodel().getcolumn(i); if (i == 2) { column.setpreferredwidth(100); //sport column is bigger } else { column.setpreferredwidth(50); } }

15 Table cells Cell renderer used to draw all cells, shared by cell type Boolean -- rendered with a check box Number -- rendered by a right-aligned label ImageIcon -- rendered by a centered label Object -- rendered by a label w/ the object's string Cell editor takes over when user edits the cell Example: Integer object in cell renderer: JLabel, right-aligned editor: JTextField, right-aligned

16 Table cells Different editors in one table Text Field Combo Box Check Box

17 Table cells Color chooser as editor

18 Table data manager Provide way of manipulating data in layer between model and view One important, common use: Sorting! CLICK!

19 Trees Lots of data forms nicely into a hierarchy tree structure: every node has 1 parent (except root) e.g., directories & files, company management structures, Swing components! Nice to have a convenient, standard way of storing and viewing

20 Swing Trees Basic structure root node branch nodes leaf nodes Yet again Model vs. View model = hierarchy of data/information view = vertical list of currently visible nodes that can be expanded or collapsed

21 Tree model Constructing the model construct root node, as DefaultMutableTreeNode DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series"); can be any Object! construct other nodes & add to parent node category = new DefaultMutableTreeNode ("Books for Java Programmers"); top.add(category); book = new DefaultMutableTreeNode ("The Java Tutorial: Object-Oriented ); category.add(book); finally, construct model with root node treemodel = new DefaultTreeModel(rootNode);

22 Tree view Create a JTree with the model often good idea to add scrollbars DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series");... << create tree model >>... JTree tree = new JTree(top); JScrollPane treeview = new JScrollPane(tree);

23 Tree view Selection based on paths path of nodes from root to node (leaf or branch) in Swing: TreePath class stores path as array or, method direct to bottom-most node tree.getselectionmodel().setselectionmode (TreeSelectionModel.SINGLE_TREE_SELECTION);... DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getlastselectedpathcomponent();

24 Tree view Handling selection events tree.addtreeselectionlistener (new TreeSelectionListener() { public void valuechanged(treeselectionevent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getlastselectedpathcomponent(); if (node == null) return; } }); if (node.isleaf()) { Object nodeinfo = node.getuserobject(); BookInfo book = (BookInfo)nodeInfo; displayurl(book.bookurl); } else { displayurl(helpurl); } handle leaf handle branch

25 Tree extras Changing view properties node connectors different renderers

26 Useful things to know Components To Check/Set State To Handle Events JButton JCheckBox JRadioButton JComboBox JTextField JSlider JList void setselected (boolean) boolean isselected () void setselected (boolean) boolean isselected () void setselectedindex (int) Object getselecteditem () void settext (String) String gettext () void setvalue(int) int getvalue() void setselectedindex (int) int getselectedindex () ActionListener ItemListener ActionListener ActionListener ActionListener ChangeListener ListSelectionListener DefaultListModel void addelement (Object) void insertelementat (Object,int) void remove (int) Object getelementat (int) int getsize () ListDataListener [created for you if you use JList constructor passing list model]

27 Menus A great GUI development! (Apple Lisa) Fit lots of functionality into a small space requires overlapping & restoring of graphics Have become more standardized, more hierarchical, & just plain bigger

28 Swing Menu Components Within the component hierarchy, can contain several types of components

29 Menu Bar Represents the bar of top-level items Creating a menu bar JMenuBar () JMenu add (JMenu) Setting the bar in a frame, applet, etc. void setjmenubar(jmenubar) JMenuBar getjmenubar()

30 Menu Any item in a menu bar or menu that displays more options Creating the menu JMenu () JMenu (String) Adding items (options) to the menu JMenuItem add (JMenuItem) JMenuItem add (String) void addseparator () JMenuItem insert (JMenuItem, int) void insert (String, int) void insertseparator(int)

31 Menu Items Terminal components of the menu, with actions associated with them Creating menu items (w/ Strings, Icons) JMenuItem() JMenuItem(S) JMenuItem(I) JMenuItem(S,I) JCheckBoxMenuItem() JCheckBoxMenuItem(S) JCheckBoxMenuItem(I) JCheckBoxMenuItem(S,I) JRadioButtonMenuItem() JRadioButtonMenuItem(S) JRadioButtonMenuItem(I) JRadioButtonMenuItem(S,I)

32 Menu Items How do you handle menu item events? (this is, when the item is selected) Remember, menu items are buttons treat them that way! So then JMenuItem --> action listener JRadioButtonMenuItem --> action listener JCheckBoxMenuItem --> item listener

33 Menu Items Adding keys to items Mnemonics : keys that navigate menus, only visible components void setmnemonic (int) Accelerators : keys that provide shortcuts directly to function, visible or not void setaccelerator (KeyStroke)

34 MenuDemo.java menubar = new JMenuBar(); setjmenubar(menubar); menu = new JMenu("A Menu"); menu.setmnemonic(keyevent.vk_a); menu.getaccessiblecontext().setaccessibledescription( "The only menu in this program that has menu items"); menubar.add(menu); menuitem = new JMenuItem("A text-only menu item", KeyEvent.VK_T); menuitem.setaccelerator(keystroke.getkeystroke( KeyEvent.VK_1, ActionEvent.ALT_MASK)); menuitem.getaccessiblecontext().setaccessibledescription( "This doesn't really do anything"); menu.add(menuitem); menuitem = new JMenuItem("Both text and icon", new ImageIcon("images/middle.gif")); menuitem.setmnemonic(keyevent.vk_b); menu.add(menuitem); create menu bar create menu, with A mnemonic more menu items

35 MenuDemo.java menu.addseparator(); ButtonGroup group = new ButtonGroup(); rbmenuitem = new JRadioButtonMenuItem ("A radio button menu item"); rbmenuitem.setselected(true); rbmenuitem.setmnemonic(keyevent.vk_r); group.add(rbmenuitem); menu.add(rbmenuitem); rbmenuitem = new JRadioButtonMenuItem("Another one"); rbmenuitem.setmnemonic(keyevent.vk_o); group.add(rbmenuitem); menu.add(rbmenuitem); menu.addseparator(); cbmenuitem = new JCheckBoxMenuItem ("A check box menu item"); cbmenuitem.setmnemonic(keyevent.vk_c); menu.add(cbmenuitem); add separator create radio button menu items w/ button group create check box menu items

36 MenuDemo.java submenu = new JMenu("A submenu"); submenu.setmnemonic(keyevent.vk_s); menuitem = new JMenuItem("An item in the submenu"); menuitem.setaccelerator(keystroke.getkeystroke( KeyEvent.VK_2, ActionEvent.ALT_MASK)); submenu.add(menuitem); add submenu add items to submenu menuitem = new JMenuItem("Another item"); submenu.add(menuitem); menu.add(submenu); menu = new JMenu("Another Menu"); menu.setmnemonic(keyevent.vk_n); menu.getaccessiblecontext().setaccessibledescription( "This menu does nothing"); menubar.add(menu); add second menu in bar (no items!)

37 Pop-Up Menus Menu that can be brought up anywhere on a registered component (frame, button, ) Menus actually use pop-ups to show items!

38 Menu layout?!? You can even (gasp!) lay out the menu putting glue in the menu bar (bewarned!) changing the layout of the menu bar / items (please don t try this at home)

39 Text components GUIs may be graphical, but TEXT still forms the core of many interactions reading text: help manuals, web pages, writing text: word processing, , Some text comes in short bursts, some comes in long passages

40 Swing text components Text controls limited amount of information, then action (?) Plain text areas unformatted text of unlimited length Styled text areas display, edit text of many styles

41 Text component components What does a text component consist of? model / document : stores textual content view : displays text controller / editor kit : implements editing capabilities for read/write keymap : binds keys to actions support for undo/redo, carets

42 Text model / document Text components = View Document = Model The document... contains text in logical structure (paragraphs, styles, etc.) provides low-level support for editing text with insert and remove notifies document & undo listeners of changes manages position of focus (e.g., cursor) allows retrieval of text information / properties

43 Text editor kit Functionality for editing - inserting, deleting, cutting, pasting, e.g., move to next word/para/page, select stored as Swing Action s All text components have them, but you can t always get at them e.g., text fields Built-in Swing editors DefaultEditorKit : plain text HTMLEditorKit : HTML RTFEditorKit : RTF

44 Text keymaps Associate keys with actions classes: Keystroke --> Action e.g., Cmd-C --> copy By default, text components use JTextComponent.DEFAULT_KEYMAP

45 Text component example

46 Text & password fields Text field JTextField textfield = new JTextField(10); textfield.setactioncommand(textfieldstring); textfield.addactionlistener(this); Password field JPasswordField passwordfield = new JPasswordField(10); passwordfield.setactioncommand(passwordfieldstring); passwordfield.addactionlistener(this); public void actionperformed(actionevent e) { String prefix = "You typed \""; if (e.getactioncommand().equals(textfieldstring)) { JTextField source = (JTextField)e.getSource(); actionlabel.settext(prefix + source.gettext() + "\""); } else { JPasswordField source = (JPasswordField)e.getSource(); actionlabel.settext(prefix + new String(source.getPassword()) + "\""); } }

47 Plain text area Create & initialize (if desired) JTextArea textarea = new JTextArea( "This is an editable JTextArea " + "that has been initialized with the settext method. " + "A text area is a \"plain\" text component, " + "which means that although it can display text " + "in any font, all of the text is in the same font." ); Set properties (note single font/style) textarea.setfont(new Font("Serif", Font.ITALIC, 16)); textarea.setlinewrap(true); textarea.setwrapstyleword(true);

48 Plain text area Setting scrollbars we haven t really done this yet, but use an intermediate-level scroll pane JScrollPane areascrollpane = new JScrollPane(textArea); areascrollpane.setverticalscrollbarpolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areascrollpane.setpreferredsize(new Dimension(250, 250)); areascrollpane.setborder(...create border...);

49 Styled text area Creating an uneditable editor pane (huh?) linked to a URL page JEditorPane editorpane = new JEditorPane(); editorpane.seteditable(false);...//create a URL object for the TextSamplerDemoHelp.html file... try { editorpane.setpage(url); } catch (IOException e) { System.err.println("Attempted to read a bad URL: " + url); }

50 Validated text field Enforce a particular format on text e.g., for numbers, dates, times, etc. Two types of validation action-validated : check only on action event (i.e., user presses Return) change-validated : check continually, thus never allowing invalid data

51 Validated text field TextFieldDemo.java NumberFormat moneyformat = NumberFormat.getNumberInstance(); amountfield = new DecimalField(amount, 10, moneyformat); NumberFormat percentformat = NumberFormat.getNumberInstance(); percentformat.setminimumfractiondigits(3); ratefield = new DecimalField(rate, 10, percentformat); numperiodsfield = new WholeNumberField(numPeriods, 10); DecimalFormat paymentformat = (DecimalFormat)NumberFormat.getNumberInstance(); paymentformat.setmaximumfractiondigits(2); paymentformat.setnegativeprefix("("); paymentformat.setnegativesuffix(")"); paymentfield = new DecimalField(payment, 10, paymentformat);

52 Validated text field Side note WholeNumberField, subclass of TextField What might its implementation look like? protected Document createdefaultmodel() { return new WholeNumberDocument(); } protected class WholeNumberDocument extends PlainDocument { public void insertstring(int offs, String str, AttributeSet a) { char[] source = str.tochararray(); char[] result = new char[source.length]; int j = 0; for (int i = 0; i < result.length; i++) { if (Character.isDigit(source[i])) result[j++] = source[i]; else { toolkit.beep(); System.err.println("insertString: " + source[i]); } } super.insertstring(offs, new String(result, 0, j), a); } }

53 Panels As we ve seen don t really do anything logical groupings for layouts, with optional borders / labels

54 Panel borders Various types of borders

55 Scroll panes Sometimes, components are too big to display in whole So add scrollbars!

56 JScrollPane Constructors JScrollPane(Component view) JScrollPane(Component view, int vsbpolicy, int hsbpolicy) Scrollbar policies VERTICAL_SCROLLBAR_AS_NEEDED VERTICAL_SCROLLBAR_ALWAYS VERTICAL_SCROLLBAR_NEVER HORIZONTAL_SCROLLBAR_AS_NEEDED HORIZONTAL_SCROLLBAR_ALWAYS HORIZONTAL_SCROLLBAR_NEVER Note: typically don t create scrollbars and viewport all taken care of!

57 Scroll pane features Customizing row/column headers Swing Rule components

58 Scroll pane features Being scrolling-savvy must implement Scrollable interface getscrollableblockincrement getscrollableunitincrement getpreferredscrollableviewportsize getscrollabletracksviewportheight getscrollabletracksviewportwidth e.g. lists tables trees text

59 Finally! We re done the Swing components! Or at least the ones we ll be looking at. Still ones we haven t discussed, like JApplet top-level container JLayeredPane intermediate container etc. Make use of Sun s Java Swing web site and any of numerous Java & Swing books

Page 1. Widgets! Lecture 4: Components. Buttons. Swing components. Look at the most common GUI components see what they do see how they work

Page 1. Widgets! Lecture 4: Components. Buttons. Swing components. Look at the most common GUI components see what they do see how they work Widgets! Lecture 4: Components Look at the most common GUI components see what they do see how they work High-level goal: Get prepared to build a real interface! CS 338: Graphical User Interfaces. Dario

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 10(b): Working with Controls Agenda 2 Case study: TextFields and Labels Combo Boxes buttons List manipulation Radio buttons and checkboxes

More information

Object-Oriented Programming Design. Topic : User Interface Components with Swing GUI Part III

Object-Oriented Programming Design. Topic : User Interface Components with Swing GUI Part III Electrical and Computer Engineering Object-Oriented Topic : User Interface Components with Swing GUI Part III Maj Joel Young Joel.Young@afit.edu 17-Sep-03 Maj Joel Young Creating GUI Apps The Process Overview

More information

Swing. Component overview. Java UI, summer semester 2017/2018 1

Swing. Component overview. Java UI, summer semester 2017/2018 1 Swing Component overview 1 Label class JLabel for displaying short text image both 2 Buttons many kinds of buttons all of them extends AbstractButton regular button (JButton) "click" button toggle button

More information

Handout 14 Graphical User Interface (GUI) with Swing, Event Handling

Handout 14 Graphical User Interface (GUI) with Swing, Event Handling Handout 12 CS603 Object-Oriented Programming Fall 15 Page 1 of 12 Handout 14 Graphical User Interface (GUI) with Swing, Event Handling The Swing library (javax.swing.*) Contains classes that implement

More information

JList. Displays a series of items The user can select one or more items Class JList extends directly class Jcomponent Class Jlist supports

JList. Displays a series of items The user can select one or more items Class JList extends directly class Jcomponent Class Jlist supports GUI Component - 4 JList Displays a series of items The user can select one or more items Class JList extends directly class Jcomponent Class Jlist supports Single-selection lists: one item to be selected

More information

Basics of programming 3. Java GUI and SWING

Basics of programming 3. Java GUI and SWING Basics of programming 3 Java GUI and SWING Complex widgets Basics of programming 3 BME IIT, Goldschmidt Balázs 2 Complex widgets JList elements can be selected from a list JComboBox drop down list with

More information

Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI

Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI CBOP3203 Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI components like button, text input, scroll bar and others.

More information

Introduction p. 1 JFC Architecture p. 5 Introduction to JFC p. 7 The JFC 1.2 Extension p. 8 Swing p. 9 Drag and Drop p. 16 Accessibility p.

Introduction p. 1 JFC Architecture p. 5 Introduction to JFC p. 7 The JFC 1.2 Extension p. 8 Swing p. 9 Drag and Drop p. 16 Accessibility p. Introduction p. 1 JFC Architecture p. 5 Introduction to JFC p. 7 The JFC 1.2 Extension p. 8 Swing p. 9 Drag and Drop p. 16 Accessibility p. 17 MVC Architecture p. 19 The MVC Architecture p. 20 Combined

More information

Chapter 12 GUI Basics

Chapter 12 GUI Basics Chapter 12 GUI Basics 1 Creating GUI Objects // Create a button with text OK JButton jbtok = new JButton("OK"); // Create a label with text "Enter your name: " JLabel jlblname = new JLabel("Enter your

More information

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7 PROGRAMMING DESIGN USING JAVA (ITT 303) Graphical User Interface Unit 7 Learning Objectives At the end of this unit students should be able to: Build graphical user interfaces Create and manipulate buttons,

More information

Swing. By Iqtidar Ali

Swing. By Iqtidar Ali Swing By Iqtidar Ali Background of Swing We have been looking at AWT (Abstract Window ToolKit) components up till now. Programmers were not comfortable when doing programming with AWT. Bcoz AWT is limited

More information

Contents Introduction 1

Contents Introduction 1 SELF-STUDY iii Introduction 1 Course Purpose... 1 Course Goals...1 Exercises... 2 Scenario-Based Learning... 3 Multimedia Overview... 3 Assessment... 3 Hardware and Software Requirements... 4 Chapter 1

More information

Java Swing. Lists Trees Tables Styled Text Components Progress Indicators Component Organizers

Java Swing. Lists Trees Tables Styled Text Components Progress Indicators Component Organizers Course Name: Advanced Java Lecture 19 Topics to be covered Java Swing Lists Trees Tables Styled Text Components Progress Indicators Component Organizers AWT to Swing AWT: Abstract Windowing Toolkit import

More information

Part 3: Graphical User Interface (GUI) & Java Applets

Part 3: Graphical User Interface (GUI) & Java Applets 1,QWURGXFWLRQWR-DYD3URJUDPPLQJ (( Part 3: Graphical User Interface (GUI) & Java Applets EE905-GUI 7RSLFV Creating a Window Panels Event Handling Swing GUI Components ƒ Layout Management ƒ Text Field ƒ

More information

Introduction to the JAVA UI classes Advanced HCI IAT351

Introduction to the JAVA UI classes Advanced HCI IAT351 Introduction to the JAVA UI classes Advanced HCI IAT351 Week 3 Lecture 1 17.09.2012 Lyn Bartram lyn@sfu.ca About JFC and Swing JFC Java TM Foundation Classes Encompass a group of features for constructing

More information

CS410G: GUI Programming. The Model/View/Controller Pattern. Model. Controller. View. MVC is a popular architecture for building GUIs

CS410G: GUI Programming. The Model/View/Controller Pattern. Model. Controller. View. MVC is a popular architecture for building GUIs CS410G: GUI Programming The Model/View/Controller design pattern provides a clean distinction between the your application s data (model), your GUI (view), and the how they interact (controller). Many

More information

Graphical User Interfaces. Comp 152

Graphical User Interfaces. Comp 152 Graphical User Interfaces Comp 152 Procedural programming Execute line of code at a time Allowing for selection and repetition Call one function and then another. Can trace program execution on paper from

More information

Widgets. Overview. Widget. Widgets Widget toolkits Lightweight vs. heavyweight widgets Swing Widget Demo

Widgets. Overview. Widget. Widgets Widget toolkits Lightweight vs. heavyweight widgets Swing Widget Demo Widgets Overview Widgets Widget toolkits Lightweight vs. heavyweight widgets Swing Widget Demo Widget Widget is a generic name for parts of an interface that have their own behavior: buttons, progress

More information

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Module 5 The Applet Class, Swings. OOC 4 th Sem, B Div Prof. Mouna M. Naravani Module 5 The Applet Class, Swings OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani The layout manager helps lay out the components held by this container. When you set a layout to null, you tell the

More information

Tool Kits, Swing. Overview. SMD158 Interactive Systems Spring Tool Kits in the Abstract. An overview of Swing/AWT

Tool Kits, Swing. Overview. SMD158 Interactive Systems Spring Tool Kits in the Abstract. An overview of Swing/AWT INSTITUTIONEN FÖR Tool Kits, Swing SMD158 Interactive Systems Spring 2005 Jan-28-05 2002-2005 by David A. Carr 1 L Overview Tool kits in the abstract An overview of Swing/AWT Jan-28-05 2002-2005 by David

More information

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming Objectives: Last revised 1/15/10 1. To introduce the notion of a component and some basic Swing components (JLabel, JTextField, JTextArea,

More information

Goals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords

Goals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords Goals By the end of this lesson, you should: Lecture 7 More GUI programming 1. Be able to write Java s with JTextField, JList, JCheckBox and JRadioButton components 2. Be able to implement a ButtonGroup

More information

Is image everything?

Is image everything? Is image everything? Review Computer Graphics technology enables GUIs and computer gaming. GUI's are a fundamental enabling computer technology. Without a GUI there would not be any, or much less: Computer

More information

Advanced Java Programming. Swing. Introduction to Swing. Swing libraries. Eran Werner, Tel-Aviv University Summer, 2005

Advanced Java Programming. Swing. Introduction to Swing. Swing libraries. Eran Werner, Tel-Aviv University Summer, 2005 Advanced Java Programming Swing Eran Werner, Tel-Aviv University Summer, 2005 19 May 2005 Advanced Java Programming, Summer 2005 1 Introduction to Swing The Swing package is part of the Java Foundation

More information

Programming graphics

Programming graphics Programming graphics Need a window javax.swing.jframe Several essential steps to use (necessary plumbing ): Set the size width and height in pixels Set a title (optional), and a close operation Make it

More information

Widgets. Widgets Widget Toolkits. User Interface Widget

Widgets. Widgets Widget Toolkits. User Interface Widget Widgets Widgets Widget Toolkits 2.3 Widgets 1 User Interface Widget Widget is a generic name for parts of an interface that have their own behavior: buttons, drop-down menus, spinners, file dialog boxes,

More information

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 143 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/

More information

To gain experience using GUI components and listeners.

To gain experience using GUI components and listeners. Lab 5 Handout 7 CSCI 134: Fall, 2017 TextPlay Objective To gain experience using GUI components and listeners. Note 1: You may work with a partner on this lab. If you do, turn in only one lab with both

More information

Swing UI. Powered by Pentalog. by Vlad Costel Ungureanu for Learn Stuff

Swing UI. Powered by Pentalog. by Vlad Costel Ungureanu for Learn Stuff Swing UI by Vlad Costel Ungureanu for Learn Stuff User Interface Command Line Graphical User Interface (GUI) Tactile User Interface (TUI) Multimedia (voice) Intelligent (gesture recognition) 2 Making the

More information

Widgets. Widgets Widget Toolkits. 2.3 Widgets 1

Widgets. Widgets Widget Toolkits. 2.3 Widgets 1 Widgets Widgets Widget Toolkits 2.3 Widgets 1 User Interface Widget Widget is a generic name for parts of an interface that have their own behavior: buttons, drop-down menus, spinners, file dialog boxes,

More information

More Swing. CS180 Recitation 12/(04,05)/08

More Swing. CS180 Recitation 12/(04,05)/08 More Swing CS180 Recitation 12/(04,05)/08 Announcements No lecture/labs next week Recitations and evening consulting hours will be held as usual. Debbie's study group on tuesday and office hours on thursday

More information

Prototyping a Swing Interface with the Netbeans IDE GUI Editor

Prototyping a Swing Interface with the Netbeans IDE GUI Editor Prototyping a Swing Interface with the Netbeans IDE GUI Editor Netbeans provides an environment for creating Java applications including a module for GUI design. Here we assume that we have some existing

More information

Chapter 6: Graphical User Interfaces

Chapter 6: Graphical User Interfaces Chapter 6: Graphical User Interfaces CS 121 Department of Computer Science College of Engineering Boise State University April 21, 2015 Chapter 6: Graphical User Interfaces CS 121 1 / 36 Chapter 6 Topics

More information

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 5: Will be an open-ended Swing project. "Programming Contest"

More information

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun! Swing = Java's GUI library Topic 9: Swing Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Why are we studying Swing? 1. Useful & fun! 2. Good application of OOP techniques

More information

Java Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1

Java Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1 Java Swing based on slides by: Walter Milner Java Swing Walter Milner 2005: Slide 1 What is Swing? A group of 14 packages to do with the UI 451 classes as at 1.4 (!) Part of JFC Java Foundation Classes

More information

Graphics. Lecture 18 COP 3252 Summer June 6, 2017

Graphics. Lecture 18 COP 3252 Summer June 6, 2017 Graphics Lecture 18 COP 3252 Summer 2017 June 6, 2017 Graphics classes In the original version of Java, graphics components were in the AWT library (Abstract Windows Toolkit) Was okay for developing simple

More information

Contents Chapter 1 Introduction to Programming and the Java Language

Contents Chapter 1 Introduction to Programming and the Java Language Chapter 1 Introduction to Programming and the Java Language 1.1 Basic Computer Concepts 5 1.1.1 Hardware 5 1.1.2 Operating Systems 8 1.1.3 Application Software 9 1.1.4 Computer Networks and the Internet

More information

Java IDE Programming-I

Java IDE Programming-I Java IDE Programming-I Graphical User Interface : is an interface that uses pictures and other graphic entities along with text, to interact with user. User can interact with GUI using mouse click/ or

More information

Summary Chapter 25 GUI Components: Part 2

Summary Chapter 25 GUI Components: Part 2 1040 Chapter 25 GUI Components: Part 2 ponent on the line. TheJTextField is added to the content pane with a call to our utility method addcomponent (declared at lines 79 83). MethodaddComponent takes

More information

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics Topic 9: Swing Outline Swing = Java's GUI library Swing is a BIG library Goal: cover basics give you concepts & tools for learning more Assignment 7: Expand moving shapes from Assignment 4 into game. "Programming

More information

Intro to Computer Science II. Exceptions

Intro to Computer Science II. Exceptions Intro to Computer Science II Exceptions Admin Exam review Break from Quizzes lab questions? JScrollPane JScrollPane Another swing class Allows a scrollable large component. JList? Constructors See next

More information

Window Interfaces Using Swing Objects

Window Interfaces Using Swing Objects Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs

More information

Graphical User Interface (GUI)

Graphical User Interface (GUI) Graphical User Interface (GUI) An example of Inheritance and Sub-Typing 1 Java GUI Portability Problem Java loves the idea that your code produces the same results on any machine The underlying hardware

More information

Java Programming Lecture 6

Java Programming Lecture 6 Java Programming Lecture 6 Alice E. Fischer Feb 15, 2013 Java Programming - L6... 1/32 Dialog Boxes Class Derivation The First Swing Programs: Snow and Moving The Second Swing Program: Smile Swing Components

More information

Chapter 18. Advanced graphics programming

Chapter 18. Advanced graphics programming Chapter 18 Advanced graphics programming Making choices With graphical applications, there are a number of ways of providing choices to the user: pull-down menus; pop-up menus dialogue windows; radio buttons;

More information

BASICS OF GRAPHICAL APPS

BASICS OF GRAPHICAL APPS CSC 2014 Java Bootcamp Lecture 7 GUI Design BASICS OF GRAPHICAL APPS 2 Graphical Applications So far we ve focused on command-line applications, which interact with the user using simple text prompts In

More information

Chapter 12 Advanced GUIs and Graphics

Chapter 12 Advanced GUIs and Graphics Chapter 12 Advanced GUIs and Graphics Chapter Objectives Learn about applets Explore the class Graphics Learn about the classfont Explore the classcolor Java Programming: From Problem Analysis to Program

More information

Chapter 13 GUI Basics. Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved.

Chapter 13 GUI Basics. Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved. Chapter 13 GUI Basics 1 Motivations The design of the API for Java GUI programming is an excellent example of how the object-oriented principle is applied. In the chapters that follow, you will learn the

More information

Welcome to CIS 068! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) CIS 068

Welcome to CIS 068! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) CIS 068 Welcome to! 1. GUIs: JAVA Swing 2. (Streams and Files we ll not cover this in this semester, just a review) Overview JAVA and GUIs: SWING Container, Components, Layouts Using SWING Streams and Files Text

More information

1.1 GUI. JFrame. import java.awt.*; import javax.swing.*; public class XXX extends JFrame { public XXX() { // XXX. init() main() public static

1.1 GUI. JFrame. import java.awt.*; import javax.swing.*; public class XXX extends JFrame { public XXX() { // XXX. init() main() public static 18 7 17 1 1.1 GUI ( ) GUI ( ) JFrame public class XXX extends JFrame { public XXX() { // XXX // init()... // ( )... init() main() public static public class XXX extends JFrame { public XXX() { // setsize(,

More information

EVENTS, EVENT SOURCES AND LISTENERS

EVENTS, EVENT SOURCES AND LISTENERS Java Programming EVENT HANDLING Arash Habibi Lashkari Ph.D. Candidate of UTM University Kuala Lumpur, Malaysia All Rights Reserved 2010, www.ahlashkari.com EVENTS, EVENT SOURCES AND LISTENERS Important

More information

Window Interfaces Using Swing Objects

Window Interfaces Using Swing Objects Chapter 12 Window Interfaces Using Swing Objects Event-Driven Programming and GUIs Swing Basics and a Simple Demo Program Layout Managers Buttons and Action Listeners Container Classes Text I/O for GUIs

More information

Java 1.9 Swing Index

Java 1.9 Swing Index One Introduction to Java 2 Usage of Java 3 Structure of Java 4 Flexibility of Java Programming 5 Swing and AWT in Java 6 Two Using Java in DOS 9 Using the DOS window 10 DOS Operating System Commands 11

More information

A Simple Text Editor Application

A Simple Text Editor Application CASE STUDY 7 A Simple Text Editor Application To demonstrate the JTextArea component, fonts, menus, and file choosers we present a simple text editor application. This application allows you to create

More information

Event Driven Programming

Event Driven Programming Event Driven Programming Part 1 Introduction Chapter 12 CS 2334 University of Oklahoma Brian F. Veale 1 Graphical User Interfaces So far, we have only dealt with console-based programs Run from the console

More information

Java 11 Swing with Eclipse Index

Java 11 Swing with Eclipse Index One Introduction to Java 1 Usage of Java 2 Structure of Java 4 Flexibility of Java Programming 5 Swing and AWT in Java 7 Using Eclipse 9 Two Dialog Boxes 10 Using Dialog Boxes 11 Using Message Dialogs

More information

Chapter 12 GUI Basics. Motivations. The design of the API for Java GUI programming

Chapter 12 GUI Basics. Motivations. The design of the API for Java GUI programming Chapter 12 GUI Basics 1 Motivations The design of the API for Java GUI programming is an excellent example of how the object-orientedoriented principle is applied. In the chapters that follow, you will

More information

WIMP Elements. GUI goo. What is WIMP?

WIMP Elements. GUI goo. What is WIMP? WIMP Elements GUI goo What is WIMP? 1 There are many kinds of WIMPs WIMP The GUI Interface Windows Icons Menus Pointers 2 Windows Icons Pointers Menus Windows Windows are areas of the screen that act like

More information

11/27/2007 TOPICS CHAPTER TOPICS LISTS READ ONLY TEXT FIELDS. Advanced GUI Applications. This module discusses the following main topics:

11/27/2007 TOPICS CHAPTER TOPICS LISTS READ ONLY TEXT FIELDS. Advanced GUI Applications. This module discusses the following main topics: Advanced GUI Applications TOPICS This module discusses the following main topics: The Swing and AWT Class Hierarchy Read-Only Text Fields Lists Combo Boxes Displaying Images in Labels and Buttons Mnemonics

More information

GUI Components Continued EECS 448

GUI Components Continued EECS 448 GUI Components Continued EECS 448 Lab Assignment In this lab you will create a simple text editor application in order to learn new GUI design concepts This text editor will be able to load and save text

More information

8/23/2014. Chapter Topics. Chapter Topics. Lists. Read Only Text Fields. Chapter 13: Advanced GUI Applications

8/23/2014. Chapter Topics. Chapter Topics. Lists. Read Only Text Fields. Chapter 13: Advanced GUI Applications Chapter 13: Advanced GUI Applications Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 13 discusses the following main topics: The Swing

More information

Part I: Learn Common Graphics Components

Part I: Learn Common Graphics Components OOP GUI Components and Event Handling Page 1 Objectives 1. Practice creating and using graphical components. 2. Practice adding Event Listeners to handle the events and do something. 3. Learn how to connect

More information

2110: GUIS: Graphical User Interfaces

2110: GUIS: Graphical User Interfaces 2110: GUIS: Graphical User Interfaces Their mouse had a mean time between failure of a week it would jam up irreparably, or... jam up on the table--... It had a flimsy cord whose wires would break. Steve

More information

Swing/GUI Cheat Sheet

Swing/GUI Cheat Sheet General reminders To display a Swing component, you must: Swing/GUI Cheat Sheet Construct and initialize the component. Example: button = new JButton ("ButtonLabel"); Add it to the content pane of the

More information

GUI Basics. Object Orientated Programming in Java. Benjamin Kenwright

GUI Basics. Object Orientated Programming in Java. Benjamin Kenwright GUI Basics Object Orientated Programming in Java Benjamin Kenwright Outline Essential Graphical User Interface (GUI) Concepts Libraries, Implementation, Mechanics,.. Abstract Windowing Toolkit (AWT) Java

More information

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp DM550 / DM857 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk http://imada.sdu.dk/~petersk/dm550/ http://imada.sdu.dk/~petersk/dm857/ GRAPHICAL USER INTERFACES 2 HelloWorld Reloaded

More information

Containers. Atomic Components. Containment Hierarchy. Example Example 3.3 (revisited) Example DemoSwing.java

Containers. Atomic Components. Containment Hierarchy. Example Example 3.3 (revisited) Example DemoSwing.java Atomic Components Containers An atomic component is: a low-level entity an entity that interacts with the user an entity that cannot hold other components Examples: buttons (), text fields (JTextField)

More information

Custom Data Models and Cell Renderers

Custom Data Models and Cell Renderers 2010 Marty Hall Advanced Swing & MVC Custom Data Models and Cell Renderers Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/java5.html 2 Customized Java

More information

Java 11 Swing Index. Section Title Page

Java 11 Swing Index. Section Title Page One Introduction to Java 2 Usage of Java 3 Structure of Java 4 Flexibility of Java Programming 5 Swing and AWT in Java 6 Two Using Java in DOS 9 Using the DOS window 10 DOS Operating System Commands 11

More information

JRadioButton account_type_radio_button2 = new JRadioButton("Current"); ButtonGroup account_type_button_group = new ButtonGroup();

JRadioButton account_type_radio_button2 = new JRadioButton(Current); ButtonGroup account_type_button_group = new ButtonGroup(); Q)Write a program to design an interface containing fields User ID, Password and Account type, and buttons login, cancel, edit by mixing border layout and flow layout. Add events handling to the button

More information

Chapter 17 Creating User Interfaces

Chapter 17 Creating User Interfaces Chapter 17 Creating User Interfaces 1 Motivations A graphical user interface (GUI) makes a system user-friendly and easy to use. Creating a GUI requires creativity and knowledge of how GUI components work.

More information

Java 1.8 Swing with Eclipse Oxygen Index

Java 1.8 Swing with Eclipse Oxygen Index One Introduction to Java 1 Usage of Java 2 Structure of Java 4 Flexibility of Java Programming 5 Using the Eclipse software 6 Swing and AWT in Java 7 Two Running Java in Eclipse 10 Introduction 11 Using

More information

Java 1.8 Swing with Eclipse Mars Index

Java 1.8 Swing with Eclipse Mars Index One Introduction to Java 1 Usage of Java 2 Structure of Java 4 Flexibility of Java Programming 5 Using the Eclipse software 6 Swing and AWT in Java 7 Two Running Java in Eclipse 10 Introduction 11 Using

More information

Java 1.8 Swing with Eclipse Neon Index

Java 1.8 Swing with Eclipse Neon Index One Introduction to Java 1 Usage of Java 2 Structure of Java 4 Flexibility of Java Programming 5 Using the Eclipse software 6 Swing and AWT in Java 7 Two Running Java in Eclipse 10 Introduction 11 Using

More information

GUI Event Handlers (Part II)

GUI Event Handlers (Part II) GUI Event Handlers (Part II) 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University 1 Agenda Listener

More information

GUI Event Handlers (Part I)

GUI Event Handlers (Part I) GUI Event Handlers (Part I) 188230 Advanced Computer Programming Asst. Prof. Dr. Kanda Runapongsa Saikaew (krunapon@kku.ac.th) Department of Computer Engineering Khon Kaen University 1 Agenda General event

More information

Introduction to Graphical Interface Programming in Java. Introduction to AWT and Swing

Introduction to Graphical Interface Programming in Java. Introduction to AWT and Swing Introduction to Graphical Interface Programming in Java Introduction to AWT and Swing GUI versus Graphics Programming Graphical User Interface (GUI) Graphics Programming Purpose is to display info and

More information

CSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 331 Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia http://www.cs.washington.edu/331/

More information

CS 349 / SE 382 Design Patterns. Professor Michael Terry January 21, 2009

CS 349 / SE 382 Design Patterns. Professor Michael Terry January 21, 2009 CS 349 / SE 382 Design Patterns Professor Michael Terry January 21, 2009 Today s Agenda More demos! Design patterns CS 349 / SE 382 / 2 Announcements Assignment 1 due Monday at 5PM! CS 349 / SE 382 / 3

More information

CompSci 125 Lecture 17. GUI: Graphics, Check Boxes, Radio Buttons

CompSci 125 Lecture 17. GUI: Graphics, Check Boxes, Radio Buttons CompSci 125 Lecture 17 GUI: Graphics, Check Boxes, Radio Buttons Announcements GUI Review Review: Inheritance Subclass is a Parent class Includes parent s features May Extend May Modify extends! Parent

More information

Packages: Putting Classes Together

Packages: Putting Classes Together Packages: Putting Classes Together 1 Introduction 2 The main feature of OOP is its ability to support the reuse of code: Extending the classes (via inheritance) Extending interfaces The features in basic

More information

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User CSE3461 Control Flow Paradigms: Reacting to the User Control Flow: Overview Definition of control flow: The sequence of execution of instructions in a program. Control flow is determined at run time by

More information

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Starting Out with Java: From Control Structures Through Objects Sixth Edition Starting Out with Java: From Control Structures Through Objects Sixth Edition Chapter 12 A First Look at GUI Applications Chapter Topics 12.1 Introduction 12.2 Creating Windows 12.3 Equipping GUI Classes

More information

CSE 1325 Project Description

CSE 1325 Project Description CSE 1325 Summer 2016 Object-Oriented and Event-driven Programming (Using Java) Instructor: Soumyava Das Graphical User Interface (GUI), Event Listeners and Handlers Project IV Assigned On: 07/28/2016 Due

More information

Unit 6: Graphical User Interface

Unit 6: Graphical User Interface Faculty of Computer Science Programming Language 2 Object oriented design using JAVA Dr. Ayman Ezzat Email: ayman@fcih.net Web: www.fcih.net/ayman Unit 6: Graphical User Interface 1 1. Overview of the

More information

JTcl and Swank. Bruce A. Johnson, Tom Poindexter, & Dan Bodoh. What s new with Tcl and Tk on the JVM. Wednesday, October 26, 11

JTcl and Swank. Bruce A. Johnson, Tom Poindexter, & Dan Bodoh. What s new with Tcl and Tk on the JVM. Wednesday, October 26, 11 JTcl and Swank What s new with Tcl and Tk on the JVM Bruce A. Johnson, Tom Poindexter, & Dan Bodoh JTcl and Swank Bruce s Motivation Cross-platform, scriptable, desktop applications for analyzing and visualizing

More information

Object Oriented Programming

Object Oriented Programming Object Oriented Programming 1. Graphical User Interfaces OOP10 - M. Joldoş - T.U. Cluj 1 GUI A Graphical User Interface (GUI pronounced "goo-ee") presents a userfriendly mechanism for interacting with

More information

Cork Institute of Technology. Spring 2006 GUI/Mobile/Web (Time: 3 Hours)

Cork Institute of Technology. Spring 2006 GUI/Mobile/Web (Time: 3 Hours) Cork Institute of Technology Bachelor of Science (Honours) in Software Development Stage 3 (NFQ Level 8) Spring 2006 GUI/Mobile/Web (Time: 3 Hours) Answer FOUR questions ONLY. Show all work. Marks:All

More information

Index SELF-STUDY. Symbols

Index SELF-STUDY. Symbols SELF-STUDY 393 Index Symbols -... 239 "Event-to-property"... 144 "Faux" variables... 70 %... 239 ( )... 239 (Pme) paradigm... 14 *... 239 +... 239 /... 239 =... 239 = Null... 46 A A project... 24-25, 35

More information

Human-Computer Interaction IS4300

Human-Computer Interaction IS4300 Human-Computer Interaction IS4300 1 I4 Swing! Due Now Implement a Java applet to provide online ordering for your favorite restaurant. The interface need not be functional, but the controls should be laid

More information

Outline CSE 3461 F10. What is a Widget? Properties of Widgets. A self-contained screen object Also called a control Examples of widgets:

Outline CSE 3461 F10. What is a Widget? Properties of Widgets. A self-contained screen object Also called a control Examples of widgets: CSE 3461 F10 Widgets Outline What is a widget? Buttons Combo boxes Text components Message boxes 2 What is a Widget? Properties of Widgets A self-contained screen object Also called a control Examples

More information

Today. cisc3120-fall2012-parsons-lectiii.3 2

Today. cisc3120-fall2012-parsons-lectiii.3 2 MORE GUI COMPONENTS Today Last time we looked at some of the components that the: AWT Swing libraries provide for building GUIs in Java. This time we will look at several more GUI component topics. We

More information

UNIT-V 1 KNREDDY JAVA PROGRAMMING

UNIT-V 1 KNREDDY JAVA PROGRAMMING UNIT-V 1 KNREDDY UNIT-V Swings: The origin and design philosophy of swing, Components and containers, Layout managers, Event handling, Using a push button, jtextfield, jlabel and image icon, The swing

More information

CoSc Lab # 5 (The Controller)

CoSc Lab # 5 (The Controller) CoSc 10403 Lab # 5 (The Controller) Due Date: Part I, Experiment classtime, Thursday, Oct 25 th, 2018. Part II, Program - by midnight, Thursday, Oct 25 th, 2018. Part I MUST be typed and submitted to your

More information

Java: Graphical User Interfaces (GUI)

Java: Graphical User Interfaces (GUI) Chair of Software Engineering Carlo A. Furia, Marco Piccioni, and Bertrand Meyer Java: Graphical User Interfaces (GUI) With material from Christoph Angerer The essence of the Java Graphics API Application

More information

CSE 331. Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

CSE 331. Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT CSE 331 Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT Lecturer: Michael Hotan slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer,

More information

Object-Oriented Programming: Revision. Revision / Graphics / Subversion. Ewan Klein. Inf1 :: 2008/09

Object-Oriented Programming: Revision. Revision / Graphics / Subversion. Ewan Klein. Inf1 :: 2008/09 Object-Oriented Programming: Revision / Graphics / Subversion Inf1 :: 2008/09 Breaking out of loops, 1 Task: Implement the method public void contains2(int[] nums). Given an array of ints and a boolean

More information

Information Technology for Industrial Engineers 15 November ISE 582: Information Technology for Industrial Engineers

Information Technology for Industrial Engineers 15 November ISE 582: Information Technology for Industrial Engineers ISE 582: Information Technology for Industrial Engineers University of Southern California Department of Industrial and Systems Engineering Lecture 10 JAVA Cup 9: Images, Interactive Forms Handouts & Announcements

More information