|
-
java novice needs help quickly
i am trying to draw shapes eg rectangles, circles,ellipses on my applications
using but i am failing. here is a sample of my code so far
with jbutton added.pliz reply soonest.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TwelfthFrame extends JFrame {
public TwelfthFrame() {
Container contentPane = getContentPane();
contentPane.setLayout(new FlowLayout());
contentPane.setBackground(Color.blue);
JButton button = new JButton("Next");
button.setMnemonic(KeyEvent.VK_1);
ImageIcon icon = new ImageIcon("a:forwad.gif","previous");
button = new JButton(icon);
button.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e )
{
}
});
contentPane.add(button);
JLabel myLabel=new JLabel("Hie there!",BorderLayout.CENTER);
myLabel.setLocation(500,500);
myLabel.setSize(100,50);
contentPane.add(myLabel);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);}
public void windowClosed(WindowEvent e) {}
public void windowIconified(WindowEvent e){}
public void windowOpened(WindowEvent e ){}
public void windowDeiconified(WindowEvent e){}
public void windowActivated(WindowEvent e){}
public void windowDeactivated(WindowEvent e){}
});
}
public static void main(String args[])
{
TwelfthFrame frame = new TwelfthFrame();
frame.setTitle("Addition Facts of 8");
frame.setSize(800,600);
frame.show();
}
}
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