javax.swing.JComponent.getAccessibleContext()方法的使用及代码示例

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

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

JComponent.getAccessibleContext介绍

暂无

代码示例

代码示例来源:origin: com.fifesoft.rtext/fife.common

/**
 * Sets the accessible description on the specified component.
 *
 * @param comp The component on which to set the accessible description.
 * @param msg A resource bundle from which to get the description.
 * @param key The key for the description in the resource bundle.
 */
public static void setDescription(JComponent comp, ResourceBundle msg,
              String key) {
  comp.getAccessibleContext().setAccessibleDescription(
                    msg.getString(key));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public static void setAccessibleDescription(JComponent component, String key) {
component.getAccessibleContext().
  setAccessibleDescription(get(key));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public static void setAccessibleDescription(JComponent component, String key) {
component.getAccessibleContext().
  setAccessibleDescription(get(key));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public static void setAccessibleDescription(JComponent component, String key) {
component.getAccessibleContext().
  setAccessibleDescription(get(key));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-support

private static JComponent wrapDialogContent(JComponent comp) {
    JComponent result;

    result = new SelfResizingPanel();
    result.setLayout(new GridLayout());
    result.add(comp);
    result.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
    result.getAccessibleContext().setAccessibleDescription(BUNDLE.getString("AD_title_select_generator")); //NOI18N
    return result;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-clientproject

private static void setSteps(WizardDescriptor.Panel[] panels, String[] steps, String[] resultSteps, int offset) {
  int n = steps == null ? 0 : steps.length;
  for (int i = 0; i < panels.length; i++) {
    final JComponent component = (JComponent) panels[i].getComponent();
    String step = i < n ? steps[i] : null;
    if (step == null) {
      step = component.getName();
    }
    component.putClientProperty(WIZARD_PANEL_CONTENT_DATA, resultSteps);
    component.putClientProperty(WIZARD_PANEL_CONTENT_SELECTED_INDEX, i);
    component.getAccessibleContext().setAccessibleDescription(step);
    resultSteps[i + offset] = step;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-ejbjarproject

private static void setSteps(WizardDescriptor.Panel[] panels, String[] steps, String[] resultSteps, int offset) {
  int n = steps == null ? 0 : steps.length;
  for (int i = 0; i < panels.length; i++) {
    final JComponent component = (JComponent) panels[i].getComponent();
    String step = i < n ? steps[i] : null;
    if (step == null) {
      step = component.getName();
    }
    component.putClientProperty (WIZARD_PANEL_CONTENT_DATA, resultSteps);
    component.putClientProperty(WIZARD_PANEL_CONTENT_SELECTED_INDEX, i);
    component.getAccessibleContext().setAccessibleDescription (step);
    resultSteps[i + offset] = step;
  }
}

代码示例来源:origin: net.sf.jt400/jt400

public void focusGained(FocusEvent e)
  {
   // Set default focus in TextField of main body panel.   
   for (int index=0; index< dialog_.getContentPane().getComponentCount(); index++) {
     JComponent inputPanel = (JComponent) dialog_.getContentPane().getComponent(index);
     if (inputPanel.getAccessibleContext().getAccessibleName().equals("BODY")) {
      // get TextField component and request focus.
      for (int i=0; i<inputPanel.getComponentCount(); i++) {                                                            
        if (inputPanel.getComponent(i) instanceof JTextField) 
        {
         inputPanel.getComponent(i).requestFocus();
         return;
        }
      }
      return;
     }
   }
  }
}  );

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public static void setAccessibleName(JComponent component, String key) {
component.getAccessibleContext().
  setAccessibleName(get(key));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public static void setAccessibleName(JComponent component, String key) {
component.getAccessibleContext().
  setAccessibleName(get(key));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

public static void setAccessibleName(JComponent component, String key) {
component.getAccessibleContext().
  setAccessibleName(get(key));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mobility-cldcplatform

public DetectRunnable() {
  setLayout(new GridBagLayout());
  GridBagConstraints gbc;
  searchLabel = new JLabel();
  gbc = new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(12, 12, 6, 12), 0, 0);
  add(searchLabel, gbc);
  gbc = new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 12, 6, 12), 0, 0);
  progress = ProgressHandleFactory.createHandle(NbBundle.getMessage(SearchRunnable.class, "Title_DetectRunnable_Searching")); //NOI18N
  this.getAccessibleContext().setAccessibleName(NbBundle.getMessage(SearchRunnable.class, "ACSN_detectingPlatform")); //NOI18N
  this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SearchRunnable.class, "ACSD_detectingPlatform")); //NOI18N
  JComponent component = ProgressHandleFactory.createProgressComponent(progress);
  component.getAccessibleContext().setAccessibleName(NbBundle.getMessage(SearchRunnable.class, "ACSN_detectingPlatform")); //NOI18N
  component.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(SearchRunnable.class, "ACSD_detectingPlatform")); //NOI18N
  add(component, gbc);
  setPreferredSize(new Dimension(400, 70));
}

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

/** Derive a tag for identifying this component.  */
public String deriveTag(Component comp) {
  // If the component class is custom, don't provide a tag
  if (isCustom(comp.getClass()))
    return null;
  JComponent jComp = ((JComponent)comp);
  String tag = null;
  // If label.setLabelFor has been used, then this component has
  // a label; use its text
  JLabel label = (JLabel)
    ((JComponent)comp).getClientProperty(LABELED_BY_PROPERTY);
  if (label != null
    && label.getText() != null
    && label.getText().length() > 0) {
    tag = label.getText();
  }
  if (tag == null || "".equals(tag)) {
    AccessibleContext context = jComp.getAccessibleContext();
    tag = deriveAccessibleTag(context);
  }
  if (tag == null || "".equals(tag)) {
    tag = super.deriveTag(comp);
  }
  return tag;
}

代码示例来源:origin: Multibit-Legacy/multibit-hd

/**
 * <p>Full FEST and Accessibility support (tooltip and description)</p>
 *
 * @param component  The Swing component to decorate
 * @param nameKey    The component name (used directly for FEST and with lookup for accessible name)
 * @param tooltipKey The component tooltip and accessible description
 * @param values     The values to the apply to the accessible name and tooltip text
 */
public static void apply(JComponent component, CoreMessageKey nameKey, CoreMessageKey tooltipKey, Object... values) {
 // Ensure FEST can find it
 component.setName(nameKey.getKey());
 // Ensure we have a suitable tooltip
 component.setToolTipText(Languages.safeText(tooltipKey, values));
 // Ensure Accessibility API can find it
 component.getAccessibleContext().setAccessibleName(Languages.safeText(nameKey, values));
 component.getAccessibleContext().setAccessibleDescription(Languages.safeText(tooltipKey, values));
}

代码示例来源:origin: Multibit-Legacy/multibit-hd

/**
 * <p>Full FEST and Accessibility support (tooltip and description)</p>
 *
 * @param component  The Swing component to decorate
 * @param nameKey    The component name (used directly for FEST and with lookup for accessible name)
 * @param tooltipKey The component tooltip and accessible description
 * @param values     The values to apply to tooltip message key
 */
public static void apply(JComponent component, MessageKey nameKey, MessageKey tooltipKey, Object... values) {
 // Ensure FEST can find it
 component.setName(nameKey.getKey());
 // Ensure we have a suitable tooltip
 component.setToolTipText(Languages.safeText(tooltipKey, values));
 // Ensure Accessibility API can find it
 component.getAccessibleContext().setAccessibleName(Languages.safeText(nameKey));
 component.getAccessibleContext().setAccessibleDescription(Languages.safeText(tooltipKey));
}

代码示例来源:origin: Multibit-Legacy/multibit-hd

/**
 * <p>Basic FEST and Accessibility support (no tooltip or description)</p>
 *
 * @param component The Swing component to decorate
 * @param nameKey   The component name (used directly for FEST and with lookup for accessible name)
 * @param values    The values to apply to the accessible name
 */
public static void apply(JComponent component, CoreMessageKey nameKey, Object... values) {
 // Ensure FEST can find it
 component.setName(nameKey.getKey());
 // Ensure Accessibility API can find it
 component.getAccessibleContext().setAccessibleName(Languages.safeText(nameKey, values));
}

代码示例来源:origin: Multibit-Legacy/multibit-hd

/**
 * <p>Basic FEST and Accessibility support (no tooltip or description)</p>
 *
 * @param component The Swing component to decorate
 * @param nameKey   The component name (used directly for FEST and with lookup for accessible name)
 * @param values    The values to apply to the accessible name
 */
public static void apply(JComponent component, MessageKey nameKey, Object... values) {
 // Ensure FEST can find it
 component.setName(nameKey.getKey());
 // Ensure Accessibility API can find it
 component.getAccessibleContext().setAccessibleName(Languages.safeText(nameKey, values));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-dataconnectivity

public BeanColumnPanel makeBeanColumn( DesignContext context, DesignBean rowSetBean, AbstractButton columnButton ) {
  BeanColumnPanel jp = new BeanColumnPanel(context, rowSetBean) ;
  JLabel xxLabel = new JLabel(context.getDisplayName()) ;
  xxLabel.getAccessibleContext().setAccessibleDescription(xxLabel.getText() );
  xxLabel.getAccessibleContext().setAccessibleName(xxLabel.getText());
  jp.add(xxLabel) ;
  JComponent xxField = null ;
  if ( rowSetBean != null ) {
    xxField = new JLabel(rowSetBean.getInstanceName()) ;
    xxField.getAccessibleContext().setAccessibleDescription( rowSetBean.getInstanceName() );
    xxField.getAccessibleContext().setAccessibleName( rowSetBean.getInstanceName() );
  } else {
    String defaultName = getRowSetNameForContext(context, null) ;
    JTextField tf = new JTextField(defaultName) ;
    tf.setColumns(15) ;
    // PlainDocument nameDoc = new PlainDocument() ;
    tf.getDocument().addDocumentListener( new DocListener( columnButton, jp) ) ;
    // tf.setDocument(nameDoc) ;
    xxLabel.setLabelFor(xxField);
    addToTabOrder( tf ) ;
    // either set the tooltip or the a11y description 
    tf.setName(context.getDisplayName());
    tf.getAccessibleContext().setAccessibleDescription(context.getDisplayName());
    xxField = (JComponent)tf ;
    jp.rowsetName = tf ;
  }
  jp.add(xxField) ;
  return jp ;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-editor

String a11yName = content.getAccessibleContext().getAccessibleName();
if (a11yName != null && !a11yName.equals("")) {
  popupWindow.getAccessibleContext().setAccessibleName(a11yName);
String a11yDesc = content.getAccessibleContext().getAccessibleDescription();
if (a11yDesc != null && !a11yDesc.equals("")) {
  popupWindow.getAccessibleContext().setAccessibleDescription(a11yDesc);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-beans

String a11yName = content.getAccessibleContext().getAccessibleName();
if(a11yName != null && !a11yName.equals(""))
  popupWindow.getAccessibleContext().setAccessibleName(a11yName);
String a11yDesc = content.getAccessibleContext().getAccessibleDescription();
if(a11yDesc != null && !a11yDesc.equals(""))
  popupWindow.getAccessibleContext().setAccessibleDescription(a11yDesc);

相关文章

JComponent类方法