This forum is excellent.

I've doing this practice project in drawing PostalAddress GUI
i created the jpanel and jframe also PostalAddress.java file but its sems i got lots of error every time i modify it please take a look and help me i've shown lots of effort thanks guys.

// Draws a panel.
import java.awt.Graphics; 
import javax.swing.JPanel;
public class DrawPanel extends JPanel
PostalAddress DrawingAddress;

drawingAddress = myAddress;
} // end of constructor 
// draws Rectangle
public void paintComponent( Graphics g )
// call paintComponent to ensure the panel displays correctly
super.paintComponent( g );

int width = getWidth(25); // total width 
int height = getHeight(35); // total height
// draw from the upper-left to the lower-right
g.drawLine( 25, 35, width, height );

// draw from the lower-left to the upper-right
g.drawLine( 35, height, width, 25 );
} // end method paintComponent
} // end class DrawPanel

// Application to display a DrawPanel.
import javax.swing.JFrame;
public class DrawPanelTest
public static void main( String args[] )
// create a panel that contains our drawing
DrawPanelTest panel = new DrawPanelTest(myAddress);

// create a new frame to hold the panel
JFrame application = new JFrame();

// set the frame to exit when it is closed
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
application.add( panel ); // add the panel to the frame 
application.setSize( 25,35 ); // set the size of the frame
application.setVisible( true ); // make the frame visible 
} // end main
} // end class DrawPanelTest


public class PostalAddress
private String name;
private String streetAddress;
private String city;
private String state;
private String zipcode;
private String plusFour;
} // end of constructor
public void drawAddress(Graphics g, int x, int y)


This is were i git stuck Much appriciating about this lesson exam is coming up i needed the practice thanks

Edited by pyTony: fixed formatting

10 Years
Discussion Span
Last Post by mario_atl
This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.