Extend Text Editor to Draw Shapes

 
E
x
t
e
n
d
 
T
e
x
t
 
E
d
i
t
o
r
 
t
o
 
D
r
a
w
s
h
a
p
e
s
 
 
Add Shape to text editor main menu then add to
shape menu the items in the following figure
and add text box to Draw text item
 
D
e
f
i
n
e
 
t
h
e
 
f
o
l
l
o
w
i
n
g
 
a
t
t
r
i
b
u
t
e
s
 
i
n
 
c
l
a
s
s
T
e
x
t
E
d
i
t
o
r
 
C
r
e
a
t
e
 
g
r
a
p
h
i
c
 
a
n
d
 
p
e
n
 
o
b
j
e
c
t
s
 
i
n
 
t
h
e
c
o
n
s
t
r
u
c
t
o
r
 
W
r
i
t
e
 
e
v
e
n
t
 
h
a
n
d
l
e
r
 
f
o
r
 
i
t
e
m
s
 
i
n
n
 
s
h
a
p
e
 
m
e
n
u
:
r
e
c
t
a
n
g
l
e
,
 
e
l
l
i
p
s
e
,
 
l
i
n
e
 
a
n
d
 
e
r
a
s
e
 
 
Write event handler for items draw 
 
text, return
to text and actor then write event handler to
Document Mouse Down event
 
 
I
n
 
D
o
c
u
m
e
n
t
 
M
o
u
s
e
 
U
p
 
e
v
e
n
t
 
h
a
n
d
l
e
r
w
r
i
t
e
 
t
h
e
 
f
o
l
l
o
w
i
n
g
 
c
o
d
e
 
 
I
n
 
D
o
c
u
m
e
n
t
 
M
o
u
s
e
 
D
o
w
n
 
e
v
e
n
t
h
a
n
d
l
e
r
 
w
r
i
t
e
 
t
h
e
 
f
o
l
l
o
w
i
n
g
 
c
o
d
e
 
 
R
u
n
 
t
h
e
 
p
r
o
g
r
a
m
 
a
n
d
 
t
e
s
t
 
a
l
l
 
s
h
a
p
e
m
e
n
u
 
i
t
e
m
s
 
Slide Note
Embed
Share

Learn to enhance a text editor by adding drawing capabilities such as shapes and text boxes. Define attributes in a TextEditor class, create graphic and pen objects, and write event handlers for various shape menu items. Test the program to ensure all shape menu items function correctly

  • Programming
  • Text Editor
  • Drawing Shapes
  • Event Handling
  • Graphic Objects

Uploaded on Feb 23, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Extend Text Editor to Draw shapes

  2. Add Shape to text editor main menu then add to shape menu the items in the following figure and add text box to Draw text item

  3. Define the following attributes in class TextEditor

  4. Create graphic and pen objects in the constructor

  5. Write event handler for items inn shape menu: rectangle, ellipse, line and erase

  6. Write event handler for items draw text, return to text and actor then write event handler to Document Mouse Down event

  7. In Document Mouse Up event handler write the following code

  8. In Document Mouse Down event handler write the following code

  9. Run the program and test all shape menu items

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#