javax.swing.JTextField.setFocusable()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(220)

本文整理了Java中javax.swing.JTextField.setFocusable()方法的一些代码示例,展示了JTextField.setFocusable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTextField.setFocusable()方法的具体详情如下:
包路径:javax.swing.JTextField
类名称:JTextField
方法名:setFocusable

JTextField.setFocusable介绍

暂无

代码示例

代码示例来源:origin: runelite/runelite

public void setEditable(boolean editable)
{
  this.blocked = !editable;
  textField.setEditable(editable);
  textField.setFocusable(editable);
  if (!editable)
  {
    super.setBackground(backgroundColor);
  }
}

代码示例来源:origin: wildfly/wildfly

txtArea.setPreferredSize(new Dimension((int)(main_frame_size.width * 0.9), (int)(main_frame_size.height * 0.8)));
mainFrame.setVisible(true);
txtField.setFocusable(true);
txtField.requestFocusInWindow();
txtField.setToolTipText("type and then press enter to send");

代码示例来源:origin: magefree/mage

txtName.setHorizontalAlignment(javax.swing.JTextField.LEFT);
txtName.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtName.setFocusable(false);
txtName.setMaximumSize(new java.awt.Dimension(50, 22));
txtName.setOpaque(false);
txtType.setHorizontalAlignment(javax.swing.JTextField.LEFT);
txtType.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtType.setFocusable(false);
txtType.setOpaque(false);
txtType.setRequestFocusEnabled(false);
txtStartTime.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtStartTime.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtStartTime.setFocusable(false);
txtStartTime.setOpaque(false);
txtStartTime.setRequestFocusEnabled(false);
txtEndTime.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtEndTime.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtEndTime.setFocusable(false);
txtEndTime.setOpaque(false);
txtEndTime.setRequestFocusEnabled(false);
txtTournamentState.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtTournamentState.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtTournamentState.setFocusable(false);
txtTournamentState.setOpaque(false);
txtTournamentState.setRequestFocusEnabled(false);

代码示例来源:origin: stackoverflow.com

JTextField jTextField1 = new JTextField();

addMouseListener(new java.awt.event.MouseAdapter() {
      public void mouseClicked(java.awt.event.MouseEvent evt) {
        jTextField1.setFocusable(false);
      }
    });

代码示例来源:origin: Var3D/var3dframe

@Override
public void mouseClicked(MouseEvent mouseEvent) {
  textField.setVisible(true);
  textMessage.setVisible(false);
  textField.requestFocus();
  textField.setFocusable(true);
}

代码示例来源:origin: Var3D/var3dframe

public void becomeFirstResponder(){
  textField.setVisible(true);
  textMessage.setVisible(false);
  textField.requestFocus();
  textField.setFocusable(true);
}

代码示例来源:origin: stackoverflow.com

resultField.setFocusable(false);

代码示例来源:origin: stackoverflow.com

JComboBox myComboBox = new JComboBox(array);
myComboBox .setOpaque(false);
myComboBox .setEditable(true);
JTextField boxField = (JTextField)myComboBox .getEditor().getEditorComponent();
boxField.setBorder(BorderFactory.createEmptyBorder());
boxField.setBackground(new Color(0, 0, 0, 0));
boxField.setFocusable(false);

代码示例来源:origin: stackoverflow.com

ipTextfield.setHorizontalAlignment(SwingConstants.CENTER);
ipTextfield.setAlignmentX(Component.LEFT_ALIGNMENT);
ipTextfield.setFocusable(false);
ipTextfield.setEditable(false);
add(ipTextfield);
uuidTextField.setHorizontalAlignment(SwingConstants.CENTER);
uuidTextField.setEditable(false);
uuidTextField.setFocusable(false);
add(uuidTextField);
uuidTextField.setColumns(30);

代码示例来源:origin: misakuo/svgtoandroid

public GUI(Project project) {
  this.project = project;
  frame = new JFrame("SVG to VectorDrawable (" + CommonUtil.loadMetaInf("version", "") + ")");
  modulesUtil = new ModulesUtil(project);
  distDirList.clear();
  svgPath.setFocusable(false);
  setListener();
  initModules();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-junit-ui

tfProject.setFocusable(false);

代码示例来源:origin: edu.stanford.protege/org.protege.ontograf

searchField.setSize(new Dimension(300, 22));
searchField.setPreferredSize(new Dimension(300, 22));
searchField.setFocusable(true);
searchField.requestFocus();

代码示例来源:origin: MrCrayfish/ModelCreator

textFieldDestination.setText(defaultDir);
textFieldDestination.setEditable(false);
textFieldDestination.setFocusable(false);
textFieldDestination.setCaretPosition(0);
panel.add(textFieldDestination);

代码示例来源:origin: SimpleAmazonGlacierUploader/SAGU

p2.add(jtfAddField);
jtfAddField.addMouseListener(new ContextMenuMouseListener());
jtfAddField.setFocusable(true);
p2.setBackground(wc);

代码示例来源:origin: cmu-phil/tetrad

private JTextField createResponse(JList list, int width) {
  JTextField pane = new JTextField();
  pane.setFont(getFONT());
  pane.setFocusable(true);
  pane.setEditable(false);
  pane.setBackground(list.getBackground());
  String target = regressionModel.getTargetName();
  if (target != null) {
    pane.setText(target);
  } else {
    pane.setText("Hello");
  }
  pane.setCaretPosition(0);
  LayoutUtils.setAllSizes(pane, new Dimension(width, pane.getPreferredSize().height));
  if (target == null) {
    pane.setText(null);
  }
  pane.addFocusListener(new FocusAdapter() {
    @Override
    public void focusGained(FocusEvent e) {
      getPredictorsList().clearSelection();
    }
  });
  return pane;
}

代码示例来源:origin: SimpleAmazonGlacierUploader/SAGU

p2.add(jtfDeleteField);
jtfDeleteField.addMouseListener(new ContextMenuMouseListener());
jtfDeleteField.setFocusable(true);
p2.setBackground(wc);

代码示例来源:origin: uk.org.mygrid.taverna/taverna-workbench

private JTextField getProjectSiteLabel() {
  final JTextField result=new JTextField("http://www.taverna.org.uk");
  result.setFocusable(true);
  result.setForeground(Color.BLUE);
  result.setBackground(BACKGROUND_COLOUR);
  result.setBorder(null);
  result.setEditable(false);
  result.setHorizontalAlignment(JTextField.CENTER);
  result.addMouseListener(new MouseAdapter() {
    @Override
    public void mouseClicked(MouseEvent e) {
      launchURL(result.getText());
    }
  });
  return result;
}

代码示例来源:origin: com.synaptix/SynaptixWidget

public void setValue(E value) {
  E oldValue = this.value;
  if (value != null) {
    nameField.getDocument().removeDocumentListener(nameDocumentListener);
    this.value = value;
    nameField.setText(valueToString(value));
    nameField.setEditable(false);
    if (toolTipFocusListener != null) {
      toolTipFocusListener.setEnabled(false);
    }
    nameField.setCaretPosition(0);
    button.setFocusable(true);
    nameField.setFocusable(false);
    button.transferFocus();
    updateRemoveLabel();
    nameField.getDocument().addDocumentListener(nameDocumentListener);
    firePropertyChange("value", oldValue, this.value);
  } else {
    removeValue();
  }
  paintNameFieldBackground();
}

代码示例来源:origin: com.synaptix/SynaptixWidget

private void initComponents() {
  editorButtonAction = new EditorButtonAction();
  nameField = new JTextField();
  nameField.setEditable(false);
  nameField.setFocusable(false);
  if (withRemoveLabel) {
    removeLabel = new JRemoveLabel();
    removeLabel.showErrorIcon(StaticWidgetHelper.getSynaptixWidgetConstantsBundle().noneSelected());
    removeLabel.addActionListener(new RemoveActionListener());
  }
  button = new JButton(editorButtonAction);
  ImageIcon eraseIcon = StaticImage.getImageScale(new ImageIcon(AbstractRemoveAction.class.getResource("iconClearBig.png")), 16); //$NON-NLS-1$
  removeAction = new AbstractAction(null, eraseIcon) {
    private static final long serialVersionUID = 4102703144330237406L;
    @Override
    public void actionPerformed(ActionEvent e) {
      removeValue();
      fireChangeListener();
    }
  };
  removeAction.putValue(Action.SHORT_DESCRIPTION, StaticWidgetHelper.getSynaptixWidgetConstantsBundle().clear());
}

代码示例来源:origin: com.synaptix/SynaptixWidget

private void removeValue() {
  E oldValue = this.value;
  this.value = null;
  nameField.setText(null);
  nameField.setEditable(editable && isEnabled());
  nameField.setFocusable(editable && isEnabled());
  if (button.hasFocus()) {
    nameField.grabFocus();
  }
  if (toolTipFocusListener != null) {
    toolTipFocusListener.setEnabled(editable && isEnabled());
  }
  paintNameFieldBackground();
  firePropertyChange("value", oldValue, this.value);
  updateRemoveLabel();
}

相关文章

JTextField类方法