1 7 package com.sun.java.swing.plaf.nimbus; 8 9 import java.awt.*; 10 import java.awt.geom.AffineTransform ; 11 import java.awt.geom.NoninvertibleTransformException ; 12 import java.awt.image.BufferedImage ; 13 import java.util.*; 14 import javax.swing.*; 15 import javax.swing.plaf.synth.SynthContext ; 16 import javax.swing.plaf.synth.SynthPainter ; 17 import javax.swing.plaf.synth.SynthConstants ; 18 19 import com.sun.java.swing.Painter; 20 21 22 26 class SynthPainterImpl extends SynthPainter { 27 private NimbusStyle style; 28 29 SynthPainterImpl(NimbusStyle style) { 30 this.style = style; 31 } 32 33 38 private void paint(Painter p, SynthContext ctx, Graphics g, int x, int y, 39 int w, int h, AffineTransform transform) { 40 if (p != null) { 41 if (g instanceof Graphics2D){ 42 Graphics2D gfx = (Graphics2D)g; 43 if (transform!=null){ 44 gfx.transform(transform); 45 } 46 gfx.translate(x, y); 47 p.paint(gfx, ctx.getComponent(), w, h); 48 gfx.translate(-x, -y); 49 if (transform!=null){ 50 try { 51 gfx.transform(transform.createInverse()); 52 } catch (NoninvertibleTransformException e) { 53 e.printStackTrace(); 57 } 58 } 59 } else { 60 BufferedImage img = new BufferedImage (w,h, 63 BufferedImage.TYPE_INT_ARGB); 64 Graphics2D gfx = img.createGraphics(); 65 if (transform!=null){ 66 gfx.transform(transform); 67 } 68 p.paint(gfx, ctx.getComponent(), w, h); 69 gfx.dispose(); 70 g.drawImage(img,x,y,null); 71 img = null; 72 } 73 } 74 } 75 76 private void paintBackground(SynthContext ctx, Graphics g, int x, int y, 77 int w, int h, AffineTransform transform) { 78 Painter backgroundPainter = style.getBackgroundPainter(ctx); 79 if (backgroundPainter != null) { 80 paint(backgroundPainter, ctx, g, x, y, w, h,transform); 81 } 82 } 83 84 private void paintForeground(SynthContext ctx, Graphics g, int x, int y, 85 int w, int h, AffineTransform transform) { 86 Painter foregroundPainter = style.getForegroundPainter(ctx); 87 if (foregroundPainter != null) { 88 paint(foregroundPainter, ctx, g, x, y, w, h,transform); 89 } 90 } 91 92 private void paintBorder(SynthContext ctx, Graphics g, int x, int y, int w, 93 int h, AffineTransform transform) { 94 Painter borderPainter = style.getBorderPainter(ctx); 95 if (borderPainter != null) { 96 paint(borderPainter, ctx, g, x, y, w, h,transform); 97 } 98 } 99 100 private void paintBackground(SynthContext ctx, Graphics g, int x, int y, int w, int h, int orientation) { 101 Component c = ctx.getComponent(); 102 boolean ltr = c.getComponentOrientation().isLeftToRight(); 103 if (ctx.getComponent() instanceof JSlider) ltr = true; 105 106 if (orientation == SwingConstants.VERTICAL && ltr) { 107 AffineTransform transform = new AffineTransform (); 108 transform.scale(-1, 1); 109 transform.rotate(Math.toRadians(90)); 110 paintBackground(ctx, g, y, x, h, w, transform); 111 } else if (orientation == SwingConstants.VERTICAL) { 112 AffineTransform transform = new AffineTransform (); 113 transform.rotate(Math.toRadians(90)); 114 transform.translate(0,-(x+w)); 115 paintBackground(ctx, g, y, x, h, w, transform); 116 } else if (orientation == SwingConstants.HORIZONTAL && ltr) { 117 paintBackground(ctx, g, x, y, w, h, null); 118 } else { 119 AffineTransform transform = new AffineTransform (); 121 transform.translate(x,y); 122 transform.scale(-1, 1); 123 transform.translate(-w,0); 124 paintBackground(ctx, g, 0, 0, w, h, transform); 125 } 126 } 127 128 private void paintBorder(SynthContext ctx, Graphics g, int x, int y, int w, int h, int orientation) { 129 Component c = ctx.getComponent(); 130 boolean ltr = c.getComponentOrientation().isLeftToRight(); 131 if (orientation == SwingConstants.VERTICAL && ltr) { 132 AffineTransform transform = new AffineTransform (); 133 transform.scale(-1, 1); 134 transform.rotate(Math.toRadians(90)); 135 paintBorder(ctx, g, y, x, h, w, transform); 136 } else if (orientation == SwingConstants.VERTICAL) { 137 AffineTransform transform = new AffineTransform (); 138 transform.rotate(Math.toRadians(90)); 139 transform.translate(0, -(x + w)); 140 paintBorder(ctx, g, y, 0, h, w, transform); 141 } else if (orientation == SwingConstants.HORIZONTAL && ltr) { 142 paintBorder(ctx, g, x, y, w, h, null); 143 } else { 144 paintBorder(ctx, g, x, y, w, h, null); 146 } 147 } 148 149 private void paintForeground(SynthContext ctx, Graphics g, int x, int y, int w, int h, int orientation) { 150 Component c = ctx.getComponent(); 151 boolean ltr = c.getComponentOrientation().isLeftToRight(); 152 if (orientation == SwingConstants.VERTICAL && ltr) { 153 AffineTransform transform = new AffineTransform (); 154 transform.scale(-1, 1); 155 transform.rotate(Math.toRadians(90)); 156 paintForeground(ctx, g, y, x, h, w, transform); 157 } else if (orientation == SwingConstants.VERTICAL) { 158 AffineTransform transform = new AffineTransform (); 159 transform.rotate(Math.toRadians(90)); 160 transform.translate(0, -(x + w)); 161 paintForeground(ctx, g, y, 0, h, w, transform); 162 } else if (orientation == SwingConstants.HORIZONTAL && ltr) { 163 paintForeground(ctx, g, x, y, w, h, null); 164 } else { 165 paintForeground(ctx, g, x, y, w, h, null); 167 } 168 } 169 170 182 public void paintArrowButtonBackground(SynthContext context, 183 Graphics g, int x, int y, 184 int w, int h) { 185 if (context.getComponent().getComponentOrientation().isLeftToRight()){ 186 paintBackground(context, g, x, y, w, h, null); 187 } else { 188 AffineTransform transform = new AffineTransform (); 189 transform.translate(x,y); 190 transform.scale(-1, 1); 191 transform.translate(-w,0); 192 paintBackground(context, g, 0, 0, w, h, transform); 193 } 194 } 195 196 208 public void paintArrowButtonBorder(SynthContext context, 209 Graphics g, int x, int y, 210 int w, int h) { 211 paintBorder(context, g, x, y, w, h, null); 212 } 213 214 230 public void paintArrowButtonForeground(SynthContext context, 231 Graphics g, int x, int y, 232 int w, int h, 233 int direction) { 234 String compName = context.getComponent().getName(); 236 boolean ltr = context.getComponent(). 237 getComponentOrientation().isLeftToRight(); 238 if ("Spinner.nextButton".equals(compName) || 241 "Spinner.previousButton".equals(compName)) { 242 if (ltr){ 243 paintForeground(context, g, x, y, w, h, null); 244 } else { 245 AffineTransform transform = new AffineTransform (); 246 transform.translate(w, 0); 247 transform.scale(-1, 1); 248 paintForeground(context, g, x, y, w, h, transform); 249 } 250 } else if (direction == SwingConstants.WEST) { 251 paintForeground(context, g, x, y, w, h, null); 252 } else if (direction == SwingConstants.NORTH) { 253 if (ltr){ 254 AffineTransform transform = new AffineTransform (); 255 transform.scale(-1, 1); 256 transform.rotate(Math.toRadians(90)); 257 paintForeground(context, g, y, 0, h, w, transform); 258 } else { 259 AffineTransform transform = new AffineTransform (); 260 transform.rotate(Math.toRadians(90)); 261 transform.translate(0, -(x + w)); 262 paintForeground(context, g, y, 0, h, w, transform); 263 } 264 } else if (direction == SwingConstants.EAST) { 265 AffineTransform transform = new AffineTransform (); 266 transform.translate(w, 0); 267 transform.scale(-1, 1); 268 paintForeground(context, g, x, y, w, h, transform); 269 } else if (direction == SwingConstants.SOUTH) { 270 if (ltr){ 271 AffineTransform transform = new AffineTransform (); 272 transform.rotate(Math.toRadians(-90)); 273 transform.translate(-h, 0); 274 paintForeground(context, g, y, x, h, w, transform); 275 } else { 276 AffineTransform transform = new AffineTransform (); 277 transform.scale(-1, 1); 278 transform.rotate(Math.toRadians(-90)); 279 transform.translate(-(h+y), -(w+x)); 280 paintForeground(context, g, y, x, h, w, transform); 281 } 282 } 283 } 284 285 296 public void paintButtonBackground(SynthContext context, 297 Graphics g, int x, int y, 298 int w, int h) { 299 paintBackground(context, g, x, y, w, h, null); 300 } 301 302 313 public void paintButtonBorder(SynthContext context, 314 Graphics g, int x, int y, 315 int w, int h) { 316 paintBorder(context, g, x, y, w, h, null); 317 } 318 319 330 public void paintCheckBoxMenuItemBackground(SynthContext context, 331 Graphics g, int x, int y, 332 int w, int h) { 333 paintBackground(context, g, x, y, w, h, null); 334 } 335 336 347 public void paintCheckBoxMenuItemBorder(SynthContext context, 348 Graphics g, int x, int y, 349 int w, int h) { 350 paintBorder(context, g, x, y, w, h, null); 351 } 352 353 364 public void paintCheckBoxBackground(SynthContext context, 365 Graphics g, int x, int y, 366 int w, int h) { 367 paintBackground(context, g, x, y, w, h, null); 368 } 369 370 381 public void paintCheckBoxBorder(SynthContext context, 382 Graphics g, int x, int y, 383 int w, int h) { 384 paintBorder(context, g, x, y, w, h, null); 385 } 386 387 398 public void paintColorChooserBackground(SynthContext context, 399 Graphics g, int x, int y, 400 int w, int h) { 401 paintBackground(context, g, x, y, w, h, null); 402 } 403 404 415 public void paintColorChooserBorder(SynthContext context, 416 Graphics g, int x, int y, 417 int w, int h) { 418 paintBorder(context, g, x, y, w, h, null); 419 } 420 421 432 public void paintComboBoxBackground(SynthContext context, 433 Graphics g, int x, int y, 434 int w, int h) { 435 if (context.getComponent().getComponentOrientation().isLeftToRight()){ 436 paintBackground(context, g, x, y, w, h, null); 437 } else { 438 AffineTransform transform = new AffineTransform (); 439 transform.translate(x,y); 440 transform.scale(-1, 1); 441 transform.translate(-w,0); 442 paintBackground(context, g, 0, 0, w, h, transform); 443 } 444 } 445 446 457 public void paintComboBoxBorder(SynthContext context, 458 Graphics g, int x, int y, 459 int w, int h) { 460 paintBorder(context, g, x, y, w, h, null); 461 } 462 463 474 public void paintDesktopIconBackground(SynthContext context, 475 Graphics g, int x, int y, 476 int w, int h) { 477 paintBackground(context, g, x, y, w, h, null); 478 } 479 480 491 public void paintDesktopIconBorder(SynthContext context, 492 Graphics g, int x, int y, 493 int w, int h) { 494 paintBorder(context, g, x, y, w, h, null); 495 } 496 497 508 public void paintDesktopPaneBackground(SynthContext context, 509 Graphics g, int x, int y, 510 int w, int h) { 511 paintBackground(context, g, x, y, w, h, null); 512 } 513 514 525 public void paintDesktopPaneBorder(SynthContext context, 526 Graphics g, int x, int y, 527 int w, int h) { 528 paintBorder(context, g, x, y, w, h, null); 529 } 530 531 542 public void paintEditorPaneBackground(SynthContext context, 543 Graphics g, int x, int y, 544 int w, int h) { 545 paintBackground(context, g, x, y, w, h, null); 546 } 547 548 559 public void paintEditorPaneBorder(SynthContext context, 560 Graphics g, int x, int y, 561 int w, int h) { 562 paintBorder(context, g, x, y, w, h, null); 563 } 564 565 576 public void paintFileChooserBackground(SynthContext context, 577 Graphics g, int x, int y, 578 int w, int h) { 579 paintBackground(context, g, x, y, w, h, null); 580 } 581 582 593 public void paintFileChooserBorder(SynthContext context, 594 Graphics g, int x, int y, 595 int w, int h) { 596 paintBorder(context, g, x, y, w, h, null); 597 } 598 599 610 public void paintFormattedTextFieldBackground(SynthContext context, 611 Graphics g, int x, int y, 612 int w, int h) { 613 if (context.getComponent().getComponentOrientation().isLeftToRight()){ 614 paintBackground(context, g, x, y, w, h, null); 615 } else { 616 AffineTransform transform = new AffineTransform (); 617 transform.translate(x,y); 618 transform.scale(-1, 1); 619 transform.translate(-w,0); 620 paintBackground(context, g, 0, 0, w, h, transform); 621 } 622 } 623 624 635 public void paintFormattedTextFieldBorder(SynthContext context, 636 Graphics g, int x, int y, 637 int w, int h) { 638 if (context.getComponent().getComponentOrientation().isLeftToRight()){ 639 paintBorder(context, g, x, y, w, h, null); 640 } else { 641 AffineTransform transform = new AffineTransform (); 642 transform.translate(x,y); 643 transform.scale(-1, 1); 644 transform.translate(-w,0); 645 paintBorder(context, g, 0, 0, w, h, transform); 646 } 647 } 648 649 660 public void paintInternalFrameTitlePaneBackground(SynthContext context, 661 Graphics g, int x, int y, 662 int w, int h) { 663 paintBackground(context, g, x, y, w, h, null); 664 } 665 666 677 public void paintInternalFrameTitlePaneBorder(SynthContext context, 678 Graphics g, int x, int y, 679 int w, int h) { 680 paintBorder(context, g, x, y, w, h, null); 681 } 682 683 694 public void paintInternalFrameBackground(SynthContext context, 695 Graphics g, int x, int y, 696 int w, int h) { 697 paintBackground(context, g, x, y, w, h, null); 698 } 699 700 711 public void paintInternalFrameBorder(SynthContext context, 712 Graphics g, int x, int y, 713 int w, int h) { 714 paintBorder(context, g, x, y, w, h, null); 715 } 716 717 728 public void paintLabelBackground(SynthContext context, 729 Graphics g, int x, int y, 730 int w, int h) { 731 paintBackground(context, g, x, y, w, h, null); 732 } 733 734 745 public void paintLabelBorder(SynthContext context, 746 Graphics g, int x, int y, 747 int w, int h) { 748 paintBorder(context, g, x, y, w, h, null); 749 } 750 751 762 public void paintListBackground(SynthContext context, 763 Graphics g, int x, int y, 764 int w, int h) { 765 paintBackground(context, g, x, y, w, h, null); 766 } 767 768 779 public void paintListBorder(SynthContext context, 780 Graphics g, int x, int y, 781 int w, int h) { 782 paintBorder(context, g, x, y, w, h, null); 783 } 784 785 796 public void paintMenuBarBackground(SynthContext context, 797 Graphics g, int x, int y, 798 int w, int h) { 799 paintBackground(context, g, x, y, w, h, null); 800 } 801 802 813 public void paintMenuBarBorder(SynthContext context, 814 Graphics g, int x, int y, 815 int w, int h) { 816 paintBorder(context, g, x, y, w, h, null); 817 } 818 819 830 public void paintMenuItemBackground(SynthContext context, 831 Graphics g, int x, int y, 832 int w, int h) { 833 paintBackground(context, g, x, y, w, h, null); 834 } 835 836 847 public void paintMenuItemBorder(SynthContext context, 848 Graphics g, int x, int y, 849 int w, int h) { 850 paintBorder(context, g, x, y, w, h, null); 851 } 852 853 864 public void paintMenuBackground(SynthContext context, 865 Graphics g, int x, int y, 866 int w, int h) { 867 paintBackground(context, g, x, y, w, h, null); 868 } 869 870 881 public void paintMenuBorder(SynthContext context, 882 Graphics g, int x, int y, 883 int w, int h) { 884 paintBorder(context, g, x, y, w, h, null); 885 } 886 887 898 public void paintOptionPaneBackground(SynthContext context, 899 Graphics g, int x, int y, 900 int w, int h) { 901 paintBackground(context, g, x, y, w, h, null); 902 } 903 904 915 public void paintOptionPaneBorder(SynthContext context, 916 Graphics g, int x, int y, 917 int w, int h) { 918 paintBorder(context, g, x, y, w, h, null); 919 } 920 921 932 public void paintPanelBackground(SynthContext context, 933 Graphics g, int x, int y, 934 int w, int h) { 935 paintBackground(context, g, x, y, w, h, null); 936 } 937 938 949 public void paintPanelBorder(SynthContext context, 950 Graphics g, int x, int y, 951 int w, int h) { 952 paintBorder(context, g, x, y, w, h, null); 953 } 954 955 966 public void paintPasswordFieldBackground(SynthContext context, 967 Graphics g, int x, int y, 968 int w, int h) { 969 paintBackground(context, g, x, y, w, h, null); 970 } 971 972 983 public void paintPasswordFieldBorder(SynthContext context, 984 Graphics g, int x, int y, 985 int w, int h) { 986 paintBorder(context, g, x, y, w, h, null); 987 } 988 989 1000 public void paintPopupMenuBackground(SynthContext context, 1001 Graphics g, int x, int y, 1002 int w, int h) { 1003 paintBackground(context, g, x, y, w, h, null); 1004 } 1005 1006 1017 public void paintPopupMenuBorder(SynthContext context, 1018 Graphics g, int x, int y, 1019 int w, int h) { 1020 paintBorder(context, g, x, y, w, h, null); 1021 } 1022 1023 1034 public void paintProgressBarBackground(SynthContext context, 1035 Graphics g, int x, int y, 1036 int w, int h) { 1037 paintBackground(context, g, x, y, w, h, null); 1038 } 1039 1040 1055 public void paintProgressBarBackground(SynthContext context, 1056 Graphics g, int x, int y, 1057 int w, int h, int orientation) { 1058 paintBackground(context, g, x, y, w, h, orientation); 1059 } 1060 1061 1072 public void paintProgressBarBorder(SynthContext context, 1073 Graphics g, int x, int y, 1074 int w, int h) { 1075 paintBorder(context, g, x, y, w, h, null); 1076 } 1077 1078 1093 public void paintProgressBarBorder(SynthContext context, 1094 Graphics g, int x, int y, 1095 int w, int h, int orientation) { 1096 paintBorder(context, g, x, y, w, h, orientation); 1097 } 1098 1099 1113 public void paintProgressBarForeground(SynthContext context, 1114 Graphics g, int x, int y, 1115 int w, int h, int orientation) { 1116 paintForeground(context, g, x, y, w, h, orientation); 1117 } 1118 1119 1130 public void paintRadioButtonMenuItemBackground(SynthContext context, 1131 Graphics g, int x, int y, 1132 int w, int h) { 1133 paintBackground(context, g, x, y, w, h, null); 1134 } 1135 1136 1147 public void paintRadioButtonMenuItemBorder(SynthContext context, 1148 Graphics g, int x, int y, 1149 int w, int h) { 1150 paintBorder(context, g, x, y, w, h, null); 1151 } 1152 1153 1164 public void paintRadioButtonBackground(SynthContext context, 1165 Graphics g, int x, int y, 1166 int w, int h) { 1167 paintBackground(context, g, x, y, w, h, null); 1168 } 1169 1170 1181 public void paintRadioButtonBorder(SynthContext context, 1182 Graphics g, int x, int y, 1183 int w, int h) { 1184 paintBorder(context, g, x, y, w, h, null); 1185 } 1186 1187 1198 public void paintRootPaneBackground(SynthContext context, 1199 Graphics g, int x, int y, 1200 int w, int h) { 1201 paintBackground(context, g, x, y, w, h, null); 1202 } 1203 1204 1215 public void paintRootPaneBorder(SynthContext context, 1216 Graphics g, int x, int y, 1217 int w, int h) { 1218 paintBorder(context, g, x, y, w, h, null); 1219 } 1220 1221 1232 public void paintScrollBarBackground(SynthContext context, 1233 Graphics g, int x, int y, 1234 int w, int h) { 1235 paintBackground(context, g, x, y, w, h, null); 1236 } 1237 1238 1254 public void paintScrollBarBackground(SynthContext context, 1255 Graphics g, int x, int y, 1256 int w, int h, int orientation) { 1257 paintBackground(context, g, x, y, w, h, orientation); 1258 } 1259 1260 1271 public void paintScrollBarBorder(SynthContext context, 1272 Graphics g, int x, int y, 1273 int w, int h) { 1274 paintBorder(context, g, x, y, w, h, null); 1275 } 1276 1277 1293 public void paintScrollBarBorder(SynthContext context, 1294 Graphics g, int x, int y, 1295 int w, int h, int orientation) { 1296 paintBorder(context, g, x, y, w, h, orientation); 1297 } 1298 1299 1315 public void paintScrollBarThumbBackground(SynthContext context, 1316 Graphics g, int x, int y, 1317 int w, int h, int orientation) { 1318 paintBackground(context, g, x, y, w, h, orientation); 1319 } 1320 1321 1337 public void paintScrollBarThumbBorder(SynthContext context, 1338 Graphics g, int x, int y, 1339 int w, int h, int orientation) { 1340 paintBorder(context, g, x, y, w, h, orientation); 1341 } 1342 1343 1355 public void paintScrollBarTrackBackground(SynthContext context, 1356 Graphics g, int x, int y, 1357 int w, int h) { 1358 paintBackground(context, g, x, y, w, h, null); 1359 } 1360 1361 1378 public void paintScrollBarTrackBackground(SynthContext context, 1379 Graphics g, int x, int y, 1380 int w, int h, int orientation) { 1381 paintBackground(context, g, x, y, w, h, orientation); 1382 } 1383 1384 1396 public void paintScrollBarTrackBorder(SynthContext context, 1397 Graphics g, int x, int y, 1398 int w, int h) { 1399 paintBorder(context, g, x, y, w, h, null); 1400 } 1401 1402 1419 public void paintScrollBarTrackBorder(SynthContext context, 1420 Graphics g, int x, int y, 1421 int w, int h, int orientation) { 1422 paintBorder(context, g, x, y, w, h, orientation); 1423 } 1424 1425 1436 public void paintScrollPaneBackground(SynthContext context, 1437 Graphics g, int x, int y, 1438 int w, int h) { 1439 paintBackground(context, g, x, y, w, h, null); 1440 } 1441 1442 1453 public void paintScrollPaneBorder(SynthContext context, 1454 Graphics g, int x, int y, 1455 int w, int h) { 1456 paintBorder(context, g, x, y, w, h, null); 1457 } 1458 1459 1470 public void paintSeparatorBackground(SynthContext context, 1471 Graphics g, int x, int y, 1472 int w, int h) { 1473 paintBackground(context, g, x, y, w, h, null); 1474 } 1475 1476 1491 public void paintSeparatorBackground(SynthContext context, 1492 Graphics g, int x, int y, 1493 int w, int h, int orientation) { 1494 paintBackground(context, g, x, y, w, h, orientation); 1495 } 1496 1497 1508 public void paintSeparatorBorder(SynthContext context, 1509 Graphics g, int x, int y, 1510 int w, int h) { 1511 paintBorder(context, g, x, y, w, h, null); 1512 } 1513 1514 1529 public void paintSeparatorBorder(SynthContext context, 1530 Graphics g, int x, int y, 1531 int w, int h, int orientation) { 1532 paintBorder(context, g, x, y, w, h, orientation); 1533 } 1534 1535 1548 public void paintSeparatorForeground(SynthContext context, 1549 Graphics g, int x, int y, 1550 int w, int h, int orientation) { 1551 paintForeground(context, g, x, y, w, h, orientation); 1552 } 1553 1554 1565 public void paintSliderBackground(SynthContext context, 1566 Graphics g, int x, int y, 1567 int w, int h) { 1568 paintBackground(context, g, x, y, w, h, null); 1569 } 1570 1571 1586 public void paintSliderBackground(SynthContext context, 1587 Graphics g, int x, int y, 1588 int w, int h, int orientation) { 1589 paintBackground(context, g, x, y, w, h, orientation); 1590 } 1591 1592 1603 public void paintSliderBorder(SynthContext context, 1604 Graphics g, int x, int y, 1605 int w, int h) { 1606 paintBorder(context, g, x, y, w, h, null); 1607 } 1608 1609 1624 public void paintSliderBorder(SynthContext context, 1625 Graphics g, int x, int y, 1626 int w, int h, int orientation) { 1627 paintBorder(context, g, x, y, w, h, orientation); 1628 } 1629 1630 1643 public void paintSliderThumbBackground(SynthContext context, 1644 Graphics g, int x, int y, 1645 int w, int h, int orientation) { 1646 if (context.getComponent().getClientProperty( 1647 "Slider.paintThumbArrowShape") == Boolean.TRUE){ 1648 if (orientation == JSlider.HORIZONTAL){ 1649 orientation = JSlider.VERTICAL; 1650 } else { 1651 orientation = JSlider.HORIZONTAL; 1652 } 1653 paintBackground(context, g, x, y, w, h, orientation); 1654 } else { 1655 paintBackground(context, g, x, y, w, h, orientation); 1656 } 1657 } 1658 1659 1672 public void paintSliderThumbBorder(SynthContext context, 1673 Graphics g, int x, int y, 1674 int w, int h, int orientation) { 1675 paintBorder(context, g, x, y, w, h, orientation); 1676 } 1677 1678 1689 public void paintSliderTrackBackground(SynthContext context, 1690 Graphics g, int x, int y, 1691 int w, int h) { 1692 paintBackground(context, g, x, y, w, h, null); 1693 } 1694 1695 1710 public void paintSliderTrackBackground(SynthContext context, 1711 Graphics g, int x, int y, 1712 int w, int h, int orientation) { 1713 paintBackground(context, g, x, y, w, h, orientation); 1714 } 1715 1716 1727 public void paintSliderTrackBorder(SynthContext context, 1728 Graphics g, int x, int y, 1729 int w, int h) { 1730 paintBorder(context, g, x, y, w, h, null); 1731 } 1732 1733 1748 public void paintSliderTrackBorder(SynthContext context, 1749 Graphics g, int x, int y, 1750 int w, int h, int orientation) { 1751 paintBorder(context, g, x, y, w, h, orientation); 1752 } 1753 1754 1765 public void paintSpinnerBackground(SynthContext context, 1766 Graphics g, int x, int y, 1767 int w, int h) { 1768 paintBackground(context, g, x, y, w, h, null); 1769 } 1770 1771 1782 public void paintSpinnerBorder(SynthContext context, 1783 Graphics g, int x, int y, 1784 int w, int h) { 1785 paintBorder(context, g, x, y, w, h, null); 1786 } 1787 1788 1799 public void paintSplitPaneDividerBackground(SynthContext context, 1800 Graphics g, int x, int y, 1801 int w, int h) { 1802 paintBackground(context, g, x, y, w, h, null); 1803 } 1804 1805 1820 public void paintSplitPaneDividerBackground(SynthContext context, 1821 Graphics g, int x, int y, 1822 int w, int h, int orientation) { 1823 if (orientation == JSplitPane.HORIZONTAL_SPLIT) { 1824 AffineTransform transform = new AffineTransform (); 1825 transform.scale(-1, 1); 1826 transform.rotate(Math.toRadians(90)); 1827 paintBackground(context, g, y, x, h, w, transform); 1828 } else { 1829 paintBackground(context, g, x, y, w, h, null); 1830 } 1831 } 1832 1833 1846 public void paintSplitPaneDividerForeground(SynthContext context, 1847 Graphics g, int x, int y, 1848 int w, int h, int orientation) { 1849 paintForeground(context, g, x, y, w, h, null); 1850 } 1851 1852 1866 public void paintSplitPaneDragDivider(SynthContext context, 1867 Graphics g, int x, int y, 1868 int w, int h, int orientation) { 1869 paintBackground(context, g, x, y, w, h, null); 1870 } 1871 1872 1883 public void paintSplitPaneBackground(SynthContext context, 1884 Graphics g, int x, int y, 1885 int w, int h) { 1886 paintBackground(context, g, x, y, w, h, null); 1887 } 1888 1889 1900 public void paintSplitPaneBorder(SynthContext context, 1901 Graphics g, int x, int y, 1902 int w, int h) { 1903 paintBorder(context, g, x, y, w, h, null); 1904 } 1905 1906 1917 public void paintTabbedPaneBackground(SynthContext context, 1918 Graphics g, int x, int y, 1919 int w, int h) { 1920 paintBackground(context, g, x, y, w, h, null); 1921 } 1922 1923 1934 public void paintTabbedPaneBorder(SynthContext context, 1935 Graphics g, int x, int y, 1936 int w, int h) { 1937 paintBorder(context, g, x, y, w, h, null); 1938 } 1939 1940 1951 public void paintTabbedPaneTabAreaBackground(SynthContext context, 1952 Graphics g, int x, int y, 1953 int w, int h) { 1954 paintBackground(context, g, x, y, w, h, null); 1955 } 1956 1957 1975 public void paintTabbedPaneTabAreaBackground(SynthContext context, 1976 Graphics g, int x, int y, 1977 int w, int h, int orientation) { 1978 if (orientation == JTabbedPane.LEFT) { 1979 AffineTransform transform = new AffineTransform (); 1980 transform.scale(-1, 1); 1981 transform.rotate(Math.toRadians(90)); 1982 paintBackground(context, g, y, x, h, w, transform); 1983 } else if (orientation == JTabbedPane.RIGHT) { 1984 AffineTransform transform = new AffineTransform (); 1985 transform.rotate(Math.toRadians(90)); 1986 transform.translate(0, -(x + w)); 1987 paintBackground(context, g, y, 0, h, w, transform); 1988 } else if (orientation == JTabbedPane.BOTTOM) { 1989 AffineTransform transform = new AffineTransform (); 1990 transform.translate(x,y); 1991 transform.scale(1, -1); 1992 transform.translate(0,-h); 1993 paintBackground(context, g, 0, 0, w, h, transform); 1994 } else { 1995 paintBackground(context, g, x, y, w, h, null); 1996 } 1997 } 1998 1999 2010 public void paintTabbedPaneTabAreaBorder(SynthContext context, 2011 Graphics g, int x, int y, 2012 int w, int h) { 2013 paintBorder(context, g, x, y, w, h, null); 2014 } 2015 2016 2033 public void paintTabbedPaneTabAreaBorder(SynthContext context, 2034 Graphics g, int x, int y, 2035 int w, int h, int orientation) { 2036 paintBorder(context, g, x, y, w, h, null); 2037 } 2038 2039 2051 public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, 2052 int x, int y, int w, int h, 2053 int tabIndex) { 2054 paintBackground(context, g, x, y, w, h, null); 2055 } 2056 2057 2075 public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, 2076 int x, int y, int w, int h, 2077 int tabIndex, int orientation) { 2078 if (orientation == JTabbedPane.LEFT) { 2079 AffineTransform transform = new AffineTransform (); 2080 transform.scale(-1, 1); 2081 transform.rotate(Math.toRadians(90)); 2082 paintBackground(context, g, y, x, h, w, transform); 2083 } else if (orientation == JTabbedPane.RIGHT) { 2084 AffineTransform transform = new AffineTransform (); 2085 transform.rotate(Math.toRadians(90)); 2086 transform.translate(0, -(x + w)); 2087 paintBackground(context, g, y, 0, h, w, transform); 2088 } else if (orientation == JTabbedPane.BOTTOM) { 2089 AffineTransform transform = new AffineTransform (); 2090 transform.translate(x,y); 2091 transform.scale(1, -1); 2092 transform.translate(0,-h); 2093 paintBackground(context, g, 0, 0, w, h, transform); 2094 } else { 2095 paintBackground(context, g, x, y, w, h, null); 2096 } 2097 } 2098 2099 2111 public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, 2112 int x, int y, int w, int h, 2113 int tabIndex) { 2114 paintBorder(context, g, x, y, w, h, null); 2115 } 2116 2117 2135 public void paintTabbedPaneTabBorder(SynthContext context, Graphics g, 2136 int x, int y, int w, int h, 2137 int tabIndex, int orientation) { 2138 paintBorder(context, g, x, y, w, h, null); 2139 } 2140 2141 2153 public void paintTabbedPaneContentBackground(SynthContext context, 2154 Graphics g, int x, int y, int w, 2155 int h) { 2156 paintBackground(context, g, x, y, w, h, null); 2157 } 2158 2159 2171 public void paintTabbedPaneContentBorder(SynthContext context, Graphics g, 2172 int x, int y, int w, int h) { 2173 paintBorder(context, g, x, y, w, h, null); 2174 } 2175 2176 2187 public void paintTableHeaderBackground(SynthContext context, 2188 Graphics g, int x, int y, 2189 int w, int h) { 2190 paintBackground(context, g, x, y, w, h, null); 2191 } 2192 2193 2204 public void paintTableHeaderBorder(SynthContext context, 2205 Graphics g, int x, int y, 2206 int w, int h) { 2207 paintBorder(context, g, x, y, w, h, null); 2208 } 2209 2210 2221 public void paintTableBackground(SynthContext context, 2222 Graphics g, int x, int y, 2223 int w, int h) { 2224 paintBackground(context, g, x, y, w, h, null); 2225 } 2226 2227 2238 public void paintTableBorder(SynthContext context, 2239 Graphics g, int x, int y, 2240 int w, int h) { 2241 paintBorder(context, g, x, y, w, h, null); 2242 } 2243 2244 2255 public void paintTextAreaBackground(SynthContext context, 2256 Graphics g, int x, int y, 2257 int w, int h) { 2258 paintBackground(context, g, x, y, w, h, null); 2259 } 2260 2261 2272 public void paintTextAreaBorder(SynthContext context, 2273 Graphics g, int x, int y, 2274 int w, int h) { 2275 paintBorder(context, g, x, y, w, h, null); 2276 } 2277 2278 2289 public void paintTextPaneBackground(SynthContext context, 2290 Graphics g, int x, int y, 2291 int w, int h) { 2292 paintBackground(context, g, x, y, w, h, null); 2293 } 2294 2295 2306 public void paintTextPaneBorder(SynthContext context, 2307 Graphics g, int x, int y, 2308 int w, int h) { 2309 paintBorder(context, g, x, y, w, h, null); 2310 } 2311 2312 2323 public void paintTextFieldBackground(SynthContext context, 2324 Graphics g, int x, int y, 2325 int w, int h) { 2326 if (context.getComponent().getComponentOrientation().isLeftToRight()){ 2327 paintBackground(context, g, x, y, w, h, null); 2328 } else { 2329 AffineTransform transform = new AffineTransform (); 2330 transform.translate(x,y); 2331 transform.scale(-1, 1); 2332 transform.translate(-w,0); 2333 paintBackground(context, g, 0, 0, w, h, transform); 2334 } 2335 } 2336 2337 2348 public void paintTextFieldBorder(SynthContext context, 2349 Graphics g, int x, int y, 2350 int w, int h) { 2351 if (context.getComponent().getComponentOrientation().isLeftToRight()){ 2352 paintBorder(context, g, x, y, w, h, null); 2353 } else { 2354 AffineTransform transform = new AffineTransform (); 2355 transform.translate(x,y); 2356 transform.scale(-1, 1); 2357 transform.translate(-w,0); 2358 paintBorder(context, g, 0, 0, w, h, transform); 2359 } 2360 } 2361 2362 2373 public void paintToggleButtonBackground(SynthContext context, 2374 Graphics g, int x, int y, 2375 int w, int h) { 2376 paintBackground(context, g, x, y, w, h, null); 2377 } 2378 2379 2390 public void paintToggleButtonBorder(SynthContext context, 2391 Graphics g, int x, int y, 2392 int w, int h) { 2393 paintBorder(context, g, x, y, w, h, null); 2394 } 2395 2396 2407 public void paintToolBarBackground(SynthContext context, 2408 Graphics g, int x, int y, 2409 int w, int h) { 2410 paintBackground(context, g, x, y, w, h, null); 2411 } 2412 2413 2428 public void paintToolBarBackground(SynthContext context, 2429 Graphics g, int x, int y, 2430 int w, int h, int orientation) { 2431 paintBackground(context, g, x, y, w, h, orientation); 2432 } 2433 2434 2445 public void paintToolBarBorder(SynthContext context, 2446 Graphics g, int x, int y, 2447 int w, int h) { 2448 paintBorder(context, g, x, y, w, h, null); 2449 } 2450 2451 2466 public void paintToolBarBorder(SynthContext context, 2467 Graphics g, int x, int y, 2468 int w, int h, int orientation) { 2469 paintBorder(context, g, x, y, w, h, orientation); 2470 } 2471 2472 2483 public void paintToolBarContentBackground(SynthContext context, 2484 Graphics g, int x, int y, 2485 int w, int h) { 2486 paintBackground(context, g, x, y, w, h, null); 2487 } 2488 2489 2504 public void paintToolBarContentBackground(SynthContext context, 2505 Graphics g, int x, int y, 2506 int w, int h, int orientation) { 2507 paintBackground(context, g, x, y, w, h, orientation); 2508 } 2509 2510 2521 public void paintToolBarContentBorder(SynthContext context, 2522 Graphics g, int x, int y, 2523 int w, int h) { 2524 paintBorder(context, g, x, y, w, h, null); 2525 } 2526 2527 2542 public void paintToolBarContentBorder(SynthContext context, 2543 Graphics g, int x, int y, 2544 int w, int h, int orientation) { 2545 paintBorder(context, g, x, y, w, h, orientation); 2546 } 2547 2548 2560 public void paintToolBarDragWindowBackground(SynthContext context, 2561 Graphics g, int x, int y, 2562 int w, int h) { 2563 paintBackground(context, g, x, y, w, h, null); 2564 } 2565 2566 2582 public void paintToolBarDragWindowBackground(SynthContext context, 2583 Graphics g, int x, int y, 2584 int w, int h, int orientation) { 2585 paintBackground(context, g, x, y, w, h, orientation); 2586 } 2587 2588 2600 public void paintToolBarDragWindowBorder(SynthContext context, 2601 Graphics g, int x, int y, 2602 int w, int h) { 2603 paintBorder(context, g, x, y, w, h, null); 2604 } 2605 2606 2622 public void paintToolBarDragWindowBorder(SynthContext context, 2623 Graphics g, int x, int y, 2624 int w, int h, int orientation) { 2625 paintBorder(context, g, x, y, w, h, orientation); 2626 } 2627 2628 2639 public void paintToolTipBackground(SynthContext context, 2640 Graphics g, int x, int y, 2641 int w, int h) { 2642 paintBackground(context, g, x, y, w, h, null); 2643 } 2644 2645 2656 public void paintToolTipBorder(SynthContext context, 2657 Graphics g, int x, int y, 2658 int w, int h) { 2659 paintBorder(context, g, x, y, w, h, null); 2660 } 2661 2662 2673 public void paintTreeBackground(SynthContext context, 2674 Graphics g, int x, int y, 2675 int w, int h) { 2676 paintBackground(context, g, x, y, w, h, null); 2677 } 2678 2679 2690 public void paintTreeBorder(SynthContext context, 2691 Graphics g, int x, int y, 2692 int w, int h) { 2693 paintBorder(context, g, x, y, w, h, null); 2694 } 2695 2696 2707 public void paintTreeCellBackground(SynthContext context, 2708 Graphics g, int x, int y, 2709 int w, int h) { 2710 paintBackground(context, g, x, y, w, h, null); 2711 } 2712 2713 2724 public void paintTreeCellBorder(SynthContext context, 2725 Graphics g, int x, int y, 2726 int w, int h) { 2727 paintBorder(context, g, x, y, w, h, null); 2728 } 2729 2730 2741 public void paintTreeCellFocus(SynthContext context, 2742 Graphics g, int x, int y, 2743 int w, int h) { 2744 } 2746 2747 2758 public void paintViewportBackground(SynthContext context, 2759 Graphics g, int x, int y, 2760 int w, int h) { 2761 paintBackground(context, g, x, y, w, h, null); 2762 } 2763 2764 2775 public void paintViewportBorder(SynthContext context, 2776 Graphics g, int x, int y, 2777 int w, int h) { 2778 paintBorder(context, g, x, y, w, h, null); 2779 } 2780} 2781 | Popular Tags |