Oracle Java Tutorials

The Java Tutorials are practical guides for programmers who want to use the Java programming language to create applications. They include hundreds of complete, working examples, and dozens of lessons. Groups of related lessons are organized into "trails".

Trails Covering the Basics


Getting Started 


This trail provides everything you'll need to know about getting started with the Java programming language.

The Java Technology Phenomenon Provides an overview of Java technology as a whole. It discusses both the Java programming language and platform, providing a broad overview of what this technology can do and how it will make your life easier.

The "Hello World!" Application This hands-on approach describes what to download, what to install, and what to type, for creating a simple "Hello World!" application. It provides separate instructions for the NetBean integrated development environment (NetBeans IDE), Microsoft Windows, Solaris™ Operating System (Solaris OS), Linux, and Mac users.

A Closer Look at "Hello World!" Discusses the "Hello World!" application, describing each section of code in detail. It covers source code comments, the HelloWorldApp class definition block, and the main method.

Common Problems (and Their Solutions) This is the place to go if you have trouble compiling or running the programs in this trail.

Learning the Java Language


This trail covers the fundamentals of programming in the Java programming language.

Object-Oriented Programming Concepts teaches you the core concepts behind object-oriented programming: objects, messages, classes, and inheritance. This lesson ends by showing you how these concepts translate into code. Feel free to skip this lesson if you are already familiar with object-oriented programming.

Language Basics describes the traditional features of the language, including variables, arrays, data types, operators, and control flow.

Classes and Objects describes how to write the classes from which objects are created, and how to create and use the objects.

Annotations are a form of metadata and provide information for the compiler. This lesson describes where and how to use annotations in a program effectively.

Interfaces and Inheritance describes interfaces—what they are, why you would want to write one, and how to write one. This section also describes the way in which you can derive one class from another. That is, how a subclass can inherit fields and methods from a superclass. You will learn that all classes are derived from the Object class, and how to modify the methods that a subclass inherits from superclasses.

Numbers and Strings This lesson describes how to use Number and String objects The lesson also shows you how to format data for output.

Generics are a powerful feature of the Java programming language. They improve the type safety of your code, making more of your bugs detectable at compile time.

Packages are a feature of the Java programming language that help you to organize and structure your classes and their relationships to one another.

Essential Classes


This trail discusses classes from the Java platform that are essential to most programmers.

Exceptions explains the exception mechanism and how it is used to handle errors and other exceptional conditions. This lesson describes what an exception is, how to throw and catch exceptions, what to do with an exception once it has been caught, and how to use the exception class hierarchy.

Basic I/O covers the Java platform classes used for basic input and output. It focuses primarily on I/O Streams, a powerful concept that greatly simplifies I/O operations. The lesson also looks at Serialization, which lets a program write whole objects out to streams and read them back again. Then the lesson looks at some file system operations, including random access files. Finally, it touchs briefly on the advanced features of the New I/O API.

Concurrency explains how to write applications that perform multiple tasks simultaneously. The Java platform is designed from the ground up to support concurrent programming, with basic concurrency support in the Java programming language and the Java class libraries. Since version 5.0, the Java platform has also included high-level concurrency APIs. This lesson introduces the platform's basic concurrency support and summarizes some of the high-level APIs in the java.util.concurrent packages.

The Platform Environment is defined by the underlying operating system, the Java virtual machine, the class libraries, and various configuration data supplied when the application is launched. This lesson describes some of the APIs an application uses to examine and configure its platform environment.

Regular Expressions are a way to describe a set of strings based on common characteristics shared by each string in the set. They can be used to search, edit, or manipulate text and data. Regular expressions vary in complexity, but once you understand the basics of how they're constructed, you'll be able to decipher (or create) any regular expression. This lesson teaches the regular expression syntax supported by the java.util.regex API, and presents several working examples to illustrate how the various objects interact.

Collections


This section describes the Java Collections Framework. Here, you will learn what collections are and how they can make your job easier and programs better. You'll learn about the core elements — interfaces, implementations, aggregate operations, and algorithms — that comprise the Java Collections Framework.

Introduction tells you what collections are, and how they'll make your job easier and your programs better. You'll learn about the core elements that comprise the Collections Framework: interfaces, implementations and algorithms.

Interfaces describes the core collection interfaces, which are the heart and soul of the Java Collections Framework. You'll learn general guidelines for effective use of these interfaces, including when to use which interface. You'll also learn idioms for each interface that will help you get the most out of the interfaces.

Aggregate Operations iterate over collections on your behalf, which enable you to write more concise and efficient code that process elements stored in collections.

Implementations describes the JDK's general-purpose collection implementations and tells you when to use which implementation. You'll also learn about the wrapper implementations, which add functionality to general-purpose implementations.

Algorithms describes the polymorphic algorithms provided by the JDK to operate on collections. With any luck you'll never have to write your own sort routine again!

Custom Implementations tells you why you might want to write your own collection implementation (instead of using one of the general-purpose implementations provided by the JDK), and how you'd go about it. It's easy with the JDK's abstract collection implementations!

Interoperability tells you how the Collections Framework interoperates with older APIs that predate the addition of Collections to Java. Also, it tells you how to design new APIs so that they'll interoperate seamlessly with other new APIs.

Deployment


Java rich internet applications (RIA) are applications that have traits similar to desktop applications, but are deployed via the Internet. Java RIAs may be developed and deployed as Java applets or Java Web Start applications.

◉ Applets - Java applets run in the context of a browser. The Java Plug-in software controls the execution and lifecycle of Java applets.

◉ Java Web Start applications - Java Web Start applications are launched via a browser the first time. They may subsequently be launched from a desktop shortcut. Once a Java Web Start application is downloaded and its security certificate has been accepted by the user, it behaves almost like a standalone application.

Component-Based Architecture for RIAs

In the past, the decision of whether to deploy a Java rich internet application inside the browser as an applet, or outside the browser as a Java Web Start application, could significantly impact the design of the application. With the latest Java Plug-in, this decision has been greatly simplified.

Traditionally, applications construct their user interfaces, including the top-level Frame, in the main method. This programming style prevents easy re-deployment of the application in the browser, because it assumes that the application creates its own Frame. When running in the browser as an applet, the applet is the top level container that should hold the user interface for the application. A top-level Frame is not needed.

Use component-based architecture when designing your Java rich internet application. Try to organize its functionality into one or more components that can be composed together. In this context, the term "component" refers to a GUI element that is a subclass of the AWT Component class, the Swing JComponent class, or another subclass. For example, you could have a top level JPanel which contains other UI components in it (like a combination of more nested JPanels and text fields, combo boxes etc.). With such a design, it becomes relatively easy to deploy the core functionality as an applet or a Java Web Start application.

To deploy as a Java applet, you just need to wrap the core functionality in an Applet or JApplet and add the browser specific functionality, if necessary. To deploy as a Java Web Start application, wrap the functionality in a JFrame.

Choosing Between Java Applets and Java Web Start Applications

The Rich Internet Applications Decision Guide contains detailed information to help you decide whether to deploy your code as a Java applet or Java Web Start application.

The Self-Contained Application Alternative

Self-contained applications provide a deployment option that does not require a browser. Users install your application locally and run it similar to native applications. Self-contained applications include the JRE needed to run the application, so users always have the correct JRE.

This trail discusses the development and deployment of RIAs and self-contained applications

Developing and Deploying Java Applets
Developing and Deploying Java Web Start Applications
Doing More With Java Rich Internet Applications
Deployment In-Depth
Deploying Self-Contained Applications

Supporting Tools

Packaging Programs in JAR Files


Creating Graphical User Interfaces


Creating a GUI with Swing — A comprehensive introduction to GUI creation on the Java platform.

This trail tells you how to create graphical user interfaces (GUIs) for applications and applets, using the Swing components.

Getting Started with Swing is a quick start lesson. First it gives you a bit of background about Swing. Then it tells you how to compile and run programs that use Swing components.

Learning Swing with the NetBeans IDE is the fastest and easiest way to begin working with Swing. This lesson explores the NetBeans IDE's GUI builder, a powerful feature that lets you visually construct your Graphical User Interfaces.

Using Swing Components tells you how to use each of the Swing components — buttons, tables, text components, and all the rest. It also tells you how to use borders and icons.

Concurrency in Swing discusses concurrency as it applies to Swing programming. Information on the event dispatch thread and the SwingWorker class are included.

Using Other Swing Features tells you how to use actions, timers, and the system tray; how to integrate with the desktop class, how to support assistive technologies, how to print tables and text, how to create a splash screen, and how to use modality in dialogs.

Laying Out Components Within a Container tells you how to choose a layout manager, how to use each of the layout manager classes the Java platform provides, how to use absolute positioning instead of a layout manager, and how to create your own layout manager.

Modifying the Look and Feel tells you how to specify the look and feel of Swing components.

Drag and Drop and Data Transfer tells you what you need to know to implement data transfer in your application.

Writing Event Listeners tells you how to handle events in your programs.

Performing Custom Painting gives you information on painting your own Swing components. It discusses painting issues specific to Swing components, provides an overview of painting concepts, and has examples of custom components that paint themselves.


Creating a JavaFX GUI — A collection of JavaFX tutorials.

0 comments:

Post a Comment