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

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

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

JTextField.getFocusTraversalKeys介绍

暂无

代码示例

代码示例来源:origin: dcaoyuan/nbscala

public static JScrollPane createScrollableLineEditor(JEditorPane editorPane) {
    editorPane.setKeymap(new FilteredKeymap(editorPane));
    JScrollPane sp = new JScrollPane(editorPane, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
                           JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        
    editorPane.setBorder (
      new CompoundBorder (editorPane.getBorder (),
      new EmptyBorder (0, 0, 0, 0))
    );
    
    JTextField referenceTextField = new JTextField();
    
    int preferredHeight = referenceTextField.getPreferredSize().height;
    if (sp.getPreferredSize().height < preferredHeight) {
      sp.setPreferredSize(referenceTextField.getPreferredSize());
    }
    sp.setMinimumSize(sp.getPreferredSize());
    
    Set<AWTKeyStroke> tfkeys = referenceTextField.getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
    editorPane.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, tfkeys);
    tfkeys = referenceTextField.getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
    editorPane.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, tfkeys);
    return sp;
  }
}

代码示例来源:origin: org.gephi/directory-chooser

Set<AWTKeyStroke> tKeys = filenameTextField.getFocusTraversalKeys(java.awt.KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
Set<AWTKeyStroke> newTKeys = new HashSet<>(tKeys);
newTKeys.remove(AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_TAB, 0));

相关文章

JTextField类方法