27-08-2014, 02:54 PM
This report is procedural help document designed to familiarize you with the CoreLog environment and facilitate your working with it. This project is based purely on“Java Swings” completed at APV India Pvt. Ltd. To complete the above project successfully, I acquire all the sufficient knowledge of java swings and practiced SDLC to effectively merge the requirements of this project into a code excellently. Java Swings is a vast field, allow us to design various applications of our concern . Further , for the editing and compilation of the code , a software named Eclipse works effectively and helps us finding any errors. Our Project “CoreLog” is an efficient well log analysis tool, it also includes a petro-physical module for basic calculations. It is a log analysis and petrophysical modeling application, , based on industry standard models, used for calculating petrophysical properties of a well(s). This report shall help all those who shall need an insight into company functioning and products development.This report helps the user by prov
1) INTRODUCTION TO PROGRAMMING LANGUAGE AND TOOLS USED i. What Are Swing?
Swing is a part of JFC, Java Foundation Classes. It is a collection of packages for creating full featured desktop applications. JFC consists of AWT, Swing, Accessibility, Java 2D, and Drag and Drop. Swing was released in 1997 with JDK 1.2.
There are basically two types of widget toolkits.
Lightweight Heavyweight
The Standard widget toolkit (SWT) library was initially developed by the IBM corporation. Now it is an open source project maintained by the Eclipse community. The SWT is an example of a heavyweight toolkit.
Java Swing ia a lightweight Java graphical user interface (GUI) widget toolkit that includes a rich set of widgets. Swing includes built-in controls such as trees, image buttons, tabbed panes, sliders, toolbars, color choosers, tables, and text areas to display HTTP or rich text format (RTF). Swing components are written entirely in Java and thus are platform-independent.
Swing offers customization of the look and feel of every component in a application without making significant changes to the application code. It also includes a pluggable look and feel feature, which allows it to emulate the appearance of native components while still having the advantage of platform independence. This particular feature makes writing appliucations in Swing easy and distinguish it from othe native programs.
ii. The main characteristics of the Swing toolkit: Platform independent Customizable Extensible Configurable Lightweight iii. Swing Architecture
Swing components are designed based on Model-View-Controller(MVC) architecture. The Swing architecture is not strictly based on MVC architecture but has its roots in MVC.
Model-View-Controller Architecture:
According to the MVC architecture, a component can be modeled as three separate parts.
· Model – The model stores data used to define the components.
· View – The view represents the visual display of the component. This display is governed by the data in the model.
· Controller – The controller deals with the behavious of the components when a user interacts with it. This behaviour can include any updates to the model or view.
Fig 2.1 Model-View-Controller Architecture
Theoretically, these three types of architecture turns out to be very difficult because of the dependencies between the view and the controller. The role of the controller is heavily dependent on the implementation of the view , because the user interacts with the view. In other words, it is difficult to write a generic controller, independent of the implementation of the view. This issue is addressed by the separable model architecture.
Separable Model Architecture:
The Swing architecture follow a separable model architecture. In this architecture the view and the controller are merged as a single composite object, because of their tight dependency on each other. The model object is treated as a separate object just like in MVC architecture.
Fig 2.2 Separable Model Architecture
The UI Object is referred to as UI delegate. With this architecture it is possible to delegate a few responsibilities of the component to an independent UI Object. This explains how the pluggable look-and-feel is facilitated by the Swing components. The components make the visual appearance of the components the responsibility of the independent UI Object. So the UI Object of the installed look-and-feel is responsible for the components look-and-feel.
iv. The Swing package in JDK 1.6 contains following subpackages: javax.swing - Provides a set of "lightweight" (written in Java with no native code) components that, to the maximum degree possible, work the same on all platforms. javax.swing.border - Provides classes and interfaces for drawing specialized borders around a Swing component. javax.swing.colorchooser - Contains classes and interfaces used by the JColorChooser component. javax.swing.event - Provides support for events fired by Swing components. javax.swing.filechooser - Contains classes and interfaces used by the JFileChooser component. javax.swing.plaf - Provides one interface and many abstract classes that Swing uses to provide its pluggable look and feel capabilities. javax.swing.plaf.basic - Provides user interface objects built according to the Basic look and feel. javax.swing.plaf.metal - Provides user interface objects built according to the Java look and feel (once codenamed Metal), which is the default look and feel. javax.swing.plaf.multi - Provides user interface objects that combine two or more look and feels. javax.swing.plaf.synth - Provides user interface objects for a skinnable look and feel in which all painting is delegated. javax.swing.table - Provides classes and interfaces for dealing with JTable. javax.swing.text - Provides classes and interfaces that deal with editable and non-editable text components. javax.swing.text.html - Provides the class HTMLEditorKit and supporting classes for creating HTML text editors. javax.swing.text.html.parser - Provides the default HTML parser, along with support classes. javax.swing.text.rtf - Provides a class (RTFEditorKit) for creating Rich Text Format text editors. javax.swing.tree - Provides classes and interfaces for dealing with JTree. javax.swing.undo - Allows developers to provide support for undo/redo in applications such as text editors. v. Layout Of Components:
What is Layout?
A layout is a set of rules that define how grapica components should be positioned in a container.
There are two ways to position a component in a container:
· Using a predefines layout and allowing the layout to decide where to position the component.This is a soft way of positioning a component. If the container changes its size, the component.s position will be adjusted. But you may not be able to get precisely where you want the component to be.
· Specifying the position of the component using the container.s coordinates.This is a hard way of positioning a component. You can get precisely where you want the component to be. But if the container changes its size the component.s position will not be adjusted.
AWT offers a number of predefined layouts for you to use:
· java.awt.BorderLayout – Divides the container into five regions: east, south, west, north and center and assigns one component for each region.
· java.awt.FlowLayout – Takes unlimited number of components and let them flow naturally horizontallu first, then vertically.
· java.awt.BoxLayout – Takes unlimited number of components and let them flow horizontally or vertically in one direction.
· java.awt.GridLayout – Divides the container into rows and columns and assign one component for each cell.
· java.awt.GridBagLayout – Divides the container into rows and columns and assigns one component for each cell with cell sizes not equal.
· java.awt.CardLayout – A CardLayoutobject is a layout manager for a container. It treats each component in the container as a card. Only one card is visible at a time, and the container acts as a stack of cards. The first component added to aCardLayoutobject is the visible component when the container is first displayed.
vi. The JAVA GUI API:
The GUI API has three categories of objects: component classes, container classes and helper classes.
1. Basic Swing GUI Components:
A component is an object having a graphical representation that can be displayed on the screen and that can interact with the user .
JComponent is the base class for all Swing components except top-level containers.
To use a component that inherits from JComponent, you must place the component in a containment hierarchy whose root is a top-level Swing container. Top-level Swing containers -- such as JFrame, JDialog, and JApplet -- are specialized components that provide a place for other Swing components to paint themselves.
To use swing components we first have to import a package:
Import javax.swing.*;
Some basic Jcomponents are:
o JFrame: In java terms a window is called a frame and it consists of:
· A top part with a title, a little icon and buttons to minimize, maximize and close the window.
·&nbs