Copyright 1998-2005 Curt Hill GridBag Layout Manager A flexible but complicated layout.

Slides:



Advertisements
Similar presentations
Spreadsheet Vocabulary
Advertisements

Spreadsheet Vocabulary Split the screen so you can see the words AND the crossword puzzle AND the quiz at the same time.
GUI Elements Session 17. Memory Upload Layout Components Button TextField TextArea Label Choice Containers Panels The applet itself.
GridLayout, n*m grid. Column width/row height adjusted to fith the widest/highest Component.
Microsoft Office 2007 Excel Chapter 1 Creating a Worksheet and an Embedded Chart.
Graphic User Interfaces Layout Managers Event Handling.
CMSC 341 Building Java GUIs. 09/26/2007 CMSC 341 GUI 2 Why Java GUI Development? Course is about Data Structures, not GUIs. We are giving you the opportunity.
Advanced Swing. Advanced Layout Managers GridBagLayout – Example: Web Browser (Grid Bag Layout)Web Browser (Grid Bag Layout) BoxLayout – Example: Web.
Direction at your fingertips. A compass rose is a design on a map that shows directions. It shows north, south, east, west, northeast, northwest, southeast,
Help me find the cardinal directions
LayoutManager, J 1 Layout Manager. LayoutManager, J 2 Layout Manager To each UI container there is a layout manager (an object). When you add a component.
GUI programming AWT(Abstract Windows Toolkit)-GUI components library when Java was introduced AWT was replaced by Swing components import javax.swing.*;
Understanding SWING Architecture CS 4170 UI Design Hrvoje Benko Oct. 9, 2001.
Unit 131 GUI Layout Managers Learning Outcomes oList and distinguish between the four most common, standard layout managers in Java. oUse these and other.
LAB SESSION 10 *LAYOUT MANAGER *LISTENERS. Laying the components manually by using a null layout is tedious. Each container object has a layout manager.
Creating a Web Page with Tables. Objectives Create a text table with preformatted text Create the basic structure of a graphical table Organize table.
1 L48 Advanced GUI Component (3). 2 OBJECTIVES  To use additional layout managers.
Jan Containers Yangjun Chen Dept. Business Computing University of Winnipeg.
XP Creating Web Pages with HTML Using Tables. XP Objectives Create a text table Create a table using the,, and tags Create table headers and captions.
GUI Layout Managers Arkadiusz Edward Komenda. Outline Components and Containers Layout Managers Flow Layout Grid Layout Border Layout Nested Containers.
Notes Ch. 12—Creating Tables Web Page Design. Why Use Tables? Tables are used to create a variety of items such as calendars, charts, and spreadsheets.
Using HTML to Create Tables in Web pages Connie Lindsey November 2005.
Chapter 13 Advanced GUIs and Graphics. Chapter Objectives Learn about applets Explore the class Graphics Learn about the class Font Explore the class.
1 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES LECTURE 3 GEORGE KOUTSOGIANNAKIS George Koutsogiannakis / Summer 2011.
Layout Managers A layout manager is an object that determines the way that components are arranged in a container There are several predefined layout managers.
©2007 · Georges Merx and Ronald J. NormanSlide 1 Chapter 7 Interfacing with Users.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
MSc Workshop - © S. Kamin, U.Reddy Lect 5 – GUI Prog - 1 Lecture 5 – GUI Programming r Inner classes  this and super r Layout r Reading: m.
Rina System development with Java Instructors: Rina Zviel-Girshin Lecture 12.
Formatting a Workbook.  Formatting: process of changing a workbook’s appearance by defining fonts, styles, colors, and decorative features.  Theme:
Columns run horizontally in tables and rows run from left to right.
 Definition  Components  Advantages  Limitations Contents  Introduction Introduction  Inserting a Table Inserting a Table  Drawing a Table Drawing.
Copyright 2006 South-Western/Thomson Learning Chapter 12 Tables.
Introducing Web Tables. Tables for tabulating items  Better looking  More flexibility  More efficient to explain information than plain text.
© Marty Hall, Larry Brown, Web core programming 1 Layout Managers Arranging Elements in Windows.
Grid Bag Layout Most Complex and Powerful Components can vary in size and can be added in any order Draw out on piece of paper first Columns and Rows:
CPSC 233 Tutorial Xin Apr 6, Reading files An example available on my website pages.cpsc.ucalgary.ca/~liuxin.
AWT Layout Managers (Chapter 10) Java Certification Study Group January 21, 1999 Mark Roth.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 3 Designing the Interface with Layout Managers.
Grid References.
CSI 3125, Preliminaries, page 1 Layout Managers. CSI 3125, Preliminaries, page 2 Layout Managers The LayoutManagers are used to arrange components in.
Copyright © Curt Hill Further Picture Manipulation Considering position.
Java Swing - Lecture 3 Layout Management
Web Page Tables GMU-Teaching with Technology. Table Characteristics: Looks like a news page Contains columns and rows.
Copyright © 2012 Certification Partners, LLC -- All Rights Reserved Lesson 5: HTML Tables.
Java Programming: Guided Learning with Early Objects Chapter 8 Applications of Arrays (Sorting and Searching) and Strings.
Unit 131 GUI Layout Managers Learning Outcomes oList and distinguish between the four most common, standard layout managers in Java. oUse these and other.
Chapter 7 A First Look at GUI Applications Layout Managers.
Laying out Elements with CSS
Working with Tabs and Tables
University of Central Florida COP 3330 Object Oriented Programming
Tim McKenna Layout Mangers in Java Tim McKenna
Chap 7. Building Java Graphical User Interfaces
Layout Managers A layout manager is an object that determines the way that components are arranged in a container There are several predefined layout managers.
Tables:.
Graphical User Interfaces -- Introduction
Objectives Create a reset style sheet Explore page layout designs
Tim McKenna Layout Mangers in Java Tim McKenna
Chapter 11 Review.
Map & Compass Skills.
北 N north 西 W west 東 E east south南 S.
LayoutManagers The LayoutManagers are used to arrange components in a particular manner. LayoutManager is an interface that is implemented by all the classes.
Lesson 5: HTML Tables.
Mandeville Center Upper Level West: Interior Inaccessible Element
Maps & Map Keys.
Parts of a Map.
Layout Organization and Management
Advanced GUIs and Graphics
Presentation transcript:

Copyright Curt Hill GridBag Layout Manager A flexible but complicated layout

Copyright Curt Hill Is this the best or worst? Very flexible and complicated Allows different sized components Each component has constraints which determine its positioning It allows merging of cells Most of the work is done by an object of GridBagConstraints When it does not work it is seldom clear why

Copyright Curt Hill GridBag Has only default constructor The number of rows and columns is determined by the constraints of the added components Each component occupies a rectangle of cells The adds are somewhat different than expected

Copyright Curt Hill Adding to the layout manager Three steps: Establish the constraints –This is most of the work Use the setConstraints –Connects the constraints and component Do the add –Add has only parameter: a component

Copyright Curt Hill GridBagConstraints An object that effectively describes the formatting of the component Specifies –x,y positions –sizes –Alignment –filling

Copyright Curt Hill GridBagConstraints properties Unlike very many objects most properties are public, rather than private or protected Thus we can merely do assignments on them before executing the setConstraints method The properties usage follows

Copyright Curt Hill Position Properties int gridx –Position of left portion –Zero is leftmost int gridy –Position of top –Zero is top These determine the upper left corner of the component’s rectangle

Copyright Curt Hill Size Properties int gridwidth and gridheight –Determines the number of rows and columns in this component fill – enlarge to limits of the rectangle –Set to one of four constants HORIZONTAL VERTICAL NONE – no filling BOTH – fill in both directions

Copyright Curt Hill Other padding properties insets, a class of four integers This specifies external padding This is the padding between the component and its rectangular boundary The Inset has the following constructor parameters: –(int top, int left, int bottom, int right)

Copyright Curt Hill Alignment property Anchor –How to place an item that is smaller than its rectangle May be one of several constants: –CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, and NORTHWEST