I am building a whiteboard, which would have a server(teacher) and clients(students). Teacher would draw something on his side, which will be shown exactly same to the students.
- I want to know which component i should use to do the drawing? i am currently drawing on JPanel .
- I want the screen of Server gets copied on the clients, so for that what could be the right method to do this?
- option1: i save the JPanel as image, and send thru socket, and loads it on the screen of client, also it always saves the background image only, not what the user has drawn onto it. OR
- option2: both server and client JPanel dimensions are same, so i just send the new coordinates drawn everytime thru socket, with some protocol to understand whether it is rubber or pencil..
Any help would be appreciated.
JComponentunless you need to add other components, then use aJPanel.Update
Then you definitely want to go the least bandwidth intensive route possible. That will be the bottleneck.
In that case, make the drawing component a
JComponent& stay with aJPanel(or aJToolBar) for the controls.In order of bandwidth and ignoring corner cases, they would decrease in approximately this order:
In case there is any confusion, I recommend option 3.2.