jtable中的文本

时间:2011-05-19 16:06:54

标签: java swing jtable

您好我想在按钮“购买”

之前将我的文件数据显示在此面板中

这是我的代码:

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);
  }
} 

1 个答案:

答案 0 :(得分:1)