-Please i need help with this for a homework,please help !!
i made this coude using JDK and Jcreator Pro here is the code :
/**
* This program displays a message in a window.
*/
import java.awt.*;
import javax.swing.*;
public class HelloGui extends JFrame
{
public HelloGui () // Constructor
{
super("GUI Demo"); // Set the little bar
Container c = getContentPane ();
c.setBackground(Color.GREEN);
c.setLayout(new FlowLayout ());
c.add (new JTextField("Roses are red,Violets are blue,"+
"Sugar is sweet" +
" so are you" + " and so are you, and so are you...."));
}
public static void main(String[] args)
{
HelloGui windows = new HelloGui();
// Set this window's location and size:
// upper-left corner at 300, 300; width 200,height 100
windows.setBounds(700, 700, 500, 400);
windows.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
windows.setVisible(true);
}
}
Java JDK Help !!!!?
You already have a peom in there -- it's defined in the constructor call to JTextField. Generally, it's cleaner to do something like this:
JTextField jTextField = new JTextField();
jTextField.setText( "Roses are red, etc." );
c.add(jTextField);
But this will give you the same results as your code. Just put your poem text in the JTextField.
survey software
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment