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


Java AC类代码示例

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


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

示例1: update

import net.miginfocom.layout.AC; //导入依赖的package包/类
@Override
protected void update() {
    LC lc = new LC();
    lc.setWrapAfter(getColumns());
    lc.hideMode(2); // The size of an invisible component will be set to 0, 0 and the gaps will also be set to 0 around it.
    lc.fill();

    lc.setInsets(MigLayoutHelper.makeInsets(margins));

    if (!spacing) {
        lc.gridGap("0", "0");
    }

    if (isDebug())
        lc.debug(1000);

    layout.setLayoutConstraints(lc);

    AC rowConstr = new AC();
    rowConstr.align("top");  // left-top align by default
    layout.setRowConstraints(rowConstr);

    AC colConstr = new AC();
    for (int i = 0; i < colCount; i++) {
        float ratio = columnRatio[i];
        colConstr.grow(ratio, i);
        colConstr.shrink(ratio != 0 ? (float) Math.sqrt(1.0f / ratio) : 100.0f, i);
    }
    layout.setColumnConstraints(colConstr);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:31,代码来源:MigGridLayoutAdapter.java

示例2: updateLayoutConstraints

import net.miginfocom.layout.AC; //导入依赖的package包/类
private void updateLayoutConstraints(boolean resetExpanded) {
    LC lc = new LC();
    lc.hideMode(2); //  Invisible components will not participate in the layout at all and it will for instance not take up a grid cell
    lc.fill(); // always give all space to components, otherwise align doesn't work
    AC rowConstr = new AC();
    AC colConstr = new AC();

    if (direction.equals(FlowDirection.X)) {
        rowConstr.align("top");
        lc.flowX();
        if (expandedComponent != null || resetExpanded) {
            adjustExpanding(lc, colConstr);
        }
    } else {
        lc.flowY();
        if (expandedComponent != null || resetExpanded) {
            adjustExpanding(lc, rowConstr);
        }
    }

    lc.setInsets(MigLayoutHelper.makeInsets(margins));

    if (!spacing) {
        if (direction.equals(FlowDirection.X)) {
            lc.gridGapX("0");
        } else {
            lc.gridGapY("0");
        }
    }

    if (isDebug())
        lc.debug(1000);

    layout.setLayoutConstraints(lc);
    layout.setRowConstraints(rowConstr);
    layout.setColumnConstraints(colConstr);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:38,代码来源:MigBoxLayoutAdapter.java

示例3: adjustExpanding

import net.miginfocom.layout.AC; //导入依赖的package包/类
private void adjustExpanding(LC lc, AC ac) {
    Component[] components = container.getComponents();
    for (int i = 0; i < components.length; i++) {
        if (expandedComponent == null
                || expandedComponent == components[i]) {
            ac.fill(i);
        } else {
            ac.size("min!", i);
        }
    }
    lc.fill();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:MigBoxLayoutAdapter.java

示例4: testTableAndButtons

import net.miginfocom.layout.AC; //导入依赖的package包/类
private void testTableAndButtons() {
        MigLayout mainLayout = new MigLayout();
        JPanel mainPanel = new JPanel(mainLayout);
        contentPane.add(mainPanel, BorderLayout.CENTER);

        mainLayout.setLayoutConstraints("flowy, fillx, insets panel, debug");

        MigLayout buttonsLayout = new MigLayout("flowx, filly, insets panel, debug");
        JPanel buttonsPanel = new JPanel(buttonsLayout);
        buttonsPanel.add(new JButton("button1"));
        buttonsPanel.add(new JButton("button2"));

        mainPanel.add(buttonsPanel);

        MigLayout tableLayout = new MigLayout("flowy, fill, debug");
        JPanel tablePanel = new JPanel(tableLayout);
        JTable table = new JTable();
        table.setModel(new DefaultTableModel(new String[] {"col1", "col2"}, 3));
        tablePanel.add(table, "grow");

        mainPanel.add(tablePanel);
        mainLayout.setComponentConstraints(tablePanel, "grow");
        mainLayout.setLayoutConstraints("flowy, fill, insets panel, debug"); // change fillx to fill
//        mainLayout.setRowConstraints("[min!][fill]");
        AC ac = new AC().size("min!", 0).fill(1);
        mainLayout.setRowConstraints(ac);
    }
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:28,代码来源:LayoutTest.java

示例5: createAlignTab

import net.miginfocom.layout.AC; //导入依赖的package包/类
private Component createAlignTab() {
    JPanel box = new JPanel();
    box.setFocusable(false);
    MigLayout boxLayout = new MigLayout("debug 1000, fill");
    box.setLayout(boxLayout);

    JPanel panel = new JPanel();
    MigLayout layout = new MigLayout("debug 1000, fill");
    panel.setLayout(layout);

    JLabel label = new JLabel("Label");
    CC cc = new CC();
    cc.alignX("right").alignY("50%");

    panel.add(label);

    layout.setComponentConstraints(label, cc);

    LC lc = new LC();
    lc.hideMode(2); // The size of an invisible component will be set to 0, 0 and the gaps will also be set to 0 around it.
    lc.debug(1000);

    AC rowConstr = new AC();
    AC colConstr = new AC();

    lc.fillX();
    lc.flowY();
    lc.gridGapY("0");

    layout.setLayoutConstraints(lc);
    layout.setRowConstraints(rowConstr);
    layout.setColumnConstraints(colConstr);

    box.add(panel, "height 100px, width 100px");
    layout.setComponentConstraints(label, cc);
    return box;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:38,代码来源:VclTestApp.java

示例6: QueryPanel

import net.miginfocom.layout.AC; //导入依赖的package包/类
public QueryPanel()
{
	super();
	final Properties ctx = Env.getCtx();

	setLayout(new MigLayout(
			// layoutConstraints
			new LC().fill().noGrid().flowX()
			// colConstraints
			, new AC().fill().grow(0)
			// rowConstraints
			, new AC().fill().grow(0)
	//
	));

	//
	// Bank Statements
	{
		final CLabel lblBankStatement = new CLabel(msgBL.translate(ctx, org.compiere.model.I_C_BankStatement.COLUMNNAME_C_BankStatement_ID));
		add(lblBankStatement);
		add(fBankStatement, new CC().width("200px"));
	}

	//
	// Bank Accounts
	{
		final CLabel lblBankAccount = new CLabel(msgBL.translate(ctx, org.compiere.model.I_C_BP_BankAccount.COLUMNNAME_C_BP_BankAccount_ID));
		add(lblBankAccount);
		add(fBankAccount, new CC().width("200px"));
	}

	//
	// Button: Query
	{
		btnQuery.setText(msgBL.translate(ctx, "Refresh"));
		add(btnQuery);
		btnQuery.addActionListener(new ActionListener()
		{

			@Override
			public void actionPerformed(final ActionEvent e)
			{
				onQuery();
			}
		});
	}

	//
	// Load
	load();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:52,代码来源:QueryPanel.java

示例7: createFieldsPanelLayout

import net.miginfocom.layout.AC; //导入依赖的package包/类
/**
 * Creates the layout to be used on fields panel.
 * 
 * @param zeroInsets if true, the container insets will be set to zero.
 * @return layout
 */
public MigLayout createFieldsPanelLayout(final boolean zeroInsets)
{
	final LC layoutConstraints = new LC()
			.hideMode(3)// hidden fields take no part in grid
			.fillX()// fill the whole available width in the container
	;
	// layoutConstraints.debug(1000);
	if (zeroInsets)
	{
		layoutConstraints.insets("0", "0", "n", "0"); // top, left, bottom right
	}

	final AC colConstraints = new AC();
	if (columns > 0)
	{
		final BoundSize labelWidth = getLabelWidthConstraint();
		final BoundSize fieldWidth = getFieldWidthConstraint();
		final List<DimConstraint> colConstraintsList = new ArrayList<>();
		for (int i = 0; i < columns; i++)
		{
			// Label column
			final DimConstraint ccLabel = new DimConstraint();
			ccLabel.setGrowPriority(1); // low priority
			ccLabel.setGrow(0F);
			if (labelWidth != null)
			{
				ccLabel.setSize(labelWidth);
			}
			colConstraintsList.add(ccLabel);

			// Field column
			final DimConstraint ccField = new DimConstraint();
			ccField.setGrow(100F);
			ccField.setGrowPriority(100); // normal priority
			if (fieldWidth != null)
			{
				ccField.setSize(fieldWidth);
			}
			colConstraintsList.add(ccField);
		}

		colConstraints.setConstaints(colConstraintsList.toArray(new DimConstraint[colConstraintsList.size()]));

		layoutConstraints.wrap(); // automatically wrap if the number of columns was exceeded
	}

	final AC rowConstraints = new AC();
	rowConstraints.fill();
	rowConstraints.align("top");

	return new MigLayout(layoutConstraints, colConstraints, rowConstraints);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:59,代码来源:VPanelLayoutFactory.java

示例8: jbInit

import net.miginfocom.layout.AC; //导入依赖的package包/类
/**
 * Static component init
 *
 * @throws Exception
 */
void jbInit() throws Exception
{
	// NOTE: because we have problems with window resizing when some address fields are added,
	// we are setting the minimum size to make sure there is room for all address fields, even if they are not displayed
	setMinimumSize(new Dimension(370, 330));

	//
	// Content pane
	final CPanel contentPane = new CPanel();
	{
		final BorderLayout panelLayout = new BorderLayout();
		panelLayout.setHgap(5);
		panelLayout.setVgap(10);
		contentPane.setLayout(panelLayout);
		setContentPane(contentPane);
	}

	//
	// Center: address fields
	{
		final MigLayout mainPanelLayout = new MigLayout(
				// layoutConstraints
				new LC()
						.fillX()
						.hideMode(3)
				// colConstraints
				, new AC()
						.index(0).grow(50).fill()
						.index(1).grow(100).fill()
				// rowConstraints
				, new AC()
				);
		mainPanel.setLayout(mainPanelLayout);
		contentPane.add(mainPanel, BorderLayout.CENTER);
		//

		fPostal.addFocusListener(new FocusAdapter()
		{
			@Override
			public void focusLost(final FocusEvent e)
			{
				final String text = fPostal.getText();
				fPostal.setText(text == null ? null : text.trim());
			}
		});

		createAndAddLocationPart(LocationCaptureSequence.PART_Address1, "Address1", fAddress1);
		createAndAddLocationPart(LocationCaptureSequence.PART_Address1, "Address2", fAddress2);
		createAndAddLocationPart(LocationCaptureSequence.PART_Address1, "Address3", fAddress3);
		createAndAddLocationPart(LocationCaptureSequence.PART_Address1, "Address4", fAddress4);
		createAndAddLocationPart(LocationCaptureSequence.PART_City, "City", fCity);
		createAndAddLocationPart(LocationCaptureSequence.PART_Postal, "Postal", fPostal);
		createAndAddLocationPart(LocationCaptureSequence.PART_PostalAdd, "PostalAdd", fPostalAdd);
		locationPart_Region = createAndAddLocationPart(LocationCaptureSequence.PART_Country, "Region", fRegion);
		locationPart_Region.setEnabledCustom(false);
		createAndAddLocationPart(LocationCaptureSequence.PART_Country, "Country", fCountry);
		locationPart_Online = createAndAddLocationPart(LocationCaptureSequence.PART_Country, "Online", fOnline);
		locationPart_Online.setEnabledCustom(false);
	}

	//
	// Bottom panel: confirm panel
	{
		final CPanel southPanel = new CPanel();
		southPanel.setLayout(new BorderLayout());
		contentPane.add(southPanel, BorderLayout.SOUTH);

		final ConfirmPanel confirmPanel = ConfirmPanel.newWithOKAndCancel();
		// Make the buttons not focusable to make it easy for user when he/she is tabbing between location fields
		confirmPanel.getOKButton().setFocusable(false);
		confirmPanel.getCancelButton().setFocusable(false);
		//
		confirmPanel.setActionListener(this);
		southPanel.add(confirmPanel, BorderLayout.NORTH);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:82,代码来源:VLocationDialog.java

示例9: MigLayout

import net.miginfocom.layout.AC; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param layoutConstraints
 *            The constraints that concern the whole * * * * * * * layout.
 *            <code>null</code> will be treated as an empty cosntraint.
 * @param colConstraints
 *            The constraints for the columns in the * * * * * * * * * grid.
 *            <code>null</code> will be treated as an empty constraint.
 * @param rowConstraints
 *            The constraints for the rows in the grid. <code>null</code>
 *            will be treated as an empty constraint.
 */
public MigLayout(BaseScreen screen, LC layoutConstraints, AC colConstraints, AC rowConstraints) {
	setLayoutConstraints(layoutConstraints);
	setColumnConstraints(colConstraints);
	setRowConstraints(rowConstraints);

	this.screen = screen;
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:21,代码来源:MigLayout.java


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