XML, HTML - PowerPoint PPT Presentation

About This Presentation
Title:

XML, HTML

Description:

There is a toplevel container, usually a window ... JFrames are top-level windows. JPanels allow grouping of ... window.contentPane.add(swing.JScrollPane(list) ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 17
Provided by: Jahme
Learn more at: https://ics.uci.edu
Category:
Tags: html | xml | window

less

Transcript and Presenter's Notes

Title: XML, HTML


1
XML, HTML Swing An Overview
  • Inf 141
  • Information Retrieval
  • Winter 2007

2
XML
  • General purpose mark-up language
  • Extensible because it allows users to define
    their own elements
  • Example ltstartgtlt/startgt
  • Follows a tree-like structure
  • Must have exactly one root element

3
XML
  • Levels of correctness
  • Well-formed if u start with a statement you must
    end with a statement or it will not be parsed
  • Example ltstartgt blah blah blah lt/startgt
  • Element names are case sensitive
  • ltstart /gt
  • Valid conforms to semantic rules (either user
    defined or schema included)
  • Example if a document contains an undefined
    element, then it is not valid and will not be
    parsed

4
HTML
  • Predominant markup language for web pages.
  • It provides a means to describe the structure of
    text-based information in a document by
    denoting certain text as headings, paragraphs,
    lists, and so on and to supplement that text
    with interactive forms, embedded images, and
    other objects.

5
HTML
  • Elements are the basic structure
  • Properties
  • Attributes contained in the start label
  • ltfont size 8gtlt/fontgt
  • Content - located between the labels
  • ltpgt hello lt/pgt
  • Types of markup
  • Structural describes purpose most browsers have
    formatting standards
  • Example
  • lth2gtlt/h2gt
  • Presentational describes appearance
  • Example
  • ltstronggt bold lt/stronggt
  • ltemgt italics lt/emgt
  • Hypertext links to other documents or pages
  • Example
  • lta href"http//en.wikipedia.org/"gtWikipedialt/agt

6
HTML
  • Must start with a document type which determines
    which rendering mode to use
  • HTML documents transmitted from a web server to a
    web browser for viewing

7
Swing
  • GUIs are layed out as trees
  • There is a toplevel container, usually a window
  • Inside this are multiple panels (often
    invisible), used to control layout
  • Swing Javas GUI programming toolkit

8
Swing
9
Common Swing Widgets
  • JFrames, JPanels
  • Layout Managers
  • JLists
  • JButtons
  • JLabels, JTextFields, JTextAreas

10
Swing JFrames and JPanels
  • JFrames are top-level windows
  • JPanels allow grouping of other widgets
  • Each JFrame has a panel into which the frames
    contents must go the contentPane
  • window swing.JFrame(FrameDemo)
  • window.contentPane.add(new JButton())
  • You must pack and show a JFrame to display it
  • window.pack()
  • window.show()

11
Swing Layout Managers
  • Layout Managers control the placement of widgets
    in a JPanel
  • Simplest by far awt.BorderLayout
  • window.contentPane.layout awt.BorderLayout()
  • window.contentPane.add(Center,
    swing.JButton(Button 2 (CENTER)))
  • Five regions
  • North, South expand horizontally
  • East, West expand vertically
  • Center expands in both directions

12
Swing JLists
  • JLists are collections of widgets
  • list swing.JList()
  • Put JLists in a JScrollPane to make them
    scrollable
  • window.contentPane.add(swing.JScrollPane(list))
  • JLists contain a listData member with the
    contents
  • list.listData January, February, March,
    ...
  • selectedValue contains the selected item!
  • gtgtgt print list.selectedValue
  • March

13
Swing JButtons
  • JButtons have many fancy features...
  • Images, labels, tooltips, etc.
  • Basic use is very simple
  • Supply a label when you construct the button
  • button swing.JButton(This is my label!)
  • Provide a function to use as a callback
  • button.actionPerformed someCallback

14
Swing JTextFields, JTextAreas, and JLabels
  • JLabels are the worlds simplest widgets
  • years swing.JLabel(Years)
  • JTextFields are used for single-line text entry
  • yearValue swing.JTextField()
  • print yearValue.text
  • JTextAreas are used for longer pieces of text
  • area swing.JTextArea(24, 80)

15
Resources
  • XML
  • Wikipedia
  • Tutorial http//www.w3schools.com/xml/default.asp
  • inside out http//www.xml.com/
  • HTML
  • Wikipedia
  • Tutorial http//www.w3schools.com/html/default.as
    p
  • Swing
  • Wikipedia
  • JComponent Class http//java.sun.com/docs/books/t
    utorial/uiswing/components/jcomponent.html

16
Questions
  • ?
Write a Comment
User Comments (0)
About PowerShow.com