GUI Components Continued EECS 448

Similar documents
Prototyping a Swing Interface with the Netbeans IDE GUI Editor

Is image everything?

Introduction. Table Basics. Access 2010 Working with Tables. Video: Working with Tables in Access To Open an Existing Table: Page 1

Nauticom NetEditor: A How-to Guide

FrontPage. Directions & Reference

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.

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

Chapter 6: Graphical User Interfaces

SITE DESIGN & ADVANCED WEB PART FEATURES...

Java IDE Programming-I

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

2. This tutorial will teach you the basics of PowerPoint and how to hyperlink and embed (insert) videos into your PowerPoint.

Contents Introduction 1

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

BASICS OF GRAPHICAL APPS

Clip Art and Graphics. Inserting Clip Art. Inserting Other Graphics. Creating Your Own Shapes. Formatting the Shape

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

The Basics of PowerPoint

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

Creating a Dashboard Prompt

CS 209 Spring, 2006 Lab 8: GUI Development Instructor: J.G. Neal

A Simple Text Editor Application

Chapter 14. More Swing

Chapter 12 GUI Basics

Index SELF-STUDY. Symbols

Week 5 Creating a Calendar. About Tables. Making a Calendar From a Table Template. Week 5 Word 2010

ITP 342 Mobile App Dev. Interface Fun

FrontPage 2000 Tutorial -- Advanced

Shop by Brand. Magento Extension User Guide. Here you will find the latest Shop by Brand user guide version *

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

PowerPoint Tips and Tricks

Starting Microsoft Visual Studio 6.0 And Exploring Available Controls Tools

Office 365: . Accessing and Logging In. Mail

PowerPoint X. 1. The Project Gallery window with the PowerPoint presentation icon already selected. 2. Click on OK.

Netscape Composer Tutorial

Working with Tables in Word 2010

MCS3 USB Software for OSX

Word Introduction. SmartArt graphics. Video: SmartArt Graphics in. Word To insert a SmartArt illustration: SmartArt Graphics

1 Ctrl + X Cut the selected item. 2 Ctrl + C (or Ctrl + Insert) Copy the selected item. 3 Ctrl + V (or Shift + Insert) Paste the selected item

MICROSOFT WORD 2010 BASICS

Event Driven Programming

The Collections Workbench can be used to view and manage accounts. Click anywhere to continue. Copyright 2012 Pulse Systems, Inc.

Forte for Java Community Edition 1.0

Assignment 1. Application Development

Oracle General Navigation Overview

FM 4/100 USB Software for OSX

PowerPoint Basics (Office 2000 PC Version)

Creating Fill-able Forms using Acrobat 7.0: Part 1

Graphical User Interface (GUI)

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

APPLICATION DEVELOPMENT CHALLENGE

FrontPage 98 Quick Guide. Copyright 2000 Peter Pappas. edteck press All rights reserved.

How To Use WebStudy Mail

Chapter 8: GUI Dialog & Table. Informatics Practices Class XII. By- Rajesh Kumar Mishra. KV No.1, AFS, Suratgarh

PowerPoint 2016 Building a Presentation

OpenForms360 Validation User Guide Notable Solutions Inc.

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming

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

Display Systems International Software Demo Instructions

Page 1 of 7. public class EmployeeAryAppletEx extends JApplet

Introduction. SmartArt Graphics. Word 2010 SmartArt Graphics. Video: SmartArt Graphics in Word To Insert a SmartArt Illustration: Page 1

Publisher 2000 Creating a Calendar The Academic Computing Services

PowerPoint Introduction

Basics of programming 3. Java GUI and SWING

Crystal Reports. Contents. Guidelines to Formatting Consistent Reports

Vizit Essential for SharePoint 2013 Version 6.x User Manual

The Domino Designer QuickStart Tutorial

Overview of Cisco UCS Manager GUI

Appleworks 6.0 Word Processing

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

EL-CID Quick Reference Version 6.0

MCS 2 USB Software for OSX

Netscape Composer: Working with Tables

Overview of Cisco UCS Manager GUI

Lab - Task Scheduler in Windows 8

Getting Started (1.8.7) 9/2/2009

PowerPoint Slide Basics. Introduction

SPARK. User Manual Ver ITLAQ Technologies

Access Review. 4. Save the table by clicking the Save icon in the Quick Access Toolbar or by pulling

UTAS CMS. Easy Edit Suite Workshop V3 UNIVERSITY OF TASMANIA. Web Services Service Delivery & Support

In the fourth unit you will learn how to upload and add images and PDF files.

Table Basics. The structure of an table

PowerPoint Intermediate 2010

Interface. 2. Interface Photoshop CS/ImageReady CS for the Web H O T

There are six main steps in creating web pages in FrontPage98:

PROFILE DESIGN TUTORIAL KIT

DbSchema Forms and Reports Tutorial

AutoCAD 2009 User InterfaceChapter1:

Graphical User Interfaces. Comp 152

button Double-click any tab on the Ribbon to minimize it. To expand, click the Expand the Ribbon button

Lecture 18 Java Graphics and GUIs

Section 2. Slides. By the end of this Section you should be able to:

Customizing Interface Elements and Commands Part 02

USER GUIDE MADCAP CAPTURE 7. Getting Started

Word 2013 Quick Start Guide

Where Did My Files Go? How to find your files using Windows 10

EDIT202 PowerPoint Lab Assignment Guidelines

PowerPoint Basics. Objectives. PowerPoint Basics. Just what are we trying to do with this software anyway?

PowerPoint Launching PowerPointX

Hands-On Lab. Authoring and Running Automated GUI Tests using Microsoft Test Manager 2012 and froglogic Squish. Lab version: 1.0.5

Transcription:

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 files with file selection dialogs. It will have a static sized tool box on the left and a dynamically sized multi-lined text field on the right. It will have menus, tooltips, tabbed panes, scroll panes, custom components, and other GUI doodads. Implement the features incrementally by following the slides and pay special attention to the "Requirement" bullet points

Relative Layouts So far, we have used only the 'Absolute Layout' in lab The absolute layout gives the most precision and control, but does not easily allow for resizing of the form Relative layouts allow for intelligent resizing For this lab, you will need to try out one of the relative layouts. Requirement: Your form needs to resize such that the tool pane on the left does not change but the text area does. Static Dynamic Resize!

Relative Layouts Experiment with the Form or Grid layout These layouts allow you to add components to cells in a grid/table You can then make some cells sizes dynamic and others static Check the 'grow' property Requirement: You will also need to set a minimum size to the main frame so that components aren't clipped off Static Dynamic Resize!

Tabbed Panes Panes are sections of a GUI that can house components Like the frame, a pane must define it's own layout for its components The JTabbedPane is a special container that can hold an array of panes Add a JTabbedPane in the correct spot in your relative layout and then add the desired number of JPanes to it to create tabs JTabbedPane Possessed JPanes

Tabbed Panes With the JTabbedPane, only one of its possessed panes are visible at a time This is selected with the tabs Requirement: The tool box for this editor groups its tools with a tabbed pane. You need a 'Display' tab and an 'Insert' tab. The JPane 'Display' is the current visible JPane in the possessing JTabbedPane

Scroll Panes Scroll panes are designed such that vertical and/or horizontal scroll bars appear when the pane's contents become to large to be viewed Requirement: Your JTextArea must be a component of a JScrollPane to allow scrolling of the text area JScrollPane

Radio buttons and button groups Radio buttons are essentially mutually exclusive checkboxes Requirement: A group of radio buttons must control the text color of your editor (this is the foreground property of the JTextArea). There must be at least four colors. You may pick whatever colors you want. RadioButtons

Radio buttons and button groups Add a JPane to house the radio buttons within your 'Display' pane Add a border to this radio button pane Add at least four buttons, each corresponding to a color Right click on one of them and navigate to 'Set ButtonGroup' Radio buttons are only mutually exclusive within their own button group Create a new button group with 'Standard' settings Add all of the other buttons to this same group If you run the program now, you should only be able to select one of these at a time

Radio buttons and button groups Now, create an event handler that will be called on the 'actionperformed' event of all of the radio buttons Right click each button, 'Add event handler'->action- >actionperformed Each button should call the same method The event handler should use conditionals to figure out which of the buttons is selected and then it should update the JTextArea's foreground with the new color Look into JTextArea.setForeground() and JRadioButton.isSelected()

Comboboxes A combobox is a drop down list box Requirement - Add a JComboBox to control the background color of the JTextArea. This must include at least four colors of your choosing. The event handler here can also be its 'actionperformed' JComboBox

Custom components, JDateChooser The ability to pick a date is often an important feature for GUI applications, but you will notice that Swing does not already implement a component to do so This means that will need to either define your own or import an already existing component Defining something as common as a date picker in most cases is way out of scope of a project's initiative No need to reinvent any wheels here

Custom components, JDateChooser For this lab, we will use toedter's JCalendar version 1.4 Pull up your favorite search engine and find a download for JCalendar 1.4 In the event that this is an archive, look for 'jcalendar-1.4.jar' Once you've gotten this file, we want to add the components it defines to our WindowBuilder's palette Components are defined as classes The palette is the region that lets us select and add components to our design Right click the palette and navigate to 'Import Jar...' Click on the folder icon and select 'File System' Navigate to where you downloaded jcalendar-1.4.jar and select it You should now see a list of classes: JCalendar, JSpinField, JYearChooser, etc Select all of these and hit Ok It will prompt you to add each to the classpath, say yes Refresh the palette and you should now see the new components

Custom components, JDateChooser Requirement: You will need to add a JDateChooser and then a insert button. When the insert button is clicked, it will add a string representation of the selected date to the text editor at caret position. For example, if the date you selected was September 1st, 2012, hitting insert would then add "1 Sep 2012 05:00:00 GMT" to the JTextArea at the cursor position.

Menu bars, menus, and menu items Menus are the drop downs that occur upon right clicks and clicking of menu bar entries like 'File' in most programs Requirement: You will need a menu bar of the following structure... File Edit -> Open -> Select All -> Save -> Exit File->Open will open a text file. (explained later) File->Save will save a text file. (explained later) File->Exit will call System.Exit() Edit->'Select All' will select all the text in the JTextArea

Menu bars, menus, and menu items Menus are expandable, MenuItems are simply buttons You will need to add a JMenuBar to your frame You will need to add JMenus to your JMenuBar one for 'File', one for 'Edit' You will need to add JMenuItems to your JMenuBars

File dialogs File->Open should show an open file dialog and then read all the text in the selected file to the JTextArea File->Save should show a save file dialog and then write all of the text in the JTextArea to the selected file Show file dialogs as follows: final JFileChooser fc = new JFileChooser(); int result = fc.showsavedialog(null); //or try showopenfiledialog() if (result == JFileChooser.APPROVE_OPTION) { //if user hit 'ok' File savefile = fc.getselectedfile(); //this is the selected file //do stuff with the file... } else //if user hit 'cancel' { //cancelled }

File IO in Java Reading and writing to files in Java is pretty trivial This should be very similar to C++ programs you have written //Reading a file - infile is of type File BufferedReader in = new BufferedReader(new FileReader(infile)); while (in.ready()) { //not end of file String line = in.readline(); } in.close(); //Writing a file - outfile is of type File PrintWriter out = new PrintWriter(new FileWriter(outfile)); out.print("some text..."); out.println("some text..."); out.close();

Tool tips Tool tips are the suggestion boxes that appear when you hover the cursor over a component of a form Requirement: All clickable components need to have a tool tip that gives a short description of what the action will do. Most GUI components have a tooltiptext property that accept a string value Tool tip for the insert button

That is all If you have implemented all the aforementioned requirements, you should be ready to present Keep in mind that there are still many other useful components, both defined by Swing and not, that may come in handy to you in your project Refer to this visual guide for a quick easy reference: http://docs.oracle.com/javase/tutorial/ui/features/components.html JTables and JTrees are very powerful gui components that can be used in conjunction with databases