Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] simple GUI question

Started by yves032784 Mar 4, 2004 at 9:34 AM 1 replies 350+ views
Original Post
yves032784
yves032784
ok, this is a should be fairly simple for anybody who has experience with java, but i can''t seem to figure it out since i''m new to the language. I''m able to display my JFrame, but the buttons just wont be displayed (all the JButtons are not displayed in my JFrame...) here is my code:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;


public class BushAdvisor extends JFrame implements ActionListener
{
	
	private JComboBox locationCBox;
	private JButton addButton=new JButton("Add");
	private JButton modifyButton=new JButton ("Modify");
	private JButton removeButton=new JButton("Remove");

	public static void main(String[] args)
	{
		
		BushAdvisor test=new BushAdvisor();
		test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		test.setSize(500,500);
		test.show();
	}	
	
	public void BushAdvisor()
	{
		Container c=this.getContentPane();
		c.setLayout(new FlowLayout());
		c.add(addButton);
		c.add(modifyButton);
		c.add(removeButton);
	
		addButton.addActionListener(this);
	
	}
	
	public void actionPerformed(ActionEvent event)
	{
		if(event.getSource()==addButton)
		{
			//do something
		}
		
	}
}
 
yves032784
yves032784
thanks for the help

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.