April 30, 1998

Setting icon image for dialogs in java

Question: How can we set icon images for the dialogs? Answer: There is currently (as of Java 1.1 and 1.2beta3) no way to set icon images for dialogs. On most platforms, dialogs will inheritthe same icon used by their parent Frame.The Swing classes in the Java FoundationClasses suffer from the

Byte to string conversion

Question: A variable retrieves its contents in the byte form, since I require to convert into the string format . Which is the method used in java or rather how do I go about it? Answer: The String class has a few constructorsthat accept a byte array as an argument.To

Garbage collection process

Question: If i have a code like this in the while loop while (true){ java.util.date ldt_date = new java.util.Date() …} Will the ldt_date variable be initialized with new location in memory all the time and previously allocated will be garbage collected by java. I am not sure about what’s happening

Java Pausing Abilities

Question: I want to make my Java program pause for a specified amount of time, but I don’t want to use a threading implementation. How can I do this? Answer: You really cannot avoid using threads in Java because the Java virtual machine automatically starts at least two separate threads.

ASCII Value Conversions

Question: How can I convert an integer ascii representationof a number to its character equivalent in astring form. For example A= 72 What procedure will take in int 72 and returnstring “A” Answer: The simplest way to accomplish this is totypecast the int to a char and convert thatchar to