当前位置: 首页>>代码示例>>Java>>正文


Java Container类代码示例

本文整理汇总了Java中java.awt.Container的典型用法代码示例。如果您正苦于以下问题:Java Container类的具体用法?Java Container怎么用?Java Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Container类属于java.awt包,在下文中一共展示了Container类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: enumerateCycle

import java.awt.Container; //导入依赖的package包/类
private void enumerateCycle(Container container, List<Component> cycle) {
    if (!(container.isVisible() && container.isDisplayable())) {
        return;
    }

    cycle.add(container);

    Component[] components = container.getComponents();
    for (Component comp : components) {
        if (comp instanceof Container) {
            Container cont = (Container)comp;

            if (!cont.isFocusCycleRoot() &&
                !cont.isFocusTraversalPolicyProvider() &&
                !((cont instanceof JComponent) && ((JComponent)cont).isManagingFocus()))
            {
                enumerateCycle(cont, cycle);
                continue;
            }
        }
        cycle.add(comp);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:SortingFocusTraversalPolicy.java

示例2: addTree

import java.awt.Container; //导入依赖的package包/类
private void addTree(Collection<Long> order, Set<Long> set, Container cont) {
    for (int i = 0; i < cont.getComponentCount(); i++) {
        Component comp = cont.getComponent(i);
        Object peer = AWTAccessor.getComponentAccessor().getPeer(comp);
        if (peer instanceof XComponentPeer) {
            Long window = Long.valueOf(((XComponentPeer)peer).getWindow());
            if (!set.contains(window)) {
                set.add(window);
                order.add(window);
            }
        } else if (comp instanceof Container) {
            // It is lightweight container, it might contain heavyweight components attached to this
            // peer
            addTree(order, set, (Container)comp);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:XComponentPeer.java

示例3: removeProjectTab

import java.awt.Container; //导入依赖的package包/类
@Override
public void removeProjectTab(ProjectWindowTab projectWindowTab) {

	DefaultMutableTreeNode node = this.getTreeNode(projectWindowTab.getTitle());
	if (node != null) {
		DefaultMutableTreeNode pareNode = (DefaultMutableTreeNode) node.getParent();
		pareNode.remove(node);
	}

	JComponent component = projectWindowTab.getJComponentForVisualization();
	Container container = component.getParent();
	if (container != null) {
		container.remove(component);
	}
	this.tabVector.remove(projectWindowTab);

	this.getTreeModel().reload();
	this.projectTreeExpand2Level(3, true);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:20,代码来源:ProjectWindow.java

示例4: setViewer

import java.awt.Container; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void setViewer(LayerViewer vv) {
	if (this.vv == vv)
		return;
	this.vv = vv;
	Container contentPane = satellite.getContentPane();

	if (satelliteViewer != null)
		contentPane.remove(satelliteViewer);
	if (vv != null) {
		satelliteViewer = new MySatelliteVisualizationViewer(vv,
				new Dimension(100, 100));

		satelliteViewer.getRenderContext().setVertexFillPaintTransformer(
				vv.getRenderContext().getVertexFillPaintTransformer());

		vv.addChangeListener(satelliteViewer);

		contentPane.add(satelliteViewer);
	} else {
		satelliteViewer = null;
	}
	satellite.pack();
	autoZoomSatellite();
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:26,代码来源:SatelliteViewerCorner.java

示例5: init

import java.awt.Container; //导入依赖的package包/类
private static void init(Container container) {
    container.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridx = 0;
    gbc.gridy = 1;
    JLabel label = new JLabel();
    Dimension size = new Dimension(111, 0);
    label.setPreferredSize(size);
    label.setMinimumSize(size);
    container.add(label, gbc);
    gbc.gridx = 1;
    gbc.weightx = 1;
    container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.weightx = 0;
    gbc.weighty = 1;
    container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Test8039464.java

示例6: findButton

import java.awt.Container; //导入依赖的package包/类
private static JButton findButton(Component comp) {

        if (comp instanceof JButton) {
            return (JButton) comp;
        }

        if (comp instanceof Container) {
            Container cont = (Container) comp;
            for (int i = 0; i < cont.getComponentCount(); i++) {
                JButton result = findButton(cont.getComponent(i));
                if (result != null) {
                    return result;
                }
            }
        }
        return null;
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:bug6219960.java

示例7: addTree

import java.awt.Container; //导入依赖的package包/类
private void addTree(Collection order, Set set, Container cont) {
    for (int i = 0; i < cont.getComponentCount(); i++) {
        Component comp = cont.getComponent(i);
        ComponentPeer peer = comp.getPeer();
        if (peer instanceof XComponentPeer) {
            Long window = Long.valueOf(((XComponentPeer)peer).getWindow());
            if (!set.contains(window)) {
                set.add(window);
                order.add(window);
            }
        } else if (comp instanceof Container) {
            // It is lightweight container, it might contain heavyweight components attached to this
            // peer
            addTree(order, set, (Container)comp);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:XComponentPeer.java

示例8: createSeparator

import java.awt.Container; //导入依赖的package包/类
protected Container createSeparator() {
    return new JPanel() {

        public Dimension getPreferredSize() {
            return new Dimension(10, 2);
        }

        public void paint(Graphics g) {
            int width = getWidth();
            g.setColor(Color.darkGray);
            g.drawLine(0, 0, width, 0);
            g.setColor(Color.white);
            g.drawLine(0, 1, width, 1);
        }
    };
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:MotifOptionPaneUI.java

示例9: found

import java.awt.Container; //导入依赖的package包/类
protected List<IJavaElement> found(List<IJavaElement> pElements, IJavaAgent driver) {
    List<IJavaElement> r = new ArrayList<IJavaElement>();
    for (IJavaElement je : pElements) {
        Component component = je.getComponent();
        if (!(component instanceof Container)) {
            continue;
        }
        int index = getIndexOfComponentInParent(component);
        if (index < 0) {
            continue;
        }
        Container parent = component.getParent();
        JWindow topContainer = driver.switchTo().getTopContainer();
        for (int i = index + 1; i < parent.getComponentCount(); i++) {
            Component c = parent.getComponent(i);
            IJavaElement je2 = JavaElementFactory.createElement(c, driver, driver.switchTo().getTopContainer());
            if (sibling.matchesSelector(je2).size() > 0) {
                IJavaElement e = topContainer.addElement(JavaElementFactory.createElement(c, driver, topContainer));
                if (!r.contains(e)) {
                    r.add(e);
                }
            }
        }
    }
    return r;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:27,代码来源:GeneralSiblingSelector.java

示例10: JDesktopPane

import java.awt.Container; //导入依赖的package包/类
/**
 * Creates a new <code>JDesktopPane</code>.
 */
public JDesktopPane() {
    setUIProperty("opaque", Boolean.TRUE);
    setFocusCycleRoot(true);

    setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {
        public Component getDefaultComponent(Container c) {
            JInternalFrame jifArray[] = getAllFrames();
            Component comp = null;
            for (JInternalFrame jif : jifArray) {
                comp = jif.getFocusTraversalPolicy().getDefaultComponent(jif);
                if (comp != null) {
                    break;
                }
            }
            return comp;
        }
    });
    updateUI();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:JDesktopPane.java

示例11: layoutContainer

import java.awt.Container; //导入依赖的package包/类
@Override
public void layoutContainer(Container container) {
  ComponentElement parent = (ComponentElement) container;
  CssStyleDeclaration style = ((ComponentElement) parent).getComputedStyle();

  float scale = parent.getOwnerDocument().getSettings().getScale();
  float containingBoxWidth = container.getWidth() / scale;

  float left = style.getPx(CssProperty.BORDER_LEFT_WIDTH, containingBoxWidth) + 
      style.getPx(CssProperty.PADDING_LEFT, containingBoxWidth);
  float top = style.getPx(CssProperty.BORDER_TOP_WIDTH, containingBoxWidth) + 
      style.getPx(CssProperty.PADDING_TOP, containingBoxWidth);
  float right = style.getPx(CssProperty.BORDER_RIGHT_WIDTH, containingBoxWidth) + 
      style.getPx(CssProperty.PADDING_RIGHT, containingBoxWidth);
  
  layout.layout(parent, left, top, container.getWidth() - left - right, false);
}
 
开发者ID:stefanhaustein,项目名称:nativehtml,代码行数:18,代码来源:SwingLayoutAdapter.java

示例12: requestFocus

import java.awt.Container; //导入依赖的package包/类
private static void requestFocus(final JEditorPane editorPane) {
    if (!SwingUtilities.isEventDispatchThread()) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                requestFocus(editorPane);
            }
        });
        return ;
    }
    Container p = editorPane;
    while ((p = p.getParent()) != null) {
        if (p instanceof TopComponent) {
            ((TopComponent) p).requestActive();
            break;
        }
    }
    editorPane.requestFocusInWindow();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:MethodChooser.java

示例13: main

import java.awt.Container; //导入依赖的package包/类
public static void main(String[] args) throws IntrospectionException {
    Class[] types = {
            Component.class,
            Container.class,
            JComponent.class,
            AbstractButton.class,
            JButton.class,
            JToggleButton.class,
    };
    // Control set. "enabled" and "name" has the same pattern and can be found
    String[] names = {
            "enabled",
            "name",
            "focusable",
    };
    for (String name : names) {
        for (Class type : types) {
            BeanUtils.getPropertyDescriptor(type, name);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:Test4619792.java

示例14: RoutingInfoWindow

import java.awt.Container; //导入依赖的package包/类
public RoutingInfoWindow(DTNHost host) {
	this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	this.host = host;
	Container cp = this.getContentPane();
	this.setLayout(new BorderLayout());
	
	this.treePane = new JScrollPane();
	updateTree();
	
	cp.add(treePane, BorderLayout.NORTH);
	
	this.refreshButton = new JButton("refresh");
	this.refreshButton.addActionListener(this);
	cp.add(refreshButton, BorderLayout.SOUTH);
	
	this.pack();		
	this.setVisible(true);
}
 
开发者ID:MaX121,项目名称:Bachelor-Thesis,代码行数:19,代码来源:RoutingInfoWindow.java

示例15: setButtonState

import java.awt.Container; //导入依赖的package包/类
static void setButtonState(Container c, String buttonString, boolean flag) {
	int len = c.getComponentCount();
	for (int i = 0; i < len; i++) {
		Component comp = c.getComponent(i);

		if (comp instanceof JButton) {
			JButton b = (JButton) comp;

			if (buttonString.equals(b.getText())) {
				b.setEnabled(flag);
			}

		} else if (comp instanceof Container) {
			setButtonState((Container) comp, buttonString, flag);
		}
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:18,代码来源:SingleOrStereoCameraCalibration.java


注:本文中的java.awt.Container类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。