public class table extends JPanel implements ActionListener{
	JButton addInfo;
	public table(String dataFilePath) {
        JTable table;
        model model;
        Font f;
        f = new Font("SanSerif",Font.PLAIN,24);
        setLayout(new BorderLayout());
        model = new model(dataFilePath);
        table = new JTable();
        GridLayout layout = new GridLayout(80,30);
        addInfo = new JButton("Add Data");
        addInfo.setSize(80, 30);
        addInfo.addActionListener(this); //action listener is somewhere below
        //i'm not good at swing...and I don't know how to make the button 
        //appear AFTER the table rather than right on top of it...
        JScrollPane scrollpane = new JScrollPane(table);
        } catch (Exception e){
        	System.out.println("Can't set look and feel:" + e.getMessage());

This class is a table with the model "model" (model is another one of my classes). I tried to add a button, but I need the button to be located beneathe the table rather than on top of the table. Is this possible?

Items will be aligned in a container in the order that you add them. So yes, it is possible. Is that what you're asking? If you wanted the button above, just add the button first and add the table second.

This article has been dead for over six months. Start a new discussion instead.