本文整理汇总了Java中java.awt.TextField.setEditable方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setEditable方法的具体用法?Java TextField.setEditable怎么用?Java TextField.setEditable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.TextField
的用法示例。
在下文中一共展示了TextField.setEditable方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PgbNetDialog
import java.awt.TextField; //导入方法依赖的package包/类
public PgbNetDialog(Frame frame) {
super(frame, "Pgb Netplay", true);
this.frame = frame;
setSize(250, 90);
setResizable(false);
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
c.insets = new Insets(5, 10, 5, 10);
status = new TextField("", 30);
status.setEditable(false);
c.gridwidth = GridBagConstraints.REMAINDER;
gridbag.setConstraints(status, c);
add(status);
listen = new Button("Listen");
listen.setActionCommand("listen");
listen.addActionListener(this);
c.gridwidth = 1;
gridbag.setConstraints(listen, c);
add(listen);
connect = new Button("Connect...");
connect.setActionCommand("connect");
connect.addActionListener(this);
gridbag.setConstraints(connect, c);
add(connect);
cancel = new Button("Cancel");
cancel.setActionCommand("cancel");
cancel.addActionListener(this);
c.gridwidth = GridBagConstraints.REMAINDER;
gridbag.setConstraints(cancel, c);
add(cancel);
}
示例2: MainFrame
import java.awt.TextField; //导入方法依赖的package包/类
public MainFrame() throws HeadlessException {
super(AppName);
this.setLayout(new BorderLayout());
imagePath = System.getProperty("java.io.tmpdir") + "/images/";
urlText = new TextField();
urlText.setEditable(false);
this.imageView = new ImageView();
this.add(imageView, BorderLayout.CENTER);
this.add(urlText, BorderLayout.NORTH);
this.imageView.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent me) {
if (me.getClickCount() == 2) {
updateImage();
}
}
});
this.urlText.addMouseListener(new MouseAdapter(){
@Override
public void mouseClicked(MouseEvent e) {
copyUrl();
}
});
new File(imagePath).mkdirs();
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.uploader = new Uploader(this);
this.updateImage();
this.pack();
}
示例3: jButton3ActionPerformed
import java.awt.TextField; //导入方法依赖的package包/类
/**
* 点击测试连接按钮
*
* @param evt
*/
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
JFrame frame = new JFrame("设备连接测试");
LayoutManager layout = new GridLayout(2, 2);
frame.setLayout(layout);
frame.setBounds(20, 20, 300, 100);
frame.setVisible(true);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
TextField textFiled1 = new TextField("可用设备数");
textFiled1.setEditable(false);
connectedCountDeviceTextField.setEditable(false);
frame.getContentPane().add(textFiled1);
frame.getContentPane().add(connectedCountDeviceTextField);
TextField textFiled2 = new TextField("总设备数");
textFiled2.setEditable(false);
totalCountDeviceTextField.setEnabled(false);
frame.getContentPane().add(textFiled2);
frame.getContentPane().add(totalCountDeviceTextField);
// 设备数监听
Thread countDeviceThread = new Thread(new Runnable() {
@Override
public void run() {
int connected = 0, total = 0;// 已在线设备数,总设备数
AndroidDebugBridge bridge = AdbUtil.getADBInstance();
if (bridge != null) {
try {
while (!Thread.currentThread().isInterrupted()) {
IDevice[] devices = bridge.getDevices();
if (devices != null) {
total = devices.length;
connected = 0;
for (IDevice device : devices) {
if (device != null && device.isOnline()) {
connected++;
}
}
}
connectedCountDeviceTextField.setText(String.format("%d", connected));
totalCountDeviceTextField.setText(String.format("%d", total));
Thread.sleep(500);
}
} catch (InterruptedException e) {
logger.info("设备数目监听线程退出");
}
}
}
}, "CountDeviceThread");
countDeviceThread.start();
/* 窗口退出,退出线程 */
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
countDeviceThread.interrupt();
}
});
}
示例4: actionPerformed
import java.awt.TextField; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent arg0) {
// Set settings to default
TextField textLineWidth = (TextField) gd.getNumericFields().get(0);
textLineWidth.setText("" + IJ.d2s(Lines_.lineWidthDefault, 2));
textLineWidth.setEditable(true);
TextField textHighCon = (TextField) gd.getNumericFields().get(1);
textHighCon.setText("" + IJ.d2s(Lines_.contrastHighDefault, 0));
textHighCon.setEditable(true);
TextField textLowCon = (TextField) gd.getNumericFields().get(2);
textLowCon.setText("" + IJ.d2s(Lines_.contrastLowDefault, 0));
textLowCon.setEditable(true);
TextField textSigma = (TextField) gd.getNumericFields().get(3);
textSigma.setText("" + IJ.d2s(Lines_.sigmaDefault, 2));
textSigma.setEditable(true);
TextField textLowThresh = (TextField) gd.getNumericFields().get(4);
textLowThresh.setText("" + IJ.d2s(Lines_.lowerThreshDefault, 2));
textLowThresh.setEditable(true);
TextField textUppThresh = (TextField) gd.getNumericFields().get(5);
textUppThresh.setText("" + IJ.d2s(Lines_.upperThreshDefault, 2));
textUppThresh.setEditable(true);
TextField textMinLength = (TextField) gd.getNumericFields().get(6);
textMinLength.setText("" + IJ.d2s(Lines_.minLengthDefault, 2));
textMinLength.setEditable(true);
TextField textMaxLength = (TextField) gd.getNumericFields().get(7);
textMaxLength.setText("" + IJ.d2s(Lines_.maxLengthDefault, 2));
textMaxLength.setEditable(true);
((Checkbox) gd.getCheckboxes().get(0)).setState(Lines_.isDarkLineDefault);
((Checkbox) gd.getCheckboxes().get(1)).setState(Lines_.doCorrectPositionDefault);
((Checkbox) gd.getCheckboxes().get(2)).setState(Lines_.doEstimateWidthDefault);
((Checkbox) gd.getCheckboxes().get(3)).setState(Lines_.doExtendLineDefault);
((Checkbox) gd.getCheckboxes().get(4)).setState(Lines_.showJunctionPointsDefault);
((Checkbox) gd.getCheckboxes().get(5)).setState(Lines_.showIDsDefault);
((Checkbox) gd.getCheckboxes().get(6)).setState(Lines_.verboseDefault);
((Checkbox) gd.getCheckboxes().get(7)).setState(Lines_.displayResultsDefault);
((Checkbox) gd.getCheckboxes().get(8)).setState(Lines_.addToRoiManagerDefault);
((Checkbox) gd.getCheckboxes().get(9)).setState(Lines_.makeBinaryDefault);
((Choice) gd.getChoices().get(0)).select(0);
}
示例5: setupDBFields
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<Component>(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);
}
示例6: PgbConnectionStatus
import java.awt.TextField; //导入方法依赖的package包/类
public PgbConnectionStatus(Frame frame, ActionListener al, Socket socket) {
super(frame, "Pgb Connection Status", false);
setSize(300, 150);
setResizable(false);
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
setLayout(gridbag);
c.insets = new Insets(2, 10, 2, 10);
connectedTo = new Label("Connected To:");
gridbag.setConstraints(connectedTo, c);
add(connectedTo);
addressField = new TextField(socket.getInetAddress().getHostName(), 20);
addressField.setEditable(false);
c.gridwidth = GridBagConstraints.REMAINDER;
gridbag.setConstraints(addressField, c);
add(addressField);
playing = new Label("Playing:");
c.gridwidth = 1;
gridbag.setConstraints(playing, c);
add(playing);
gameField = new TextField("", 20);
gameField.setEditable(false);
c.gridwidth = GridBagConstraints.REMAINDER;
gridbag.setConstraints(gameField, c);
add(gameField);
status = new Label("Status:");
c.gridwidth = 1;
gridbag.setConstraints(status, c);
add(status);
statusField = new TextField("", 20);
statusField.setEditable(false);
c.gridwidth = GridBagConstraints.REMAINDER;
gridbag.setConstraints(statusField, c);
add(statusField);
disconnect = new Button("Disconnect");
disconnect.setActionCommand("disconnect");
disconnect.addActionListener(al);
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = GridBagConstraints.REMAINDER;
gridbag.setConstraints(disconnect, c);
add(disconnect);
}
示例7: disableEditing
import java.awt.TextField; //导入方法依赖的package包/类
private void disableEditing(TextField textField)
{
textField.setEditable(false);
textField.setBackground(SystemColor.control);
}
示例8: enableEditing
import java.awt.TextField; //导入方法依赖的package包/类
private void enableEditing(TextField textField)
{
textField.setEditable(true);
textField.setBackground(SystemColor.white);
}
示例9: buildAssociations
import java.awt.TextField; //导入方法依赖的package包/类
/**
* Method that launches the search to find the rules with the highest
* confirmation.
*
* @param instances The instances to be used for generating the rules.
* @throws Exception if rules can't be built successfully.
*/
public void buildAssociations(Instances instances) throws Exception {
Frame valuesFrame = null; /* Frame to display the current values. */
/* Initialization of the search. */
if (m_parts == null) {
m_instances = new Instances(instances);
} else {
m_instances = new IndividualInstances(new Instances(instances), m_parts);
}
m_results = new SimpleLinkedList();
m_hypotheses = 0;
m_explored = 0;
m_status = NORMAL;
if (m_classIndex == -1)
m_instances.setClassIndex(m_instances.numAttributes()-1);
else if (m_classIndex < m_instances.numAttributes() && m_classIndex >= 0)
m_instances.setClassIndex(m_classIndex);
else
throw new Exception("Invalid class index.");
// can associator handle the data?
getCapabilities().testWithFail(m_instances);
/* Initialization of the window for current values. */
if (m_printValues == WINDOW) {
m_valuesText = new TextField(37);
m_valuesText.setEditable(false);
m_valuesText.setFont(new Font("Monospaced", Font.PLAIN, 12));
Label valuesLabel = new Label("Best and worst current values:");
Button stop = new Button("Stop search");
stop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
/* Signal the interruption to the search. */
m_status = STOP;
}
});
valuesFrame = new Frame("Tertius status");
valuesFrame.setResizable(false);
valuesFrame.add(m_valuesText, BorderLayout.CENTER);
valuesFrame.add(stop, BorderLayout.SOUTH);
valuesFrame.add(valuesLabel, BorderLayout.NORTH);
valuesFrame.pack();
valuesFrame.setVisible(true);
} else if (m_printValues == OUT) {
System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +"Best and worst current values:");
}
Date start = new Date();
/* Build the predicates and launch the search. */
m_predicates = buildPredicates();
beginSearch();
Date end = new Date();
if (m_printValues == WINDOW) {
valuesFrame.dispose();
}
m_time = new Date(end.getTime() - start.getTime());
}
示例10: PanelID
import java.awt.TextField; //导入方法依赖的package包/类
public PanelID() {
campoID = new TextField(4);
campoID.setEditable(false);
add(new Label("ID de Proceso:"));
add(campoID);
}