import java.awt.* ;   
		   
public class HelloX
{
	public static void main(String[] args)	{
		if (1 == args.length)
			HelloX gui = new HelloX(args[0]);
		else
			System.err.println("Usage:java HelloX <Display string>");
				
	}
    //  HelloX:     . 
    //  GUI     
    //  HelloXComponent. 
	public HelloX(String strDisplay){
		//        
		Frame f = new Frame("HelloX Example Program");
		f.setLayout(new BorderLayout());
		f.resize(300, 200);
        //   string display. 
        HelloXComponent c = new HelloXComponent(strDisplay); 
        //     , 
        f.add("Center", c); 
	}
}

import java.awt.*;
public class HelloXComponent extends Canvas {
	//    display string   . 
	public HelloXComponent(String strDisplay) { 
       m_strDisplay = new String(strDisplay); 
	} 
	
    //  paint ()     
    // . 
    public void paint(Graphics g) { 
		String strDisplay = "Hello," + m_strDisplay + "!";
		FontMetrics fm = g.getFontMetrics();
		int cxText = (size().width / 2) - (fm.stringWidth(strDisplay) /2);
		int cyText = (size().height / 2) - 1 ;
		//  int cyText = (size().height / 2) - (fm.textHeight(strDisplay) /2); 

		g.drawString(strDisplay, cxText, cyText);
	}
    // ,   private, 
    private String m_strDisplay = null; 
}
