text in a jtable

Hello i want to display my file's data into this panel before the button "Buy it"

here is my code:

package program;

import java.awt.Container;
import java.awt.FlowLayout;    
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;

public class Button1 extends JApplet {
    private static final String EXT_FILE = "Dogss.txt";//"../ApplicationESB/src/applicationesb/pricelist.txt";


  private JButton b1 = new JButton("Buy it");      

  public void init() {
    Container cp = getContentPane();
    cp.setLayout(new FlowLayout());
    cp.add(b1);

  }    

  public static void main(String[] args) {
    run(new Button1(), 500, 600);
  }

  public static void run(JApplet applet, int width, int height) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(applet);
    frame.setSize(width, height);
    applet.init();
    applet.start();
    frame.setVisible(true);
  }
} 

Upvotes: 0

Views: 118

Answers (1)

Kennet
Kennet

Reputation: 5796

Look in the Swing tutorial how to create tables, http://download.oracle.com/javase/tutorial/uiswing/components/table.html

Upvotes: 1

Related Questions