本文整理了Java中javax.swing.JComponent.getComponents()
方法的一些代码示例,展示了JComponent.getComponents()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.getComponents()
方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:getComponents
暂无
代码示例来源:origin: stanfordnlp/CoreNLP
public static void alignLeft(JComponent box) {
for(Component comp: box.getComponents()) {
((JComponent) comp).setAlignmentX(Box.LEFT_ALIGNMENT);
}
}
代码示例来源:origin: stackoverflow.com
protected void installRolloverBorders ( JComponent c ) {
// Put rollover borders on buttons
Component[] components = c.getComponents();
for (Component component : components) {
if (component instanceof JComponent) {
((JComponent) component).updateUI();
setBorderToRollover(component);
}
}
}
代码示例来源:origin: stackoverflow.com
public List<JTextField> getAllJTextField(JComponent input) {
List<JTextField> list = new ArrayList<JTextField>();
for (Component c : input.getComponents()) {
if (c.getClass().equals(JTextField.class)) {
list.add((JTextField)c);
}
}
return list;
}
代码示例来源:origin: abel533/DBMetadata
private void enableAllComponent(JComponent parent, boolean enable) {
for (Component component : parent.getComponents()) {
component.setEnabled(enable);
}
}
代码示例来源:origin: stackoverflow.com
public static <T extends Component> List<T> getAllJTextField(JComponent input, T clazz) {
List<T> list = new ArrayList<T>();
for (Component c : input.getComponents()) {
if (c.getClass().equals(clazz)) {
list.add((T)c);
}
}
return list;
}
代码示例来源:origin: eu.mihosoft.vrl/vrl
public ArrayList<Component> getOrder() {
ArrayList<Component> result = new ArrayList<Component>();
result.addAll(Arrays.asList(target.getComponents()));
return result;
}
代码示例来源: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[] getComponents() {
buildWidgets();
return super.getComponents();
}
代码示例来源:origin: edu.stanford.nlp/stanford-corenlp
public static void alignLeft(JComponent box) {
for(Component comp: box.getComponents()) {
((JComponent) comp).setAlignmentX(Box.LEFT_ALIGNMENT);
}
}
代码示例来源:origin: JetBrains/jediterm
private static <T extends JComponent> void findComponentsOfType(JComponent parent, Class<T> cls, ArrayList<T> result) {
if (parent == null) return;
if (cls.isAssignableFrom(parent.getClass())) {
@SuppressWarnings({"unchecked"}) final T t = (T) parent;
result.add(t);
}
for (Component c : parent.getComponents()) {
if (c instanceof JComponent) {
findComponentsOfType((JComponent) c, cls, result);
}
}
}
代码示例来源:origin: stackoverflow.com
private static void setComponentsEnable(final JComponent component, final boolean enabled) {
final Component[] vComponents = component instanceof JMenu ? ((JMenu)component).getMenuComponents() : component.getComponents();
for (final Component vComponent : vComponents) {
if (vComponent instanceof JMenu)
setComponentsEnable((JMenu)vComponent, true);
vComponent.setVisible(enabled);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject
private void setArchiveTemplateEnabled(boolean enabled) {
for (Component component : archiveSiteCustomizer.getComponent().getComponents()) {
component.setEnabled(enabled);
}
}
代码示例来源: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[] getComponents() {
buildWidgets();
return super.getComponents();
}
代码示例来源:origin: Audiveris/audiveris
private void disconnectKeyboard ()
{
if (boardsPane != null) {
for (Component topComp : boardsPane.getComponent().getComponents()) {
for (Component comp : ((Container) topComp).getComponents()) {
if (comp instanceof JComponent) {
((JComponent) comp).resetKeyboardActions();
}
}
}
}
}
代码示例来源:origin: tulskiy/musique
private void setComponentChildrenState(JComponent component, boolean state) {
component.setEnabled(state);
for (Component child : component.getComponents()) {
child.setEnabled(state);
if (child instanceof JComponent) {
setComponentChildrenState((JComponent) child, state);
}
}
}
代码示例来源:origin: stackoverflow.com
public static void setButtonCursor(JComponent component, Cursor cursor) {
for (Component comp : component.getComponents()) {
if (comp instanceof JButton) {
comp.setCursor(cursor);
} else if (comp instanceof JComponent) {
setButtonCursor((JComponent)comp, cursor);
}
}
}
代码示例来源:origin: stackoverflow.com
public static void setToolTipRecursively(JComponent c, String text) {
c.setToolTipText(text);
for (Component cc : c.getComponents())
if (cc instanceof JComponent)
setToolTipRecursively((JComponent) cc, text);
}
代码示例来源:origin: stackoverflow.com
public void setDefaultVisibility(JComponent j) {
defaultVisibility.put(j, j.isVisible());
for(JComponent c : j.getComponents()) {
setDefaultVisibility(c);
}
}
代码示例来源:origin: stackoverflow.com
private static void addListenerToAllComponents(JComponent c, MouseListener l) {
c.addMouseListener(l);
for (Component cc : c.getComponents())
if (cc instanceof JComponent)
addListenerToAllComponents((JComponent) cc, l);
}
代码示例来源:origin: bcdev/beam
@Override
public PopupPanel createPopupComponent() {
final PopupPanel popupComponent = super.createPopupComponent();
final JScrollPane content = (JScrollPane) popupComponent.getComponents()[0];
final JComponent upperPane = (JComponent) content.getComponents()[0];
FolderChooser folderChooser = (FolderChooser) upperPane.getComponents()[0];
folderChooser.setRecentListVisible(false);
popupComponent.setTitle("Choose download directory");
return popupComponent;
}
};
代码示例来源:origin: protegeproject/protege
private static void removeFromInputMap(KeyStroke ks, JComponent c) {
// Most likely stored in the ancestor of focused component map,
// but...
removeKeyBinding(c.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT), ks);
removeKeyBinding(c.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW), ks);
removeKeyBinding(c.getInputMap(JComponent.WHEN_FOCUSED), ks);
// Process children recursively
for (Component child : c.getComponents()) {
if (child instanceof JComponent) {
removeFromInputMap(ks, (JComponent) child);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!