| |

VerySource

 Forgot password?
 Register
Search
View: 966|Reply: 2

How do I draw an oval and a rectangle with characters?

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-24 17:40:01
| Show all posts |Read mode
The size of the ellipse and rectangle can change with the length of the content of the word

This ellipse is an object with its own tips

What should I do with such things?

thank you all
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-2-24 01:15:02
| Show all posts
You can determine the length of the ellipse just by calculating the pixel length of the text
FontMetrics fm = label.getFontMetrics (font); // font is the font you use
int width = fm.stringWidth ("String");
Reply

Use magic Report

0

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-4 18:00:01
| Show all posts
There is a relative radius setting for drawing an ellipse. By calculating the length of the text, it is set as the radius of the ellipse. There seems to be a monitoring method to change the radius of the ellipse object when the text changes. It has not been implemented specifically, only an idea is provided.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list