CanCeylan
CanCeylan

Reputation: 3010

Creating a small images from JPanel

I'm writing simple slide program in Java. In that program, I draw lines, ellipses, rectangles and etc in each slide. What is more, like a powerpoint I want to show all of my slides' symbolic small pictures on the JList.

How should I create small images from all elements in JPanel?

Thanks.

Upvotes: 2

Views: 151

Answers (2)

trashgod
trashgod

Reputation: 205875

You might look at capturing a panel's image using Screen Image, discussed here.

Addendum: See also ComponentImageCapture.

Upvotes: 2

korifey
korifey

Reputation: 3519

If I understood your task correct, you must inherit from JPanel and overload method paintComponent(Graphics g). Inside you can write something like g.drawLine(0,0, 10, 10)

Upvotes: 0

Related Questions