[英]Is there a way to create Table in Java AWT?
有沒有辦法在Java AWT中創建表? 我需要創建簡單的Java AWT程序,以便從數據庫中插入,編輯,刪除和讀取用戶。
是:用一堆標簽作為單元格和一個滾動窗格來創建自己的表。 您可以對其進行設置以動態添加更多單元格/標簽,並添加所需的任何功能。
如果您不能或不想執行上述操作,則可以查找為AWT創建表的第三方庫。
或者選擇更輕松,更快速的選項,然后使用swing。
您可以在Swing JTable中創建表。 但是現在您應該使用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.