java.awt.event.ContainerListener#java.awt.Container源码实例Demo

下面列出了java.awt.event.ContainerListener#java.awt.Container 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: TencentKona-8   文件: GroupLayout.java
/**
 * Lays out the specified container.
 *
 * @param parent the container to be laid out
 * @throws IllegalStateException if any of the components added to
 *         this layout are not in both a horizontal and vertical group
 */
public void layoutContainer(Container parent) {
    // Step 1: Prepare for layout.
    prepare(SPECIFIC_SIZE);
    Insets insets = parent.getInsets();
    int width = parent.getWidth() - insets.left - insets.right;
    int height = parent.getHeight() - insets.top - insets.bottom;
    boolean ltr = isLeftToRight();
    if (getAutoCreateGaps() || getAutoCreateContainerGaps() ||
            hasPreferredPaddingSprings) {
        // Step 2: Calculate autopadding springs
        calculateAutopadding(horizontalGroup, HORIZONTAL, SPECIFIC_SIZE, 0,
                width);
        calculateAutopadding(verticalGroup, VERTICAL, SPECIFIC_SIZE, 0,
                height);
    }
    // Step 3: set the size of the groups.
    horizontalGroup.setSize(HORIZONTAL, 0, width);
    verticalGroup.setSize(VERTICAL, 0, height);
    // Step 4: apply the size to the components.
    for (ComponentInfo info : componentInfos.values()) {
        info.setBounds(insets, width, ltr);
    }
}
 
/**
 * Package private method which returns either BorderLayout.NORTH,
 * BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending
 * on the location of the toolbar in its parent. The toolbar might be
 * in PAGE_START, PAGE_END, CENTER, or some other position, but will be
 * resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar
 * actually IS, with CENTER being NORTH.
 *
 * This code is used to determine where the border line should be drawn
 * by the custom toolbar states, and also used by NimbusIcon to determine
 * whether the handle icon needs to be shifted to look correct.
 *
 * Toollbars are unfortunately odd in the way these things are handled,
 * and so this code exists to unify the logic related to toolbars so it can
 * be shared among the static files such as NimbusIcon and generated files
 * such as the ToolBar state classes.
 */
static Object resolveToolbarConstraint(JToolBar toolbar) {
    //NOTE: we don't worry about component orientation or PAGE_END etc
    //because the BasicToolBarUI always uses an absolute position of
    //NORTH/SOUTH/EAST/WEST.
    if (toolbar != null) {
        Container parent = toolbar.getParent();
        if (parent != null) {
            LayoutManager m = parent.getLayout();
            if (m instanceof BorderLayout) {
                BorderLayout b = (BorderLayout)m;
                Object con = b.getConstraints(toolbar);
                if (con == SOUTH || con == EAST || con == WEST) {
                    return con;
                }
                return NORTH;
            }
        }
    }
    return NORTH;
}
 
源代码3 项目: jdk8u_jdk   文件: DefaultFocusManager.java
public Component getComponentAfter(Container aContainer,
                                   Component aComponent)
{
    Container root = (aContainer.isFocusCycleRoot())
        ? aContainer
        : aContainer.getFocusCycleRootAncestor();

    // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getComponentAfter(root, aComponent);
        }

        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getComponentAfter(root, aComponent);
    }

    return null;
}
 
源代码4 项目: netbeans   文件: ProjectsTabOperator.java
/**
 * Gets ProjectRootNode. Wait if Opening Projects label is in main window
 * progress bar.
 *
 * @param projectName display name of project
 * @return ProjectsRootNode
 */
public ProjectRootNode getProjectRootNode(String projectName) {
    final String openingProjectsLabel = "Opening Projects";
    Object lblOpening = JLabelOperator.findJLabel(
            (Container) MainWindowOperator.getDefault().getSource(),
            openingProjectsLabel, false, false);
    if (lblOpening != null) {
        JLabelOperator lblOper = new JLabelOperator((JLabel) lblOpening);
        lblOper.getTimeouts().setTimeout("ComponentOperator.WaitStateTimeout", 180000);
        lblOper.waitState(new ComponentChooser() {
            @Override
            public boolean checkComponent(Component comp) {
                String text = ((JLabel) comp).getText();
                return text == null || !text.startsWith(openingProjectsLabel) || !comp.isShowing();
            }

            @Override
            public String getDescription() {
                return openingProjectsLabel + " label disappears";
            }
        });
    }
    return new ProjectRootNode(tree(), projectName);
}
 
源代码5 项目: javagame   文件: PoleBalancing.java
public PoleBalancing() {
    // �^�C�g����ݒ�
    setTitle("�|���U�q������");

    Container contentPane = getContentPane();
    
    // �C���t�H���[�V�����p�l�����쐬
    InfoPanel infoPanel = new InfoPanel();
    contentPane.add(infoPanel, BorderLayout.NORTH);
    
    // ���C���p�l�����쐬
    MainPanel mainPanel = new MainPanel();
    contentPane.add(mainPanel, BorderLayout.CENTER);
    // ���C���p�l���ɃC���t�H���[�V�����p�l����n��
    mainPanel.setInfoPanel(infoPanel);
    
    // �R���g���[���p�l�����쐬
    ControlPanel controlPanel = new ControlPanel(mainPanel);
    contentPane.add(controlPanel, BorderLayout.SOUTH);

    // �p�l���T�C�Y�ɍ��킹�ăt���[���T�C�Y�������ݒ�
    pack();
}
 
源代码6 项目: jdk8u-jdk   文件: MotifOptionPaneUI.java
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);
        }
    };
}
 
源代码7 项目: jdk8u-jdk   文件: JDesktopPane.java
private static Collection<JInternalFrame> getAllFrames(Container parent) {
    int i, count;
    Collection<JInternalFrame> results = new LinkedHashSet<>();
    count = parent.getComponentCount();
    for (i = 0; i < count; i++) {
        Component next = parent.getComponent(i);
        if (next instanceof JInternalFrame) {
            results.add((JInternalFrame) next);
        } else if (next instanceof JInternalFrame.JDesktopIcon) {
            JInternalFrame tmp = ((JInternalFrame.JDesktopIcon) next).getInternalFrame();
            if (tmp != null) {
                results.add(tmp);
            }
        } else if (next instanceof Container) {
            results.addAll(getAllFrames((Container) next));
        }
    }
    return results;
}
 
源代码8 项目: jdk8u-jdk   文件: XComponentPeer.java
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);
        }
    }
}
 
源代码9 项目: beautyeye   文件: BEUtils.java
/**
 * 设置对象集的透明性,如果该组件是Container及其子类则递归设
 * 置该组件内的所有子组件的透明性,直到组件中的任何组件都被设置完毕.
 * 
 * @param comps 对象集
 * @param opaque true表示要设置成不透明,否则表示要设置成透明
 */
public static void componentsOpaque(java.awt.Component[] comps
		, boolean opaque)
{
	if(comps == null)
		return;
	for (Component c : comps)
	{
		//递归设置它的子组件
		if(c instanceof Container)
		{
			if(c instanceof JComponent)
				((JComponent)c).setOpaque(opaque);
			componentsOpaque(((Container)c).getComponents(), opaque);
		}
		else
		{
			if(c instanceof JComponent)
				((JComponent)c).setOpaque(opaque);
		}
	}
}
 
源代码10 项目: snap-desktop   文件: OutputGeometryForm.java
public static void main(String[] args) throws Exception {
    final JFrame jFrame = new JFrame("Output parameter Definition Form");
    Container contentPane = jFrame.getContentPane();
    if (args.length == 0) {
        throw new IllegalArgumentException("Missing argument to product file.");
    }
    Product sourceProduct = ProductIO.readProduct(args[0]);
    CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:32632");
    OutputGeometryFormModel model = new OutputGeometryFormModel(sourceProduct, targetCrs);
    OutputGeometryForm form = new OutputGeometryForm(model);
    contentPane.add(form);

    jFrame.setSize(400, 600);
    jFrame.setLocationRelativeTo(null);
    jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            jFrame.setVisible(true);
        }
    });
}
 
源代码11 项目: netbeans   文件: VerticalGridLayout.java
private Dimension layoutSize(Container target) {
    int cols = 1;
    int height;
    int componentCount = this.components.size();
    int itemsPerColumn = this.screenHeight / getMaxCellHeight();
    if (componentCount > itemsPerColumn) {
        cols = componentCount / itemsPerColumn;
        if (componentCount % itemsPerColumn != 0) {
            cols++;
        }
        height = itemsPerColumn * getMaxCellHeight();
    } else {
        height = getMenuItemsHeight();
    }
    return new Dimension(cols * getMaxCellWidth() + 2, height + 4);
}
 
private boolean accept(Component aComponent) {
    if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
          aComponent.isFocusable() && aComponent.isEnabled())) {
        return false;
    }

    // Verify that the Component is recursively enabled. Disabling a
    // heavyweight Container disables its children, whereas disabling
    // a lightweight Container does not.
    if (!(aComponent instanceof Window)) {
        for (Container enableTest = aComponent.getParent();
             enableTest != null;
             enableTest = enableTest.getParent())
        {
            if (!(enableTest.isEnabled() || enableTest.isLightweight())) {
                return false;
            }
            if (enableTest instanceof Window) {
                break;
            }
        }
    }

    return true;
}
 
源代码13 项目: gcs   文件: RitualMagicSpellEditor.java
protected Container createPointsFields() {
    boolean forCharacter = mRow.getCharacter() != null;
    boolean forTemplate  = mRow.getTemplate() != null;
    int     columns      = forTemplate ? 8 : 6;
    JPanel  panel        = new JPanel(new ColumnLayout(forCharacter ? 10 : columns));

    JLabel label = new JLabel(I18n.Text("Difficulty"), SwingConstants.RIGHT);
    label.setToolTipText(Text.wrapPlainTextForToolTip(I18n.Text("The difficulty of the spell")));
    panel.add(label);

    SkillDifficulty[] allowedDifficulties = {SkillDifficulty.A, SkillDifficulty.H};
    mDifficultyCombo = createComboBox(panel, allowedDifficulties, mRow.getDifficulty(), I18n.Text("The difficulty of the spell"));

    if (forCharacter || forTemplate) {
        mPointsField = createNumberField(panel, panel, I18n.Text("Points"), I18n.Text("The number of points spent on this spell"), mRow.getPoints(), 4);
        if (forCharacter) {
            mLevelField = createField(panel, panel, I18n.Text("Level"), getDisplayLevel(mRow.getLevel(), mRow.getRelativeLevel()), I18n.Text("The spell level and relative spell level to roll against.\n") + mRow.getLevelToolTip(), 7);
            mLevelField.setEnabled(false);
        }
    }
    return panel;
}
 
源代码14 项目: openjdk-jdk9   文件: DefaultFocusManager.java
/**
 * Returns the first component.
 * @return the first component
 * @param aContainer a container
 */
public Component getFirstComponent(Container aContainer) {
    Container root = (aContainer.isFocusCycleRoot())
        ? aContainer
        : aContainer.getFocusCycleRootAncestor();

    // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getFirstComponent(root);
        }

        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getFirstComponent(root);
    }

    return null;
}
 
源代码15 项目: jdk8u60   文件: DefaultFocusManager.java
public Component getFirstComponent(Container aContainer) {
    Container root = (aContainer.isFocusCycleRoot())
        ? aContainer
        : aContainer.getFocusCycleRootAncestor();

    // Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getFirstComponent(root);
        }

        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getFirstComponent(root);
    }

    return null;
}
 
源代码16 项目: pentaho-reporting   文件: CenterLayout.java
/**
 * Returns the preferred size.
 *
 * @param parent
 *          the parent.
 * @return the preferred size.
 */
public Dimension preferredLayoutSize( final Container parent ) {

  synchronized ( parent.getTreeLock() ) {
    final Insets insets = parent.getInsets();
    if ( parent.getComponentCount() > 0 ) {
      final Component component = parent.getComponent( 0 );
      final Dimension d = component.getPreferredSize();
      return new Dimension( (int) d.getWidth() + insets.left + insets.right, (int) d.getHeight() + insets.top
          + insets.bottom );
    } else {
      return new Dimension( insets.left + insets.right, insets.top + insets.bottom );
    }
  }

}
 
源代码17 项目: dragonwell8_jdk   文件: Font2DTest.java
private void addLabeledComponentToGBL( String name,
                                       JComponent c,
                                       GridBagLayout gbl,
                                       GridBagConstraints gbc,
                                       Container target ) {
    LabelV2 l = new LabelV2( name );
    GridBagConstraints gbcLabel = (GridBagConstraints) gbc.clone();
    gbcLabel.insets = new Insets( 2, 2, 2, 0 );
    gbcLabel.gridwidth = 1;
    gbcLabel.weightx = 0;

    if ( c == null )
      c = new JLabel( "" );

    gbl.setConstraints( l, gbcLabel );
    target.add( l );
    gbl.setConstraints( c, gbc );
    target.add( c );
}
 
源代码18 项目: openjdk-8-source   文件: Test7024235.java
public void run() {
    if (this.pane == null) {
        this.pane = new JTabbedPane();
        this.pane.addTab("1", new Container());
        this.pane.addTab("2", new JButton());
        this.pane.addTab("3", new JCheckBox());

        JFrame frame = new JFrame();
        frame.add(BorderLayout.WEST, this.pane);
        frame.pack();
        frame.setVisible(true);

        test("first");
    }
    else {
        test("second");
        if (this.passed || AUTO) { // do not close a frame for manual review
            SwingUtilities.getWindowAncestor(this.pane).dispose();
        }
        this.pane = null;
    }
}
 
源代码19 项目: jdk8u-jdk   文件: WPageDialog.java
@Override
@SuppressWarnings("deprecation")
public void addNotify() {
    synchronized(getTreeLock()) {
        Container parent = getParent();
        if (parent != null && parent.getPeer() == null) {
            parent.addNotify();
        }

        if (getPeer() == null) {
            ComponentPeer peer = ((WToolkit)Toolkit.getDefaultToolkit()).
                createWPageDialog(this);
            setPeer(peer);
        }
        super.addNotify();
    }
}
 
源代码20 项目: netbeans   文件: OptionsPanel.java
private void computeOptionsWords() {
    Set<Map.Entry<String, CategoryModel.Category>> categories = categoryModel.getCategories();
    categoryid2tabs = new HashMap<String, HashMap<Integer, TabInfo>>();
    for (Map.Entry<String, CategoryModel.Category> set : categories) {
        JComponent jcomp = set.getValue().getComponent();
        String id = set.getValue().getID();
        if(jcomp instanceof JTabbedPane) {
            categoryid2tabbedpane.put(id, (JTabbedPane)jcomp);
        } else if(jcomp instanceof AdvancedPanel) {
            categoryid2tabbedpane.put(id, (JTabbedPane)jcomp.getComponent(0));
        } else if (jcomp instanceof Container) {
            handleAllComponents((Container) jcomp, id, null, -1);
        }
    }

    FileObject keywordsFOs = FileUtil.getConfigRoot().getFileObject(CategoryModel.OD_LAYER_KEYWORDS_FOLDER_NAME);

    for(FileObject keywordsFO : keywordsFOs.getChildren()) {
        handlePanel(keywordsFO);
    }
}
 
源代码21 项目: gcs   文件: AdvantageModifierEnabler.java
private static Container createTop(Advantage advantage, int remaining) {
    JPanel top   = new JPanel(new ColumnLayout());
    JLabel label = new JLabel(Text.truncateIfNecessary(advantage.toString(), 80, SwingConstants.RIGHT), SwingConstants.LEFT);

    top.setBorder(new EmptyBorder(0, 0, 15, 0));
    if (remaining > 0) {
        String msg;
        msg = remaining == 1 ? I18n.Text("1 advantage remaining to be processed.") : MessageFormat.format(I18n.Text("{0} advantages remaining to be processed."), Integer.valueOf(remaining));
        top.add(new JLabel(msg, SwingConstants.CENTER));
    }
    label.setBorder(new CompoundBorder(new LineBorder(), new EmptyBorder(0, 2, 0, 2)));
    label.setOpaque(true);
    top.add(new JPanel());
    top.add(label);
    return top;
}
 
源代码22 项目: freecol   文件: FreeColOptionPaneUI.java
/**
 * {@inheritDoc}
 */
@Override
protected Container createButtonArea() {
    Object[] buttons = getButtons();
    JPanel bottom = new MigPanel(new MigLayout((this.okIndex < 0)
            // Multi-line choice dialog
            ? "wrap " + getColumns(buttons.length)
            // Confirm dialog
            : "insets dialog"));
    bottom.setOpaque(false);
    bottom.setName("OptionPane.buttonArea");
    addButtonComponents(bottom, buttons, getInitialValueIndex());
    bottom.setSize(bottom.getPreferredSize());
    return bottom;
}
 
源代码23 项目: jitsi   文件: ChatWritePanel.java
/**
 * Indicates that a new plugin component has been added. Adds it to this
 * container if it belongs to it.
 *
 * @param event the <tt>PluginComponentEvent</tt> that notified us
 */
public void pluginComponentAdded(PluginComponentEvent event)
{
    PluginComponentFactory factory = event.getPluginComponentFactory();
    if (!factory.getContainer().equals(
            net.java.sip.communicator.service.
                gui.Container.CONTAINER_CHAT_WRITE_PANEL))
        return;

    PluginComponent component = factory.getPluginComponentInstance(this);
    this.pluginComponents.add(component);

    ChatSession chatSession = chatPanel.getChatSession();
    if (chatSession != null)
    {
        ChatTransport currentTransport =
            chatSession.getCurrentChatTransport();
        Object currentDescriptor = currentTransport.getDescriptor();
        if (currentDescriptor instanceof Contact)
        {
            Contact contact = (Contact) currentDescriptor;

            component.setCurrentContact(
                contact, currentTransport.getResourceName());
        }
    }

    GridBagConstraints constraints = new GridBagConstraints();

    constraints.anchor = GridBagConstraints.NORTHEAST;
    constraints.fill = GridBagConstraints.NONE;
    constraints.gridy = 0;
    constraints.gridheight = 1;
    constraints.weightx = 0f;
    constraints.weighty = 0f;
    constraints.insets = new Insets(0, 3, 0, 0);
    centerPanel.add((Component) component.getComponent(), constraints);

    this.centerPanel.repaint();
}
 
源代码24 项目: Logisim   文件: Frame.java
private void placeToolbar() {
	String loc = AppPreferences.TOOLBAR_PLACEMENT.get();
	Container contents = getContentPane();
	contents.remove(toolbar);
	mainPanelSuper.remove(toolbar);
	if (AppPreferences.TOOLBAR_HIDDEN.equals(loc)) {
		; // don't place value anywhere
	} else if (AppPreferences.TOOLBAR_DOWN_MIDDLE.equals(loc)) {
		toolbar.setOrientation(Toolbar.VERTICAL);
		mainPanelSuper.add(toolbar, BorderLayout.WEST);
	} else { // it is a BorderLayout constant
		Object value = BorderLayout.NORTH;
		for (Direction dir : Direction.cardinals) {
			if (dir.toString().equals(loc)) {
				if (dir == Direction.EAST)
					value = BorderLayout.EAST;
				else if (dir == Direction.SOUTH)
					value = BorderLayout.SOUTH;
				else if (dir == Direction.WEST)
					value = BorderLayout.WEST;
				else
					value = BorderLayout.NORTH;
			}
		}
		contents.add(toolbar, value);
		boolean vertical = value == BorderLayout.WEST || value == BorderLayout.EAST;
		toolbar.setOrientation(vertical ? Toolbar.VERTICAL : Toolbar.HORIZONTAL);
	}
	contents.validate();
}
 
源代码25 项目: jdk8u_jdk   文件: XComponentPeer.java
/**
 * @see java.awt.peer.ComponentPeer
 */
public void setEnabled(final boolean value) {
    if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
        enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
    }
    boolean status = value;
    // If any of our heavyweight ancestors are disable, we should be too
    // See 6176875 for more information
    final Container cp = SunToolkit.getNativeContainer(target);
    if (cp != null) {
        status &= ((XComponentPeer) cp.getPeer()).isEnabled();
    }
    synchronized (getStateLock()) {
        if (enabled == status) {
            return;
        }
        enabled = status;
    }

    if (target instanceof Container) {
        final Component[] list = ((Container) target).getComponents();
        for (final Component child : list) {
            final ComponentPeer p = child.getPeer();
            if (p != null) {
                p.setEnabled(status && child.isEnabled());
            }
        }
    }
    repaint();
}
 
源代码26 项目: jstarcraft-core   文件: SwingAttributeNode.java
static SwingAttributeNode getInstance(SwingNode node, String name) {
    Container container = node.getComponent();
    Map<String, PropertyDescriptor> properties = ReflectionUtility.getPropertyDescriptors(container.getClass());
    PropertyDescriptor property = properties.get(name);
    SwingAttributeNode instance = new SwingAttributeNode(node, property);
    return instance;
}
 
源代码27 项目: openjdk-jdk8u   文件: CompactLayout.java
public Dimension getSize(Container parent, boolean minimum) {
    int n = parent.getComponentCount();
    Insets insets = parent.getInsets();
    Dimension d = new Dimension();
    for (int i = 0; i < n; i++) {
        Component comp = parent.getComponent(i);
        if (comp instanceof EnableButton) {
            continue;
        }
        Dimension p = (minimum
                       ? comp.getMinimumSize()
                       : comp.getPreferredSize());
        if (horizontal) {
            d.width += p.width;
            if (d.height < p.height) {
                d.height = p.height;
            }
        } else {
            if (d.width < p.width) {
                d.width = p.width;
            }
            d.height += p.height;
        }
    }
    d.width += (insets.left + insets.right);
    d.height += (insets.top + insets.bottom);
    return d;
}
 
源代码28 项目: hottub   文件: AncestorNotifier.java
public void componentHidden(ComponentEvent e) {
    Component ancestor = e.getComponent();
    boolean needsNotify = firstInvisibleAncestor == null;

    if ( !(ancestor instanceof Window) ) {
        removeListeners(ancestor.getParent());
    }
    firstInvisibleAncestor = ancestor;
    if (needsNotify) {
        fireAncestorRemoved(root, AncestorEvent.ANCESTOR_REMOVED,
                            (Container)ancestor, ancestor.getParent());
    }
}
 
源代码29 项目: openjdk-jdk9   文件: SynthMenuLayout.java
public Dimension preferredLayoutSize(Container target) {
    if (target instanceof JPopupMenu) {
        JPopupMenu popupMenu = (JPopupMenu) target;
        popupMenu.putClientProperty(
                SynthMenuItemLayoutHelper.MAX_ACC_OR_ARROW_WIDTH, null);
    }

    return super.preferredLayoutSize(target);
}
 
源代码30 项目: openjdk-jdk8u   文件: SpringLayout.java
public Dimension maximumLayoutSize(Container parent) {
    setParent(parent);
    Constraints pc = getConstraints(parent);
    return addInsets(abandonCycles(pc.getWidth()).getMaximumValue(),
                     abandonCycles(pc.getHeight()).getMaximumValue(),
                     parent);
}