Java Drawing DrawTop

Language

JP  US  UK

 

Utility

 H. Jyounishi, Tokyo Japan
 

Frame (Index), No frame                 version:0.3(latest)  

Summary: This page describes the simple methods of this application such as geometric calculations, sort methods and so on.

Relevant major classes of Java SE: java.awt.*, javax.swing.*

Classes on this page: Util
1. Class Util return=>page top

Field

Description

nf

static NumberFormat nf = NumberFormat.getNumberInstance()
The NumberFormat object.


Method

Description

simpleSort

public static void simpleSort(int [] data)

The sorting method for interger array data.
The data will be rewritten.

simpleSort

public static void simpleSort(double[] data)

The sorting method for double floating array data.
The data will be rewritten.

indexedSimpleSort

public static int[] indexedSimpleSort(int[] data)

The sorting method for interger array of data.The data won't be changed.
Denotes the returned integers as indices, then the sorting result is as follow.

data[indices[0]]<= data[indices[1]]<= data[indices[2]] ....

indexedSimpleSort

public static int[] indexedSimpleSort(double[] data)

The sorting method for double floating array of data. The data won't be changed.

Denotes the returned integers as indices, then the sorting result is as follow.

data[indices[0]]<= data[indices[1]]<= data[indices[2]] ....

indexedSwap

private static void indexedSwap(int[] indices, int i,int j)

Exchanges indices[i] with indices[j].

swap

private static void swap(int [] data, int i,int j)

Exchanges data[i] with data[j].

swap

private static void swap(double[] data, int i,int j)

Exchanges data[i] with data[j].

printSort

private static void printSort(String message, int [] data)

Prints the data.

printSort

private static void printSort(String message, double[] data)

Prints the data.

printSort

private static void printSort(String message, int[] data, int[] indices)

Prints the data and indices.

printSort

private static void printSort(String message, double[] data, int[] indices)

Prints the data and indices.

getASCIIControlString

public String getASCIIControlString(String command)

parameters:
command - The command name.

Return:

The string representing the ASCII code, if the first character of command is an ASCII code, otherwise returns "".

Processing:

If the "c" key is presed with holding down the Ctrl key (ctrl+c), for example, the string of an action command given by the statement of ActionEvent.getActionCommand()is an ASCII code of "0x03". The probelem is that the "0x03" is an undefined character in Java.
This method checks whether the first character of the parameter is an ASCII code or not. If is's an ASCII code, then return the String representing the ASCII code, for example, "ctrl+c" in this case.

Example: the returned string for the ASCII code.
"0x01" ->"ctrl+a", "0x08" ->"ctrl+h" (Back space), "0x16" ->"ctrl+v", "0x18" ->"ctrl+x"

toHexString public static String toHexString(String str)
Returns the hexadecimal form of the parameter.
toHexString public static String toHexString(byte[] byteBuff)
Returns the hexadecimal form of the parameter.

Text

public static String Text(AttributedString attribStr)

Returns the string expression of the AttributedString. If the "\n"(line feed) is in the attribStr, then "\n" is chenged with the string of "$n".

Num

public static String Num(double d)

Returns the string representing the parameter formatted by the nf.

PercentNum public static String PercentNum(double d, int fraction)
Returns the string representing the parameter formatted by the nf.

Pt

public static String Pt(Point point)

Returns the string representing the parameter formatted by the nf.

Pt

public static String Pt(Point2D point)

Returns the string representing the parameter formatted by the nf.

Pt

public static String Pt(Vector2D vec)

Returns the string representing the parameter formatted by the nf.

Pt

public static String Pt(Rectangle2D rect)

Returns the string representing the parameter formatted by the nf.

Pt

public static String Pt(Arc2D arc)

Returns the string representing the parameter formatted by the nf.

Angle

public static String Angle(Arc2D arc)

Returns the string representing the parameter formatted by the nf.

Rect

public static String Rect(Rectangle rect)

Returns the string representing the parameter formatted by the nf.

Rect

public static String Rect(Component component)

Returns the string representing the parameter formatted by the nf.

Rect

public static String Rect(Rectangle2D rect)

Returns the string representing the parameter formatted by the nf.

Dim public static String Dim(Dimension dim)
Returns the string representing the parameter formatted by the nf.
Insets ublic static String Insets(Insets insets)
Returns the string representing the parameter formatted by the nf.


Copyright (c) 2009-2013
All other trademarks are property of their respective owners.