@@ -626,7 +626,8 @@ protected void paintComponent(Graphics g) {
626626 isBackgroundPainted = false ;
627627 ui .update (scratchGraphics , this );
628628 // BH TODO CHECK THIS
629- isBackgroundPainted = ((JSGraphics2D ) (Object )scratchGraphics ).isBackgroundPainted ();
629+ JSGraphics2D jsg = getJSGraphic2D (scratchGraphics );
630+ isBackgroundPainted = (jsg != null && jsg .isBackgroundPainted ());
630631 } finally {
631632 scratchGraphics .dispose ();
632633 }
@@ -725,7 +726,7 @@ protected void paintChildren(Graphics g) {
725726 // if (!printing) {
726727 jc .checkBackgroundPainted (null );
727728 jc .paint ((Graphics ) (Object ) jsg );
728- jc .checkBackgroundPainted (jsg );
729+ jc .checkBackgroundPainted (getJSGraphic2D (( Graphics ) ( Object ) jsg ) );
729730 // } else {
730731 // if (!getFlag(IS_PRINTING_ALL)) {
731732 // comp.print(cg);
@@ -4575,7 +4576,7 @@ void _paintImmediately(int x, int y, int w, int h) {
45754576 // (so that the underlying JRootPane canvas can show).
45764577 checkBackgroundPainted (null );
45774578 paintingComponent .paint (g );
4578- checkBackgroundPainted (( JSGraphics2D ) ( Object ) g );
4579+ checkBackgroundPainted (getJSGraphic2D ( g ) );
45794580 }
45804581 } finally {
45814582 g .dispose ();
@@ -4813,16 +4814,7 @@ public void dndDone() {
48134814 */
48144815 @ SuppressWarnings ("unused" )
48154816 private void paintComponentSafely (Graphics g ) {
4816- JSGraphics2D jsg = null ;
4817-
4818- /**
4819- * @j2sNative
4820- *
4821- * jsg = (g.mark ? g : null);
4822- */
4823- {
4824- }
4825-
4817+ JSGraphics2D jsg = getJSGraphic2D (g );
48264818 int nSave = (jsg == null ? 0 : jsg .mark ());
48274819 checkBackgroundPainted (null );
48284820 // note that paintComponent may be overridden.
@@ -4846,19 +4838,8 @@ private void paintComponentSafely(Graphics g) {
48464838 *
48474839 * @param g
48484840 */
4849- @ SuppressWarnings ("unused" )
48504841 private void printComponentSafely (Graphics g ) {
4851-
4852- JSGraphics2D jsg = null ;
4853-
4854- /**
4855- * @j2sNative
4856- *
4857- * jsg = (g.mark ? g : null);
4858- */
4859- {
4860- }
4861-
4842+ JSGraphics2D jsg = getJSGraphic2D (g );
48624843 int nSave = (jsg == null ? 0 : jsg .mark ());
48634844 printComponent (g );
48644845 if (jsg != null )
@@ -4877,18 +4858,8 @@ private void printComponentSafely(Graphics g) {
48774858 *
48784859 * @param g
48794860 */
4880- @ SuppressWarnings ("unused" )
48814861 private void paintBorderSafely (Graphics g ) {
4882- JSGraphics2D jsg = null ;
4883-
4884- /**
4885- * @j2sNative
4886- *
4887- * jsg = (g.mark ? g : null);
4888- */
4889- {
4890- }
4891-
4862+ JSGraphics2D jsg = getJSGraphic2D (g );
48924863 int nSave = (jsg == null ? 0 : jsg .mark ());
48934864 printBorder (g );
48944865 if (jsg != null )
@@ -4907,17 +4878,8 @@ private void paintBorderSafely(Graphics g) {
49074878 *
49084879 * @param g
49094880 */
4910- @ SuppressWarnings ("unused" )
49114881 private void printBorderSafely (Graphics g ) {
4912- JSGraphics2D jsg = null ;
4913- /**
4914- * @j2sNative
4915- *
4916- * jsg = (g.mark ? g : null);
4917- */
4918- {
4919- }
4920-
4882+ JSGraphics2D jsg = getJSGraphic2D (g );
49214883 int nSave = (jsg == null ? 0 : jsg .mark ());
49224884 printBorder (g );
49234885 if (jsg != null )
0 commit comments