| | |
Problem with JPanel and JComponent
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2007
Posts: 280
Reputation:
Solved Threads: 19
Iam using an AWT component. Did a little research but cannot find anyway I can make my player return a JComponent..tried this casting but Iam getting an exception at the line.
I also got to see something about mixing SWING with AWT so I decided to take out AWT completely but i seem to get errors with FlowLayout, and ActionListener..PS Iam using swing panels and frames and only used the AWT for the component and listeners..
This is what I tried with the image part
when a button A is clicked the mainPanel is supposed to display the webcam image, which works well. when button B is pressed, this image displays but not correctly. after a resize of the window, it then displays as needed on the frame. however, when button A is pressed again, the frame does not display anymore..hope this helps abit
java Syntax (Toggle Plain Text)
((com = (JComponent)p.getVisualComponent()) != null)
I also got to see something about mixing SWING with AWT so I decided to take out AWT completely but i seem to get errors with FlowLayout, and ActionListener..PS Iam using swing panels and frames and only used the AWT for the component and listeners..
This is what I tried with the image part
java Syntax (Toggle Plain Text)
imageLabel=new JLabel(new ImageIcon("optic.jpg")); imageLabel.setHorizontalAlignment(JLabel.CENTER); mainPanel.setEnabled(false); mainPanel.setOpaque(false); otherPanel.setBackground(Color.black); otherPanel.add(imageLabel,BorderLayout.CENTER);
Java Syntax (Toggle Plain Text)
((com = (JComponent)p.getVisualComponent()) != null)
I do not think second part sufficient to locate problem.
PS: It is not recommended to mix SWING and AWT.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Oct 2007
Posts: 280
Reputation:
Solved Threads: 19
sorry about that...I was trying to use a JComponent instead of Component since the getVisiaualComponent() method is not availble with JComponent...PS these are two diffrerent problems
prob 1- using JComponent instead of Component with a player or processor in JMK
prob-2
how to place the frames captured by my webcam on my JPanel correctly since the captured data appears infront of the JPanel i.e if I click on the menu bar in my panel, the list appears behind and not at the front
prob 1- using JComponent instead of Component with a player or processor in JMK
prob-2
how to place the frames captured by my webcam on my JPanel correctly since the captured data appears infront of the JPanel i.e if I click on the menu bar in my panel, the list appears behind and not at the front
![]() |
Similar Threads
- Why isn't my modified KeyTyped method working properly? (Java)
- jpanel swicthing problem.... (Java)
- Problem Refreshing Picture on JPanel (Java)
- desktop application concerning innerclass (Java)
- Swing Problem (Java)
- n00b problem (Java)
- "cannot resolve symbol"problem (Java)
- Time Refreshing on a GUI Menu Bar (Java)
- JarOutputStream (Java)
- problem with TicTacToe..somebody help me!! (Java)
Other Threads in the Java Forum
- Previous Thread: My Postings
- Next Thread: function
| Thread Tools | Search this Thread |
addball addressbook android api append applet application apps array arrays automation binary bluetooth businessintelligence button card chat class classes client code collision component crashcourse css csv database eclipse ee error exception fractal free game gis givemetehcodez graphics gui html ide image input integer integration j2me java javaarraylist javadoc javafx javaprojects jni jpanel julia jvm linux list loan loop machine map method methods migrate mobile netbeans newbie output phone physics print problem program programming project radio recursion reporting robot scanner screen se server service set size sms socket software sort sql string swing textfield threads transfer tree trolltech ubuntu utility windows






