SOURCE CODE

Java AppleScript 4D

                             Java                             


My Java source code (Zipped, 50K) My Java Links My Java classes (Zipped, 41K)
SmartTextField NumberTextField DoubleTextField PosIntTextField
UByteTextField PercentTextField DegreeTextField RetroFocusable
RFContainer RF Assert Maths
ComplexNumber ClassPreloadThread

SMARTTEXTFIELD 1.2

A bug-fix subclass of the standard-distribution JDK 1.0.2 Java class java.awt.TextField, implementing standard tabbing behaviour for enterable-text fields in a GUI.
 
Now smarter, faster, less picky about which Components it will give the focus to (any that implement RetroFocusable), and fully exception-protected. Utilises the RF utility class.
 
No home should be without one. Please let me have bug reports, comments and suggestions.
 
The two comparative demonstration applets give you the chance to see SmartTextFields in action. Use this class suite in real-world conditions, and see for yourself how SmartTextFields differ from standard TextFields.
 
The discussion page includes notes, feedback, and bug reports about this suite of classes.
 
 

NUMBERTEXTFIELD 1.2

An abstract subclass of SmartTextField, making a TextField behave like both a Number and a TextField.
 
 

DOUBLETEXTFIELD 1.2

A concrete subclass of NumberTextField, providing general number-format text-entry/display constraints.
 
DoubleTextFields (not used in the demo) provide the widest, least constrained range of numeric-text entry and display: either positive or negative (the other three field types are for positive and 0 only), decimal fractions as well as integers (the others are for integers only), and the enormous range of values of Java's 64-bit double-precision floating-point double datatype.
 
 

POSINTTEXTFIELD 1.1

An abstract subclass of NumberTextField, constraining the field's Number value and text display to positive-or-zero integer values.
 
 

UBYTETEXTFIELD 1.2, PERCENTTEXTFIELD 1.2, DEGREETEXTFIELD 1.2

Concrete subclasses of PosIntTextField, providing specific integer text-entry/display constraints.
 
The SmartTextField demo uses all three of these classes: UByteTextField for the RGB colors, DegreeTextField for the Hue, and PercentTextField for the Saturation and Brightness. Try typing first "255" into the Red field, then backspace and type "256". Similarly, try "360" and "361" in the Hue field, and "100" and "101" in the Saturation field. In each case, the first entry is allowed, but the second is not.
 
 

RETROFOCUSABLE 1.2

Interface for use by java.awt.Component descendants which would like to have Shift-Tab functionality, i.e. the ability to send or receive the focus in the reverse of the tab order.
 
Implemented by SmartTextField.
 
 

RFCONTAINER 1.2

Interface for use by java.awt.Container descendants which would like to assist in determining Shift-Tab functionality, i.e. the ability to send or receive the focus in the reverse of the tab order.
 
Implemented by the SmartTextField demo Applet and both its nested Panels.
 
 

RF 1.0

A utility class which exposes inline (final) search methods for determining which RetroFocusable-implementing Component should receive the focus next.
 
Container subclasses which implement RFContainer can co-operate with RF by implementing replacements, accelerations or callbacks for RF's default search algorithms.
 
Utilised by SmartTextField.
 
 

ASSERT 1.2

A tremendously useful debugging tool; very simple, but quite powerful.
 
The Assert utility class provides inline (final) methods for testing conditions which you expect to be true in the course of your program, and for giving you context-specific information if they prove to be false at runtime. Especially useful for catching those conditions which "obviously" cannot ever be false but nevertheless somehow turn out to be.
 
Use Assert to test every "obviously true" condition in your program's flow of control and gasp at the number that turn out to be false!
 
Typically, you use Assert._() in if blocks:
 
if ( __DEBUGGING__ )
{
    Assert._( such_and_such == mustBeTrue(),
                    "Hey! It wasn't true after all!" );
}

 
where __DEBUGGING__ is a private static final boolean, so the compiler can skip it in your shipping code. Just set __DEBUGGING__ to true while developing, and false for release.
 
Utilised by just about everything I write.
 
 

MATHS 1.1

A utility class for filling gaps left by java.lang.Math.
 
So far, only contains a factorial() method. (When did you last need one of those?)
 
 

COMPLEXNUMBER 1.0a1

Rudimentary complex-number class, with just enough functionality for use in a Mandelbrot set generator (i.e. square and add).
 
 

CLASSPRELOADTHREAD 1.0a1

An optimization utility class to assist applets in making sure that class definitions are loaded before they're needed.
 
Used by the second demo applet.
 
 


Brew your own!

Got a Java compiler? You can compile my Java source code yourself.

Compile the source files in the following order, making sure that each one can see the ".class" output files resulting from compiling the earlier one(s):

  1. RetroFocusable.java
  2. Assert.java
  3. RFContainer.java
  4. RF.java
  5. SmartTextField.java
  6. NumberTextField.java
  7. DoubleTextField.java
  8. PosIntTextField.java
  9. UByteTextField.java
  10. PercentTextField.java
  11. DegreeTextField.java
  12. ClassPreloadThread.java
  13. ColorTest2.java and ColorControls2.java (the second demo applet)
  14. Maths.java (optional -- interest only)
  15. ComplexNumber.java (ditto)
(Sorry, this will not work on DOS/Win3.x systems without re-editing the files, because of the 8.3 filename limitation.)

Use a SmartTextField anywhere you would use an ordinary TextField.

To add SmartTextField's tabbing behaviour to another Component subclass (eg Button, Checkbox or List):

  1. Create a new subclass which implements RetroFocusable, e.g.:
     
    public class SmartButton extends java.awt.Button implements RetroFocusable
    {
        // class code...
    }

     
  2. Copy and paste the prevComponent(), nextComponent(), keyDown() and prevFocus() methods from SmartTextField.java.
     
  3. Write constructor methods for your new class.
     



                             AppleScript                             


FOLDER OBJECT 1.0.1

An AppleScript "wrapper" script object implementing an "intelligent" folder object.
 
 

HTML TAG MERGER 1.0

An AppleScript script for eliminating redundant repetitions of tags in an HTML file. One of the scripts used to prepare these code-listing pages.
 
 

QUIT ALL APPLICATIONS 1.0

An AppleScript script for quitting all running applications in the same order as a system shutdown/restart, leaving just the Finder and any faceless background apps running.
 
 


                             4D                             


EXPORT ALL

A suite of global procedures for exporting all data in any 4D database, including full descriptions of field formats and attributes. Exports files in parallel for maximum efficiency, allocating one concurrent export process per file. Export times can be 30% less compared to sequential export for 4D data files larger than 1MB.
 
 



Top of page
Cool IT in Africa Site design by Phil Hudson. Comments? Email phil.hudson@iname.com.
Top of page