Results 1 to 3 of 3
Thread: JFrames in netbeans
- 11-28-2010, 04:51 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 20
- Rep Power
- 0
JFrames in netbeans
I'm trying to build a JFrame application in netbeans but i cant seem to get the simple jframe code to compile on my computer. can someone tell me how to set up a project properly to get this code to compile please
Java Code:import java.awt.*; import javax.swing.*; import java.awt.event.*; public class FrameDemo extends JFrame { public FrameDemo() // Constructor { super( "Frame Demo Application" ); Container c = getContentPane(); c.setLayout(new FlowLayout Label prompt = new Label ("a Label component in a JFrame"); c.add( prompt); setSize(230, 100); show(); } public static void main( String args[] ) { FrameDemo app = new FrameDemo(); app.addWindowListener( new WindowAdapter() { public void windowClosing( WindowEvent e ) { System.exit( 0 ); } }); } }
- 11-28-2010, 04:55 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
c.setLayout(new FlowLayout --> c.setLayout(new FlowLayout());
notes:
dont mix awt and swing components !
show is deprecated --> Component (Java Platform SE 6)
- 11-28-2010, 05:10 PM #3
Member
- Join Date
- Oct 2010
- Posts
- 20
- Rep Power
- 0
Similar Threads
-
help with jframes
By pao09 in forum AWT / SwingReplies: 0Last Post: 04-15-2009, 02:10 PM -
jframes
By ddj in forum AWT / SwingReplies: 0Last Post: 03-24-2009, 03:15 PM -
linking 2 Jframes
By suhaib1thariq in forum New To JavaReplies: 9Last Post: 02-13-2009, 01:30 AM -
problem with jframes
By Robert in forum AWT / SwingReplies: 1Last Post: 01-16-2009, 03:05 AM -
two JFrames
By kirtesh4u in forum New To JavaReplies: 0Last Post: 11-17-2008, 08:26 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks