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.

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. Fast Hadamard Transform (FHT) is a watermarking approach proposed in a conference paper developed by Datamark Technologies Pvt Ltd. Singapore. This algorithm is often referred as robust one because of its following properties and attributes that meets the requirements. To increase the invisibility of he water mark a visual model based on the original image charecterstics.It also offers a significant advantage in term of a shorter processing time and the ease of hardware implementation than many common transformation techniques. 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. . it found to be more robust against various attacks . The Hadamard transform has more useful middle and high frequency bands than several high gain transforms. In this paper we propose a fast Hadamard transform based watermarking approach that embeds a gray scale image as a watermark.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. The watermark gray scale image is decomposed into Hadamard coefficients for embedding.When compared with the DCT. 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. such as DCT. such as edges and textures are incorporated to determine the watermarking strength factor.

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

DESIGN PRINCIPLES & EXPLANATION: With the advent of the Internet. 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.Over the past few years. Cox et al. the online purchasing and distribution of digital images can now be performed relatively easily.However. Hsu and Wu embedded an image watermark into selectively modified middle frequency of discrete cosine transform (DCT) coefficients of container image[4].and video). A digital watermark is a sequence of information. 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. Joseph et al developed a digital image watermarking using the Fourier .However. 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. audio.this technique has relatively low information hiding capacity and can be easily erased by lossy image compression.g. The techniques proposed so far can be divided into two main groups according to the embedding domain of the container image. They embedded a Gaussian distributed sequence into the perceptually most significant frequency components of container image. The other is the frequency domain approach. One group is the spatial domain approach.[3] used the spread spectrum communication for digital multimedia watermarking. A great deal of research efforts has been focused on digital image watermarking in recent years. This approach can be embed more information bits and is relatively robust to attacks. 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].image.

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].Several other methods used discrete wavelet transform (DWT) to hide the data to the frequency domain[6-8].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.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.scaling and translation[5].some of these techniques are quite complicated to implement in real-time.which is used in the watermarking embedding and extraction process.we give a brief overview of the Hadamard tranform representation of image data. To increase the invisibility of the watermark. 2 . In this section.we propose a fast Hadamard transform(FHT) based watermarking approach that embeds a grayscale image as a water mark.Moreover. .The reason of choosing FHT domain is given below.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.such as edges and textures are incorporated to determine the watermarking strength factor.Mellin transform that is invariant to image manipulations or attacks due to rotation .The watermark grayscale image is decomposed into Hadamard coefficients for embedding.10]. In this algorithm . 2D-Hadamard transform of signal The 2D-Hadamard transformation has been used extensively in image processing and image compression [9.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.

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. In contrast to cryptography where the content of a communicated message is secret. Some of the techniques of steganography like use of invisible ink. The low-energy signal is called watermark and it depicts some metadata. word spacing patterns in printed documents. Steganography is a technique for concealed communication. Digital watermarking is similar to watermarking physical objects except that the watermarking technique is used for digital content instead of physical objects. coding messages in music compositions.the 2DHadamard transform is given by [V]= Hn [U] Hn N 1. 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. It is descendent of a technique known as steganography which had been in existence for at least a few hundred years.. 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. The watermarking techniques prevent forgery and unauthorized replication of physical objects. like security or rights information about the main signal. Steganography is technique where a secret message is hidden within another unrelated message and then communicated to the other party.1 Digital Watermarking Watermarking is not a new technique. The main signal in which the . etc. In digital watermarking a low-energy signal is imperceptibly embedded in another signal.Let [U] represents the original image and[V] the transformed image .

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

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

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

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

As opposed to this. the users are aware of the presence of a watermark. • Public & Private Watermarking: In public watermarking. Asymmetric & Symmetric Watermarking 5. Public & Private Watermarking 4. • Robust & Fragile Watermarking: Robust watermarking is a technique in which modification to the watermarked content will not affect the 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. In non-steganographic watermarking. . users of the content are authorized to detect the watermark while in private watermarking the users are not authorized to detect the watermark. fragile watermarking is a technique in which watermark gets destroyed when watermarked content is modified or tampered with. • 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. • Steganographic & Non-Steganographic watermarking: Steganographic watermarking is the technique where content users are unaware of the presence of a watermark. Steganographic & Non-Steganographic Watermarking.3.

These intentional errors are the marks that constitute the total watermarking.2 Digital watermarking A Digital watermark is a sequence of information.1 Spatial domain approach There is a vast majority of image watermarking approaches. 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. • • Spatial domain approach Frequency domain approach 2. it is fragile to any data processing. with direct replacement between cover image’s LSB and message (watermark) bits by adopting different logical or arithmetic combinations. 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. 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. because information is hidden in LSB.Steganographic watermarking is used in fingerprinting applications while non steganographic watermarking techniques can be used to deter piracy 2. A great deal of research efforts has been focused on digital image watermarking in recent years. 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. . which results in loss of information from these LSB bits. However. for water marking digital data and several commercial software are also available . The techniques proposed so far can be divided into two main groups according to the embedding domain of container image. Although water marking does not prevent data being stolen (illegal copying). but allows establishing the original ownership. containing the owner’s copy right information for protected digital content.2.

image-adaptive). Wavelet). 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. and very robust. Specifically. Image-adaptive watermarks are usually transform-based. Below Figure shows the procedure for image-adaptive watermarking . And they are embedded directly into an image's pixel data.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. visual models allow the user to raise or lower the amplitude of the watermark according to the image content (hence the name. The watermarks that are constructed using spatial domain approach are called spatial watermarks. before such changes are noticeable under standard viewing conditions. These models originally developed for image compression. These visual models provide thresholds for how much a given transform coefficient can change. However. Spectral (or transform-based) watermarks are incorporated into an image's transform coefficients (DCT. this technique has relatively low information hiding capacity and can be easily erased by lossy image compression. They locally adapt the strength of the watermark to the image content through perceptual models for human vision.

3 Non-Blind Digital watermarking It is also called as Private Watermarking. and then it produces the watermark.Figure 2.1 Image adaptive watermarking 2. In this scheme the original cover signal is required during the detection process. The main issue is the requirement of the original image at the detection/decoding stage. . 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. 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). The DCT is similar to the discrete Fourier transform: it transforms a signal or image from the spatial domain to the frequency domain. 2. DCT and wavelet transforms are examples of Frequency Domain Approach.2. Watermark extraction would be a simple matter of subtracting the original image’s blue channel from the watermarked image’s blue channel.2 Frequency domain approach This approach can embed more information bits and is relatively robust to attacks.2.

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

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

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

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

Subset Alteration Altering a subset of the items in the original data set such that there is still value associated with the resulting set. This addition is not to significantly alter the useful (from Mallory’s perspective) properties of the initial set versus the resulting set. In the categorical data framework. Subset Addition Mallory adds a set of tuples to the original data. subset alteration is intuitively quite expensive from a data-value preservation perspective.Mallory can randomly select and use a subset of the original data set that might still provide value for its intended purpose. 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 . One has also to take into account semantic consistency issues that become immediately visible because of the discrete nature of the data.

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 (Fast Hadamard Transform) [15] is one of the blind and symmetric digital watermarking technique. The watermark grayscale image as a watermark. such as edges and textures are incorporated to determine the watermarking strength factor. FHT is a robust and efficient digital image watermarking algorithm for copy right protection of digital images.1 2D-Hadamard transform of signal The 2D-Hadamard transform has been used extensively in image processing and image compression. Fast Hadamard transform (FHT) based watermarking approach that embeds grayscale image as a watermark. Let [U] represents the original image and [V] the transformed image.A great deal of research efforts has been focused on digital image watermarking in the recent years. 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 watermark grayscale image is decomposed into Hadamard coefficients for embedding. 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. 3. a visual model based on the original image characteristics. the 2DHadamard transform is given by [V]= Hn [U] Hn . 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. To increase the invisibility of the watermark.

N Where H n represents and NxN Hadamard matrix. 2. as Hn = Hn-1 Or H n −1  H H n =  n −1   H n −1 − H n −1  In our algorithm. n=1. H1 . 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. real numbers and the rows or columns of H n are orthogonal.with element values either +1 or -1. The advantages of Hadamard transform are that the elements of the transform matrix Hn are simple: they are binary. 3…. 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 . the third order Hadamard transform matrix H3 is used. the processing is performed based on 8x8 sub-blocks of the whole image. N=2n.

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

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

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

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

operational use and technical support required for implementing it. Operational Feasibility It refers to the feasibility of the product to be operational. Technical Feasibility It refers to whether the software that is available in the market fully supports the present application.FEASIBILITY ANALYSIS Feasibility study is an important phase in the software development process. Feasibility study should be performed on the basis of various criteria and parameters. If the benefits are more or less the same as the older system. . 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. then it is not feasible to develop the product. It also studies the additional training needed to be given to the people to make the application work. It includes the study of additional human resource required and their technical expertise. 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. It refers to the feasibility study of the product in terms of out comes of the product. It studies the pros and cons of using particular software for the development and its feasibility.

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

and will not make any alterations without the permission of the client. and will also by the basis for validating the final delivered system. Any changes made to the requirements in the future will have to go through a formal change approval process. The developer is responsible for asking for clarifications. It is meant for the use by the developers. 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. It also describes the interfaces for the system. . where necessary.

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

.

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 .

.. display keyfile.SEQUENCE DIAGRAMS:Insertion Sequence Diagram::FHTDigital Waterma.. 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() ..

.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( ) .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.. keyfil e.

AWT.TECHNOLOGIES One of the most difficult tasks is that. you either compile or interpret a program so that you can run it on your computer. 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. Java. JAVA Java technology is both a programming language and a platform. 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. The Java . the selection of the software. After initial selection further security is needed to determine the desirability of particular software compared with other candidates. SWINGS.

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 :-

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Class not found. 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. Creating Your Own Exception Sub Classes: . Illegal argument used to invoke a method. 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 created with a negative size. Access to a class is denied. Attempt violate security. Assignment to an array element of an Incompatible Invalid cast. Invalid conversion of a string a numeric format. Some type of index is out-of-bounds. A requested method does not exist. Invalid use of a null reference.Array Index Out of bounds Exception Array Store Exception type. Attempt to index outside the bounds of a string.

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

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

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

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

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

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

It will soon. OOP and Java We've been talking abstractly until now about OOP. otherwise you wouldn't be able to use your alarm clock. though. javac AlarmClock. and put in the code for the class definition above. A class is used to define a new type in Java.this.java . Everything happens within classes.java. albeit one that doesn't do much yet. 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. 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. and in variables in methods). and you'd never get to work on time. Rewrite your resume -. and classes are central to the language. Here's a (simple and incomplete) definition for an AlarmClock class. All executable code exists in classes (generally in methods). Create a file called AlarmClock. Compile it using javac.you're an object-oriented programmer.

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

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

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

* All new JFC components are JavaBeansTM architecture-based. The Java Foundation Classes includes many new.JFC's continually evolving new features include a rich suite of high-level components and services that are fully and uniquely cross-platform compatible. it eliminates the need to download special classes at runtime and is compatible with all AWT-based applications. Internet and Crossware applications. JFC will also include many of the key features found in Netscape's Internet Foundation Classes. The Java Development Kit (JDK) software release 1. And because Java is an open. * Components are cross-platform. .rapidly being incorporated into operating systems and hardware devices to provide a common meta-platform for applications. 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. Since the JFC is core to the Java platform. 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. and offer significant performance improvements.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). a broad complement of third party tools and components are available to enhance application development. Developers can easily bring in other third party components to enhance their JFC applications. developers can create and deploy large scale. * No framework lock-in. In addition. With the JFC. standard technology. 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. mission-critical intranet .

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

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

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

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

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

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. such offerings can cause confusion in the marketplace." JFC -. This is why it is important for Java applications and applets remain "100% Pure Java. This collaboration is evident in many of the specifications now available for review. The release of these classes with JDK 1. Once these specifications have been implemented the technology will become part of the JDK and will exist on every Java platform. New features will include: * Drag and Drop * New High-Level Components * Pluggable Look and Feel * Java 2D API * Accessibility Features for the Physically Challenged . Additions to the Java Foundation Classes will soon incorporate several features that further enhance a developer's ability to deliver scalable.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. Although their apparent enthusiasm for the Java platform is certainly understandable.Recently. commercial-grade applications. other companies have announced or delivered specifications and class libraries to the Java development community.1 marks the beginning of major enhancements that will continue to improve the completeness and functionality of Java GUI applications. network-centric applications a reality. Sun has endeavored to cultivate relationships with other technology providers in order to provide an open standard for all Java developers. 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.

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. thus facilitating a customizable look and feel without relying on native windowing systems or adding system overhead. These new high-level components will be available on all platforms as part of the standard Java platform. It will significantly improve application interoperability by enabling D&D between Java applications and non-Java applications. and improving the deployment of applications will be simplified. 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. . thereby eliminating the need to download extra classes. New Java Foundation Classes Components Working closely with Netscape and IBM. platform-independent implementation of D&D will enable objects to be dragged and dropped from one application to another. 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. The generic. it will support D&D between a Java application and a native application. This update will support D&D between two Java applications.* Additional new features continually being added Drag and Drop The Drag and Drop specification is available in the JDK 1. new JFC components will carry two important attributes: all components will be both lightweight and peerless. but more importantly. 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.

This comprehensive set of new high-level components will allow developers to create sophisticated professional-quality applets and applications using core JDK 1. 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.1 functionality. Check marks * StatusBar * SpinBox * ComboBox * Drop down ComboBox * Drop down ListBox * Composable Button * Multimedia Controls * MovieSlider .

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

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

more dynamic interaction. supports keyboard navigation. 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. Two of the most important features are Screen Readers and Screen Magnifiers. introduces a new highperformance UI framework. JavaBeans Architecture Compliant JavaBeans is an architecture and platform neutral API for creating and using dynamic Java components. JFC delivers a wish list of features that make Java the most compelling development platform available. The Screen Magnifier enables the user to adjust the magnification of the screen from 1 to 16 times the normal size. enables printing support. Accessibility features will be easily integrated into existing Java applications and will ensure an even broader audience for information in a networked age. Event tracking and screen content knowledge enable the user to more easily navigate the interface. JavaBeans enhances the Java platform by allowing richer. improves event handling. With the JDK 1. Font smoothing and text highlighting act in concert to create a clearer picture which renders the content more easily read and understood. JFC embraces the new JavaBeans component model.1 release.challenged users. The user can then interact with the GUI through the alternate computer input and output device. and introduces popup menu and scroll pane components. JFC Features Delivered in JDK 1.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 .

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

With JFC. all event data is accessed through a standard set/get . 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. 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. There are no longer public data fields.It is remarkably easy to take advantage of this new framework in existing applications and applets.EventObject is now unique because of the data it holds. To convert existing Canvas and Panel based components into Lightweight components.awt. a developer needs only to change the superclass from Canvas to Component and from Panel to Container. Events are identified by their class instead of their ID and are either propagated or delegated from an event "Source" to and event "Listener. Complex if-then-else conditional logic was required in the top level object to determine which object triggered an event.util. This was not scalable and was ill-suited to high-performance distributed applications. This is also a better way of passing events to distributed objects. 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. Each derived class from java." Only objects interested in a particular event need deal with the event and no super-event handler is required. The new event hierarchy is defined by the package java.0 was quite simple. the callback-style delegation event model is elegant yet powerful.event. When the paint() method is called.

Additionally. 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. you can create a listener class on the fly within the body of another class. With Inner Classes. Button button = new Button("Close"). a new Lightweight component may wish to send an "ActionEvent" when the user clicks on the component.1 which makes creating listener objects much more convenient. 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. When a source object wishes to delegate a specific event type. The "Listener" interface is typically defined by only a few methods. some derived Event classes still contain an ID to help objects distinguish between events within a specific group of events. 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). Any object desiring to be a "Listener" of a specific event type must implement the <EventType>Listener interface for that event type. it must first define a set of methods that enable the listener object(s) to register with the source.JavaBeans compliant interface. which makes it easy to implement the interface. ActionListener action = new ActionListener() { . a new language feature called "Inner Classes" has been added in JDK 1. These methods take the form of set<EventType>Listener for single-cast and/or add<EventType>Listener for multicast delegation. However.

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

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

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

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

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

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

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

realizing Java technology's promise. Accessibility . and simplified application deployment. imaging. Run Anywhere. and brings the future of portable GUI development here today." Overview of Java Foundation Classes (JFC) Features Abstract Window Toolkit (AWT) .on all Java platforms. * 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. including APIs for Drag and Drop. Swing GUI Components . New application services are slated for JFC that will further integrate Java applications into the desktop environment. "Write Once.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. . 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. Java 2D . more reliable applications.APIs to enable advanced 2D graphics. text and printing.APIs that enable programs to integrate into the native desktop window system. extensible GUI component library with a pluggable look and feel.APIs that extend the AWT to provide a rich.

A focus manager looks for special keystrokes that change the focus (usually the Tab and Shift-Tab keys).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.Internationalization . it's time to stop howling. Java has had a focus manager for AWT components since version 1. . Other than getting notification of focus changes with gotFocus and lostFocus. Solaris. and then decides which component will next get the focus.0 is through a few methods in the Component class. and Mac OSX. that's pretty much all you can do. including Microsoft Windows. and developers have howled about its inadequacies ever since. The focus management services provided with the Java Foundation Classes (JFC) should satisfy all of your needs for controlling focus changes. Well. you'll want to control how the focus moves between components. JDK 1. especially if you're designing a complex form or dialog for users to enter information.0 allows components to set the focus to themselves with requestFocus and to change the focus to the next component with nextFocus. 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. 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. Often. Linux.0 of the Java Development Kit (JDK). This includes the Input Method Framework API. A bit of history The only way to manage focus changes with JDK 1.

If you've worked with AWT components. Neither JDK 1. 1. or to change the algorithm used to determine focus traversal.0 nor 1.1 deprecates gotFocus and lostFocus and replaces them with the addFocusListener method to support focus change notification using the 1. The following figure shows how JFC incorporates both the AWT and Swing focus managers. Likewise. which provides exactly the same functionality as nextFocus.1 deprecates nextFocus and replaces it with transferFocus.1 provide any means for applications to override the behavior of the focus manager.JDK 1. What's new with Swing's focus management Swing provides some powerful new ways to manage focus changes at the component level. 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. Let's take a quick look at the relationship between the AWT and Swing focus managers.1 event model. Swing overrides this Component method with an implementation that allows you to call the new . Swing allows you to create and use your own custom focus manager. you're probably familiar with the requestFocus method. 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.

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

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

bFocusIndicated = true. most of what I've covered is probably familiar to you if you have much experience with AWT 1. 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. } } public void focusLost(FocusEvent e) { // restore original background color setBackground(originalColor).private Color originalColor. setBackground(originalColor. . This can be a powerful alternative to writing your own focus manager . Swing provides a mechanism for component-managed focus traversal. . // 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().1 components. .darker()). bFocusIndicated = false. hence the need for the bFocusIndicated variable to keep up with whether we've indicated focus on a component. Managing focus at the component level Up until this point. } }).

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. For example.1 by using the focusLost notification to validate the data and then set the focus back to the text field. One obvious solution to this problem -. you've probably experienced some frustration. 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. If you've tried to implement such a component in AWT 1. } public MyTextField (String text) { super(text). With Swing components. init().doesn't always have a predictable outcome. } // 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 . say you want to develop a text field component that won't surrender the focus until the user enters valid data.calling requestFocus while processing the focusLost event -. // Constructors public MyTextField () { super(). init().and is a better solution for developing components that have their own particular behavior when it comes to gaining and losing the focus.

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

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

simply advance the focus to the next or previous component. 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. This method looks for focus-change keystrokes (normally Tab and Shift-Tab) and then calls focusNextComponent or focusPreviousComponent to change the focus. * 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 -. The other method.Let's take a look at the structure of a Swing focus manager. setCurrentManager. 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. processKeyEvent. The static class methods getCurrentManager. focusNextComponent. Focus managers are based on the abstract FocusManager class." implements a focus manager that allows you to specify the tab order of components. This class contains four static class methods for applications to use to install and manage focus managers. This example application. regardless of their screen position or the order . focusNextComponent and focusPreviousComponent. called "CustomFocusManagerExample. Two of the methods. The abstract methods processKeyEvent. is a low-level handler for key events.there are only three methods you must implement to create 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. . four. two. We'll start with the interface that components must implement to be managed by our custom focus manager. six. Here's a screen shot of the application when it's run as a standalone application. Screen shot of CustomFocusManagerExample application Now let's get into the implementation. Instead of adding the text fields to their container in numerical order. it adds them in a somewhat arbitrary order: one. represented by the CustomFocusManager class. There are four parts to this example: * A custom focus manager. interface CustomFocusManagerSupport { public void setNextFocus(JComponent component). an extension of JTextField. four. The application creates six text fields identified by a number from one to six. five.in which they were added to their container. three. three. The interface class is represented by the CustomFocusManagerSupport class. The application then sets the tab order such that focus traverses the text fields in numerical order: one. * An interface class that components managed by this custom focus manager must implement. five. two. Components managed by this focus manager must implement methods for setting and getting the next and previous focus recipients. * A component that implements methods required by the custom focus manager. It's designed to be run as an applet or as a standalone application. The application shell consists of the CustomFocusManagerExample and AppPanel classes. * The application shell to illustrate use of the custom focus manager. six. This component is represented by the MyTextField class.

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

if (focusedComponent.getPreviousFocus(). but it makes sense when you understand that the focus manager doesn't keep track of which component currently has the focus. Does it seem odd that these methods have a parameter specifying a component? When you tell the focus manager to advance the focus. if (focusedComponent. } } } Nothing fancy here either -.grabFocus(). let's stop for a moment and think about the focusNextComponent and focusPreviousComponent methods. I know this seems convoluted. Remember. We then set the focus to that component by calling its grabFocus method. This is the part . Before I show you how the focus manager processes keystrokes. 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. } } } public void focusPreviousComponent(Component component) { if(component instanceof CustomFocusManagerSupport) { CustomFocusManagerSupport focusedComponent = (CustomFocusManagerSupport) component.CustomFocusManagerSupport focusedComponent = (CustomFocusManagerSupport) component.getNextFocus().getNextFocus() != null) { focusedComponent.grabFocus(). The final part of the custom focus manager code is the implementation of the processKeyEvent method.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. Focus management is a cooperative effort between components and the focus manager.getPreviousFocus() != null) { focusedComponent.

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

This means that the windows should look the same whatever platform they are on and should be easier to maintain (for Sun).0 and 1. but with interfaces that match the interface . 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.1). This in turn allows the idea of different “looks and feels”. In swing. Firstly. 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. FocusManager. 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. FocusManager fm = new CustomFocusManager(). This allows different views to be plugged in. As all graphical components are “lightweight”. a separate user interface “view” component performs the actual rendering of the component on the screen. their appearance is controlled purely by the Java code (without the need for platform dependent peers – as in JDK 1.setCurrentManager(fm).is how the application installs a custom focus manager.

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

For example. It is the largest element of the JFC (as it stands now) and will therefore be taken by many to equate to the JFC. Accessibility and Drag and Drop. as can be seem from the above list. 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. the performance enhancements provided will be of welcome.1. but what is its relationship to the JFC and the JDK? Essentially. So where does that leave the JDK 1.2 includes numerous collection classes for data structures that greatly improve on the basic set of facilities provided with JDK 1. As this column is about Swing we will not digress into Java2D. however it is the Swing set of components that will grab the attention.0 and 1. However.1.2? In many ways JDK 1.2 is the JFC plus various enhancements which consolidate JDK 1. this is not the case. . JDK 1. the Accessibility API or Drag and Drop. Equally.So that’s Swing. Swing is a core component of the JFC along with Java2D.

SCREENS :- 1) Executing the application .

2) Screen 2 .

2) Screen 3 .

4) Screen 4 .

Testing: - .

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

The software more or less confirms to the quality and reliable standards.The main objective of testing is to uncover a host of errors. we can say. Stating formally. The tests are inadequate to detect possibly present errors. A good test case is one that has a high probability of finding error.e. Levels of testing In order to uncover the errors present in different phases we have the concept of levels of testing. if it exists.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. systematically and with minimum effort and time. • • • • • Testing is a process of executing a program with the intent of finding an error. the module. A successful test is one that uncovers an as yet undiscovered error. Using the detailed design and the process specifications testing is done to .

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

Output testing: After performing validation testing. interfacing errors have been uncovered and corrected and final series of software validation testing begins. and the goal os to see if software meets its requirements. Then the entire program is tested as a whole. The output generated are displayed by the system under consideration or tested by asking the user about the format required by them. All modules are combined in the testing step.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 reference document for this process is the requirements document. the software is completely assembled as a package. . One is on the screen and the other is on the printed form. the next steps are output testing of the proposed system. Here entire project has been tested against requirements of project and it is checked whether all requirements of project have been satisfied or not. Validation testing: At the culmination of the integration testing. 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 internal logic of program is not emphasized. • • • • Input screen design Output screen design Online message to guide the user Menu driven system . Test cases should be selected so that the largest number of attributes of an equivalence class is exercised at once.ACCEPTANCE TESTING Acceptance Test is performed with realistic data of the client to demonstrate that the software is working satisfactorily. This is done with regard to the following points. User acceptance of a system is the key factor for the success of any system. Testing here is focused on external behavoiur of the 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. In this project ‘Digital Watermarking on Multimedia Files’ we have collected some data and tested whether project is working correctly or not. 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.The testing phase is an important part of software development.

I tested step wise every piece of code. Here the module will be treated as a block box that will take some Input generate output.sample data.The embedding and extracting processes have been described in detail.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. 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.which is used to check all possible combinations of execution paths through the code at every module level.the embedding scheme takes the spatial information into consideration. 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.The experimental results show that the proposed method is robust against approximately 70% of stirmark attacks.and generates the watermark strength factor according to the visual mask.This increases the invisibility of the watermark in the watermarked image.In the proposed method. . Output for a given set of input combinations are forwarded to other module. I have generated a list of test cases . taking care that every statement in the code is executed at least once. The white box testing is also called Glass Box Testing.

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

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

Sign up to vote on this title
UsefulNot useful