|
-
It does not print message to screen
Hey Developers,
Today is my first day trying to write a Java Application. I have a book that
somewhat walks me through the initial process. However, after I typed in
the code that was listed in the book it does not print the, "HelloJava" message
to the screen. They have a screen shots in the book showing the small app
should look like. My app looks exactly like it expect for the fact that it
doesn't print the message. The code is as follows:
public class HelloJava1 extends javax.swing.JComponent {
public static void main(String[] args) {
javax.swing.JFrame f = new javax.swing.JFrame("HelloJava1");
f.setSize(300, 300);
f.getContentPane().add(new HelloJava1( ));
f.setVisible(true);
}
public void paintComponent(java.awt.Graphics g) {
g.drawString("Hello, Java!", 125, 95);
}
}
Thanks in advance for your responses,
eejay
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks