1 / 26

JAVA SWING

JAVA SWING. By Tahira Braschi April 20, 2001 Dr. Marchant CS 108-002. What is JFC?. JFC stands for Java Foundation Classes, and it includes a group of features to help people build GUIs (Graphical User Interfaces). Features which help defined JFC are: The Swing components

maus
Télécharger la présentation

JAVA SWING

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JAVA SWING By Tahira Braschi April 20, 2001 Dr. Marchant CS 108-002

  2. What is JFC? • JFC stands for Java Foundation Classes, and it includes a group of features to help people build GUIs (Graphical User Interfaces). • Features which help defined JFC are: • The Swing components • Pluggable Look and Feel Support • Accessibility API (Application Programmer Interface) • Java 2D™ API • Drag and Drop Support

  3. Swing • “Swing” is the codename of the project that developed the new components. It is not the official name. • However, it’s frequently used to refer to the new components and related API.

  4. Swing Components… • Part of the Java™ Foundation Classes (JFC), and can be used with either JDK™ 1.1 or the Java™ 2 platform. • Include everything: buttons, lists, menus, tables, text areas, and containers such as windows and tool bars.

  5. Top-Level Containers Applet—you should know that by now! Dialog—windows that are more limited than frames. Frame—is a window that has decorations such as a border, a title, and buttons for closing and iconifying the window. Applications with a GUI typically use at least one frame.

  6. General-Purpose Containers • Intermediate containers which can be used under many different circumstances: • Panel • Scroll pane • Split pane • Tabbed pane • Tool bar

  7. General Purpose Containers • Panel—most flexible and frequently used. Add almost no functionality beyond what all objects have. Often used to group components. • Scroll pane—provides scroll bars around a large or growable component. • Split pane—displays two components in a fixed amount of space, letting the user adjust the amount of space devoted to each component.

  8. General Purpose Containers • Tabbed pane—contains multiple components but show only one at a time. The user can easily switch between components. • Tool bar—holds a group of components (usually buttons) in a row or column, optionally allowing the user to drag the tool bar into different locations.

  9. General-Purpose Containers Panel Split pane Scroll Pane Tool bar Tabbed pane

  10. Special-Purpose Containers • Intermediate containers that play specific roles in the use interface. • Internal frame— Able to display display a Frame-like window within another window. Usually, you add internal frames to a desktop pane. • Layered frame—Provides a third dimension for positioning components: depth, also known as Z order. • Root pane—Has 4 parts: glass pane, layered pane, content pane, and the (optional) menu bar.

  11. Special-Purpose Containers Internal Frame Layered Pane Root Pane

  12. Basic Controls • Atomic components that exist primarily to get input from the user; they generally also show simple state. • Buttons—can be square or round • Combo Box—can be uneditable and editable. • List—Presents the user with a group of items, displayed in a column, to choose from. • Menu—provides a space-saving way to let the user choose one of several options. • Slider—lets user enter a numeric value bounded by a minimum and maximum value. • Text Fields—basic text control that lets the user enter a small amount of text.

  13. Basic Controls List Buttons Combo Box Slider Text Fields Menu

  14. Uneditable Information Displays • Atomic components that exist solely to give the user information. • Label—able to display unselectable text and images. • Progress Bar—displays the progress of a long-running task (also, ProgressMonitor and ProgressMonitorInputStream) • Tool tip—comes up when the user of the program pauses with the cursor over any of the program's buttons

  15. Uneditable Information Displays Progress Bar Label Tool Tips

  16. Editable Displays of Formatted Information • Atomic components that display highly formatted information that can be edited by the user. • Color chooser—provide users with a palette of colors to choose from. • File chooser—provide a GUI for navigating the file system, and then either choosing a file or directory from a list or entering a file name or directory name. • Table—displays tables of data, optionally allowing the user to edit the data. • Text—displays text and allows user to edit it • Tree—displays data in hierarchical way

  17. Editable Displays of Formatted Information File Chooser Color Chooser Tree Table Text

  18. Pluggable Look & Feel Support • Gives any program that uses Swing components a choice of looks and feels. For example, the same program can use either the Java™ look-and-feel or the Windows look-and-feel. • Many more look-and-feel packages will be available in the future from various sources, including some that use sound instead of a visual “look.”

  19. Pluggable Look & Feel Support Java Look-and-feel CDE/Motif Look-and-feel Windows Look-and-feel

  20. Accessibility API • Enables assistive technologies such as screen readers and Braille displays (for blind people) to get information from the user interface. • Primarily, assistive technologies exist to enable people with permanent or temporary disabilities to use the computer. • For example, if you get carpal tunnel syndrome, you can use assistive technologies to accomplish your work without using your hands.

  21. Java 2D™ API Java 2 Platform only • Enables developers to easily incorporate high-quality 2D graphics, text, and images in applications and in applets. • Enables you to display complex charts and graphs that use various line and fill styles to distinguish sets of data. • Enables you to store and to manipulate image data—by performing image-filter operations, such as blur and sharpen.

  22. Drag and Drop Support • Java 2 Platform only • Provides the ability to drag and drop between a Java application and a native application.

  23. For more information on … • Go to java.sun.com. This is a very useful site and it is where I got my information for this presentation • There’s a tutorial which takes you step by step on how to use Swing components.

  24. Questions • What is JFC? • What is Swing? • Name the Swing components? • Name 3 general purpose containers of Swing? • What does the Pluggable look and feel support does?

  25. Thank you!!! Thank you for your time! No, no questions, please!!!! …or else you’ll be running after class!

  26. END

More Related