Hemanth Balaji

Greenhorn
+ Follow
since Jan 02, 2006
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hemanth Balaji

Hello All,

I am using JBoss v5.1.0.GA. When I start my server without deploying my Jar file, it starts fine.

When I place my ejb jar file in the all\server\deploy folder and try to restart the server, I get a huge spool of errors. I have tried to clip the first part of the error by trying to pause the screen and uploaded the screenshot.

My JBoss Version: JBoss v5.1.0.GA
Java Version - JDK 1.6.0

Please Help me Get started with the Issue...

Thanks & Regards,
Hemanth
13 years ago

Nathan Pruett wrote:For a button, the majority of those are just method calls, as opposed to having to implement "button-like" features in a JLabel or JPanel. Here's a quick example of making a JButton into a "Link" - the only part I had to implement was to rollover to change the text color:



Hello Nathan,

This is a great Peice of code which I could also use to make my Jbutton to look like a hyperlink. On Click of the Hyperlink I would need to open up a Dialog. However I need to have some tweaks in here. The Label on the JButton should show a Hand Cursor when Hovered upon my Mouse Enter and Mouse Exit to the Normal Curson. How do I get the Hand Cursor

Regards,
Hemanth

Update: I got it.. Just Added setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); in mouseEntered. But Nathan, Thanks for the Code. Neat Stuff.
14 years ago
Sun java certification scjp exam programmer resources including certification mock exams and scjp2 faqs

Sun Java Certification SCJP
I have a Person Object with attributes like name, age, sex etc which I wanna store in the sybase database. The column in which it is to be stored is of "text" datatype.

I have converted the object into a Byte Output Stream and stored the object as a Byte Array in to the database. I have done something like this..



Now when I want to read the object from the database I did something like this..




I used rs.getBytes and do the following as shown above. Gives me an sql exception. I used getClob also. Still it gives me some sql exception. What I want is the object back. How do I get it back.


Basically My sybase column datatype is "text". Is there a better way to serialize the object and store in the databse. If there is one please let me know. Note that I cant change the type of column type (text) to any other type...
17 years ago
Singleton Pattern

The Singleton Pattern is one of the commonly used design templates when there needs to be a control on how an object can be created. This design pattern proposes that at any time there can only be one instance of a singleton (object) created by the JVM. The Singleton class�s default constructor is made private, which prevents the direct instantiation of the object by others (Other Classes).
One such scenario where it might prove useful is when we develop the Java Help Module in a project. JavaHelp is an extensible, platform-independent help system that enables authors and developers to incorporate online help into applications. Since at any time we can do only with one main Help object and use the same object in different screens, Singleton Pattern suits best for its implementation.
Implementing the Singleton Pattern
To implement this design pattern we need to consider the following 4 steps:

Step 1: Provide a default Private constructor



Step 2: Create a Method for getting the reference to the Singleton Object



We write a public static getter or access method to get the instance of the Singleton Object at runtime. First time the object is created inside this method as it is null. Subsequent calls to this method returns the same object created as the object is globally declared (private) and the hence the same referenced object is returned.

Step 3: Make the Access method Synchronized to prevent Thread Problems.



It could happen that the access method may be called twice from 2 different classes at the same time and hence more than one singleton object being created. This could violate singleton pattern principle. In order to prevent the simultaneous invocation of the getter method by 2 threads or classes simultaneously we add the synchronized keyword to the method declaration

Step 4: Override the Object clone method to prevent cloning.
We can still be able to create a copy of the Object by cloning it using the Object�s clone method. This can be done as shown below


This again violates the Singleton Design Pattern's objective. So to deal with this we need to override the Object�s clone method which throws a CloneNotSupportedException exception.



The below program shows the final Implementation of Singleton Design Pattern in java, by using all the 4 steps mentioned above.



Regards,
Hemanth
Hi,
This is Hemanth. I have made a website http://www.java-swing-tutorial.com which contains a beginner level tutorial to learn Java Swing along with source code.

Link Name: Java Swing Tutorial

Description: Java swing tutorial and source code giving in-depth coverage of everything you need to know about java swing, providing descriptions of commonly used components.

Thanking you in advance,
Hemanth
17 years ago