简体   繁体   中英

Is there a way to create Table in Java AWT?

Is there way to create Table in Java AWT? I need to create simple Java AWT program for insert, edit, delete and read users from database.

Yes: Make your own table with a bunch of labels as cells, and a scroll pane. You can set it up to add more cells/labels on the fly, and add any features you want.

If you cannot or do not want to do the above, then you can seek out a third party library that creates tables for AWT.

Or take the much easier and faster option and just use swing.

you can make table in swing JTable. But now you should use Graphics:

import java.awt.*;
public class name extends Frame{
 name(){
  setLayout(new FlowLayout());
  setSize(1000,1000);
  setVisible(true);
}//end of name()
public void paint(Graphics g){//opening graphics
  g.drawRect(10,50,100,100);//make a rectangle 
  g.drawRect(50,50,100,100);//another rectangle
  g.drawRect(10,100,100,100);//and another
  g.drawRect(50,100,100,100);//last rectangle
  g.drawString("SOMTHING", 30,80);//write a text in a rectangle
}//end of graphics
public static void main(String[] args){
  name n=new name();
}
}//end of Frame

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM