Tip Bank

DevX - Software Development Resource

Setting textfield focus

Question: I have an initially disabled TextField on a frame.When the user clicks a specific button the TextField is enabled. How do I set the input focus to the TextField

DevX - Software Development Resource

Copy & Paste

Question: How can I copy the selected text from a TextArea to the system clipboard or paste from the system clipboard to a TextArea? Answer: Java 1.1 introduced the java.awt.datatransfer

DevX - Software Development Resource

HTML browser in Java

Question: I am tring to make a stand-alone application that can read HTML files and render them like a Web browser. How can I do this in pure Java? Answer:

DevX - Software Development Resource

Saving Panels with TextField?

Question: I am writing a presentation application and want to take a Panel and add TextFields and maybe Images to it. Is it possible to save this Panel with TextFields

DevX - Software Development Resource

TextField listeners

Question: I want to capture an event that signals a user’s completed update to a TextField. Answer: In general, a user will finish entering text in a TextField by pressing

DevX - Software Development Resource

Classes in sun.* packages

All the classes in sun.* that accompany the Sun JDK are provided assupport classes that are used to implement specific sets of functionalityfor the core JDK classes. The classes in

DevX - Software Development Resource

Converting a String into an int

The Java core API possesses a method equivalent to the C atoi() function in Java. The java.lang.Integer class contains a method called parseInt()which will convert a String into an int.

DevX - Software Development Resource

Generating Random Numbers

The java.util package contains a class called Random which you can useto generate random numbers. A Random object represents a repeatingpseudo-random sequence of numbers. You can either fetch the next

DevX - Software Development Resource

Array Reflection

The java.lang.reflect package provides an Array class through whichthe values of an array can be accessed. It is usually more effectiveto cast the array after it has been obtained through