Can't add Webcam panel to existing jPanel.
See original GitHub issueHello,
I’m using NetBeans and I made basic layout with jPanel in the middle of it. Now I would like to add Webcam in this jPanel.
Webcam webcam = Webcam.getDefault();
webcam.setViewSize(WebcamResolution.VGA.getSize());
WebcamPanel panel = new WebcamPanel(webcam);
panel.setFPSDisplayed(true);
panel.setDisplayDebugInfo(true);
panel.setImageSizeDisplayed(true);
panel.setMirrored(true);
jPanel5.add(panel);
jPanel5.setVisible(true);
jPanel5.revalidate();
jPanel5.repaint();
This code is in my class constructor. I would like to run this at startup. Just after other netbeans componenst are loaded. When I add example to my program it’s working but my main layout is loaded and webcam screen in another window. I would like to get it in the same window.
I tried to do it with other componenst like jInternalFrame, even jLabel and I just have no idea how to add webcam to existing element, not to new one.
Thanks for any help, Qbaloz
Issue Analytics
- State:
- Created 9 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Adding Webcam panel to existing jPanel - java - Stack Overflow
Adding Webcam panel to existing jPanel ... I'm using NetBeans and I made basic layout with jPanel in the middle of it. Now...
Read more >com.github.sarxos.webcam.WebcamPanel java code examples
Adding Webcam panel to existing jPanel. final JPanel jPanelCamera = new JPanel(); jTabbedPane1.addTab("Camera", jPanelCamera); Webcam webcam = Webcam.
Read more >How to Use Panels - Oracle Help Center
When you add components to a panel, you use the add method. Exactly which arguments you specify to the add method depend on...
Read more >Using webcam with a Java application
First you need to get a list of devices with the help of CaptureDeviceManager and filter out the first element of that list....
Read more >Why isn't my image loading on my JPanel?? - java - DaniWeb
Overridding paint rather that paintComponent is almost always a mistake. In this case you call super.paint - which paints the Panel and all ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After obtaining the same problem, for the components created from swing with netbeans it is necessary to put the panel with flowlayout.
-Panel created in netbeans
Hi @lilblazekonceptz,
There should be no issue when adding
WebcamPanel
to otherJPanel
. If it’s not working in your case it means that theJPanel
added from Netbeans builder have some fancy something set which differs it from a normalJPanel
(I guess, e.g. special layaout manager, preferred size, bounds, or something else).I tested this idea of embedding
WebcamPanel
inside anotherJPanel
and it works well: