简体   繁体   English

有没有办法在Java AWT中创建表?

[英]Is there a way to create Table in Java AWT?

Is there way to create Table in Java AWT? 有没有办法在Java AWT中创建表? I need to create simple Java AWT program for insert, edit, delete and read users from database. 我需要创建简单的Java AWT程序,以便从数据库中插入,编辑,删除和读取用户。

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. 如果您不能或不想执行上述操作,则可以查找为AWT创建表的第三方库。

Or take the much easier and faster option and just use swing. 或者选择更轻松,更快速的选项,然后使用swing。

you can make table in swing JTable. 您可以在Swing JTable中创建表。 But now you should use Graphics: 但是现在您应该使用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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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