Java Swing Things - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Java Swing Things

Description:

HTML in Swing. Good for formatting text and such. ... referenced from http://www.tutorialized.com/tutorial/Introduction-to-Swing/10213 ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 12
Provided by: csU60
Category:
Tags: html | java | swing | things | tutorial

less

Transcript and Presenter's Notes

Title: Java Swing Things


1
Java Swing Things
Project Presentation by Chris Backo
2
Closing Applications
  • DISPOSE_ON_CLOSE - Dispose the window when
    closed.
  • DO_NOTHING_ON_CLOSE - Do nothing when the window
    is closed.
  • EXIT_ON_CLOSE - Exit the application when the
    window is closed.
  • HIDE_ON_CLOSE - Hide the window when the window
    is closed.
  • setDefaultCloseOperation(EXIT_ON_CLOSE)

3
Containers and Panels
  • For aligning contents and such.
  • Containers hold panels.
  • Subdivides the window.

4
Glass Panes
  • Create a transition effects between screens.
  • Display a progress screen within the glass pane.
  • Display debug information within the glass pane.
  • Example

5
HTML in Swing
  • Good for formatting text and such.
  • MUCH easier than working with things such as
    setFont() and setColor() methods in Swing.. If
    youre familiar with HTML that is.

6
Starting up
  • JFrame or JWindow used for GUI.
  • JFrames are simpler.
  • One difference is JFrames dont put buttons on OS
    task bar?
  • public class Calculator extends JFrame
  • super("Calculator")

7
Applets vs. Applications
  • Applets run on browsers.
  • Applications us main method.
  • Reference
  • Reference

8
Components
  • Visual objects are subclasses of Component class.
  • Containers are components which can store
    components. For example
  • Container content getContentPane()content.add(
    new JButton("Button 1"))
  • code referenced from code referenced from
    http//www.tutorialized.com/tutorial/Introduction-
    to-Swing/10213

9
JPanels
  • General purpose containers for components.
  • For example
  • JPanel panelnew JPanel()panel.add(new
    JButton("Button 1"))panel.add(new
    JButton("Button 2"))panel.add(new
    JButton("Button 3"))content.add(panel)
  • code referenced from code referenced from
    http//www.tutorialized.com/tutorial/Introduction-
    to-Swing/10213

10
Native Look and Feel in Java
11
Thank you.
Write a Comment
User Comments (0)
About PowerShow.com