The Java Foundation Classes ( JFC ) are a graphical framework for building portable Java -based graphical user interfaces (GUIs). JFC consists of the Abstract Window Toolkit (AWT), Swing and Java 2D . Together, they provide a consistent user interface for Java programs, regardless of whether the underlying user interface system is Windows , macOS or Linux .
23-541: AWT existed before JFC. AWT was heavily criticized for being little more than a wrapper around the native graphical capabilities of the host platform. That meant that the standard widgets in the AWT relied on those capabilities of the native widgets, requiring the developer to also be aware of the differences between host platforms. An alternative graphics library called the Internet Foundation Classes
46-544: A graphics stack other than one of those provided by the official JDK ( X Window System , OpenGL or DirectX ), by including an external library and setting some system properties. A DirectFB backend for Caciocavallo is under development, as is an HTML5 backend; the aim is to deploy existing Swing applications—without Java support—as ordinary web applications running on a web server. Look and feel#Look and Feel in Widget Toolkits In software design ,
69-558: A native Microsoft Windows application when run on Windows, but the same program looks like a native Apple Macintosh application when run on a Mac, etc. However, some application developers dislike this model because they prefer their applications to look exactly the same on every platform. In J2SE 1.2 , the Swing toolkit largely superseded the AWT's widgets. In addition to providing a richer set of UI widgets, Swing draws its own widgets (by using Java 2D to call into low-level subroutines in
92-569: A new operating system may involve a lot of work, especially if it involves any of the AWT GUI widgets, because each of them requires that its native peers be developed from scratch. A new project, Caciocavallo , has been created, that provides an OpenJDK -based Java API to ease AWT implementation on new systems. The project has successfully implemented AWT widgets using Java2D . All the necessary core-JDK modifications have since been pushed to OpenJDK 7 , which means that Java can now be used on
115-450: A set of products from one company. Second, it increases ease of use, since users will become familiar with how one product functions (looks, reads, etc.) and can translate their experience to other products with the same look and feel. Contrary to operating system user interfaces , for which look and feel is a part of the product identification, widget toolkits often allow users to specialize their application look and feel, by deriving
138-705: A vehement reaction from some in the software community, and causing Richard Stallman to form the League for Programming Freedom , the expected landmark ruling never happened, as most of the issues were resolved based on a license that Apple had granted Microsoft for Windows 1.0. See: Apple v. Microsoft . The First Circuit Court of Appeals rejected a copyright claim on the feel of a user interface in Lotus v. Borland . In 2012 and 2014, Apple Inc. has filed lawsuits against competing manufacturers of smartphones and tablet computers , claiming that those manufacturers copied
161-547: Is also the GUI toolkit for a number of Java ME profiles. For example, Connected Device Configuration profiles require Java runtimes on mobile telephones to support the Abstract Window Toolkit. When Sun Microsystems first released Java in 1995, AWT widgets provided a thin level of abstraction over the underlying native user-interface. For example, creating an AWT check box would cause AWT directly to call
184-547: Is inherently thread safe . Therefore, code that updates the GUI or processes events should execute on the Event dispatching thread . Failure to do so may result in a deadlock or race condition. To address this problem, a utility class called SwingWorker allows applications to perform time-consuming tasks following user-interaction events in the event dispatching thread. Where there is a Swing version of an AWT component it will begin with J- and should be used exclusively, replacing
207-461: Is used in reference to both software and websites . Look and feel applies to other products. In documentation, for example, it refers to the graphical layout (document size, color, font, etc.) and the writing style. In the context of equipment, it refers to consistency in controls and displays across a product line. Look and feel in operating system user interfaces serves two general purposes. First, it provides branding , helping to identify
230-502: The Swing widget toolkit that is part of the Java API , allow users to change the look and feel at runtime (see Pluggable look and feel ). Some examples of Widget toolkits that support setting a specialized look and feel are: Some companies try to assert copyright of trade dress over their look and feel. The Broderbund v. Unison (1986) case was an early software copyright case that attempted to apply U.S. copyright law to
253-488: The look and feel of a graphical user interface comprises aspects of its design, including elements such as colors, shapes, layout, and typefaces (the "look"), as well as the behavior of dynamic elements such as buttons, boxes, and menus (the "feel"). The term can also refer to aspects of a non-graphical user interface (such as a command-line interface ), as well as to aspects of an API – mostly to parts of an API that are not related to its functional properties. The term
SECTION 10
#1732800870974276-500: The "Java Foundation Classes". The "Java Foundation Classes" were later renamed "Swing", adding the capability for a pluggable look and feel of the widgets. This allowed Swing programs to maintain a platform-independent code base, but mimic the look of a native application. The release of JFC made IFC obsolete, and dropped interest for Microsoft's AFC. Using the Java programming language, Java Foundation Classes (JFC) are pre-written code in
299-500: The AWT version. For example, in Swing, only use JButton, never Button class. As mentioned above, the AWT core classes, such as Color and Font, are still used as-is in Swing. When drawing in Swing, use JPanel and override paintComponent(Graphics g) instead of using the AWT paint() methods. Before Java 6 Update 12 , mixing Swing components and basic AWT widgets often resulted in undesired side effects, with AWT widgets appearing on top of
322-469: The Swing widgets regardless of their defined z-order . This problem was because the rendering architecture of the two widget toolkits was very different, despite Swing borrowing heavyweight top containers from AWT. Starting in Java 6 Update 12 , it is possible to mix Swing and AWT widgets without having z-order problems. As the AWT is a bridge to the underlying native user-interface, its implementation on
345-447: The default look and feel of the toolkit, or by completely defining their own. This specialization can go from skinning (that only deals with the look, or visual appearance of the graphical control elements ) to completely specializing the way the user interacts with the software (that is, the feel). The definition of the look and feel to associate with the application is often done at initialization, but some Widget toolkits, such as
368-517: The form of class libraries (coded routines) that give the programmer a comprehensive set of graphical user interface (GUI) routines to use. The Java Foundation Classes are comparable to the Microsoft Foundation Class Library (MFC). JFC is an extension of the original Java Abstract Windowing Toolkit (AWT). Using JFC and Swing, an additional set of program components, a programmer can write programs that are independent of
391-447: The local graphics subsystem) instead of relying on the operating system's high-level user interface module. Swing provides the option of using either the native platform's "look and feel" or a cross-platform look and feel (the "Java Look and Feel") that looks the same on all windowing systems. The AWT provides two levels of APIs : AWT also makes some higher level functionality available to applications, such as: Neither AWT nor Swing
414-488: The look and feel of Apple's popular iPhone and iPad products. An API , which is an interface to software which provides some sort of functionality, can also have a certain look and feel. Different parts of an API (e.g. different classes or packages) are often linked by common syntactic and semantic conventions (e.g. by the same asynchronous execution model, or by the same way object attributes are accessed). These elements are rendered either explicitly (i.e. are part of
437-470: The look and feel presented by a software product. In 1987 Lotus sued Paperback Software and Mosaic for copyright infringement, false and misleading advertising, and unfair competition over their low-cost clones of 1-2-3, VP Planner and Twin, and sued Borland over its Quattro spreadsheet. In December 1989, Xerox sued Apple over the Macintosh copyright. Apple Computer was notable for its use of
460-500: The term look and feel in reference to their Mac OS operating system . The firm tried, with some success, to block other software developers from creating software that had a similar look and feel. Apple argued that they had a copyright claim on the look and feel of their software, and even went so far as to sue Microsoft , alleging that the Windows operating system was illegally copying their look and feel. Although provoking
483-418: The underlying native subroutine that created a check box. However, the check box on Windows is not the same as the check box on macOS or on the various types of Unix . Some application developers prefer this model because it provides a high degree of fidelity to the underlying native windowing toolkit and seamless integration with native applications. In other words, a GUI program written using AWT looks like
SECTION 20
#1732800870974506-482: The windowing system within a particular operating system. Abstract Window Toolkit The Abstract Window Toolkit ( AWT ) is Java 's original platform-dependent windowing , graphics , and user-interface widget toolkit , preceding Swing . The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program. AWT
529-544: Was developed in more platform-independent code by Netscape . At the same time, another graphics library, called Application Foundation Classes (AFC), was developed independently by Microsoft . It was made to be easier to extend the graphic components, but was primarily aimed for use with the Microsoft Java Virtual Machine . On April 2, 1997, Sun Microsystems and Netscape announced their intention to combine IFC with other technologies to form
#973026