javax.swing.JFrame.setFocusTraversalPolicy()方法的使用及代码示例

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

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

JFrame.setFocusTraversalPolicy介绍

暂无

代码示例

代码示例来源:origin: Killerardvark/CryodexSource

public void actionPerformed(ActionEvent e) {
  if ("toggle".equals(e.getActionCommand())) {
    frame.setFocusTraversalPolicy(togglePolicy.isSelected() ?
        newPolicy : null);
  }
}

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

private void tryCustomFocusTraversal() {
  final JFrame frame = new JFrame("Stack Overflow: vertical tab order");
  frame.setBounds(100, 100, 800, 600);
  frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  final JPanel panel = new JPanel(null);
  final JTextField[] jTextFieldArray = new JTextField[22];

  int k = 130;
  int h = 10;
  for (int i = 0; i < jTextFieldArray.length; ++i) {
    jTextFieldArray[i] = new JTextField();
    jTextFieldArray[i].setBounds(k, h, 120, 25);
    String s = Integer.toString(i + 1);
    jTextFieldArray[i].setText(s);
    h += 30;
    panel.add(jTextFieldArray[i]);
    if (i == 10) k = 430;
    if (i == 10) h = 10;
  }

  frame.getContentPane().add(panel);
  frame.setFocusTraversalPolicy(new CustomFocusTraversalPolicy(Arrays.asList(jTextFieldArray)));
  frame.setVisible(true);
}

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

frame.setFocusTraversalPolicy(policy);

代码示例来源:origin: de.sciss/scisslib

protected void deactivateHelpMode()
{
  if( f.getGlassPane() != this ) return;
  this.setVisible( false );
  f.setGlassPane( normalGlassPane );
  f.setFocusTraversalPolicy( normalFocus );
  normalGlassPane         = null;
  normalFocus                = null;
  focussedHelpComponent   = null;
  focussedArea.reset();
  f.requestFocus();
}

代码示例来源:origin: de.sciss/scisslib

protected void activateHelpMode()
{
  Component recentGlassPane = f.getGlassPane();
  if( recentGlassPane == this || recentGlassPane.isVisible() ) return;
  normalGlassPane         = recentGlassPane;
  focussedHelpComponent   = null;
  focussedArea.reset();
  f.setGlassPane( this );
  this.setVisible( true );
  normalFocus                = f.getFocusTraversalPolicy();
  f.setFocusTraversalPolicy( new NoFocusTraversalPolicy() );
  this.requestFocus();
}

代码示例来源:origin: de.dfki.mary/marytts-client

mainFrame.setFocusTraversalPolicy(maryGUITraversal);
} else { // this is an applet
  mainApplet.setFocusTraversalPolicy(maryGUITraversal);

相关文章

JFrame类方法