當前位置: 首頁>>代碼示例>>Java>>正文


Java Container.getLayout方法代碼示例

本文整理匯總了Java中java.awt.Container.getLayout方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.getLayout方法的具體用法?Java Container.getLayout怎麽用?Java Container.getLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.Container的用法示例。


在下文中一共展示了Container.getLayout方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: GridBagInfoProvider

import java.awt.Container; //導入方法依賴的package包/類
public GridBagInfoProvider(Container container, LayoutSupportManager layoutManager) {
    this.container = container;
    this.layoutManager = layoutManager;
    LayoutManager containerLayout = container.getLayout();
    if (!(containerLayout instanceof GridBagLayout)) {
        throw new IllegalArgumentException();
    }
    try {
        tempXField = GridBagConstraints.class.getDeclaredField("tempX"); // NOI18N
        tempXField.setAccessible(true);
        tempYField = GridBagConstraints.class.getDeclaredField("tempY"); // NOI18N
        tempYField.setAccessible(true);
        tempHeightField = GridBagConstraints.class.getDeclaredField("tempHeight"); // NOI18N
        tempHeightField.setAccessible(true);
        tempWidthField = GridBagConstraints.class.getDeclaredField("tempWidth"); // NOI18N
        tempWidthField.setAccessible(true);
    } catch (NoSuchFieldException nsfex) {
        FormUtils.LOGGER.log(Level.INFO, nsfex.getMessage(), nsfex);
    }
    containerEmphColor = deriveEmphColor(container);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:22,代碼來源:GridBagInfoProvider.java

示例2: resolveToolbarConstraint

import java.awt.Container; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:38,代碼來源:NimbusLookAndFeel.java

示例3: addNewComponent

import java.awt.Container; //導入方法依賴的package包/類
/**
 * Add a component to the PolicyTool window
 */
void addNewComponent(Container container, JComponent component,
    int index, int gridx, int gridy, int gridwidth, int gridheight,
    double weightx, double weighty, int fill, Insets is) {

    if (container instanceof JFrame) {
        container = ((JFrame)container).getContentPane();
    } else if (container instanceof JDialog) {
        container = ((JDialog)container).getContentPane();
    }

    // add the component at the specified gridbag index
    container.add(component, index);

    // set the constraints
    GridBagLayout gbl = (GridBagLayout)container.getLayout();
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = gridx;
    gbc.gridy = gridy;
    gbc.gridwidth = gridwidth;
    gbc.gridheight = gridheight;
    gbc.weightx = weightx;
    gbc.weighty = weighty;
    gbc.fill = fill;
    if (is != null) gbc.insets = is;
    gbl.setConstraints(component, gbc);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:30,代碼來源:PolicyTool.java

示例4: createButtonArea

import java.awt.Container; //導入方法依賴的package包/類
/**
 * Creates and returns a Container containin the buttons. The buttons
 * are created by calling <code>getButtons</code>.
 */
protected Container createButtonArea() {
    Container          b = super.createButtonArea();

    if(b != null && b.getLayout() instanceof ButtonAreaLayout) {
        ((ButtonAreaLayout)b.getLayout()).setCentersChildren(false);
    }
    return b;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:MotifOptionPaneUI.java

示例5: createInterfaceComponents

import java.awt.Container; //導入方法依賴的package包/類
private void createInterfaceComponents(Container pane) {

    if (!(pane.getLayout() instanceof BorderLayout)) {
      LOGGER.error("Container doesn't use BorderLayout!");
      throw new UnexpectedError();
    }

    createConsoleTextare(pane);
    createMenuButtons(pane);
  }
 
開發者ID:juliango202,項目名稱:jijimaku,代碼行數:11,代碼來源:AppGui.java

示例6: getConstraintsForCell

import java.awt.Container; //導入方法依賴的package包/類
private static SpringLayout.Constraints getConstraintsForCell(int row, int col, Container parent, int cols) {
	SpringLayout layout = (SpringLayout) parent.getLayout();
	Component c = parent.getComponent(row * cols + col);
	return layout.getConstraints(c);
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:6,代碼來源:SpringUtilities.java

示例7: getConstraintsForCell

import java.awt.Container; //導入方法依賴的package包/類
private static SpringLayout.Constraints getConstraintsForCell(int row, int col,
    Container parent, int cols) {
    SpringLayout layout = (SpringLayout) parent.getLayout();
    Component c = parent.getComponent(row * cols + col);
    return layout.getConstraints(c);
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:7,代碼來源:SpringUtilities.java


注:本文中的java.awt.Container.getLayout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。