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

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

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

JComponent.getComponent介绍

暂无

代码示例

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

final JSpinner spinner = new JSpinner();
 JComponent comp = spinner.getEditor();
 JFormattedTextField field = (JFormattedTextField) comp.getComponent(0);
 DefaultFormatter formatter = (DefaultFormatter) field.getFormatter();
 formatter.setCommitsOnValidEdit(true);
 spinner.addChangeListener(new ChangeListener() {
   @Override
   public void stateChanged(ChangeEvent e) {
     LOG.info("value changed: " + spinner.getValue());
   }
 });

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

public BCalqueLegendePanel getLegendePanel(final int _i) {
 if (_i >= 0 && (_i < pnLegendes_.getComponentCount())) {
  return ((BCalqueLegendePanel) pnLegendes_.getComponent(_i));
 }
 return null;
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-2d

public BCalqueAffichage getLegendDisplayAtPosition(final int _i) {
 if (_i >= 0 && (_i < pnLegendes_.getComponentCount())) {
  return ((BCalqueLegendePanel) pnLegendes_.getComponent(_i)).aff_;
 }
 return null;
}

代码示例来源:origin: org.metawidget.modules.swing/metawidget-swing

/**
 * Overridden to build widgets just-in-time.
 * <p>
 * This method may be called by developers who wish to modify the created Components before they
 * are displayed. For example, they may wish to call .setBorder( null ) if the component is to
 * be used as a JTable CellEditor.
 */
@Override
public Component getComponent( int index ) {
  buildWidgets();
  return super.getComponent( index );
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

/**
 * @param _parent le composant  partir duquel la recherche commence
 * @param _name le nom du composant fils  chercher
 * @return le fils direct de _parent ayant le nom donne ou null si non trouve
 */
public static JComponent findChildByName(JComponent _parent, String _name) {
 if (_parent == null || _name == null) return null;
 for (int i = _parent.getComponentCount() - 1; i >= 0; i--) {
  if (_name.equals(_parent.getComponent(i).getName())) return (JComponent) _parent.getComponent(i);
 }
 return null;
}

代码示例来源:origin: org.metawidget.modules/metawidget-all

/**
 * Overridden to build widgets just-in-time.
 * <p>
 * This method may be called by developers who wish to modify the created Components before they
 * are displayed. For example, they may wish to call .setBorder( null ) if the component is to
 * be used as a JTable CellEditor.
 */
@Override
public Component getComponent( int index ) {
  buildWidgets();
  return super.getComponent( index );
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-common

private void internSetFont(final JComponent _c, final Font _font) {
 for (int i = _c.getComponentCount() - 1; i >= 0; i--) {
  _c.getComponent(i).setFont(_font);
 }
}

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

private Component getResizedComponent() {
  final JComponent parent = (JComponent) getParent();
  if(parent != null && resizeComponentIndex == null) {
    resizeComponentIndex = getIndex();
  }
  return parent.getComponent(resizeComponentIndex);
}

代码示例来源:origin: org.fudaa.framework.ebli/ebli-common

private void internSetFont(final JComponent _c, final Font _font) {
 for (int i = _c.getComponentCount() - 1; i >= 0; i--) {
  _c.getComponent(i).setFont(_font);
 }
}

代码示例来源:origin: undera/jmeter-plugins

@Override
  public void stateChanged(ChangeEvent e) {
    updateGui();
    JComponent selectedComponent = (JComponent) getSelectedComponent();
    //settings panel is added to a top container panel, so we get it
    //as selected component
    if (selectedComponent == settingsTab) {
      selectedComponent = (JComponent) selectedComponent.getComponent(0);
    }
    GraphRendererInterface renderer = (GraphRendererInterface) (selectedComponent);
    renderer.getGraphDisplayPanel().add(graphPanelObject, BorderLayout.CENTER);
    graphPanelObject.setIsPreview(renderer.isPreview());
  }
}

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

JComponent editor = spinner.getEditor();
   int n = editor.getComponentCount();
   for (int i=0; i<n; i++)
   {
     Component c = editor.getComponent(i);
     if (c instanceof JTextField)
     {
       c.setForeground(Color.red);
       c.setBackground(Color.red);
     }
   }

代码示例来源:origin: kg.apc/jmeter-plugins-cmn-jmeter

@Override
  public void stateChanged(ChangeEvent e) {
    updateGui();
    JComponent selectedComponent = (JComponent) getSelectedComponent();
    //settings panel is added to a top container panel, so we get it
    //as selected component
    if (selectedComponent == settingsTab) {
      selectedComponent = (JComponent) selectedComponent.getComponent(0);
    }
    GraphRendererInterface renderer = (GraphRendererInterface) (selectedComponent);
    renderer.getGraphDisplayPanel().add(graphPanelObject, BorderLayout.CENTER);
    graphPanelObject.setIsPreview(renderer.isPreview());
  }
}

代码示例来源:origin: girtel/Net2Plan

public void setColor(Color color)
  {
    JComponent editor = this.getEditor();
    int numberOfComps = editor.getComponentCount();
    for(int i = 0; i < numberOfComps; i++)
    {
      editor.getComponent(i).setBackground(color);
    }
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-calendar-widget

public static void setFocusableRecursive(Component aComp, boolean aValue) {
  aComp.setFocusable(aValue);
  if (aComp instanceof JComponent) {
    JComponent jComp = (JComponent) aComp;
    for (int i = 0; i < jComp.getComponentCount(); i++) {
      setFocusableRecursive(jComp.getComponent(i), aValue);
    }
  }
}

代码示例来源:origin: com.github.arnabk/pgslookandfeel

public void installUI(JComponent c) {
  super.installUI(c);
  c.putClientProperty("gradientStart", UIManager.get("ToolBar.gradientStart"));
  c.putClientProperty("gradientEnd", UIManager.get("ToolBar.gradientEnd"));
  int limit = c.getComponentCount();
  for (int i = 0; i < limit; i++) {
    setToolBarUI((JComponent) c.getComponent(i));
  }
}

代码示例来源:origin: nroduit/Weasis

private void selectAll(final JComponent parent, boolean selected) {
  for (int i = 0; i < parent.getComponentCount(); i++) {
    Component c = parent.getComponent(i);
    if (c instanceof AbstractButton) {
      ((AbstractButton) c).setSelected(selected);
    }
  }
  itemList.forEach(m -> m.setSelected(selected));
}

代码示例来源:origin: lbalazscs/Pixelitor

private static void setOpaque(JComponent jc,boolean opaque) {
  if(jc instanceof JTextField)
    return;
  
  jc.setOpaque(false);
  if(jc instanceof JSpinner)
    return;
  
  for(int a = 0; a<jc.getComponentCount(); a++) {
    JComponent child = (JComponent)jc.getComponent(a);
    setOpaque(child,opaque);
  }
}

代码示例来源:origin: org.fudaa.framework.fudaa/fudaa-common

protected static void addKeyListener(final Component _c, final KeyListener _key) {
 if (_c != null) {
  _c.addKeyListener(_key);
  if (_c instanceof JComponent) {
   final JComponent jc = (JComponent) _c;
   for (int i = jc.getComponentCount() - 1; i >= 0; i--) {
    addKeyListener(jc.getComponent(i), _key);
   }
  }
 }
}

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

public void setMainToolBar(BuToolBar _tb) {
 main_toolbar_ = _tb;
 if (!(getApp() instanceof BuSubApp)) {
  if ((content_.getComponentCount() > 1) && (content_.getComponent(1) != null)) content_.remove(1);
  if (main_toolbar_ != null) {
   content_.add(main_toolbar_, BuBorderLayout.NORTH);
   main_toolbar_.revalidate();
   // content_.doLayout();
   // content_.validate();
  }
 }
}

代码示例来源:origin: GoldenGnu/jeveassets

private void fixTextComponents(final JComponent jComponent) {
  for (int i = 0; i < jComponent.getComponentCount(); i++) {
    Component c = jComponent.getComponent(i);
    if (c instanceof JTextComponent) {
      JTextComponent jTextComponent = (JTextComponent) c;
      if (!jTextComponent.isEditable()) {
        jTextComponent.getActionMap().put(DefaultEditorKit.insertBreakAction, new HideAction(DialogCenteredAction.OK.name()));
      }
    }
    if (c instanceof JComponent) {
      fixTextComponents((JComponent) c);
    }
  }
}

相关文章

JComponent类方法