I'm just stepping into this huge world of designing graphic UIs, so please be patient.
I went through (some of) the (vast) documentation on the official website and I just wanted to know if there was a method that told me the shape of my JComponent.
When I do getBounds it says rectangle, does this refer to my shape?
Thanks in advance.
AWT's class Component
and Swing's class JComponent
don't have the concept of arbitrary shapes, they just have a rectangular shape. That's why JComponent
's method getBounds
returns a Rectangle
which is just a special case of the Shape
interface.
Only class java.awt.Window
has getShape
and setShape
methods, and of course all its subclasses ( Dialog
, Frame
, JWindow
, JDialog
, JFrame
, ...) also have. May be this is what you need.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.