javax.swing.Box.getComponents()方法的使用及代码示例

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

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

Box.getComponents介绍

暂无

代码示例

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets

public <U extends Component> U getWidget(Class<U> clazz) {
  for (Component component : box.getComponents()) {
    if (clazz == component.getClass()) {
      return (U) component;
    }
  }
  return null;
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime-swing-widget

public <U extends Component> U getWidget(Class<U> clazz) {
  for (Component component : box.getComponents()) {
    if (clazz == component.getClass()) {
      return (U) component;
    }
  }
  return null;
}

代码示例来源:origin: org.nuiton.jaxx/jaxx-widgets-status

public <U extends Component> U getWidget(Class<U> clazz) {
  for (Component component : box.getComponents()) {
    if (clazz == component.getClass()) {
      return (U) component;
    }
  }
  return null;
}

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

JFrame frame=new JFrame("Box ordering test");
Box box=Box.createVerticalBox();
frame.setContentPane(box);
box.add(new JLabel("One"));
box.add(new JLabel("Two"));
box.add(new JLabel("Three"));
box.add(new JLabel("Four"));
box.add(new JLabel("Five"));
MouseMotionListener l=new MouseMotionAdapter() {
  @Override
  public void mouseDragged(MouseEvent e) {
    Component c=e.getComponent();
    Container p=c.getParent();
    int count = p.getComponentCount();
    int newPos=Math.max(0, Math.min(count,
      (e.getY()+c.getY())*count/p.getHeight()));
    if(newPos!=p.getComponentZOrder(c)) {
      p.setComponentZOrder(c, newPos);
      p.revalidate();
      p.repaint();
    }
  }
};
for(Component c: box.getComponents()) c.addMouseMotionListener(l);
frame.pack();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);

代码示例来源:origin: com.nativelibs4java/jnaerator

optPanel.add(forceNamesCb);
optBox.add(optPanel);
for (Component c : optBox.getComponents()) {
  ((JComponent) c).setAlignmentX(0);

代码示例来源:origin: nativelibs4java/JNAerator

optPanel.add(forceNamesCb);
optBox.add(optPanel);
for (Component c : optBox.getComponents()) {
  ((JComponent) c).setAlignmentX(0);

代码示例来源:origin: RPTools/maptool

Component[] comps = ((Box) comp).getComponents();
int componentCount = 0;
Integer index = 0;

相关文章