ABSTRACT A Digital watermark is a digital signal or pattern inserted into a digital image.

Since this signal or pattern is present in each unaltered copy of the original image, the digital watermark may also serve as digital signature for the copies. Digital watermarking is also to be contrasted with public key encryption, which also transforms original files into another form. Unlike encryption, digital watermarking leaves the original digital data basically intact and recognizable. Digital watermarks are designed to be persistence in viewing, printing or subsequent retransmission or discrimination. Thus, watermarking does not prevent copying but it deters illegal copying by providing a means for establishing the original ownership of a redistributed copy. Watermarking data for copyright protection is an accepted technique adopted for digital information. This subject has been quite exhaustively researched and several techniques have been established for protecting copyright for still images, audio and video files. The main aim of this project is to propose a possible new technique for watermarking on images. Digital Watermarking is a robust and efficient digital image water marking algorithm using the Fast Hadamard Transform is proposed for the copyright protection of digital images. This algorithm can embed or hide an entire image or pattern as a watermark such as a company’s logo or trademark into the original image. The performance of the proposed algorithm is evaluated using the Stirmark, which consists of 90 different types of image attacks. Results show that the proposed algorithm is very robust and can survive most of the stirmark attacks.

Organizational Profile

INTRODUCTION
Overview of The Project

PRESENT SYSTEM: Digital Watermark is an invisible mark inserted into the digital multimedia data so that it can be detected in the later stage of evidence of rightful ownership. A great deal of research efforts has been focused on digital watermark in recent years. The techniques proposed so far can be divided into two main groups of according to the embedding domain of the container image. 1) Spatial Domain Approach: One group is SPATIAL domain approach .The earliest watermarking techniques are mainly this kind and the simplest example is to embed the watermark into least significant bits(LSB) of the image pixels. However, this technique has relatively low information hiding capacity and can be easily erased by lossy image compression. 2) Frequency Domain Approach: The other group is FREQUENCY domain approach. This can embed more information bits and is relatively robust to attacks. They embedded a Guassian distributed sequence into the perceptually most significant frequency components of the container image. Another technique embedded an image watermark into selectively modified middle frequency of discrete cosine transform coefficients. One more algorithm embedded watermark using Fourier transformations that is invariant to image manipulations or attacks due to rotation scaling and translation. Still several methods used to hide the data to the frequency domain such as HVS, JND. The major problem with many of these watermarking schemas is that they are not very robust against different types of image manipulations or attacks such as ones found in Stirmark. Moreover, some of these techniques are quite complicated to implement in real-time.

such as DCT. it found to be more robust against various attacks . This algorithm is often referred as robust one because of its following properties and attributes that meets the requirements. This factor is used to scale the watermark coefficients in a similar range to the coefficients from Hadamard coefficients of the sub blocks of the container image. In this paper we propose a fast Hadamard transform based watermarking approach that embeds a gray scale image as a watermark. The watermark gray scale image is decomposed into Hadamard coefficients for embedding. The FHT embedding algorithm was found to provide a robust and efficient approach to perform digital watermarking of digital image data for copyright protection and proof of rightful ownership. Singapore.It also offers a significant advantage in term of a shorter processing time and the ease of hardware implementation than many common transformation techniques.PROPOSED SYSTEM: Due to above mentioned failures a new technique has been proposed so that to cover and maintain the drawbacks prevailed in the previous system and hence a technique called Fast Hadamard Transformation proposed. such as edges and textures are incorporated to determine the watermarking strength factor. To increase the invisibility of he water mark a visual model based on the original image charecterstics.When compared with the DCT. . The simplicity of FHT offers a significant advantage in shorter processing time and ease of hardware implementation than most orthogonal transform techniques such as DCT and DWT. The Hadamard transform has more useful middle and high frequency bands than several high gain transforms. Fast Hadamard Transform (FHT) is a watermarking approach proposed in a conference paper developed by Datamark Technologies Pvt Ltd.

Windows 2000 or later -------Java • 0 0 0 0 0 0 0 0 0 0 . 600MHz -------. In the selection of hardware.128MB or above -------. • Operating System Software -------. of at least 128 MB RAM and Hard disk drive having 20 GB that can be driven by a processor of 600 MHz.PIII. the size and the capacity requirements are also important. once system requirement is known is determining whether a particular software package fits the requirements. This section first summarizes the application requirement question and then suggests more detailed comparisons.Requirement Specifications: HARDWARE REQUIREMENTS: The selection of hardware is very important in the existence and proper working of any software. The Digital Watermarking Algorithm (FHT) can efficiently run on System With minimum requirements.20GB or above SOFTWARE REQUIREMENTS One of the most difficult tasks is that. suits the information system operation • • • Processor RAM Capacity Hard Disk -------. the selection of the software.

However.[3] used the spread spectrum communication for digital multimedia watermarking. audio. Cox et al. Hsu and Wu embedded an image watermark into selectively modified middle frequency of discrete cosine transform (DCT) coefficients of container image[4]. They embedded a Gaussian distributed sequence into the perceptually most significant frequency components of container image. the online purchasing and distribution of digital images can now be performed relatively easily. there exists one major problem associated with the distribution of any digital images is the important issue of copyright protection and the proof of rightful ownership.image. The other is the frequency domain approach. Joseph et al developed a digital image watermarking using the Fourier . The techniques proposed so far can be divided into two main groups according to the embedding domain of the container image. One group is the spatial domain approach. This approach can be embed more information bits and is relatively robust to attacks.this technique has relatively low information hiding capacity and can be easily erased by lossy image compression. the technology of digital watermarking has gained prominence and emerged as a leading candidate that could solve the fundamental problems of legal ownership and content authentications for digital multimedia data(e.DESIGN PRINCIPLES & EXPLANATION: With the advent of the Internet. A great deal of research efforts has been focused on digital image watermarking in recent years.However.Over the past few years. containing the owner’s copyright information for the protected multimedia data so that it can be detected in the later stage for evidence of rightful ownership. A digital watermark is a sequence of information.and video). The earliest watermarking techniques are mainly this kind and the simplest example is to embed the watermark into least significant bits(LSBs) of the image pixels[2].g.

2 . To increase the invisibility of the watermark. a visual model based on the original image characteristics.Wie et al applied JND(just-noticeable distortion)feature of HVS(human visual system)in wavelet transform domain and hid 236 information bits into the ‘lenna’image[6]. In this section.Moreover.The simplicity of FHT offers a advantage in shorter processing time and ease of hardware implementation than most orthogonal transform techniques such as DCT and DWT.we give a brief overview of the Hadamard tranform representation of image data. 2D-Hadamard transform of signal The 2D-Hadamard transformation has been used extensively in image processing and image compression [9.The FHT embedding algorithm was found to provide a robust and efficient approach to perform digital watermarking of digital image data for copyright protection and proof of rightful ownership.Mellin transform that is invariant to image manipulations or attacks due to rotation .10].which is used in the watermarking embedding and extraction process.such as edges and textures are incorporated to determine the watermarking strength factor.The watermark grayscale image is decomposed into Hadamard coefficients for embedding. In this algorithm .scaling and translation[5].we propose a fast Hadamard transform(FHT) based watermarking approach that embeds a grayscale image as a water mark.Several other methods used discrete wavelet transform (DWT) to hide the data to the frequency domain[6-8].The reason of choosing FHT domain is given below. .The major problem with many of these watermarking schemes is that they are not very robust against different types of image manipulations or attacks such as the ones found in Stirmark.This factor is used to scale the watermark coefficients to similar range to the coefficients from the Hadamard coefficients of the sub-blocks of the container image.some of these techniques are quite complicated to implement in real-time.

in steganography the very existence of the message that is communicated is a secret and its presence is known only by parties involved in the communication.Let [U] represents the original image and[V] the transformed image . word spacing patterns in printed documents. coding messages in music compositions. It is descendent of a technique known as steganography which had been in existence for at least a few hundred years. In digital watermarking a low-energy signal is imperceptibly embedded in another signal. The most common examples of watermarking are the presence of specific patterns in currency notes which are visible only when the note is held to light and logos in the background of printed text documents. The main signal in which the . The low-energy signal is called watermark and it depicts some metadata. have been used by military intelligence since the times of ancient Greek civilization Watermarking can be considered as a special technique of steganography where one message is embedded in another and the two messages are related to each other in some way. like security or rights information about the main signal. The watermarking techniques prevent forgery and unauthorized replication of physical objects. In contrast to cryptography where the content of a communicated message is secret.1 Digital Watermarking Watermarking is not a new technique.the 2DHadamard transform is given by [V]= Hn [U] Hn N 1. Digital watermarking is similar to watermarking physical objects except that the watermarking technique is used for digital content instead of physical objects.. Some of the techniques of steganography like use of invisible ink. Steganography is a technique for concealed communication. etc. Steganography is technique where a secret message is hidden within another unrelated message and then communicated to the other party.

2 Features of Digital Watermarking As mentioned earlier.. The watermark key has a one-to-one correspondence with watermark signal (i. However. the digital watermarking technique is appealing. for inserting visible marks in images & video and for adding information about audio at the beginning or end of the audio clip etc. Further. audio clip.e. There are alternate mechanisms like using the header of a digital file to store meta-information.watermark is embedded is referred to as cover signal since it covers the watermark. The cover signal is generally a still image. The watermark key is private and known to only authorized parties and it ensures that only authorized parties can detect the watermark. Note that an entity called watermark key is used during the process of embedding and detecting watermarks. a unique watermark key exists for every watermark signal).prone to security attacks) and hence the digital watermarking techniques should be resilient to both noise and security attacks. 1. since it provides .e.. The digital watermarking system essentially consists of a watermark embedder and a watermark detector (see Figure 1). The watermark embedder inserts a watermark onto the cover signal and the watermark detector detects the presence of watermark signal. video sequence or a text document in digital format. note that the communication channel can be noisy and hostile (i. digital watermarking techniques are useful for embedding metadata in multimedia content.

following main features and does not require out-of-band data as in other mechanisms. digital-to-analog conversion. On the other hand. • Robustness: Depending on the application. rotation. dithering. • Imperceptibility: The embedded watermarks are imperceptible both perceptually as well as statistically and do not alter the aesthetics of the content that is watermarked. cropping. then the watermark has to be robust against any modifications.. scaling and compression of the content. if digital watermarking is used for content authentication. the watermarks should be fragile. The watermarks should not get degraded or destroyed as a result of unintentional or malicious signal and geometric distortions like analog-to digital conversion. alter the bit rate of video or introduce audible frequencies in audio signals.e. • Inseparability: After the digital content is embedded with watermark. resampling. If digital watermarking is used for ownership identification. • Security: The digital watermarking techniques prevent unauthorized users from detecting and modifying the watermark embedded in the cover signal. separating the content from the watermark to retrieve the original content is not possible. i. the digital watermarking technique can support different levels of robustness against changes made to the watermarked content. the watermarks should get destroyed whenever the content is modified so that any modification to content can be detected. Watermark keys ensure that only authorized users are able to detect/modify the watermark. . The watermarks do not create visible artifacts in still images. quantization.

cropping. watermarks should be readily detectable by the proper authorities. 3. • Copy Protection: Digital content can be watermarked to indicate that the content cannot be illegally replicated. scaling. even if imperceptible to the average observer. un-watermarked image would be necessary for efficient recovery of property and subsequent prosecution. an invisible watermark should be imperceptible so as not to affect the experience of viewing the image. the watermark must survive image modifications that are common to typical image-processing applications (e. and 4.g. 1. Digital content can be embedded with watermarks depicting metadata identifying the copyright owners. dithering. at least without visibly degrading the original image.Requirements of watermarks To be effective in the protection of the ownership of intellectual property. for some invisible watermarking applications.3 Applications of Digital Watermarking Digital watermarking techniques have wide ranging applications. . and image compression). 2. color requantization.. the watermark must be difficult or impossible to remove. the invisibly watermarked document should satisfy several criteria: 1. • Copyright Protection: Digital watermarks can be used to identify and protect copyright ownership. Some of the applications are enlisted below. Devices capable of replication can then detect such watermarks and prevent unauthorized replication of the content. Such decodability without requiring the original.

Digital content can be embedded with fragile watermarks that get destroyed whenever any sort of modification is made to the content. can be used for tamper proofing. Robust & Fragile Watermarking 2. 1. it can be used for concealed communication also. 1. Advertising companies can use systems that can detect the broadcast of advertisements for billing purposes by identifying the watermarks broadcast along with the content. • Concealed Communication: Since watermarking is a special technique of steganography. Tamper Proofing: Digital watermarks. which are fragile in nature. • Broadcast Monitoring: Digital watermarks can be used to monitor broadcasted content like television and broadcast radio signals. Such watermarks can be used to detect illegal replication of content by identifying the users who replicated the content illegally. Various types of watermarking techniques are enlisted below. The watermarking technique used for tracking is called as fingerprinting. Such watermarks can be used to authenticate the content. Each of the different types mentioned below have different applications. Visible & Transparent Watermarking .• Tracking: Digital watermarks can be used to track the usage of digital content. Each copy of digital content can be uniquely watermarked with metadata specifying the authorized users of the content.4 Classification of Digital Watermarking Techniques: Digital Watermarking techniques can be classified in a number of ways depending on different parameters.

the users are aware of the presence of a watermark. • Robust & Fragile Watermarking: Robust watermarking is a technique in which modification to the watermarked content will not affect the watermark. • Public & Private Watermarking: In public watermarking. • Visible & Transparent Watermarking: Visible watermarks are ones which are embedded in visual content in such a way that they are visible when the content is viewed. In symmetric watermarking (or symmetric key watermarking) the same keys are used for embedding and detecting watermarks. . In non-steganographic watermarking.3. fragile watermarking is a technique in which watermark gets destroyed when watermarked content is modified or tampered with. • Steganographic & Non-Steganographic watermarking: Steganographic watermarking is the technique where content users are unaware of the presence of a watermark. Transparent watermarks are imperceptible and they cannot be detected by just viewing the digital content. • Asymmetric & Symmetric Watermarking: Asymmetric watermarking (also called asymmetric key watermarking) is a technique where different keys are used for embedding and detecting the watermark. Asymmetric & Symmetric Watermarking 5. Public & Private Watermarking 4. Steganographic & Non-Steganographic Watermarking. As opposed to this. users of the content are authorized to detect the watermark while in private watermarking the users are not authorized to detect the watermark.

• • Spatial domain approach Frequency domain approach 2. However. it is fragile to any data processing. .2. These intentional errors are the marks that constitute the total watermarking. with direct replacement between cover image’s LSB and message (watermark) bits by adopting different logical or arithmetic combinations. Although water marking does not prevent data being stolen (illegal copying). containing the owner’s copy right information for protected digital content.2 Digital watermarking A Digital watermark is a sequence of information. for water marking digital data and several commercial software are also available . One method of data hiding exploits the least significant bit (LSB) plane. All these techniques are based on one basic principle that the watermarking software introduces small errors into the object being watermarked. Several techniques have been proposed and tested . Therefore an important aspect of these techniques is that the malicious user cannot destroy the watermarks without considerably degrading the quality of the data and thus rendering it almost useless.Steganographic watermarking is used in fingerprinting applications while non steganographic watermarking techniques can be used to deter piracy 2. It is an invisible mark inserted into the digital data so that it can be detected in the later stage for evidence of rightful ownership. The techniques proposed so far can be divided into two main groups according to the embedding domain of container image.1 Spatial domain approach There is a vast majority of image watermarking approaches. However these marks (errors) are chosen so as to have an insignificant impact on the usefulness of the data and further a malicious user cannot precisely locate these marks. A great deal of research efforts has been focused on digital image watermarking in recent years. which results in loss of information from these LSB bits. but allows establishing the original ownership. because information is hidden in LSB.

They locally adapt the strength of the watermark to the image content through perceptual models for human vision. this technique has relatively low information hiding capacity and can be easily erased by lossy image compression. And they are embedded directly into an image's pixel data. Image-adaptive watermarks are usually transform-based. Spectral (or transform-based) watermarks are incorporated into an image's transform coefficients (DCT. Wavelet). Below Figure shows the procedure for image-adaptive watermarking . image-adaptive). These visual models provide thresholds for how much a given transform coefficient can change. Specifically. and very robust. These models originally developed for image compression. before such changes are noticeable under standard viewing conditions. The image-adaptive watermarks are based on the robustness of the basic spreadspectrum technique The work in image-adaptive watermarking shows that using visual models in the embedding scheme can produce an even more robust watermark than the standard spread-spectrum technique. The watermarks that are constructed using spatial domain approach are called spatial watermarks. visual models allow the user to raise or lower the amplitude of the watermark according to the image content (hence the name.The earliest watermarking techniques are mainly this kind and simplest example is to embed the watermark into least significant bits (LSBs) of the image pixels. However.

2.2.Figure 2. The Discrete Cosine Transform (DCT) helps separate the image into parts (or spectral sub-bands) of differing importance (with respect to the image's visual quality). 2. The main issue is the requirement of the original image at the detection/decoding stage. In this scheme the original cover signal is required during the detection process. The DCT is similar to the discrete Fourier transform: it transforms a signal or image from the spatial domain to the frequency domain. For example the integer value 10 could be added to the integer value of the blue channel on every pixel to represent a ‘1’ and perhaps 5 added for a ‘0’ value.3 Non-Blind Digital watermarking It is also called as Private Watermarking.1 Image adaptive watermarking 2. and then it produces the watermark.2 Frequency domain approach This approach can embed more information bits and is relatively robust to attacks. DCT and wavelet transforms are examples of Frequency Domain Approach. . Watermark extraction would be a simple matter of subtracting the original image’s blue channel from the watermarked image’s blue channel.

4 Blind Digital watermarking It is also called as Public Watermarking. Solely the key. The watermark information is embedded into the host signal dependent on a private key.2. In this scheme. This scheme can be used easily in mass-market electronic equipment or software.2. Embed Attack Detection Private Key Private Key Figure 2. 2. With the same private key the watermark is detected from watermarked data. The detector must know the required private key for extracting the watermark from the digital data. depicts a general blind symmetric watermarking scheme. .5 Symmetric Digital watermarking The key for embedding and detection of the watermark are identical.2.2 General Symmetric Watermarking Schemes The above Fig. The term blind” indicates that the host signal (Original data) is not known at the watermark detector. which is typically used to generate some random sequence used during the embedding process. the cover signal (the original signal) is not needed during the detection process to detect the mark. is required.

Public key is used to detect and attack the watermark.6 Asymmetric Digital watermarking One particular problem. is that they are Symmetric. have access to the public key necessary for watermark detection. depicts a general asymmetric watermarking scheme. even with state-of-the-art watermarking schemes. an attacker can try to use the knowledge of the public key to destroy the embedded watermark information. the watermark is embedded into the host signal(Original data) . Thus. So. Here. This means that the keys necessary for watermark embedding and detection are identical.3 General Asymmetric Watermarking Schemes Seq The above Fig.2. With aid of a private and a public key.7 Fragile watermarking A fragile mark is designed to detect slight changes to the watermarked image with high probability. A fragile watermark is a mark that is readily altered or destroyed when the host image is modified through a linear or nonlinear transformation. Data Embed Attack Detection Figure Watermark 2. attack and detection. Obviously. Fragile marks are not suited . embedding.2. without knowledge of private key it is not possible to completely eliminate the embedded watermark. 2. the watermark detector knows all critical parameter of the watermarking scheme that also allows efficient removal of the embedded watermark.2. public key and private key is used to embed the watermark. The significant difference to the symmetric scheme is that all entities.

Detector should be able to locate and characterize alterations made to a marked image. That is. by definition. he has also made his data completely useless. if Mallory can change all the bits. Perceptual Transparency. easily destroyed. or altered since it was marked. 2. Clearly.for enforcing copyright ownership of digital images.4. Detection should not require the original image. since each change can be considered an error. he can easily destroy the watermark. . A zero out attack sets values of some number of bit positions to zero. A randomization attack assigns random values to some number of bit positions. The watermarking system should protect Alice from various forms of Mallory’s malicious attacks: Bit Attacks : The simplest malicious attack attempts to destroy the watermark by updating some bits. The effectiveness of an attack should therefore consider the relationship between the numbers of bits that Mallory and Alice change.2 Malicious Attacks Mallory may know that the data he has stolen contains a watermark. The sensitivity of fragile marks to modification leads to their use in image authentication. an attacker would attempt to destroy the embedded mark and fragile marks are. it may be of interest for parties to verify that an image has not been edited. but he may try to erase the watermark or try other means for claiming false ownership. Features of Fragile Marking Systems • • • • Detect tampering. However. Having more errors clearly makes the data less useful. damaged.

A related attack will be one in which the numeric values are uniformly translated. Invertibility Attack Mallory may launch an invertibility attack [7] to claim ownership if he can successfully discover a fictitious watermark. Note that benign updates can also be modeled as a randomization attack.. Mallory would also need to inform potential users of the conversion used which could also be applied by Alice before detecting her watermark. Even if his guess is correct. his data will not be competitive against Alice’s data because his data values are less precise. In general. This attack is not any better than the bit attacks discussed above. If he underestimates it. Mix and Match Attack Mallory may create his relation by taking disjoint tuples from multiple relations containing similar information. In this case. Mallory may translate using units of measurement (e.g. imperial units to metric units). Subset Attack Mallory may take a subset of the tuples or attributes of a watermarked relation and hope that the watermark is lost. he has degraded the quality of his data more than necessary. Rounding Attack Mallory may try to lose the marks contained in a numeric attribute by rounding all the values of the attribute. The unnecessary conversion would also raise suspicion among users. Alice simply needs to convert the values back to the original system in order to recover the marks. Additive Attack Mallory may simply add his watermark to Alice’s watermarked relation and claim ownership. For example.A bit flipping attack inverts the values of some number of bit positions. Mallory can apply arbitrary translations to numeric values. Mallory’s claimed watermark is in fact a random occurrence. his attack may not succeed. If he overestimates it. Horizontal Data Partitioning . Mallory has to correctly guess how many bit positions are involved in the watermarking.

One has also to take into account semantic consistency issues that become immediately visible because of the discrete nature of the data.Mallory can randomly select and use a subset of the original data set that might still provide value for its intended purpose. This addition is not to significantly alter the useful (from Mallory’s perspective) properties of the initial set versus the resulting set. Subset Alteration Altering a subset of the items in the original data set such that there is still value associated with the resulting set. In the categorical data framework. subset alteration is intuitively quite expensive from a data-value preservation perspective. Watermarking a Sample Image Watermarking an image involves two steps to provide the original authentication and the steps are a) Embedding a watermark b) Extracting a watermark a) Embedding a watermark: Digital watermarking Using Fast Hadamard Transform . Subset Addition Mallory adds a set of tuples to the original data.

The simplicity of FHT offers a significant advantage in shorter processing time and ease of hardware implementation than most orthogonal transform techniques such as DCT and DWT. a visual model based on the original image characteristics. The watermark grayscale image as a watermark. The FHT embedding algorithm was found to provide a robust and efficient approach to perform digital watermarking of digital image data for copyright protection and proof of rightful ownership. FHT (Fast Hadamard Transform) [15] is one of the blind and symmetric digital watermarking technique. such as edges and textures are incorporated to determine the watermarking strength factor.A great deal of research efforts has been focused on digital image watermarking in the recent years. the 2DHadamard transform is given by [V]= Hn [U] Hn .1 2D-Hadamard transform of signal The 2D-Hadamard transform has been used extensively in image processing and image compression. 3. Fast Hadamard transform (FHT) based watermarking approach that embeds grayscale image as a watermark. The watermark grayscale image is decomposed into Hadamard coefficients for embedding. This algorithm can embed or hide entire image or pattern as a watermark such as company’s logo or trademark directly into the original image. FHT is a robust and efficient digital image watermarking algorithm for copy right protection of digital images. Let [U] represents the original image and [V] the transformed image. To increase the invisibility of the watermark. This factor is used to scale the watermark coefficients to a similar range to the coefficients from the Hadamard coefficients of the sub-blocks of the container image.

2. The advantages of Hadamard transform are that the elements of the transform matrix Hn are simple: they are binary. as Hn = Hn-1 Or H n −1  H H n =  n −1   H n −1 − H n −1  In our algorithm. Hence the Hadamard transform matrix has the following property: Hn=Hn*=HT=H-1 Since Hn has N orthogonal rows HnHn=NI (I is identity matrix) and HnHn=NHnHn-1. the processing is performed based on 8x8 sub-blocks of the whole image. real numbers and the rows or columns of H n are orthogonal. thus H-1=Hn/N The inverse 2D-fast Hadamard transform (IHFT) is given as [U]=Hn-1[V]Hn*=Hn[V]Hn/N The Hadamard matrix of the order n is generated in terms of Hadamard matrix of order n-1 using Kronecker product . N=2n.with element values either +1 or -1.N Where H n represents and NxN Hadamard matrix. H1 . n=1. 3…. the third order Hadamard transform matrix H3 is used.

.We use a grey scale image of size 64x64 as a watermark for our testing.y’). the watermark image.2 and 5.y) is also decomposed into a set of non-overlapped blocks of hxh.K-1.3. After transformation. 64x64 Hadamrd transform coefficients are obtained.the no of transitions for row1 to row 8 is 0.1. a Hadamard transformation matrix H6 is used. Zero sign transitions correspond to a DC component.……. The DC component is stored in the key file and AC components are then selected for embedding. a test image of size 256x256and sub-block size of 8x8 is used. such that the transitions are 0.2..denoted by fk(x’.4. f(x.1.4. In our experiment.The concept of sequency is analogous to frequency for the Fourier Transform.6 and 7. In the watermarking embedding process. The original image. the elements are not arranged in an increasing sequency.5. While a large number of sign transitions correspond to high frequency components.7.where the subscript k denotes the index of blocks and K denotes total number of blocks.The number of sign changes is referred to as sequency .The algorithm pseudo-randomly selects the sub-blocks for watermark insertion using an m-sequence random number generator. For a Hadamard matrix H3.k=0.1 1  1  1 Hn =  1  1 1  1  1 −1 1 −1 1 −1 1 −1 1 1 −1 −1 1 1 −1 −1 1 −1 −1 1 1 −1 −1 1 1 1 1 1 −1 −1 −1 −1 1 −1 1 −1 −1 1 −1 1 1 1 −1 −1 −1 −1 1 1 1  −1   −1   1  −1  1 1  −1  For a H3 matix.6. 3.2 Watermark Insertion process Copyright information in the form of a trademark or logo can be used as an image watermark. w (x. y) is first transformed into FHT coefficients . As such.3.1.

the watermarked image. The IFHT is then applied to the 8x8 matrix using equation(3) to obtain the luminance value matrix of the watermarked image sub-block. Where i Є (0.After performing the watermark insertion for all the relevant sub-blocks of the original image.y’) is obtained. The image-in-image watermark embedding process is shown in below figure. n]. After that.The seed of this m-sequence and initial state are also stored in the key file.After the watermark insertion.The AC components of FHT coefficients of the original image sub-blocks.1 Watermark embedding process b) Extracting Watermark: - . For each 8x8 subblock.fk’(x’.f’(x’. Let the watermark FHT coefficients denote by m i.3 Watermark Detection The original coefficient Xi is replaced by Xi*. Since the subblock size is 8x8 a Hadamard transform of matrix size H3 is used. Image +LOGO Image Original Image watermark watermarked image Figure 3. with n the number of watermarked co-efficients. a FHT is performed on each selected sub-blocks of original image. a new 8x8 matrix of FHT coefficients is obtained.y’). which is needed for the decoding process. before and after inserting watermark are denoted by xi and xi* respectively. At the same time.The embedding formula is Xi*=Bmi 3. a key file is also generated. 64 Hadamard transform coefficients are obtained.

is obtained by IFHT of the 64x64 Hadamard coefficients matrix using equation (3).The Watermark is extracted by using the embedding position and the watermark strength factor B. Let these components denote by xi*’.4 Watermark Strength Factor The determination of the watermark strength factor is based on the original image textures and edges characteristic. Let the received watermarked image denoted by f’’(x. 3. the watermark bits are inserted into the bottom right sixteen middle and high frequency components. w’(x.fk’’(x’. Along with the DC component stored in the key file. y).y).the retrieved watermark FHT coefficients denote by mi’.y’).into the FHT domain. we obtain all the Hadamard transform coefficients embedded with the watermark. .where i Є (0. the energy is mainly concentrated in the low AC and DC components. The classification of different areas is based on the Hadamard transformed space energy analysis and canny edge detection algorithm. in each of the sub-block FHT coefficients.The information of watermark embedded sub-blocks’ position is extracted from the seed of m-sequence and initial state number stored in the key file.and the number of the watermarked co-efficient n=16. For coarse texture and outstanding edge areas. The analysis is performed on the FHT coefficients of sub-blocks for watermarking. For example.The watermark extraction formula is given as: mi’= xi* / B The watermark FHT coefficients are extracted from all the sub-blocks of original image.n]. the AC coefficients are rearranged into a 64x64 FHT coefficients matrix. The first visual mask model is determined by the Hadamard transformed space image energy distribution. most of the signal energy is concentrated in the AC components of the Hadamard transform for smooth areas. The extracted watermark image. By transforming all the relevant sub-blocks .

5 Advantages • • FHT watermarking algorithm does not require the original information at the watermark identification stage. j and k indicate the positions of the sub-blocks. mask1 (j.The two mask values are multiplied and scaled to a specific range. mask2 (j. k) to distinguish the smooth and coarse texture areas.We use a squared sum of AC components to generate this visual mask. Smaller values indicate that the block contains outstanding edges . 3. k).This mask is used to determine the coarse texture or outstanding edge in the image block. k) Where b is scaling factor. This is blind or public digital watermarking. . The canny edge algorithm was selected because of its ability in detecting weak edges by using two different thresholds. Large values in this mask indicate that the corresponding block is highly textured. Counting the number of edge points in each sub-block. Shorter processing time and the easy of hardware implementation than many common transform techniques. The water mark strength factor B is obtained as follows: B=b*mask1 (j. we obtain another visual mask. k)*mask2 (j. it is applied to each selected sub-blocks of the original image used for watermarking.

. Some products may work very well at design and implementation but may fail in the real time environment. It enables the developer to have an assessment of the product being developed. Feasibility study should be performed on the basis of various criteria and parameters. It studies the pros and cons of using particular software for the development and its feasibility. It also studies the additional training needed to be given to the people to make the application work. operational use and technical support required for implementing it. If the benefits are more or less the same as the older system. The various feasibility studies are:  Economic Feasibility  Operational Feasibility  Technical Feasibility Economic Feasibility It refers to the benefits or outcomes we are deriving from the product as compared to the total cost we are spending for developing the product. then it is not feasible to develop the product. It includes the study of additional human resource required and their technical expertise. Technical Feasibility It refers to whether the software that is available in the market fully supports the present application. It refers to the feasibility study of the product in terms of out comes of the product. Operational Feasibility It refers to the feasibility of the product to be operational.FEASIBILITY ANALYSIS Feasibility study is an important phase in the software development process.

The software project is initiated by the client needs.7. deals with understand the problem. The Requirement phase terminates with the production of the validate SRS document. the goal and constraints. It forms the basis of software development. specification languages and tools. . SOFTWARE REQUIREMENT SPECIFICATION What is SRS? Software Requirement Specification (SRS) is the starting point of the software developing activity. 2) Requirement Specification: Here. A good SRS should satisfy all the parties involved in the system. Producing the SRS document is the basic goal of this phase.) The SRS phase consists of two basic activities: 1) Problem/Requirement Analysis: The process is order and more nebulous of the two. the focus is on specifying what has been found giving analysis such as representation. As system grew more complex it became evident that the goal of the entire system cannot be easily comprehended. and checking the specifications are addressed during this activity. Hence the need for the requirement phase arose. Role of Srs: The purpose of the Software Requirement Specification is to reduce the communication gap between the clients and the developers. The SRS is the means of translating the ideas of the minds of clients (the input) into a formal document (the output of the requirement phase. Software Requirement Specification is the medium though which the client and user needs are accurately specified.

It also describes the interfaces for the system. Any changes made to the requirements in the future will have to go through a formal change approval process. and will also by the basis for validating the final delivered system. The developer is responsible for asking for clarifications. and will not make any alterations without the permission of the client. SCOPE: This document is the only one that describes the requirements of the system.PURPOSE: The purpose of this document is to describe all external requirements for the JDBC Editor. where necessary. It is meant for the use by the developers. .

java .DIAGRAMS CLASS DIAGRAMS :1) FHTDigitalWatermarking.java 2) ImageBuilt.

.

OBJECT DIAGRAMS::FHTDigitalWatermarking fname : String ib:ImageBuild img : Image img2 : Image .

USECASE DIAGRAMS:- performFHT OnWatermar performFHTO k nOriginal randomNumb erGeneration Watermark Insertion Insert Watermark O r i g i n a l PerformIFht OnOriginal check loading paint performFHT OnOriginal Watermark Extraction PerformIFHT OnWatermar k Close .

ib:ImageBu wm:int[256] k:int[100] ilt show() actionPerformed() performFHTOnWatermark() opixels: flag:boolea int[65536] n count rseq:int[10 0] iwm:int[10] out:File OutputS..dat performFHTOnOriginal() randomGeneration() check() false k++ true k<100 insertWaterMark() 0 < wm[i] < -99999 count<10 iwm[count] writeInt(0) 0>wm[i]>-99999 & count>10 writeInt(wm[i]) i<256 opixel[]+iwm[j]%100 -opixel[]-iwm[j]%100 iwm[j]!=0 j>10 j<10 performIFHTOnOriginal() loading() .. display keyfile...SEQUENCE DIAGRAMS:Insertion Sequence Diagram::FHTDigital Waterma.

dat display performFHTOnOriginal() wm2[i] wm2 [i ]=0 readInt() i6=0 opixels[i2] i6=(i6+opixels[i2])*100 i > 256 count1++ count2++ rseq[count2] count1< 3 i6=i6%100 rev=0 rev=rev*100+i6 count1>2 i6!=0 i6=i6/100 i6=0 rev =rev *-1 wm2[i]=rev i++ i > 256 performIFHTOnWatermark( ) paint( ) ... keyfil e.2)Extraction Sequence Diagram:- ib:ImageBu ilt rev:int i6:int int:i2 opixels: int[65536] count1 :i nt count2:int rseq:int[10 wm2:int[25 0] 6] i:int in:File InputSt.

the selection of the software. The Java Programming Language The Java programming language is a high-level language that can be characterized by all of the following buzzwords:  neutral Object  Portable  High performance  Multithreaded  Dynamic Architecture  Simple  oriented  Distributed  Interpreted  Robust  Secure With most programming languages. After initial selection further security is needed to determine the desirability of particular software compared with other candidates. Java.TECHNOLOGIES One of the most difficult tasks is that. This section first summarizes the application requirement question and then suggests more detailed comparisons. once system requirement is known is determining whether a particular software package fits the requirements. JAVA Java technology is both a programming language and a platform. The Java . SWINGS. AWT. you either compile or interpret a program so that you can run it on your computer.

programming language is unusual in that a program is both compiled and interpreted. With the compiler, first you translate a program into an intermediate language called Java bytecodes —the platformindependent codes interpreted by the interpreter on the Java platform. The interpreter parses and runs each Java bytecode instruction on the computer. Compilation happens just once; interpretation occurs each time the program is executed. You can think of Java bytecodes as the machine code instructions for the Java Virtual Machine (Java VM). Every Java interpreter, whether it's a development tool or a Web browser that can run applets, is an implementation of the Java VM. Java bytecodes help make "write once, run anywhere" possible. You can compile your program into bytecodes on any platform that has a Java compiler. The bytecodes can then be run on any implementation of the Java VM. That means that as long as a computer has a Java VM, the same program written in the Java programming language can run on Windows 2000, a Solaris workstation, or on an iMac. The Java Platform A platform is the hardware or software environment in which a program runs. We've already mentioned some of the most popular platforms like Windows 2000, Linux, Solaris, and MacOS. Most platforms can be described as a combination of the operating system and hardware. The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardwarebased platforms. The Java platform has two components:

The Java Virtual Machine (Java VM)

The Java Application Programming Interface (Java

API) You've already been introduced to the Java VM. It's the base for the Java platform and is ported onto various hardware-based platforms. The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages. Native code is code that after you compile it, the compiled code runs on a specific hardware platform. As a platform-independent environment, the Java platform can be a bit slower than native code. However, smart compilers, well-tuned interpreters, and just-in-time bytecode compilers can bring performance close to that of native code without threatening portability. Creation of Java: Java was conceived by James Gosling, Patrick Naughton, Chris Warth, EdFrank and Mike Sheridan at SUN Micro systems Incorporation in 1991. It took 18 months to develop the first working version. This language was initially called "OAK", but was renamed "JAVA" in 1995. Before the initial implementation of Oak in 1992 and the public announcement of Java in 1995, many more contributed to the design and evolution of the language. Java is developed in year 1990 by “Sun micro system” to develop special soft wear that is used to manipulate censurer electronic drivers. In year 1992 “Green project team” win micro system, demonstrated the application of their new language to control list of home application (or) appliances to handle device with any they touch screen. In year 1993 www(world wide web) appeared on the internet and transformed the text – based internet in to graphical –rich environment. The green

project team come up with the idea of developing web applets, using the new language. In year 1994 the “green project team” developed a web browser called “Hot Java” demonstrated the power of the new language. In year 1996, java established it self-not only as a leader for Internet programming, but also as general purpose, object – oriented programming language.

JAVA FEATURES
The invents of java wanted to design language which could offeg solution to the problems encovntcged in modern programming “win micro systems” officially describes java with the following categories Completed & integrated Platform– independent and portable. Object – oriented Robust and secure. Distributed. Timelier, simple and smell. Multithreaded and interactive. High performance. Dynamic &Extensible.

Completed and Integrated:
Usually a computer language is either completed (&) interrogated. Java combines both these approaches, this making java two-stage system. Java compiler translates source code in to know by to code instruction. Java interpreter generates machine code that can be directly executed by the machine that is running the java program.

Platform – independent & portable :-

Object-Oriented: Java is a true object – language. The object model in java is simple and easy to extend. The absence of pointers in java ensures that programs cannot gain access to memory locations with out proper authorization. It provides many safeguards to ensure reliable code. It has the ability to shear both data and programs. Security becomes an important issue for language that is use for programming on internet. It is designed as a garbage collected language relieving the programmers virtually all memory management problems. Robust and secure: Java is a robust language.Java programs can be easily moved from one computer system to another. It has strict compiled time and run time checking for data types. Java ensures portalrility in two ways. 411 program code and data resides within object and classes. Threat of viruses and abuse of resources every where. every thing in java is an Object. Java application can open and access remote object on internet as easily as they can do in a local system. anywhere and any time. We can download a java Internet &execute it locally. Changes and upgrades in operating systems. Distributed: Java is designed as a distributed language for creating applications on networks. This . processor and system resources will not trice any changes in java programs. java also in cooperates in concept of expectation handling which captures series errors and eliminates any risk of crashing the system. Java systems not only verify all memory access but also ensure that viruses are communicated with an applet. First. java compiler generates byte code instruction that can be implemented on any machine – independent.

To make the language look familiar to the existing programmers. we can listen to an audio clip while scrolling a page and at the same time download an applet from a distant computer. Many features of C & C++ that are either redundant or sources of unreliable code or not part of java. This feature greatly improves the interactive performance of graphical applications. For more detailed comparison of java with C & C++. . For example. preprocessor header files.3. java dose not use pointers. Java Overview: Java is a powerful but lean object oriented programming language. programs that can be embedded in web page. The means that we need not wait for the application to finish one task before beginning another. It also eliminates operator overloading and multiple inheritance. it was modeled on C & C++ languages. Simple. java code “looks like a C++” code.enables multiple programmers at multiple remote locations to collaborate and work together on a single project. The java runtime comes with tools that support multiprocess synchronization and construct smoothly running interactive systems. Java uses many construets of C &C++ and therefore. It has generated a lot of excitement because it makes it possible to program for internet by creating applets. Multithreaded and Interactive : Multithreaded means handling multiple tasks simultaneously. Java is a simplified version of C++. In fact. Familiarity is another striking feature of java. refer to section 2. goto statement and many others. For example. Java supports multithreaded programs. small and familiar : Java is a small and simple language.

a new buzzword has appeared ubiquitous. all indications are that it will soon be every where. Indeed. an applet can be animation with sound. powerful and easy to use. an interactive game or a ticker tape with constantly updated stock prices. elegant. still another to run on a UNIX . The result is simple. Java Virtual Machine. It is becoming so popular that many people believe it will become standard language for There are many buzzwords associated with Java. multithreading (the capacity for on program to do more than one thing at a time). Java builds on the strength of C++. Java is actually a platform consisting of three components: 1. For example. The following sections will say more about their components: Java is Portable: One of the biggest advantages Java offers is that it is portable. Java Library of Classes and Interfaces. An application written in Java will run on all the major platforms. both general purpose and Internet programming. Any computer with a Java based browser can earn the applications or applets written in the Java Programming Language. It has taken the best features of C+ + and discarded the more problematic and error prone parts. another program to run on a windows machine. it has added garbage collection (automatic memory management).The context of an applet is limited only by one's imagination. 2. But Java is more than a programming language for writing applets. but because of its spectacular growth in popularity. To this lean core. It is being used more and more for writing standalone applications as well. A programmer no longer has to write one program to run on a Macintosh. Java programming Language. security capabilities. Applets can be serious application like work processor or spreadsheet. 3.

Java Is Object Oriented: The Java programming language is object orients. Java code is compiled into byte codes. Object oriented languages use the paradigm of classes. Rather than being compiled into machine language. which will have all the data members and functionality of its calls. a class includes both the data and the functions to operate on the data. which executes them directly or translate them into the language that is understood by the machine running it. a programmer writing Java code can access all the major relational databases on any plat form that supports the Java virtual machine. which is different for each operating systems and computer architecture. also called an object. Encapsulation . The problem is that other computers with different machine instruction set cannot understand that language. A big benefit is that these components can then be reused. the program can understand. on the other hand it is compiled into byte codes rather than a machine language. with each object being a specific instance of a particular type of class. you can think of a class as being like template. Because of this. developer writes their programs only once. In other words. these means that with the JDBC API extending Java. with Java. With other languages.machine. In summary. You can create an instance of a class. which makes program design focus on what you are dealing with rather than on how you are going to do something. The virtual machine is what gives Java is cross platform capabilities. A big benefit is that these components. Java code. These byte codes go to the Java virtual machine. In simplest term. and so on. The class paradigm allows one to encapsulate data so that specific data values are function implementation cannot be seen by those using the data. This makes it more useful for programming in sophisticated projects because one can break the things down into understandable components.

In fact. as it is. change them. If for example the implementation of a function is changed. then it is automatically removed from memory. the subclass can reuse the inherited methods.makes it possible to make the changes in code without breaking other programs that use that code. or the ability to derive new classes from existing classes. and it does not affect his/her program. inherits all the data and the functions of the existing class referred to as the parent class. a huge potential source of errors. but static binding with strict type checking is used when possible. and/or Java Makes It Easy To Write Correct Code: In addition to being portable and object oriented. Simplicity: . Java facilitates writing correct code. Dynamic binding is possible and often very useful. Java includes inheritance. As far as methods are concerned. the change is invisible to the another programmer who invokes that function. The following is a list of some of Java's features that make it easier to write correct code. add its own new methods. A subclass can add new data members to those inherited from the parent class. except hopefully to improve it. or "Garbage Collected" programmers don't have to keep track of memory. developers have reported slashing development time by as much as two thirds. If an object is no longer being used (has no references to it). Programmers spend less time writing Java code and a lot less time debugging it. also called a subclass. Garbage Collection: Automatically takes care of allocating and reallocating memory. The derived class.

Java lets you add functionality to a class throws the use of interfaces. and then implements all the methods in that interface as part of the class. A package is a collection of related Java classes and interfaces. In a class. method signature (the return type. gives example of some Java packages and what they cover. or implement interfaces to augment the capabilities of classes. though not complete. which eliminate the errors and ambiguity that arise when you create a subclass that inherits from two or more classes. the function name. multiple inheritance provides. Java also stays lean by not including multiple inheritance. but there are major differences. Java Includes a Library of Classes and Interfaces: The Java platform includes an extensive class library so that programmers can use already existing class as it is. The following list. . To replace capabilities. and The prototypes give the methods are just prototypes with no implementations. as in some languages. To use an interface. Interfaces let one add functionality to a class and give a great deal of flexibility in doing it. In other words interfaces provide most of the advantages of multiple inheritance without its disadvantages. Java keep it simple by having just one way to do something instead of having just one way to do something instead of having several alternatives. In an interface. create subclasses to modify exiting classes. and In an interface. but the programmer must supply implementations. fields may be either variable or constant. fields must be constants. methods are fully implemented. and the number of parameters with the type for each parameter). and methods are fully implemented. fields must be constants. These methods are implemented in a way that is appropriate for the class in which the methods are being used.Makes Java easier to learn and use correctly. Both classes and interfaces contain data members (fields and functions (methods).

with JDBC being one of them. notification and enumeration of data structures. strings. objects. dialog boxes.awt.Miscellaneous utility classes. The first three packages listed. includes several interfaces that connect an applet to its documents and to its document and to recourses for playing audio.io---. Security and Java Beans the new API for creating resizable components. Java.net---.Classes for managing image data. including generic data structures. time. Java. It includes classes dealing with numeric. menus. security. the "AWT" stands for Abstract Window Toolkit.Classes that manage user interface components such as windows. and threads.Java. dropping color flittering.util form the Foundation. This package is so basic that it automatically is included in any Java program.The Applet class.lang---.The JDBC API. the string manipulation.util---. random number generation. date. Java. which provides the ability to write applets.2 added some new packages.The basic classes. packages server as the foundation for building other packages. setting pixels values. and text fields. Java. . classes and interfaces that access databases and send SQL Statements. Java.applet---.sql---. lists. Other new packages include such thing as Remote Method Invocation.io and Java. including color models. Java. and grabbing snapshots. they are basic classes and interfaces for general purposes programming. checkboxes. Java. buttons. In Java. As discussed in the following section. Java development kit version 1. Java.image---. this package also.Classes that manage reading data from input streams and writing data to the output streams. runtime. bit sets. system properties.lang. scrollbars.

sql package. where the compiler maker memory layout decisions. is one example of a foundation upon which extensions are being built. In addition to extensions there are also main tools being developed to make existing capabilities easier to use. a programmer can not forge pointers to memory. Java has no pointers. Programmers can modify existing classes for write their own new classes or they can write a whole new package. As the result. it was return so that extending it is very easy. The way memory is allocated and laid out In Java an object’s location in memory is not determined until The runtime. It was purposely written to be lean with the emphasis on doing what it does very well. . the Java. instead of trying to do everything from the beginning.Java Is Extensible: A big plus for Java is the fact it can be extended. The JDBC API. Java Is Secure: It is important that a programmer not be able to write subversive code for Applications or applets. The Java platform builds in security in four ways. conferencing. Other extensions are being added or worked on in area such as multimedia. as opposed to C and C++. there is already a tool that greatly simplifies creating and laying out Graphical User Interfaces such as menus. Also since. Dialog boxes and buttons. a programmer can not look at a class definition and figure out how it might be laid out in memory. This is especially true with the Internet being used more extensively for services such as electronic commerce and electronic distribution of software and multimedia content. Internet Commerce. and telephony. For example.

Java has done quite respectably in performance tests. Imported classes cannot substitute for built in classes. and built in classes cannot accidentally reference classes bring in over a network. As a result. The Java byte code loader. Java’s many advantages such as having built in security and being interpreted as will as compiled. part of the virtual machine.The way incoming code is checked. whether classes loaded during program execution are local or from across a Network. and the byte code Interpreter can run very fast the cost it doesn’t have to do may checking. The way access is restricted for untested code: The Java security manager allows user to restrict untested Java applets so that they cannot access the local network. files and other resources. byte codes can be translated on the fly. checks that A: The format of incoming code is correct B: Incoming code doesn’t forge pointers C: It doesn’t violate access restrictions D: It accesses objects as what they are. . The Byte code Verifies. The way classes are loaded. For situations that require unusually high performance. The Java virtual machine doesn’t trust any incoming code and subjects it to what is called byte code verification. Java Performs Well: Java performance is better than one might expect. Its performance numbers for interpreted Byte codes are usually more than adequate to run interactive graphical end user applications. another part of the virtual machine. generating the final machine code for the particular CPU on which the application is running at run time. do have a cost Attached to them. However. various optimizations have been built in. High levels interpreted scripting language generally offer great portability and fast prototyping but poor performance.

with the advantages of high level Languages but without the disadvantages of C and C++. Thus the ability to create robust programs was given a high priority in the design of Java. they may free some memory that another part of their code is still using. pointers and multiple inheritance. For example some programmers some times forget the free memory that has been previously allocated. . you can think of Java as providing a very attractive middle ground. tedious task in traditional programming environments. Or worse. In fact. Knowing that what you have written will behave in a predictable way under diverse conditions is a key feature of Java to understand how Java robust. consider two main reasons for program failure: Memory management mistakes and mishandled exceptional conditions (run time errors). Java frees you from having to worry about many of the most common cause of programming errors. To gain reliability. However. because it must execute reliably in a variety of systems. it checks your code at compile time. Java restricts you in a few key areas to force you to find mistakes early in program developments. Java Is Robust: The multi platform environment of WEB places extraordinary demands on a program. Java offers good performance. Memory management can be difficult. many hard to track down bugs that often turn up in hard to reproduce runtime situations are simply impossible to create in Java. At the same time. In the world of design trade-off. it also checks your code at run time. For example in C/C++ the programmer must manually allocate and free all dynamic memory. Because Java is strictly typed language.Low level compiled language like C and C++ offer great performance but require large amounts of time for writing and debugging Code because of problems with areas such as memory management. This sometimes leads to problems.

Java virtually eliminates these problems by managing memory allocations and reallocations. Even when you download a program. . The virtual machine takes a small footprint and Java accommodates the need for low storage and for low bandwidth transmission over the Internet. there are two broad categories of objects transmitted between the server and your personal Computer. Or a program could process new inventory figures while it maintains a feed for current prices. In a well-written Java program a program should manage all run time errors. This makes Java ideal for low cost network computers whose sole purpose is to access the Internet. Java Is Important To the Internet: The Internet helped catapult Java to the forefront of programming and Java in turn has a profound effect on the Internet. For example. active programs. when you read your e-mail. In a network. Multithreading is particularly important in multimedia. you are viewing passive data. For example an application could be faxing a document at the same time it is printing another document. a multimedia program might often be running a movie. Passive information and dynamic. In addition the Java operating system offers a standalone Java platform that eliminates host operating system overhead while still supporting the full Java platform API. The reason is simple: Java expands the universe of objects that can move about freely in cyberspace. running an audio track and displaying text all at the same time. Java helps in this area by providing object oriented exception handling. the program’s code is still only passive data until you execute it. from portable consumer electronic devices to powerful desktop and server machines. Java Scales Well: Java platform is designed to scale well. Java Is Multi Threaded: Multithreading is simply the ability of a program to do more than one thing at a time.

Exception Handling: An exception is an abnormal condition that arises in a code sequence at run time. Exceptions can be generated by the Java run-time system.However. or they can be manually generated by your code. Java addressed these concerns and doing so. If an exception occurs within. Exception-Handling Fundamentals: A Java exception is an object that describes an exceptional (that is. Program statements that you want to monitor for exceptions are contained within a try block. As desirable as dynamic. an exception is a run-time error. yet the server would initiate it. Such a program would be an active agent on the client computer. Your . catch. When an exceptional condition arises. Exceptions thrown by Java relate to fundamental errors that violate the rules of the Java language or the constraints of the Java execution environment. self-executing program. the try block. an object representing that exception is created and thrown in the method that caused the error. they also present serious problems in the areas of security and portability. has opened the door to an exiting a new form of program. Java exception handling is managed via five keywords: try. A dynamic. Manually generated exceptions are typically used to report some error condition to the caller of a method. there is a second type of object that can be transmitted to your computer. In other words. Prior to Java cyberspace was effectively closed to half the entities that now live there. throw. throws and finally. it is thrown. error) condition that has occurred in a piece of code. networked programs are.

There is an important subclass of Exception. or creating one with the new operator. any subsequent statements are not executed. Throw: It is possible for your program to throw an exception explicitly. Any code that absolutely must be executed before a method returns is put in a finally block. which defines exceptions that are not expected to be caught under normal circumstances by your program. The general form of throw is shown here. Throws: . Throw Throwable Instance. called Run-time Exception. using the throw statement. System-generated exceptions are automatically thrown by the Java run-time system. To manually throw an exception. use the keyboard throw. The flow of execution stops immediately after the throw statement. Throwable Instance must be an object of type Throwable or a subclass of Throwable. The other branch is topped by Error. One branch is headed by Exception. Throwable are two subclasses that partition exceptions into two distinct branches. Exception Types: All exception types are subclasses of the built-in class Throwable. Any exception that is thrown out of a method must be specified as such by a throws clause.code can catch this exception (using catch) and handle it in some rational manner. Throwable is at the top of the exception class hierarchy. There are two ways you can obtain a Throwable object: using a parameter into a catch.

Any time a method is about to return to the caller from inside a try/catch block. or any of their subclasses. . This is the general form of a method declaration that includes a throws clause. the finally clause is also executed just before the method returns. if they are not. Java’s Built Exceptions: Exception Arithmetic Exception Meaning Arithmetic error. each try statement requires at least one catch or a finally clause. such as divide-by-zero.A Throws clause lists the types of exceptions that a method might throw. the finally block will execute even if no catch statement matches the exception. a compile-time error will result. Other exceptions that a method can throw must be declared in the throws clause. However. Type method-name (parameter-list) throws exception-list { //body of method ----------------------------------} Finally: The finally block will execute whether or not an exception is thrown. except those of type Error of Runtime Exception. The finally clause is optional. If an exception is thrown. This is necessary for all exceptions. via an uncaught exception or an explicit return statement.

Creating Your Own Exception Sub Classes: . Class not found. Invalid use of a null reference. Illegal argument used to invoke a method. Assignment to an array element of an Incompatible Invalid cast. Attempt to index outside the bounds of a string. No Such Field Exception No Such Method Exception A requested field does not exist. Attempt to create an object of an abstract Class or interface. Array created with a negative size. Access to a class is denied. Attempt violate security. Class Cast Exception Illegal Argument Exception Index Out of Bounds Exceptions Negative Array size Exception Null Pointer Exception Number format Exception Security Exception String Index Out Of Bound Class not Found Exception Illegal Access Exception Instantiation Exception Array index is out-of-bounds.Array Index Out of bounds Exception Array Store Exception type. Some type of index is out-of-bounds. Invalid conversion of a string a numeric format. A requested method does not exist.

Portable. While Java started out as a niche language for developing applets or small programs that run in Web browsers. Its area of use is growing daily and includes dynamic Web-content generation with servlet technology. The Exception class does not define any methods of its own. safer. and catch as clean ways to handle errors and unusual boundary conditions in your program’s logic. Using Exception: Exception handling provides a powerful mechanism for controlling complex program’s that have many dynamic run-time characteristics. throw. it has evolved to arguably become the most important programming language for developing ecommerce and other Web-driven applications. making it easier. and there is no language better than Java for writing these programs. An introduction to Java that will help Java newbies to become Java developers: High-level overview of Java Java is a general-purpose. however. Its design. It is important to think of try. This is quite easy to do: just define a subclass of Exception (which is of course. The Java Virtual Machine . object-oriented language that looks a lot like C and C++. a subclass of Throwable). multitier. the creation of cross-platform user interfaces with Swing.Although Java’s built-in exceptions handle most common errors. and much more. and more productive than C++. was built on those of its predecessors. you will probably want to create your own exception types to handle situations specific to your applications. distributed. object-oriented programs driven by the Web are the order of the day. the building of business components with Enterprise JavaBeans.

The JVM is what gives Java its cross-platform functionality and many of its security and safety capabilities. As long as there is a JVM on any given platform. From Java source to bytecode to host machine code * Programs are written in Java and stored in . check out Sun's JVM specification in the Resources section below. you can run Java on it. Bytecode is an intermediate language between Java source and the target computer you want to run on. "You can solve any problem with another level of indirection.java files are compiled by the Java compiler into bytecode and stored in . The following figure demonstrates how it works at a very high level. There's an old saying in computer programming. Setting up Java on your system The first thing you need is the Java 2 Software Development Kit or SDK (formerly known as the Java Development Kit.java) * The .class files). If you don't have this. I'll focus mainly on its instruction set. MyClass. performs some checks on it. or JDK).class) * The JVM loads the bytecode (the .class files (for example.Let's take a look at a central component of the Java architecture. The bytecode format is the same on all platforms because it runs in the same abstract machine -. and then converts it to the machine code of the target platform that executes it This is where Java gets its platform independence. the Java Virtual Machine (JVM). The JVM is basically an abstract computer implemented in software. which is called bytecode.the JVM.2. you'll need to download the Java 2 SDK from Sun (see Resources below). Here's a brief description of what you need to do to install version 1.java files (for example. That's about it on the JVM for now.x for the Windows platform: . This is a set of software and software tools supplied by Sun that includes all of the basic components needed to build Java programs. If you want to know more. MyClass." The JVM and bytecode together is another level of indirection.

in zip format. * You can execute it by typing its name at a command prompt.2. * Execute the program to install the Java 2 SDK.x * You must set up your environment correctly * Your path must be set to include the bin subdirectory * For example. if you installed the Java 2 SDK in C:\JDK1.2.exe.2. you can do this in autoexec. A Java program looks like this: . I'll discuss this in future columns. for version 1. the default installation directory is C:\JDK1.2. * It's also important to download the javadoc HTML documentation for the core API classes. * The javadoc HTML documentation should be unzipped into the Java 2 SDK installation directory * Note that the zip file has a directory structure within it.bat * If you are using Windows NT. and the filename is in the form of jdk<version>-doc. it's time to write our first Java program. you must include C:\JDK1.x\bin in your path * If you are using Windows 95/98.x\docs. so that unzipping it into C:\ will place all of the files at the root directory C:\JDK1. especially the CLASSPATH environment variable.zip (for example.* For Windows. which is a good place for them. System. jdk1_2_2-doc. For example.exe.zip). * You can double-click it from Explorer. The following tools will be used to create and run our first program: * javac: the Java compiler that converts Java source to bytecode * java: the Java Virtual Machine How to write a Java program OK.2. This is a separate download. the file is named jdk1_2_2-win. go to Control Panel. * On Windows. Environment * You can set environment variables in the dialog box there * There are other parts of the environment that are important.2. the download will be a self-extracting archive. and the file name follows the form: jdk<version>-win.x.

java file): javac MyProgram. you can stop here.").println is the magic incantation you use to get things sent to the console. The main method is a special method that is the starting point for every Java application.out. Type the above program into a file named MyProgram.java Once it compiles without errors. This code example is for a standalone. or check out the Resources section for some of my favorites.out. System. (Hey -. It has to be declared exactly as above. to the console. (This generates the . and it has to appear within a class.println( "Eureka. as the above example also shows. Once you've done that. I can put Java on my resume. do a directory listing to see that you've generated a MyProgram.that's the bytecode.class file from the .) Now type the following to run the program: java MyProgram . so if you want. } } A Java program is a class with a main method in it. Type in the following code to compile the file. Your salary can double now.public class MyProgram { public static void main(String[] args) { System.java. nongraphical Java program that prints the string Eureka. It's a good idea to put it in its own directory just to keep things organized. Use your favorite text editor for this.class file. go to a command line that is open to the location your file is in. Those that want to learn more can keep going. I can put Java on my resume.

There are a couple of things you should notice. I can put Java on my resume. and you'll get an error message because it will look for a file called MyProgram. or what can be done to it * Properties: Data or information associated with an object (often called state) * Type: The kind (or class) of thing an object is * Identity: The unique existence of every object. Try typing java MyProgram. It's just a program. Let's further explore the notion of type. The JVM (java) does not expect you to include the .This executes the JVM. and makes it run the bytecode in the MyProgram. Note also that things are set up in such a way that you have to do everything from one directory. but don't worry too much about that. Simply put. . This is a powerful model because it reflects the way we think about the world. You should see the following output on your screen: Eureka.class. and that's what it expects you to give it. Object-oriented programming (OOP) Object-oriented programming is the key organizational factor in using Java well.java extension for the files you're compiling. What's an object? It's a representation of some concept or thing.class. this means that you organize your program around objects. We're almost always dealing with many different objects. Grasping the concepts is the important thing. and the way we conceptualize it using language. and the natural inclination is to classify or label them in some way. The Java compiler (javac) requires that you include the . independent of its characteristics You might see object described elsewhere using different terminology.class. Congratulations! You've generated your first Java program.class extension. Here are the key characteristics that define an object: * Behavior: What an object can do.class file.

* Alarm clock properties: Current time. Here are some real-world examples of different types from different areas: * Concrete: Person. (the alarm clock type). sometimes resulting in changes in their properties. Objects interact through their behaviors. snooze. How do we use this type? Easy. We'll talk more about this later when we delve into the best way to actually program a type. We'll take a crack at determining its behavior and properties. get and set alarm time We've made a bit of a distinction here between general behavior. The system depicted in this example is the core of OOP. Creating types and classifying your objects is one of the arts of OOP. and possibly more than one type. turn alarm on or off * Alarm clock property-related behavior: Get and set current time. and we have objects that are instances or examples of the types (we bought a particular alarm clock). We buy an alarm clock and bring it home. When it rings. Let's examine the alarm clock type. We set the current time and the alarm time. earthquake Every object has a type associated with it. you already knew . and we finally turn the alarm off and get out of bed. car. and ultimately (hopefully) do useful work. alarm clock. and behavior that is just related to getting and setting properties. star * Conceptual: Number. alarm time * Alarm clock behavior: Ring. We have types that represent the different kinds of things in our system. planet. C'mon. democracy * Events: General protection fault.A type is the way to classify objects. and there is no single "correct" way to do this. we hit the snooze button (repeat five to six times). and it's also the blueprint that defines the behavior and properties for objects of a certain type.

All executable code exists in classes (generally in methods). Rewrite your resume -. public class AlarmClock { } * The class keyword introduces the class * AlarmClock is the name of the class * { starts the class body * The data and methods are declared within the class body * } ends the class definition * We'll look at what public means shortly It's time to create your first class. A class is used to define a new type in Java. Let's shift back and see how OOP is done in Java. and all data appears within a class (in variables within a class. Classes are defined in a class definition. albeit one that doesn't do much yet. and in variables in methods).you're an object-oriented programmer. and put in the code for the class definition above. though. otherwise you wouldn't be able to use your alarm clock. Compile it using javac. Here's a (simple and incomplete) definition for an AlarmClock class. and you'd never get to work on time. It will soon.java . Everything happens within classes.this. OOP and Java We've been talking abstractly until now about OOP.java. and classes are central to the language. Create a file called AlarmClock. javac AlarmClock.

You can initialize a reference to refer to a given object. We'll add the snooze method. Hence. let's add a little behavior to our alarm clock. Java requires you to put the class definition (the Java source) into a file that starts with the name of the class. but it's not a cookie. and then use the reference to interact with that object. and here's what one looks like: public void snooze() { . objects float around in a computer's memory. A class definition is like a cookie cutter. You add behavior in methods. which will just print a message to the console as our first program did. aClock is the name of the variable. and new AlarmClock() creates a new alarm clock that is then used to initialize aClock. Here's what this looks like: AlarmClock aClock = new AlarmClock(). The first AlarmClock declares the type of the variable. Methods go inside classes. and we need to have a way to get to them.Note that when a class definition starts with the keyword public. Unlike cookies we can just pick up and put on a cookie sheet (and then pick up and eat). we have to cut some objects from memory to create them. Remember that a class (that defines a type in Java) is a blueprint for an object. The syntax looks like this: new AlarmClock(). You create cookies by cutting some dough with the cookie cutter. we name our file AlarmClock. but it's not the actual object. This creates an alarm clock off the heap. You create or instantiate objects in Java with an operator called new followed by the name of the class for which you want to create an instance. Similarly. however. There's still a problem here.java because the class name is AlarmClock. Java uses special variables called object references to refer to objects. What can we do with this? Have we actually created an AlarmClock? Nope. Just for fun.

Remember that a Java program is just a class with a main method in it. because there is no main method in class AlarmClock. Let's create another program called AlarmClockTest.println("ZZZZZ"). but hey. we get the following: public class AlarmClock { public void snooze() { System. public class AlarmClockTest { public static void main(String[] args) { AlarmClock aClock = new AlarmClock().println("ZZZZZ").out. We'll create an instance of AlarmClock in this program. } } Last. or. we want to do work with this alarm clock. that's everybody's favorite action with an alarm clock anyway. } } Does AlarmClock. You generally do this through the variable that refers to it. invoking. but not least. All we can do is snooze with this clock. it doesn't. The way you tell an object to do something is by calling. Here's what the code looks like: public class AlarmClockTest { .out. one of its methods. and you use the dot operator for this.System. This just means we'll create a class AlarmClockTest with a main method in it. } When we put it in our AlarmClock class.java contain a program? No.

the Abstract Window Toolkit (AWT). Early adopters of Java technology have recognized its significant productivity advantages. Java platform's graphical user interface library. so this is how you run the program: java AlarmClockTest JFC(swings): In 1995. Many Web developers used Java technology to animate sites and loved it. its initial runtime environment. You're ready to run your new program.java. } } Ready? Create AlarmClockTest.no extra effort is expended to create the port. and type in the code above. fulfilled a key role in the creation of dynamic Web pages. objectoriented language that provided client side processing for otherwise static pages. The Java Virtual Machine* (JVM) is . businesses worldwide are standardizing on Java as their primary development and deployment platform.public static void main(String[] args) { AlarmClock aClock = new AlarmClock(). Today. Java technology shook the World Wide Web with a network-centric. The main method is in AlarmClockTest class. Compile it (javac AlarmClockTest.snooze(). Java programming language is an excellent implementation of objectoriented technology which makes it easier to learn. Java language enables any application to be portable to any Java technology-enabled platform without the additional cost of development or maintenance -. aClock. This is a huge advantage for developers and system architects that use the Java development platform.java. Java technology has evolved quickly and now transcends the browser.java) as well as AlarmClock.

* Components are cross-platform. JFC will also include many of the key features found in Netscape's Internet Foundation Classes. Java Foundation Classes extends the original AWT by adding a comprehensive set of graphical user interface class libraries that is completely portable and delivered as part of the Java platform. The Java Foundation Classes includes many new. The Java Development Kit (JDK) software release 1. easy-to-use and sophisticated features that are designed together to offer the following key advantages over other frameworks: * JFC is core to the Java platform and reduces the need for bundled classes. In addition. Developers can easily bring in other third party components to enhance their JFC applications. Internet and Crossware applications.1 introduces the first installation of the most significant cross-platform graphical user interface technology since the advent of windowing systems: the Java Foundation Classes (JFC). * All new JFC components are JavaBeansTM architecture-based. Since the JFC is core to the Java platform. The JFC raises the bar for GUI functionality in the Java language and delivers a rich API with a growing set of components and services to develop commercial-grade applications. .rapidly being incorporated into operating systems and hardware devices to provide a common meta-platform for applications. developers can create and deploy large scale. standard technology. and offer significant performance improvements. it eliminates the need to download special classes at runtime and is compatible with all AWT-based applications.JFC's continually evolving new features include a rich suite of high-level components and services that are fully and uniquely cross-platform compatible. With the JFC. a broad complement of third party tools and components are available to enhance application development. And because Java is an open. mission-critical intranet . * No framework lock-in.

but applications often do not work consistently across . Applets are Java applications that are executed from inside a browser instead of being launched and run from the native operating system.* Enhanced services promote development of feature rich applications. History of Java Foundation Classes The Abstract Window Toolkit (AWT) provided developers with a rudimentary library for building applications and applets. Most implementations involved "lowest common denominator" approaches and used proprietary libraries. Alternatively. developers encountered limitations with the AWT when attempting to create modern. some evolutionary and some revolutionary. web-centric tasks. The Challenge of a Portable GUI Library The technical issues surrounding cross-platform compatibility have plagued software developers for years. Java solved this portable GUI environment problem in the most elegant and simple way possible. Designed for simple. It also provided a good starting point for graphical Java development with room for improvements. * JFC subclasses are fully customizable and fully extendible. The first approach has the desired look and feel. Many vendors have attempted to solve this seemingly simple problem by making applications independent of their windowing systems. A common approach is to layer an API or class library on top of the native toolkit. None offered an open solution. There are many different approaches to implementing a portable GUI class library or environment. sophisticated client applications. other portable GUI environments contain a single toolkit and then emulate the native look and feel on each platform. With the AWT. it did offer two important features for all applets and applications: * 100% portability from a single set of source code * Assumed a native look and feel on the deployment platforms The AWT delivered on the promise of a standards-based platform that adapted to the user desktop. Although the AWT was limited in scope.

It's biggest strength was that with it. . More challenges arise at the toolkit level. Generally speaking. This can increase complexity because many native components maintain their own state. 100% portability. Changes to minimum sizes. The JDK refers to this as the "peer" model. the peer model was viewed as unacceptable if Java was to truly act as a metaplatform that would guarantee cross platform support. Run Anywhere AWT 1. Each native toolkit has a completely different event model and contains a distinct set of native components. shading and colors. Since cross platform capabilities are one of the compelling reasons for developing with Java. the cross platform capabilities of the GUI had to be improved. No other toolkit or language has been able to match AWT's breadth of deployment platforms while supporting native look and feel. Each Java component class "wraps" the peer or native implementation. Many seasoned GUI developers have complained that the AWT's peer model was too restrictive in rendering and event handling. Components such as the scrollbar can exhibit inconsistent behavior across platforms. an application/applet could be written once and run anywhere-a single set of source code. AWT 1.0 -. and that because of this. The later approach enables applications to work consistently but their emulation never fully captures the correct look and feel on all platforms.Write Once. Problems can arise when applications designed and developed for one platform are deployed on a different windowing system.0 had several strengths and weaknesses. and fonts can result in unusable user interfaces for applications that are otherwise healthy. It was also prone to problems if the idiosyncrasies of a platform were not implemented properly.platforms. For users. it was difficult to extend or override different aspects of the component. The AWT uses the layered toolkit model where each Java component creates a native component. differences in native appearance can have a radical and negative effect on the look and behavior of an application.

In retrospect. The . Java developers demanded a single industry standard solution. the web-centric AWT GUI toolkit becomes part of a comprehensive set of GUI classes and services called The Java Foundation Classes. browsers are moving users toward a more universal look and feel on all platforms and soon. provides a robust infrastructure for creating commercial quality intranet and Internet applets and applications. The Java Foundation Classes.Nevertheless. As a result.0 was a good initial step that enabled applet development. the peer model played an important role in the acceptance of the AWT. Finally. and IBM joined force to create Java Foundation Classes which provides a single GUI component and services solution. Java Foundation Classes builds on top of the existing AWT by integrating the best of new Sun technologies and Netscape's Internet Foundation Classes. While IFC was a robust framework which delivered many important functionalities to the development community.1. JFC -.A Comprehensive Set of Classes and Services With JDK software version 1. the AWT enabled the early Java adopters to deliver applets and applications on any Java enabled platform with one set of source code and no "porting". Sun. The API was simple and clean. and enabled developers to come up to speed quickly. However. a superset of the AWT. Netscape. The AWT shielded developers from each platform's idiosyncrasies and yet was 100% portable with a native look and feel. It enabled Java's AWT to be brought to market quickly and provided true native look and feel. In fact. It provided the initial foundation upon which further releases of the AWT could build and eventually improved. Internet Foundation Classes To address the needs of developers who wanted to create commercial applications that behave and appear identical across all platforms. Netscape created the Internet Foundation Classes (IFC). users will expect this uniformity. in 1995 the market was much more dogmatic about the appearance of applications and would have almost certainly rejected the AWT if it had not provided native look and feel. AWT 1.

JFC is the result of developer and end user feedback and provides a significant advance in the development of client applications written in the Java programming language. The JFC released in JDK 1.1 provides a wide range of new features that enable Java developers to be more productive while delivering applications that are fully integrated into the desktop environment. The JFC contains a powerful, mature delegation event model, printing, clipboard support, a lightweight UI framework and is 100% JavaBeans compliant. The new capabilities of JFC make Java a platform that will support the most sophisticated enterprise applications. Development of commercial applications using Java is now both possible and attractive. Java and the AWT freed developers from being tied to a specific or proprietary platform for GUI application development and deployment. Today, the JFC provides the core set of classes and services enabling applications to scale from the desktop to the enterprise and across multiple platforms. Java developers will find the additions and improvements to the toolkit greatly enhance their ability to deliver 100% Java applications quickly and provide reliability and cross-platform consistency. The release of JFC with JDK 1.1 is only a starting point. JFC will be extended to encompass an even wider range of components and services which will support the development of even richer Java applications. The JFC strategic roadmap intends to build on this solid foundation with new functionality that will continue to deliver a new generation of applications to a new era of computing. Current JFC Features GUI developers expect baseline functionality to create professional quality applications. The AWT, while best suited for applet development, provided little integration into the desktop environment and even less functionality for creating large scale applications. JFC, introduced in JDK 1.1, delivers a more robust framework for GUI development. It also delivers the baseline components and frameworks that developers expect from the Java platform.

With JFC, Sun placed a great emphasis on quality, fixing many of the platform inconsistencies which existed in the AWT. While it is recognized that the peer model of the AWT was limited in its scope, it was necessary to correct existing problems and to help customers deploy existing applications reliably. In particular, the Win32 native implementation was 100% re-written in order to provide a more robust base for the JFC going forward. Although newly introduced, JFC is based on a mature, consistent, and widely known set of classes and services. Current features of the Java Foundation Classes are: * JavaBeans Architecture Compliant * Lightweight UI Framework * Delegation Event Model * Printing * Data Transfer/Clipboard * Desktop Colors Integration * Graphics & Image Enhancements * Mouseless Operation * Popup Menu * ScrollPane Container

JavaBeans has played an important role in the JFC. The JavaBeans specification defines a standard component architecture for visual and non-visual components. All JFC components in JDK release 1.1 are JavaBeans architecture compliant, which means they have a consistent API and a standard event handling mechanism. This standard property and event model lends itself well to component reuse and interoperability. JavaBeans also ensures easy integration of standard components and frameworks with RAD tools and GUI builders. As described earlier, the peer model has certain limitations. While native look and feel is still important, a universal look and feel is also becoming increasingly more

desirable. The Lightweight UI Framework enables components to be peerless, or lightweight, and completely written in Java. This new framework will enable component developers to create and deliver a wide range of third party components that will work consistently across platforms while remaining completely portable. The lightweight UI also enables Java developers to easily create stunning user interfaces. The new event model is especially well suited to visual development environments and development of distributed and multicast applications. The new delegation event model in the JFC extends the previous single method implementation of the AWT. Before large conditional statements were required to determine an event's type or origin. Now, events are class specific and can be "sent to" or "delegated" directly to the object that can handle the request. This provides a large degree of flexibility when handling the many different types of events generated by a GUI application. Operating system vendors are currently integrating Java's Virtual Machine directly into the OS which will shift deployment from webcentric browsers to applications, provide a common metaplatform from IBM MVS to Microsoft Windows, and provide a more consistent, flexible, and reliable operating environment than a browser. Once this is accomplished and applications based on release 1.1 are in operation, users will no longer have to view the future of the desktop windowing environment through a single vendor's eyes. Innovation will expand as the time-to-market for application decreases. In summary, JavaBeans, lightweight components, and the delegation event model provide a stronger infrastructure which enables larger and more complex applications to be built more easily and in less time. The remaining features such as popup menus, desktop colors, mouseless operation, and printing all allow Java applications to be seamlessly integrated into the native windowing environment. Collectively, these additions to the core Java GUI toolkit are designed to result in feature-rich, highperformance applications. 100% Pure Java Certified -- Ensuring Portability

as customers mix and match different desktop systems developers cannot assume a single deployment platform.A Commitment To Open Standards . Developing exclusively using the native toolkit. Although there is a growing third party market for additions to the Java platform." Java developers do not want to deliver these additional components along with their applets and applications. "100% Pure Java" means the application is written completely in Java and does not rely on any external class libraries or native code. AWT was intended to support only a limited set of GUI components. Why? So applications can more easily be "100% Pure Java. The Java development community has overwhelmingly asked for the additional components to be delivered as part of the JDK. much of this additional functionality has been incorporated into the Java platform. thus limiting the deployment of created Java applications or applets to a single platform. It was expected that the market would provide the higher-level components. It becomes a problem with large third party frameworks. Java Technology -. Third party technologies can be used but their technology must be part of the application or applet download in order for the software to be "100% Pure Java." This works well for third party components that are typically small in size with few classes. the native toolkit must support all the capabilities that developers require and take full advantage of whatever native environment they are on. an obvious need arose in the Java development community. thus improving overall performance and appeal of Java applications and applets. Today. It's also important that Java applications and applets do not rely on any proprietary technologies. With JFC. Initially. Some operating system vendors attempt to "capture" their developers by providing proprietary technologies as a part of the Java development tools. Of course. or "100% Pure Java" frees the developer from these concerns and lets them take advantage of the full benefits of the Java platform.It is important that both applications and applets should be written completely in the Java programming language to preserve cross-platform capability.

This is why it is important for Java applications and applets remain "100% Pure Java. Sun has endeavored to cultivate relationships with other technology providers in order to provide an open standard for all Java developers. The release of these classes with JDK 1. network-centric applications a reality. It is important to remember that all specifications from Sun have been made available to the larger Java development community for comment and do not reflect the views or position of a single vendor. Although their apparent enthusiasm for the Java platform is certainly understandable. commercial-grade applications.1 marks the beginning of major enhancements that will continue to improve the completeness and functionality of Java GUI applications. such offerings can cause confusion in the marketplace. other companies have announced or delivered specifications and class libraries to the Java development community.Expanding On A Solid Foundation The JFC represents a significant introduction of new functionality to the Java development environment. JFC represents the demands of Java stakeholders and is a high quality development environment that makes high performance. New features will include: * Drag and Drop * New High-Level Components * Pluggable Look and Feel * Java 2D API * Accessibility Features for the Physically Challenged . Once these specifications have been implemented the technology will become part of the JDK and will exist on every Java platform. These new features will be made available to developers as they are completed over the next few months and then rolled into the next release of the JDK.Recently." JFC -. This collaboration is evident in many of the specifications now available for review. Additions to the Java Foundation Classes will soon incorporate several features that further enhance a developer's ability to deliver scalable.

platform-independent implementation of D&D will enable objects to be dragged and dropped from one application to another. thus facilitating a customizable look and feel without relying on native windowing systems or adding system overhead. new JFC components will carry two important attributes: all components will be both lightweight and peerless. The generic. and improving the deployment of applications will be simplified. Drag and Drop (D&D) functionality as part of the core JFC class library means it will be available on all Java platforms in a consistent and supported fashion.* Additional new features continually being added Drag and Drop The Drag and Drop specification is available in the JDK 1. It will significantly improve application interoperability by enabling D&D between Java applications and non-Java applications. it will support D&D between a Java application and a native application. Sun will soon release an expanded set of components written in 100% Pure Java that will enable applications to be more fully integrated into the native environments. D&D support makes it much easier to introduce Java applications to the enterprise.1 documentation and will soon be released as an update to the JFC. In addition. . This means a user running the application on UNIX will be able to D&D to a Motif application and then run the same code on Microsoft-Windows and D&D to native application running there. New Java Foundation Classes Components Working closely with Netscape and IBM. This update will support D&D between two Java applications. These new high-level components will be available on all platforms as part of the standard Java platform. thereby eliminating the need to download extra classes. but more importantly.

Check marks * StatusBar * SpinBox * ComboBox * Drop down ComboBox * Drop down ListBox * Composable Button * Multimedia Controls * MovieSlider . The following components will be included with JFC: * Tree View * List View * Table View * Toolbar * Pane Splitter * Tabbed Folder * List * Multi-column * Supports Images * Progress Bar * Slider * Styled Text * Support import/export of HTML and Rich Text Format * Font Chooser * Color Chooser * File Chooser * Custom Cursors * Tool Tips * Generic Button and MenuItem * Support Images.This comprehensive set of new high-level components will allow developers to create sophisticated professional-quality applets and applications using core JDK 1.1 functionality.

all new applications were assumed to require that user interface. an entire application's GUI will be able to switch from one look and feel to a different one at runtime. The Java 2D API extends the JFC's strengths by enabling developers to incorporate highquality graphics into their applications and applets. Pluggable look and feel will increase the reliability and consistency of applications and applets deployed across platforms. This will increase user acceptance of network computer (NC) replacement of PCs as users will select an operating environment they are comfortable with. This is significant since users will want to work in a GUI that is familiar to them. Now. New graphical capabilities will promote the development of visually rich applications. users are familiar with and excited by the rich and unique user interfaces delivered through browsers. 2D Graphics API The existing graphic capabilities of Java will be extended with new classes. Since all applications on a platform had a common look. The "pluggable" look and feel will provide an easy yet powerful mechanism for individualizing an application's visual personality without having to subclass the entire component set.* AudioController * MovieController * Properties * AudioGauge * MidiPanel Pluggable Look and Feel Native look and feel was once the mantra of cross-platform developers. The Java 2D API will extend the . To further enhance a user's visual experience. even if they are using a network computer. The rigor with which user interfaces were designed in the past has been replaced with the requirement for effective and reliable clients. Or so it seemed until World Wide Web came along. This feature will give users the ability to switch without restarting the application.

image core class libraries. and composited just like any other graphic element. skewed. The Java 2D API treats paths. * Enable the control of how graphics primitives are rendered by specifying a set of attributes that allows characteristics such as the stroke width. join types. mixed languages. Tile. The JFC Accessibility API enables Java applications to scale to encompass the physically . and controlling the rendering process. * Provide a full range of features for handling images with several new classes including: BufferedImage. This is one of many evolutionary additions to the Java platform which ensures that existing code co-exists and benefits from these new enhancements. they can all be rotated. and images uniformly. including text strings with mixed fonts. engineering. scaled. used as a clipping path. the Java 2D API maintains compatibility for existing programs and allows programs to seamlessly integrate the features provided by JFC. text. The Java 2D API will: * Enable the path to be specified to define complex shapes. and bidirectional text. defining complex shapes. This means better performing. Accessibility Features for the Physically Challenged JFC introduces new capabilities to the Java platform that deliver benefits to end users. ComponentColorModel and ColorSpace. more sophisticated visual applications for scientific. * Provide text layout facilities that handle most common cases. with additional features for specifying fancy paint styles.java. and composited using the new Graphics2D class. * Enable text to be drawn. and business users. The Java 2D API provides a subclass of the AWT Graphics class. Many physically challenged users are prevented from using applications because developers did not integrate with the necessary accessibility functionality.awt. Graphics2D. Channel. By extending the existing classes. and color and texture fills. transformed.awt and java.

challenged users. supports keyboard navigation. more dynamic interaction. JavaBeans Architecture Compliant JavaBeans is an architecture and platform neutral API for creating and using dynamic Java components. With the JDK 1. Two of the most important features are Screen Readers and Screen Magnifiers. Accessibility features will be easily integrated into existing Java applications and will ensure an even broader audience for information in a networked age.1 release. JFC embraces the new JavaBeans component model. enables printing support. The Screen Magnifier enables the user to adjust the magnification of the screen from 1 to 16 times the normal size. and introduces popup menu and scroll pane components.1 An In depth Look JFC provides significant new capabilities for Java developers. JavaBeans allow developers to define independent components that can be used and re-used in a variety of combinations to compose new . JFC delivers a wish list of features that make Java the most compelling development platform available. JFC Features Delivered in JDK 1. The user can then interact with the GUI through the alternate computer input and output device. The Screen Reader creates an off screen representation of the GUI components enabling the information to be provided via a text to speech and/or a Braille terminal. Font smoothing and text highlighting act in concert to create a clearer picture which renders the content more easily read and understood. Event tracking and screen content knowledge enable the user to more easily navigate the interface. JavaBeans enhances the Java platform by allowing richer. introduces a new highperformance UI framework. improves event handling.

and can be distributed easily across the network. JavaBeans components do not need to be part of the same application build. . JFC solves these problems by introducing a lightweight framework that radically improves the performance and appearance of Java applications. Lightweight components are completely transparent because they do not require a native window. Instead. The problem with this approach was that each Canvas or Panel derived component was "heavy-weight". Additional overhead occurs when developers create their own classes-the applet or application must download additional classes to perform what should be a standard task.awt. etc. Lightweight UI Framework In AWT release 1.Panel. This means that they can be written entirely in Java and do not carry with them any overhead from the native windowing system. since they completely cover the components behind them. can be created with visual development environments. It also allows for a new class of GUI components such as tool tips without significant overhead. Each of these components can be built by different developers at separate times. Many developers created their own components by deriving new ones from java. non-visual functions and services. applets and or scale applications. meaning it required a native window which is rendered opaquely. JavaBeans components can be GUI widgets. Label. Opaque windows can cause problems for those wanting to layer components on top of each other.Canvas and specialized containers were derived from java.) could not be easily extended or have their look and feel overridden. peer-based components (Button.applications. JavaBeans will be supported inside browsers and in standalone applications.0.awt. Lightweight components also provide a consistent look and feel across all platforms. they communicate dynamically. developers will be able to create Java applications and applets that interoperate with legacy applications. By delivering JFC as JavaBeans.

The new event hierarchy is defined by the package java. With JFC.0 was quite simple.util. all event data is accessed through a standard set/get . Complex if-then-else conditional logic was required in the top level object to determine which object triggered an event. the callback-style delegation event model is elegant yet powerful. a developer needs only to change the superclass from Canvas to Component and from Panel to Container. Each derived class from java. All events were passed up the inheritance hierarchy forcing objects to catch and process events by subclassing and overriding either the handleEvent() or action() methods.EventObject is now unique because of the data it holds.event. When the paint() method is called.awt. Events are identified by their class instead of their ID and are either propagated or delegated from an event "Source" to and event "Listener. This was not scalable and was ill-suited to high-performance distributed applications. To convert existing Canvas and Panel based components into Lightweight components." Only objects interested in a particular event need deal with the event and no super-event handler is required.It is remarkably easy to take advantage of this new framework in existing applications and applets. This is also a better way of passing events to distributed objects. There are no longer public data fields. all rendering will be performed within the parent's Graphic context and transparent areas can be left unrendered thus enabling the background to show through. Advantages of the new lightweight UI framework are: * improved runtime performance for GUI applications * improved "time to load" for applets with fewer classes to download * easy conversion of existing AWT components to JFC lightweight components Delegation Event Model The event model in AWT 1.

Button button = new Button("Close"). The real power behind the new model is the enabling of an object to delegate or "fire" an event to a specific listener or set of listeners.JavaBeans compliant interface. Any object desiring to be a "Listener" of a specific event type must implement the <EventType>Listener interface for that event type. which makes it easy to implement the interface. With Inner Classes. ActionListener action = new ActionListener() { . it must first define a set of methods that enable the listener object(s) to register with the source. Additionally. a new Lightweight component may wish to send an "ActionEvent" when the user clicks on the component. However. you can create a listener class on the fly within the body of another class. The "Listener" interface is typically defined by only a few methods. a new language feature called "Inner Classes" has been added in JDK 1. When a source object wishes to delegate a specific event type. These methods take the form of set<EventType>Listener for single-cast and/or add<EventType>Listener for multicast delegation.1 which makes creating listener objects much more convenient. some derived Event classes still contain an ID to help objects distinguish between events within a specific group of events. The creator of the component would define an event registration method call addActionListener() which enables any object implementing the ActionListener interface to register as a consumer of ActionEvents. For example. The following example uses Inner classes to hook the action of pushing a button to closing a Frame: public class MyFrame extends Frame { public MyFrame(String title) { super(title).

} } Printing Until now Java applications have not been able to send text or graphics to a printer.addActionListener(action). add("Center". . allowing the user to enter typical printing information such as. } public void close() { hide(). which did not solve the problem of printing graphics. It is obtained from the newly implemented PrintJob class.PrintGraphics interface.public actionPerformed(ActionEvent e) { close().Toolkit package displays a platform specific dialog. JFC has made it simple to add printing to any Java application or applet. To send content or graphics to the printer. button).awt. A call method call to getPrintJob in the java. print name. Native code could be used to print text but then the application/ applet was no longer portable. JFC eliminates these barriers by introducing printer support that can be easily integrated into existing applications and makes the Java platform ready for a wide range of commercial software applications. number of pages.awt. button. This limitation has made it difficult for Java applications to be truly integrated into the native environment. The PrintJob class encapsulates all the printing functionality. a call is made to a Frame object's paint() method with a new type of Graphics context. This special context is derived from the Graphics class and implements the java. pack(). } }. etc.

This means that any object can be transferred within an application and also to other applications.getPrintJob(this. It also supports data transfer between Java and non-Java applications by enabling access to the "system clipboard.1 now has full clipboard support. if (pjob != null) { Graphics pg = pjob." Java applications can now . } } } Data Transfer/Clipboard JDK release 1. "Printing Test".printAll(pg). // flush page } pjob. registered. Sometimes it is necessary to print the entire GUI hierarchy. pg. if (pg != null) { canvas.The returned PrintJob object contains the Graphics context which can be used to call a component's paint() method. and transferred from both within and across process space boundaries. The underlying JFC implementation takes care of translating those calls to the appropriate print device. It enables dynamic data types to be created.getActionCommand().equals("print")) { PrintJob pjob = getToolkit(). null). The following code is an example of a method that handles a print request: public void actionPerformed(ActionEvent e) { String cmd = e. This sends all the rendering information to the printer.getGraphics(). if (cmd.dispose().end(). this can be accomplished with a call to printAll().

controlLtHighlight).width. mySize. shadows. Developers will need to implement a new class in their applications. // drawbackground g. Desktop Colors An important aspect of an application's integration into the desktop environment is its ability to adhere to the system color scheme. This increases the overall acceptance of the Java platform. such as those offered by Windows95 or CDE.setColor(SystemColor. called "data flavors". A transferable object must be able to provide a list of formats. .height). 0. The following code demonstrates how a lightweight component can use the symbolic colors to render itself: // draw highlight left and top g.Color and defines "symbolic" colors for backgrounds highlights.be easily rolled out to end users with a high degree of interoperability with existing applications.awt. etc. but Java applications will now be further indistinguishable from native applications. 0.1 is a key enabling technology for the upcoming drag and drop functionality. The new API is centered around the "transferable" objects. The SystemColor class is derived from java. JFC in JDK release 1.SystemColor to handle the dynamic changes in desktop color scheme. In previous releases of the AWT this was not possible.control).drawLine(0.setColor(SystemColor. g.drawLine(0. mySize. The data transfer architecture introduced in 1. It must also be able to return the data (in the form of an Object reference) when requested in a particular flavor. 0).1 introduced a new class java. 0. Although some applications achieve a unique look or personality through a distinct set of colors.awt. g. most applications change their colors when a user selects a new desktop scheme.

0. Developers found themselves creating a temporary graphics object. For example. The following line of code demonstrates the scaling the 100x100 pixel area down to a 50x50 area: g.setColor(SystemColor. mySize.g. mySize.height-1). The JFC adds a new class "Shape" and several new clipping methods.width-1. 0. in AWT 1.width-2. g. Creating images on the fly is much more flexible and offers better performance than retrieving images from files. calling the drawing methods and then disposing of the object. 50. The AWT 1. mySize. 50.drawImage(myImage.0 an image could be created from an array of pixels. While certain problems did exist with graphics handling in AWT. The pixels were converted into a screen representation and as long as the image was drawn at the same scale it ignored any changes to the original array. 10. mySize.drawLine(0. 10.height-1). JFC corrects this with addition of two new drawImage methods.fillRect(1. and engineering vertical applications. 110.0 did not offer an easy way to render a subset of an image or a mechanism for flipping the image horizontally or vertically. these have been corrected with the JFC.height-2). // draw shadow bottom and right g. g.height-1. mySize.0 the graphics clipping area could only be set to an ever decreasing area. 0. this). In release 1. mySize. mySize. Each drawImage method requires a source and destination rectangle definition and uses the pixels from the original unscaled image to draw into the Graphics object. most important of which is setClip.width-1. 110. a typical requirement when working with labels. business.drawLine(mySize. .1.controlDkShadow). Graphics & Image Enhancements The JFC enhances the graphical capabilities available for creating truly highperformance financial. setting a clipping area. It allows developers to set the clipping area to any size and does not maintain a relationship to the previously set clipping area.width-1.

and can be notified when they gain or lose focus. The short cut keys apply to the "command" key on the Macintosh and the <control> keys on UNIX(r) and Microsoft Windows platforms.awt. The benefits of mouseless operation are: * Ideally suited for data entry and operational applications typical of terminal-based applications * Ensures higher user acceptance of Java applications * Supports power user navigation Popup Menu .MenuShortcut has been added. java. Mouseless Operation Two important aspects of a GUI are second nature to most users: keyboard navigation and accelerators on menus. Several enhancements were made to the PixelGrabber class. To better support menu short cuts a new class. Additional methods and constructors have been added to the MenuItem and MenuBar classes to handle the new class. they can request and transfer focus. For data entry applications. This class now enables developers to get the original ColorModel for the image.Several new methods have been added to the MemoryImageSource class giving the developer a finer grain of control and easier animation capability. and the "control" keys to perform accelerated actions or short cuts. retrieve the size of the buffer needed for the image. Components can now be "tabbable". It is common to use the "tab" key to move from component to component in a standard user interface. The final area improved in the JFC with respect to image handling came directly from the request of developers input. and start and stop grab operations before the image is loaded. keyboard traversal is a requirement. JFC based applications now take advantage of keyboard traversal transparently. like <control> C to copy text.

e. } Popup Menus will enable: * user control of object attributes at runtime * easier application navigation * better end user acceptance of applications ScrollPane Container .add(mi).getY()). etc.getX(). middle-button click on UNIX) a single method is called to assign the popup menu to a component and display it. Here is a simple one item popup menu: // Create and add the popup popup = new PopupMenu("Edit"). add(popup). much like you would create a MenuBar menu. CDE. } super.getComponent(). mi = new MenuItem("Cut"). e.).isPopupTrigger()) { popup. mi. // add popup menu to applet enableEvents(AWTEvent. popup.processMouseEvent(e). When the popup event is fired (right-button click on MS Windows.Popup menus (also known as "context menus") are now a very common UI element in modern GUIs (Windows 95. Popup menus are created by simply allocating a new PopupMenu object and adding MenuItem objects to it. The JFC introduces a new component that makes it easy to enable the creation and display of popup menus. // The activation code public void processMouseEvent(MouseEvent e) { if (e.show(e.MOUSE_EVENT_MASK). This enables a single popup menu to be used by many different components.addActionListener(this).

since there is a round trip (native-> java-> native) for each individual scroll event that occurs. The JFC is a complete GUI toolkit that dramatically extends the original AWT with a comprehensive set of classes and services. JFC promotes ease of use and facilitates rapid application development. meaning the application must catch the scrollbar events and then take the appropriate action to update the contents being scrolled.0. This made applications slow and unreliable across platforms. the task of implementing all scrolling behavior is left to the developer. but it is also a serious performance problem.1 casts Java GUI development in a new light. The introduction of the ScrollPane container greatly simplifies the task of displaying information in a fixed area.In the AWT 1. To resolve this problem. The JFC is a scalable. The Java Foundation Classes delivered with JDK 1. Only a basic Scrollbar class is provided which must be managed by the application. Even as components and services grow. This is particularly noticeable during the event-intensive scroll-drag operations. "always". The result was slow applications prone to flickering and unreliable actions. Not only is this a general burden to developers who are accustomed to better support for this in toolkits. and the application must respond to the event and move its contents using slower Java draw/move operations. This was a problem for virtually any scrolling function. which means it is available . a ScrollPane class has been added to the JFC. ScrollPane provides a container that implements automatic scrolling for a single component child and supports three modes for its scrollbars: "when needed". JFC is delivered as core Java technology. and "never". robust and open technology that enables developers to create and deploy commercial-grade intranet and Internet applications.

APIs and assistive technologies are for ensuring an application is accessible to users with disabilities and meets government requirements for accessibility. This results in faster application downloads. and simplified application deployment. realizing Java technology's promise. Swing GUI Components . Run Anywhere. * Drag and Drop * New High-Level Components * Pluggable Look and Feel * The Java 2D API * Accessibility Features for the Physically Challenged The Java Foundation Classes empowers developers on all platforms. New application services are slated for JFC that will further integrate Java applications into the desktop environment." Overview of Java Foundation Classes (JFC) Features Abstract Window Toolkit (AWT) . including APIs for Drag and Drop.on all Java platforms.APIs that extend the AWT to provide a rich. The JFC will continue to expand with plans in-process to include a rich complement of high-level components that will enhance the user's visual experience and improve productivity. "Write Once.APIs to enable advanced 2D graphics.APIs that enable programs to integrate into the native desktop window system. text and printing. imaging. Java 2D . Accessibility . and brings the future of portable GUI development here today. extensible GUI component library with a pluggable look and feel. more reliable applications. .

Java has had a focus manager for AWT components since version 1. A focus manager looks for special keystrokes that change the focus (usually the Tab and Shift-Tab keys).0 of the Java Development Kit (JDK). Linux. Solaris. Often. including Microsoft Windows. Well. Other than getting notification of focus changes with gotFocus and lostFocus. The focus management services provided with the Java Foundation Classes (JFC) should satisfy all of your needs for controlling focus changes. . and then decides which component will next get the focus.0 is through a few methods in the Component class. especially if you're designing a complex form or dialog for users to enter information. This includes the Input Method Framework API. and Mac OSX. it's time to stop howling. JDK 1. A bit of history The only way to manage focus changes with JDK 1.0 allows components to set the focus to themselves with requestFocus and to change the focus to the next component with nextFocus.Internationalization . and developers have howled about its inadequacies ever since.All JFC technologies include support for creating applications that can interact with users around the world using the user's own language and cultural conventions. you'll want to control how the focus moves between components. Focus management with JFC's Swing components : ocus is the mechanism that determines which of the components in a window will receive keyboard input events. that's pretty much all you can do. These five technologies are designed to be used together to enable you to build fully functional GUI client applications that run and integrate on any client machine that supports the J2SE platform.

If you've worked with AWT components. Neither JDK 1. or to change the algorithm used to determine focus traversal. What's new with Swing's focus management Swing provides some powerful new ways to manage focus changes at the component level.1 deprecates nextFocus and replaces it with transferFocus. which provides exactly the same functionality as nextFocus.JDK 1.1 event model. Swing overrides this Component method with an implementation that allows you to call the new .1 provide any means for applications to override the behavior of the focus manager. Let's take a quick look at the relationship between the AWT and Swing focus managers. Swing allows you to create and use your own custom focus manager.0 nor 1.1 deprecates gotFocus and lostFocus and replaces them with the addFocusListener method to support focus change notification using the 1. you're probably familiar with the requestFocus method. Likewise. The following figure shows how JFC incorporates both the AWT and Swing focus managers. AWT and Swing focus manager relationship Explicitly setting the focus There are two JComponent methods that allow you to explicitly set the focus to a given component: requestFocus and grabFocus. 1. Here's what you can do with focus management at that level: * Set the focus to a given component * Transfer the focus to the next component in the focus-change order * Determine if a component has the focus * Disable a component from responding to focus requests * Allow the component that currently has the focus to manage the next focus change And if this isn't enough to meet your focus control needs.

} } }). However. The mouse adapter's mouseEntered method is called whenever the mouse passes over the component. This method can enable or disable the component from getting the focus via requestFocus. This fragment adds a mouse listener. } requestFocus(). The Swing docs say that only focus managers should use grabFocus. Let's take a look at a bit of sample code written for components. you can't use setRequestFocusEnabled to prevent a component from getting the focus via the focus manager.setRequestFocusEnabled method. That's because the focus manager uses a new Swing method. The implementation for mouseEntered calls hasFocus to see if the component already has the focus. and if it doesn't. grabFocus works just like requestFocus. to give components the focus. } . grabFocus. A slightly more fail-safe way to set the focus would be: if(!hasFocus()) { // ensure requestFocus is enabled if(!isRequestFocusEnabled()) { setRequestFocusEnabled(true). This code will cause a component to get the focus whenever the component is under the mouse: // add a listener for mouse enter addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent event) { // Request the focus (if don't already have it) if(!hasFocus()) { requestFocus(). calls requestFocus to give the component the focus. except that you can't disable it. which is implemented in an anonymous inner class based on the MouseAdapter adapter class.

// private instance variables private boolean bFocusIndicated = false. This method can be useful for implementing components that automatically advance the focus when the user has completed whatever task or purpose is served by the component (like choosing from a group of radio buttons or items in a list).1's focus listener implementation. } Transferring the focus Like AWT 1.nothing fancy here. FocusAdapter. The addFocusListener and removeFocusListener methods add and remove focus listeners for components. I'll give a brief description of focus listeners for those readers that aren't familiar with them.you would have to know which component has the focus just before the component that you actually want to set the focus to. Standard event-listener stuff -.1. . Let's glance at a piece of code. Focus listeners provide a means of notifying applications when components gain or lose the focus. The adapter class for focus events. if you know this stuff you may want to skip on to the next section. The following code fragment adds a focus listener that changes the background color when a component gets the focus.And if you're writing a focus manager. public void transferFocus(). Swing provides the means for a component to transfer the focus to the next component with the transferFocus method. has two methods: focusGained and focusLost. Detecting focus changes Swing doesn't bring any changes to the operation of AWT 1. transferFocus is not really useful for explicitly setting the focus -. you can use grabFocus: if(!hasFocus()) { grabFocus().

.private Color originalColor. Managing focus at the component level Up until this point. bFocusIndicated = false. This can be a powerful alternative to writing your own focus manager . . hence the need for the bFocusIndicated variable to keep up with whether we've indicated focus on a component.1 components. Swing provides a mechanism for component-managed focus traversal. } } public void focusLost(FocusEvent e) { // restore original background color setBackground(originalColor). bFocusIndicated = true.darker()). Now we'll start getting into Swing's new and improved features. You can't always count on getting focusGained and focusLost events in matched pairs. // add a listener for focus events addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { if(!bFocusIndicated) { // set background to a darker color to indicate focus originalColor = getBackground(). } }). most of what I've covered is probably familiar to you if you have much experience with AWT 1. . setBackground(originalColor.

One obvious solution to this problem -.calling requestFocus while processing the focusLost event -. say you want to develop a text field component that won't surrender the focus until the user enters valid data. // Constructors public MyTextField () { super().1 by using the focusLost notification to validate the data and then set the focus back to the text field. If you've tried to implement such a component in AWT 1.doesn't always have a predictable outcome. The following code implements a text field that doesn't allow the focus to traverse to the next component until valid data is entered: class MyTextField extends JTextField { boolean validDataEntered = false. you can override the isManagingFocus method to return true and get Tab and Shift-Tab keystrokes sent to the component's key listener. This allows the component to manage focus traversal when the component has the focus. With Swing components.and is a better solution for developing components that have their own particular behavior when it comes to gaining and losing the focus. init(). } // Private initialization routine to be run at construct time private void init() { // add a key event listener that will consume tab keys until valid data entered in field addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent event) { // look for tab keys . you've probably experienced some frustration. init(). For example. } public MyTextField (String text) { super(text).

In fact. you can't even do this by writing your own custom focus manager.getKeyChar() == '\t') { // if no valid data entered in field. Of course.if(event. you would want to present a message to the user and inform them as to why they are being prevented from tabbing away from the text field. consume event // so that it won't be passed on to focus manager if(!validDataEntered) { event. } // Override to inform focus manager that component is managing focus changes public boolean isManagingFocus() { return true. If no valid data has been entered.VK_TAB || event. One limitation to managing focus traversal at the component level is that you can't control focus changes initiated by mouse actions. } } In this example. the text field's key listener consumes Tab keystrokes. any keystrokes other than Tab keystrokes are considered to be valid data. } } else { // assume any key other than tab is valid data validDataEntered = true. } } }). if you were implementing this technique in a real application.consume(). To control focus .getKeyCode() == KeyEvent. preventing them from reaching the focus manager.

Although Swing does provide a complete. Writing a custom focus manager Swing provides the ability for applications to install and use their own custom focus manager. but it doesn't quite work that way -.changes initiated by mouse actions.when you disable it. writing a robust focus manager that works well with any arbitrary component hierarchy is no trivial task. FocusManager. Unfortunately. In my opinion. you can't disable the focus manager on a per-window or per-container basis -. That would be nice. it's disabled for your entire application. For example. you should disable the Swing focus manager with the following line of code. clean structure for supporting custom focus managers. you might think you can just override the compareTabOrder method and implement any tabbing algorithm you like. I guarantee you will spend a lot of time in the sources trying to understand exactly how everything works. so if you're mixing AWT and Swing components.disableSwingFocusManager(). It can only manage focus for Swing components. or by managing focus at the component level. Overriding the behavior of the default focus manager (represented by the DefaultFocusManager class) may look like a promising and cheap way to create a custom focus manager.the default focus manager makes certain assumptions about the tabbing order before it even calls compareTabOrder. I don't recommend this approach. you'll have to modify the low-level mouse handling for all of your components. Mixing AWT and Swing components The Swing focus manager effectively sits on top of the AWT focus manager. you might want to consider writing a custom focus manager. The AWT focus manager will then manage focus for all of your components. If you can't get the focus traversal behavior you want by using requestFocus and transferFocus. the default focus manager isn't really designed to be extended. If you try to customize the default focus manager. The structure of a focus manager .

focusNextComponent.there are only three methods you must implement to create a custom focus manager. This method looks for focus-change keystrokes (normally Tab and Shift-Tab) and then calls focusNextComponent or focusPreviousComponent to change the focus. This class contains four static class methods for applications to use to install and manage focus managers. * getCurrentManager * setCurrentManager * disableSwingFocusManager * isFocusManagerEnabled The remaining three methods in the class are abstract methods that focus managers must implement: * processKeyEvent * focusNextComponent * focusPreviousComponent That's right -. Two of the methods." implements a focus manager that allows you to specify the tab order of components. setCurrentManager. and focusPreviousComponent are methods you must override and implement if you are writing a focus manager. Example of a custom focus manager Let's take a look at an example of a custom focus manager. is a low-level handler for key events. processKeyEvent. called "CustomFocusManagerExample. simply advance the focus to the next or previous component. Focus managers are based on the abstract FocusManager class. The static class methods getCurrentManager. disableSwingFocusManager and isFocusManagerEnabled give you access to the current focus manager and allow you to disable the Swing focus management services as well as install your own focus manager.Let's take a look at the structure of a Swing focus manager. The abstract methods processKeyEvent. focusNextComponent and focusPreviousComponent. This example application. The other method. regardless of their screen position or the order .

it adds them in a somewhat arbitrary order: one. Instead of adding the text fields to their container in numerical order. six. It's designed to be run as an applet or as a standalone application. five. * A component that implements methods required by the custom focus manager. three. four.in which they were added to their container. four. Screen shot of CustomFocusManagerExample application Now let's get into the implementation. The application then sets the tab order such that focus traverses the text fields in numerical order: one. three. * The application shell to illustrate use of the custom focus manager. . This component is represented by the MyTextField class. six. interface CustomFocusManagerSupport { public void setNextFocus(JComponent component). The interface class is represented by the CustomFocusManagerSupport class. two. Here's a screen shot of the application when it's run as a standalone application. represented by the CustomFocusManager class. The application shell consists of the CustomFocusManagerExample and AppPanel classes. * An interface class that components managed by this custom focus manager must implement. We'll start with the interface that components must implement to be managed by our custom focus manager. five. two. There are four parts to this example: * A custom focus manager. The custom focus manager used in this example determines focus changes by querying the currently-focused component for the next or previous component to get the focus. an extension of JTextField. Components managed by this focus manager must implement methods for setting and getting the next and previous focus recipients. The application creates six text fields identified by a number from one to six.

public JComponent getPreviousFocus(). // Implementation of CustomFocusManagerSupport interface public void setNextFocus(JComponent component) { nextFocus = component. } } Now let's look at the code for the custom focus manager. Two of the abstract methods that focus managers must implement are focusNextComponent and focusPreviousComponent.. an extension of the FocusManager class. } public JComponent getNextFocus() { return (nextFocus). } The interface is pretty simple -.just a few methods to set and get focus-traversal information. } public JComponent getPreviousFocus() { return (previousFocus). public void focusNextComponent(Component component) { if(component instanceof CustomFocusManagerSupport) { .. public JComponent getNextFocus(). class MyTextField extends JTextField implements CustomFocusManagerSupport { private JComponent nextFocus = null. Here's how we implement these methods in the CustomFocusManager class. // Constructors . } public void setPreviousFocus(JComponent component) { previousFocus = component. The MyTextField class implements this interface by adding two private instance data members to store the next and previous components to get the focus.public void setPreviousFocus(JComponent component). This example focus manager is implemented in a class named CustomFocusManager. private JComponent previousFocus = null.

The final part of the custom focus manager code is the implementation of the processKeyEvent method.getNextFocus().grabFocus(). We then set the focus to that component by calling its grabFocus method.CustomFocusManagerSupport focusedComponent = (CustomFocusManagerSupport) component.getPreviousFocus(). these are abstract methods that all focus managers must implement. you must give it the component that should have the focus before the component you want to advance it to. This is the part .getNextFocus() != null) { focusedComponent. Before I show you how the focus manager processes keystrokes. Remember. I know this seems convoluted. if (focusedComponent. } } } Nothing fancy here either -. Focus management is a cooperative effort between components and the focus manager. Does it seem odd that these methods have a parameter specifying a component? When you tell the focus manager to advance the focus.grabFocus(). if (focusedComponent. let's stop for a moment and think about the focusNextComponent and focusPreviousComponent methods. but it makes sense when you understand that the focus manager doesn't keep track of which component currently has the focus.getPreviousFocus() != null) { focusedComponent. } } } public void focusPreviousComponent(Component component) { if(component instanceof CustomFocusManagerSupport) { CustomFocusManagerSupport focusedComponent = (CustomFocusManagerSupport) component.we just check to see if the given component implements the CustomFocusManagerSupport interface and call getPreviousFocus or getNextFocus to get the component that should next get the focus.

public void processKeyEvent(Component component.VK_TAB || event. } else { focusNextComponent(component).getModifiers() & ActionEvent. Note that focus changes occur only on the KEY_PRESSED event -processKeyEvent consumes corresponding KEY_RELEASED and KEY_TYPED events by calling the KeyEvent. It only handles focus for components that implement the CustomFocusManagerSupport interface.consume().SHIFT_MASK) == ActionEvent. The remaining piece of the puzzle .getID() == KeyEvent. } } // consume all tab key events event.getKeyCode() == KeyEvent.consume method. KeyEvent event) { if(component instanceof CustomFocusManagerSupport) { // look for tab key if(event. } } } The processKeyEvent method looks for Tab and Shift-Tab keystrokes and then calls focusNextComponent and focusPreviousComponent to change the focus.SHIFT_MASK) { focusPreviousComponent(component).KEY_PRESSED){ // is shift pressed? if ((event.getKeyChar() == '\t') { if(event.of the focus manager that actually handles the special keystrokes that change the focus.

setCurrentManager(fm). This means that it should be possible for a Unix developer to select the Win95/NT look and feel and see what the interface would look like on that platform. their appearance is controlled purely by the Java code (without the need for platform dependent peers – as in JDK 1. a separate user interface “view” component performs the actual rendering of the component on the screen.0 and 1. This allows different views to be plugged in. FocusManager fm = new CustomFocusManager(). FocusManager. In swing. As all graphical components are “lightweight”. This is accomplished by creating an instance of the custom focus manager and setting it as the current focus manager by calling the FocusManager class method setCurrentManager. but with interfaces that match the interface . This in turn allows the idea of different “looks and feels”.is how the application installs a custom focus manager. This means that the windows should look the same whatever platform they are on and should be easier to maintain (for Sun). Firstly.1). all components in Swing are 100% pure Java (referred to as lightweight). It also means that it is easier to deploy the same software on different platforms.

Swing also provides a greatly increased set of facilities for graphical user interfaces. much of what an AWT developer already knows will go a long way to helping them to get started with Swing as will be shown by this article.0 and 1.1 of Java is being thrown out of the window? Not exactly.manager on that particular platform. Indeed. However. menus with icons. borders and improved support for fonts and colours. . icons on buttons. This separation of view form the actual component is based on a modified version of the Model-View-Controller architecture (described later). including trees. So does this mean that the AWT (The Abstract Window Kit) of version 1. as the AWT knows nothing about different “look and feels” and mixes both lightweight (pure Java) and heavy weight (native) components. it makes little sense to continue to use the AWT when all of the AWT’s facilities (and more) are replicated in Swing. dockable menus bars. From the point of view of the developer. the AWT will still be available and systems can be constructed using both the AWT and Swing (although there are some limitations). any AWT windows may not be consistent with the Swing windows.

0 and 1. the Accessibility API or Drag and Drop. the performance enhancements provided will be of welcome.So that’s Swing. So where does that leave the JDK 1. as can be seem from the above list.1.2 includes numerous collection classes for data structures that greatly improve on the basic set of facilities provided with JDK 1. this is not the case. For example.2? In many ways JDK 1. Indeed one insider has said that it is “spelt JFC but pronounced Swing”. . except to say that each is a significant development with Java2D being a major improvement over the basic facilities in previous version of the JDK. Swing is a core component of the JFC along with Java2D. However. Accessibility and Drag and Drop. JDK 1. Equally.2 is the JFC plus various enhancements which consolidate JDK 1. however it is the Swing set of components that will grab the attention. As this column is about Swing we will not digress into Java2D. It is the largest element of the JFC (as it stands now) and will therefore be taken by many to equate to the JFC.1. but what is its relationship to the JFC and the JDK? Essentially.

SCREENS :- 1) Executing the application .

2) Screen 2 .

2) Screen 3 .

4) Screen 4 .

Testing: - .

The results of testing are used later on during maintainence also The aim of testing is often to demonstrate that a program works by showing that it has no errors. design and coding.but the intent should be to show that a program Doesn’t work. Thus. Testing During earlier definition and development phases. represents interesting anomaly for the software. . before the system was ready for the implementation. errors were found and corrected by using the following testing steps and corrections are also noted for future use. The testing phase involves the testing of the developed system using various test data.Testing performs a very critical role for quality assurance and for ensuring the reliability of software. Testing is the process of detecting errors. Preparation of the test data plays a vital role in the system testing. After preparing the test data the system under study was tested using those test data.Software testing is a critical element of software quality assurance and represents the ultimate reviews of specification. it was attempted to build software from an abstract concept to tangible implementation.The basic purpose of testing phase is to detect the errors that may be present in the program.Hence one should not start testing with the intent of showing that a program works. While testing the system. Testing Objectives: . a series of testing is performed for the proposed system.

the module. • • • • • Testing is a process of executing a program with the intent of finding an error. we can say. systematically and with minimum effort and time. The tests are inadequate to detect possibly present errors.The basic levels of testing are Client Needs Acceptance Testing Requirements System Testing Design Integration Testing Code Unit Testing Unit testing: Unit testing focuses verification effort on the smallest unit of software i.The main objective of testing is to uncover a host of errors. Using the detailed design and the process specifications testing is done to . A good test case is one that has a high probability of finding error. if it exists. Stating formally. A successful test is one that uncovers an as yet undiscovered error. Levels of testing In order to uncover the errors present in different phases we have the concept of levels of testing.e. The software more or less confirms to the quality and reliable standards.

the emphasis being on testing interfaces between modules. Integration Testing: After the unit testing we have to perform integration testing. In this project ’Digital Water Marking on Multimedia Files’ the techniques FHT and DCT Are tested using Unit testing.uncover errors within the boundary of the module. This testing activity can be considered as testing the design and hence the emphasis on testing module interactions. each module is found to be working satisfactorily. as regard to the expected output from the module. When integrating all the modules we have checked whether the integration effects working of any of the services by giving different combinations of inputs with which the two services run perfectly before Integration.when developing the module as well as finishing the development so that each module works without any error. important control paths are tested to uncover error with in the boundary of the module. . Using the unit test plans.The inputs are validated when accepting from the user. All modules must be successful in the unit test before the start of the integration testing begins. This is known as form testing. Unit testing focuses verification effort on the similar unit of software design the form. Each module has been tested by giving different sets of inputs. The goal here is to see if modules can be integrated properly. prepared in design phase of the system development as a guide. In this project integrating all the modules forms the main system. In this testing step.

One is on the screen and the other is on the printed form. Here entire project has been tested against requirements of project and it is checked whether all requirements of project have been satisfied or not. and the goal os to see if software meets its requirements. All modules are combined in the testing step. SYSTEM TESTING Here the entire software system is tested. Here the output format is considered in two ways. since no system could be useful if it does not produce the desired output in the specified format. The output generated are displayed by the system under consideration or tested by asking the user about the format required by them. . Then the entire program is tested as a whole.The reference document for this process is the requirements document. Output testing: After performing validation testing.Integration testing a systematic technique for constructing the program structure while at the same time conducting tests to uncover errors associated with the interface. the next steps are output testing of the proposed system. the software is completely assembled as a package. Validation testing: At the culmination of the integration testing. interfacing errors have been uncovered and corrected and final series of software validation testing begins.

ACCEPTANCE TESTING Acceptance Test is performed with realistic data of the client to demonstrate that the software is working satisfactorily.the internal logic of program is not emphasized. Testing here is focused on external behavoiur of the system. • • • • Input screen design Output screen design Online message to guide the user Menu driven system . The system under consideration was tested for user acceptance by constantly keeping in touch with the perspective system users at the time of developing and making changes whenever required. Test cases should be selected so that the largest number of attributes of an equivalence class is exercised at once. In this project ‘Digital Watermarking on Multimedia Files’ we have collected some data and tested whether project is working correctly or not. This is done with regard to the following points.The testing phase is an important part of software development. User acceptance of a system is the key factor for the success of any system. It is the process of finding errors and missing operations and also a complete verification to determine whether the objectives are met and the user requirements are satisfied.

. I have generated a list of test cases . I tested step wise every piece of code.White Box Testing This is a unit testing method where a unit will be taken at a time and tested thoroughly at a statement level to find the maximum possible errors.The embedding and extracting processes have been described in detail. The white box testing is also called Glass Box Testing.the embedding scheme takes the spatial information into consideration.which is used to check all possible combinations of execution paths through the code at every module level.In the proposed method.This increases the invisibility of the watermark in the watermarked image. Here the module will be treated as a block box that will take some Input generate output. CONCLUSION This paper has presented a robust hybrid watermarking technique for Embedding characters or grayscale image watermark into a container image based on the FHT.The experimental results show that the proposed method is robust against approximately 70% of stirmark attacks.sample data.and generates the watermark strength factor according to the visual mask. Black Box Testing This testing method considers a module as a single unit and checks the unit at interface and communication with other modules rather getting into details at statement level. Output for a given set of input combinations are forwarded to other module. taking care that every statement in the code is executed at least once.

When compared with the DCT. . such as DCT.it is found to be more robust against various attacks.The Hadamard transform has more useful middle and high frequency bands than several high gain transforms.It also refers significant advantage in terms of shorter processing time and the ease of hardware implementation than many common transform techniques.

.66.T.” IEEE Processing. vol . 4..L. vol. Signal Processing. Conf.Van Schyndel... Jan.Cox. Bloom..4. 5. Ratakonda.” in Proc. T. J. 1994. vol. 1997. vol. Leighton.8. Scale and Translation Invarient .F.Cox. J. Trans. “Secure spread spectrum watermarking for multimedia. “A new wavelet – base for watermarking using wavelet transform “. Z. J. Qin. 6.” IEEE Trans.J.Bristol. 1998. 86-90..K. Int . M.. Conf. Image 1687... Sept.Joseph. Image Processing. Proc. N.BIBLOGRAPHY 1. No. K.” Proc . 58-68. Pun T.”Watermarking in the Real World: An Application to DVD”. R. Shamoon.. 1673- Digital Image Watermarking”. J. Wksp Multimedia and security at ACM Multimedia 98 . No. U.”Perceptual digital watermark of image 1272.T. A.. Aug. Osborne. 6. Nov. 44.. vol.J.45. 1998. pp.Miller.. Image Processing.Dugad. 2.. Y..101. 1999. P..K. IEEE Int. 3. Dec. Ahuja. On Consumer Electronics. A. . O’ Ruanaidh.H. Wu. I. Image Processing.3. C.Q. 1267- image. 2.” A digital watermark.. 7. 1097. 1998. 1998.J.Hsu. F. IEEE Trans. Trikel. Fu.Z. Vol. R. “Hidden digital watermarks in images. Kilian. 303-317. I.. “Rotation.Wei..

Sign up to vote on this title
UsefulNot useful