日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

java seteditable,Java TextField.setEditable方法代碼示例

發布時間:2023/12/10 java 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java seteditable,Java TextField.setEditable方法代碼示例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

import java.awt.TextField; //導入方法依賴的package包/類

public void setupDBFields(String dbname) throws Exception

{

viewPane.setLayout(null);

Dimension dimView = sp.getSize();

int height = 0, width = 50;

viewPane.removeAll();

db = new DBF(dbname);

setTitle(dbname);

gb = new GridBagLayout();

gbc = new GridBagConstraints();

viewPane.setLayout(gb);

int i, j;

fldObjects = new Vector(db.getFieldCount());

for (i = 1; i <= db.getFieldCount(); i++)

{

j = i - 1;

f = db.getField(i);

if (f.isMemoField() || f.isPictureField()) {

b = new Button(db.getField(i).getName());

b.addActionListener(this);

addComponent(viewPane, b, 1, j, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

fldObjects.addElement(b);

}

else if (f.getType() == 'L') {

c = new Checkbox(db.getField(i).getName(), true);

addComponent(viewPane, c, 1, j, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

fldObjects.addElement(c);

}

else {

l = new Label(db.getField(i).getName(), Label.RIGHT);

addComponent(viewPane, l, 0, j, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

int ln = f.getLength();

if (ln > 100) ln = 100;

t = new TextField(db.getField(i).getName(), ln);

if (width < ln*10) width=ln*10;

addComponent(viewPane, t, 1, j, ln, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

fldObjects.addElement(t);

t.setEditable(true);

}

height += 10;

}

crl.setText("Record " + db.getCurrentRecordNumber());

trl.setText(" of " + db.getRecordCount());

SBrecpos.setMaximum(db.getRecordCount());

addComponent(viewPane, crl, 0, i, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

addComponent(viewPane, trl, 1, i, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

i++;

addComponent(viewPane, SBrecpos, 0, i, 2, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

addComponent(viewPane, delCB, 2, i, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST );

i++;

addComponent(viewPane, Prev, 0, i, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

addComponent(viewPane, Next, 1, i, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

i++;

addComponent(viewPane, Add, 0, i, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

addComponent(viewPane, Update, 1, i, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

addComponent(viewPane, Clear, 2, i, 1, 1, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST);

Prev.setEnabled(false);

prevRecord.setEnabled(false);

if (db.getRecordCount() == 0) {

Update.setEnabled(false);

updateRecord.setEnabled(false);

Next.setEnabled(false);

nextRecord.setEnabled(false);

}

dimView.setSize(width+150, height+150);

sp.setSize(dimView);

goTo(1);

}

總結

以上是生活随笔為你收集整理的java seteditable,Java TextField.setEditable方法代碼示例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。