2307 void drawLetter(Graphics g, char letter, int ax, int ay, int aw,
2308 int ah, float align, int index) {
2309 String str = formatItemNum(index, letter);
2310 str = isLeftToRight ? str + "." : "." + str;
2311 FontMetrics fm = SwingUtilities2.getFontMetrics(null, g);
2312 int stringwidth = SwingUtilities2.stringWidth(null, fm, str);
2313 int gap = isLeftToRight ? - (stringwidth + bulletgap) :
2314 (aw + bulletgap);
2315 int x = ax + gap;
2316 int y = Math.max(ay + fm.getAscent(), ay + (int)(ah * align));
2317 SwingUtilities2.drawString(null, g, str, x, y);
2318 }
2319
2320 /**
2321 * Converts the item number into the ordered list number
2322 * (i.e. 1 2 3, i ii iii, a b c, etc.
2323 *
2324 * @param itemNum number to format
2325 * @param type type of ordered list
2326 */
2327 String formatItemNum(int itemNum, char type) {
2328 String numStyle = "1";
2329
2330 boolean uppercase = false;
2331
2332 String formattedNum;
2333
2334 switch (type) {
2335 case '1':
2336 default:
2337 formattedNum = String.valueOf(itemNum);
2338 break;
2339
2340 case 'A':
2341 uppercase = true;
2342 // fall through
2343 case 'a':
2344 formattedNum = formatAlphaNumerals(itemNum);
2345 break;
2346
|
2307 void drawLetter(Graphics g, char letter, int ax, int ay, int aw,
2308 int ah, float align, int index) {
2309 String str = formatItemNum(index, letter);
2310 str = isLeftToRight ? str + "." : "." + str;
2311 FontMetrics fm = SwingUtilities2.getFontMetrics(null, g);
2312 int stringwidth = SwingUtilities2.stringWidth(null, fm, str);
2313 int gap = isLeftToRight ? - (stringwidth + bulletgap) :
2314 (aw + bulletgap);
2315 int x = ax + gap;
2316 int y = Math.max(ay + fm.getAscent(), ay + (int)(ah * align));
2317 SwingUtilities2.drawString(null, g, str, x, y);
2318 }
2319
2320 /**
2321 * Converts the item number into the ordered list number
2322 * (i.e. 1 2 3, i ii iii, a b c, etc.
2323 *
2324 * @param itemNum number to format
2325 * @param type type of ordered list
2326 */
2327 @SuppressWarnings("fallthrough")
2328 String formatItemNum(int itemNum, char type) {
2329 String numStyle = "1";
2330
2331 boolean uppercase = false;
2332
2333 String formattedNum;
2334
2335 switch (type) {
2336 case '1':
2337 default:
2338 formattedNum = String.valueOf(itemNum);
2339 break;
2340
2341 case 'A':
2342 uppercase = true;
2343 // fall through
2344 case 'a':
2345 formattedNum = formatAlphaNumerals(itemNum);
2346 break;
2347
|