Referring to my earlier question :
Based on your valuable answers, I choose Java 2D library to cater my requirements.
I completely read the above said library and have full understanding of dealing with the graphics stuff, like what to draw and how to draw etc.Now i only left with one question that how do i draw my required shapes inside JPanel and after drawing all those shapes how do i place that JPanel inside a JScrollPane?
You will typically draw your stuff inside a subclass of JComponent, say, MyComponent.
MyComponent myc = new MyComponent();
JScrollPane jsp = new JScrollPane(myComponent);
Override paintComponent(Graphics g)
method. Cast Graphics
to Graphics2D
and use drawShape()
method passing all your Shapes
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.