Create a method that draws an X across the current picture using dashed lines.

What will be an ideal response?


```
public void drawDashedX( Color c o l o r , f loat width )
{
f loat dash1 [ ] = f10.0 f g ;
Bas i cSt roke dashed =
new Bas i cSt roke (width ,
Bas i cSt roke .CAP BUTT,
Bas i cSt roke . JOIN MITER,
10.0 f , dash1 , 0 . 0 f ) ;
// g e t the Graphics2D o b j e c t
Graphics g r aphi c s = this . ge tGraphi c s ( ) ;
Graphics2D g2 = (Graphics2D) g r aphi c s ;
// s e t the c o l o r and brush width
g2 . s e tPa int ( c o l o r ) ;
g2 . s e tSt r o k e ( dashed ) ;
// g e t the max x and y v a l u e s
int maxX = getWidth ( ) ¡ 1 ;
int maxY = ge tHe ight ( ) ¡ 1 ;
// draw the l i n e s
g2 . draw(new Line2D . Double ( 0 , 0 ,maxX,maxY) ) ;
g2 . draw(new Line2D . Double ( 0 ,maxY, maxX, 0 ) ) ;
}
```

Computer Science & Information Technology

You might also like to view...

A chart in a presentation can be edited in Excel and updated in the presentation

Indicate whether the statement is true or false

Computer Science & Information Technology

The results of a search executed in the Search Document box of the Navigation pane appear at the bottom of the pane in the ________ list

A) Outcome B) Search C) Results D) Navigation

Computer Science & Information Technology

Elements are organized as pages of a book or a stack of cards in a(n) ____________________ authoring system.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The Apple II computer included color graphics.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology