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


Java Sizes类代码示例

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


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

示例1: buttonStack

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
/**
 * Example:<pre>
 * 	buttonStack( jMoveUpButton, jMoveDownButton, FormsUtils.BS_UNRELATED, 
 *	             jRemoveButton, jEditButton ).getPanel()
 * </pre>
 */
public static ButtonStackBuilder buttonStack(Object ... args) {
	ButtonStackBuilder ans = new ButtonStackBuilder();
	boolean addrel = false;
	for (int i = 0; i < args.length; ++i) {
		if (args[i] instanceof javax.swing.JComponent) {
			if (addrel)
				ans.addRelatedGap();
			ans.addGridded((javax.swing.JComponent)args[i]);
			addrel = true;
		}
		else if (BS_UNRELATED.equals(args[i])) {
			ans.addUnrelatedGap();
			addrel = false;
		}
		else if (BS_GLUE.equals(args[i])) {
			ans.addGlue();
			addrel = false;
		}
		else {
			ans.addStrut(Sizes.constant(args[i].toString(), false)); 
			addrel = false;
		}
	}
	return ans;
}
 
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:32,代码来源:FormsUtils.java

示例2: createEmptyBorder

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
public static Border createEmptyBorder(String encodedSizes) {
	String token[] = encodedSizes.split("\\s*,\\s*");
	int tokenCount = token.length;
	if (token.length != 4) {
		throw new IllegalArgumentException((new StringBuilder()).append(
				"The border requires 4 sizes, but \"").append(encodedSizes)
				.append("\" has ").append(tokenCount).append(".")
				.toString());
	} else {
		ConstantSize top = Sizes.constant(token[0], false);
		ConstantSize left = Sizes.constant(token[1], true);
		ConstantSize bottom = Sizes.constant(token[2], false);
		ConstantSize right = Sizes.constant(token[3], true);
		return createEmptyBorder(top, left, bottom, right);
	}
}
 
开发者ID:javachen,项目名称:IBMDataMovementTool,代码行数:17,代码来源:Borders.java

示例3: createControl

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
protected JComponent createControl() {
	if (messageLabel == null) {
		this.messageLabel = new JLabel();
		this.messageAreaModel.renderMessage(messageLabel);
	}
	int prefWidth = messageLabel.getPreferredSize().width;
	int prefHeight = Sizes.dialogUnitYAsPixel(linesToDisplay * ONE_LINE_IN_DLU, messageLabel);

	int iconHeight = getDefaultIcon().getIconHeight() + messageLabel.getIconTextGap() * 2;
	prefHeight = Math.max(iconHeight, prefHeight);

	messageLabel.setPreferredSize(new Dimension(prefWidth, prefHeight));
	messageLabel.setOpaque(false);
	messageLabel.setVerticalAlignment(SwingConstants.TOP);
	messageLabel.setVerticalTextPosition(SwingConstants.TOP);
	messageLabel.setIcon(getDefaultIcon());
	return messageLabel;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:19,代码来源:DefaultMessageAreaPane.java

示例4: adjustFont

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
protected void adjustFont(final double adjustAmount) {
    System.out.println(Sizes.getUnitConverter().dialogUnitYAsPixel(10, new JLabel()));
    final Object[] objs = UIManager.getLookAndFeel().getDefaults().keySet().toArray();
    for (int i = 0; i < objs.length; i++) {
        if (objs[i].toString().toUpperCase().indexOf("FONT") != -1) {
            final Font font = UIManager.getFont(objs[i]);
            UIManager.put(objs[i], new FontUIResource(font.deriveFont((float)(font.getSize() + adjustAmount))));
        }
    }        
    System.out.println(Sizes.getUnitConverter().dialogUnitYAsPixel(10, new JLabel()));
    ApplicationWindow[] applicationWindows = Application.instance().getWindowManager().getWindows();
    for (int i = 0; i < applicationWindows.length; i++) {
        ApplicationWindow window = applicationWindows[i];
        SwingUtilities.updateComponentTreeUI(window.getControl());
        window.getControl().repaint();
    }        
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:18,代码来源:AdjustFontSizeCommand.java

示例5: createTitledDialogContentPane

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
@Override
protected JComponent createTitledDialogContentPane() {
	messageArea = new JTextArea();
	messageArea.setEditable(false);
	Reporter reporter = getReporter();
	Assert.notNull(reporter);
	reporter.setMessageArea(messageArea);

	JPanel panel = new JPanel(new FormLayout(new ColumnSpec[] {
			new ColumnSpec(ColumnSpec.FILL, Sizes.PREFERRED, FormSpec.DEFAULT_GROW),
			FormFactory.UNRELATED_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.NO_GROW) },
			new RowSpec[] { new RowSpec(RowSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), }));
	CellConstraints cc = new CellConstraints();
	panel.add(reporter.getControl(), cc.xy(1, 1));
	AbstractCommand[] reporterCommands = reporter.getReporterCommands();
	AbstractCommand[] commandStack = new AbstractCommand[reporterCommands.length + 1];
	System.arraycopy(reporterCommands, 0, commandStack, 0, reporterCommands.length);
	commandStack[reporterCommands.length] = getClearTextAreaCommand();
	CommandGroup commandGroup = CommandGroup.createCommandGroup(commandStack);
	panel.add(commandGroup.createButtonStack(), cc.xy(3, 1));
	JScrollPane scrollPane = new JScrollPane(messageArea,
			ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panel, scrollPane);
	scrollPane.setPreferredSize(new Dimension(200, 100));
	return splitPane;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:27,代码来源:AbstractReporterTitledApplicationDialog.java

示例6: createDialogContentPane

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
@Override
protected JComponent createDialogContentPane() {
	JPanel panel = new JPanel(new FormLayout(new ColumnSpec[] { new ColumnSpec(ColumnSpec.LEFT, Sizes.DEFAULT,
			ColumnSpec.DEFAULT_GROW) }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
			FormFactory.DEFAULT_ROWSPEC }));
	CommandManager commandManager = Application.instance().getActiveWindow().getCommandManager();
	List<Object> members = new ArrayList<Object>();
	for (int i = 0; i < commandIds.length; i++) {
		members.add(commandManager.getCommand(commandIds[i]));
	}

	CellConstraints cc = new CellConstraints();

	CommandGroupFactoryBean commandGroupFactory = new CommandGroupFactoryBean("toolbar", members.toArray());
	panel.add(commandGroupFactory.getCommandGroup().createToolBar(), cc.xy(1, 1));

	JTextField toolbarTextField = new JTextField(20);
	toolbarTextField.setText("input");
	members.add(toolbarTextField);
	commandGroupFactory = new CommandGroupFactoryBean("toolbar2", members.toArray());
	panel.add(commandGroupFactory.getCommandGroup().createToolBar(), cc.xy(1, 3));

	return panel;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:25,代码来源:ToolbarSample.java

示例7: ExamplePanel

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
public ExamplePanel() {
    setLayout(new FormLayout(new ColumnSpec[]{
            ColumnSpec.decode("450px"),},
            new RowSpec[]{
                    RowSpec.createGap(LayoutStyle.getCurrent().getRelatedComponentsPadY()),
                    new RowSpec(Sizes.DEFAULT),
                    RowSpec.createGap(LayoutStyle.getCurrent().getRelatedComponentsPadY()),
                    RowSpec.decode("fill:max(65dlu;default):grow"),
                    RowSpec.createGap(LayoutStyle.getCurrent().getRelatedComponentsPadY()),
                    new RowSpec(Sizes.DEFAULT),}));

    JLabel lblNewLabel = new JLabel(Labels.USE_CASE_COLON);
    add(lblNewLabel, "1, 2, fill, fill");

    JScrollPane scrollPane = new JScrollPane();
    add(scrollPane, "1, 4, fill, fill");

    exampleTextArea = new WebTextArea();
    exampleTextArea.setLineWrap(true);
    scrollPane.setViewportView(exampleTextArea);

    Box horizontalBox = Box.createHorizontalBox();
    add(horizontalBox, "1, 6, right, default");

    btnSave = new WebButton(Labels.ADD);
    btnSave.setHorizontalAlignment(SwingConstants.RIGHT);
    horizontalBox.add(btnSave);

    Component horizontalStrut = Box.createHorizontalStrut(10);
    horizontalBox.add(horizontalStrut);

    btnCancel = new WebButton(Labels.CANCEL);
    btnCancel.setHorizontalAlignment(SwingConstants.RIGHT);
    horizontalBox.add(btnCancel);

}
 
开发者ID:CLARIN-PL,项目名称:WordnetLoom,代码行数:37,代码来源:ExamplePanel.java

示例8: createEmptyBorder

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
/**
 * Creates and returns a <code>Border</code> using sizes as specified by
 * the given string. This string is a comma-separated encoding of
 * 4 <code>ConstantSize</code>s.
 *
 * @param encodedSizes	 top, left, bottom, right gap encoded as String
 * @return an <code>EmptyBorder</code> with the specified gaps
 *
 * @see #createEmptyBorder(ConstantSize, ConstantSize, ConstantSize, ConstantSize)
 */
public static Border createEmptyBorder(String encodedSizes) {
    String[] token = encodedSizes.split("\\s*,\\s*");
    int tokenCount = token.length;
    if (token.length != 4) {
        throw new IllegalArgumentException(
            "The border requires 4 sizes, but \"" + encodedSizes +
            "\" has " + tokenCount + ".");
    }
    ConstantSize top    = Sizes.constant(token[0], false);
    ConstantSize left   = Sizes.constant(token[1], true);
    ConstantSize bottom = Sizes.constant(token[2], false);
    ConstantSize right  = Sizes.constant(token[3], true);
    return createEmptyBorder(top, left, bottom, right);
}
 
开发者ID:evandrocoan,项目名称:ComputerScienceGraduation,代码行数:25,代码来源:Borders.java

示例9: createPadding

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
/**
 * Creates and returns a padding (an instance of {@link EmptyBorder})
 * using sizes as specified by the given string.
 * This string is a comma-separated encoding of 4 {@code ConstantSize}s.
 *
 * @param encodedSizes	 top, left, bottom, right gap encoded as String
 * @param args           optional format arguments,
 *                       used if {@code encodedSizes} is a format string
 * @return a padding with the specified margins
 *
 * @see #createPadding(ConstantSize, ConstantSize, ConstantSize, ConstantSize)
 */
public static Padding createPadding(String encodedSizes, Object... args) {
    String formattedSizes = Strings.get(encodedSizes, args);
    String[] token = formattedSizes.split("\\s*,\\s*");
    int tokenCount = token.length;
    checkArgument(token.length == 4,
            "The padding requires 4 sizes, but \"%s\" has %d.", formattedSizes, Integer.valueOf(tokenCount));
    ConstantSize top    = Sizes.constant(token[0]);
    ConstantSize left   = Sizes.constant(token[1]);
    ConstantSize bottom = Sizes.constant(token[2]);
    ConstantSize right  = Sizes.constant(token[3]);
    return createPadding(top, left, bottom, right);
}
 
开发者ID:JFormDesigner,项目名称:swing-jgoodies-forms,代码行数:25,代码来源:Paddings.java

示例10: CellInsets

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
/** @param c used for dlu comptation */ 
public CellInsets(int dlu_top, int dlu_left, int dlu_bottom, int dlu_right, String alignments, Component c) {
	this(Sizes.dialogUnitYAsPixel(dlu_top, c),
		Sizes.dialogUnitXAsPixel(dlu_left, c),
		Sizes.dialogUnitYAsPixel(dlu_bottom, c), 
		Sizes.dialogUnitXAsPixel(dlu_right, c), alignments);
}
 
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:8,代码来源:FormsUtils.java

示例11: createTitledDialogContentPane

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
@Override
protected JComponent createTitledDialogContentPane() {
	JPanel panel = new JPanel(new FormLayout(new ColumnSpec[] {
			new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, ColumnSpec.DEFAULT_GROW),
			FormFactory.RELATED_GAP_COLSPEC,
			new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, ColumnSpec.DEFAULT_GROW) }, new RowSpec[] {
			FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
	// create all columns, needed to add/remove them
	TableColumn column;
	for (int i = 0; i < headers.size(); ++i) {
		column = new TableColumn(i, -1, new DefaultTableCellRenderer(), null);
		column.setHeaderValue(headers.get(i));
		tableColumns.add(column);
	}
	columnModel = new DefaultTableColumnModel();
	// create the sortable model by wrapping our simple custom model
	sortedModel = new ShuttleSortableTableModel(new CustomerTableModel());
	table = new JTable(sortedModel, columnModel);
	table.setAutoCreateColumnsFromModel(false);
	TableSortIndicator sortIndicator = new TableSortIndicator(table);
	new SortTableCommand(table, sortIndicator.getColumnSortList());
	JScrollPane scrollPane = new JScrollPane(table);
	CellConstraints cc = new CellConstraints();
	panel.add(scrollPane, cc.xyw(1, 1, 3));
	panel.add(createAddCommand().createButton(), cc.xy(1, 3));
	panel.add(createRemoveCommand().createButton(), cc.xy(3, 3));

	return panel;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:30,代码来源:ShuttleSortableTableDialog.java

示例12: createDialogContentPane

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
@Override
protected JComponent createDialogContentPane() {
	JPanel panel = new JPanel(new FormLayout(new ColumnSpec[] {FormFactory.DEFAULT_COLSPEC , FormFactory.RELATED_GAP_COLSPEC, new ColumnSpec(ColumnSpec.LEFT, Sizes.DEFAULT,
			ColumnSpec.DEFAULT_GROW)}, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
			FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
			FormFactory.DEFAULT_ROWSPEC }));
	CommandManager commandManager = Application.instance().getActiveWindow().getCommandManager();
	List<Object> members = new ArrayList<Object>();
	for (int i = 0; i < commandIds.length; i++) {
		members.add(commandManager.getCommand(commandIds[i]));
	}

	CellConstraints cc = new CellConstraints();

	CommandGroupFactoryBean commandGroupFactory = new CommandGroupFactoryBean("buttonBar", members.toArray());
	panel.add(new JLabel(getMessage("buttonBar.label")), cc.xy(1, 1));
	panel.add(commandGroupFactory.getCommandGroup().createButtonBar(), cc.xyw(1, 3, 3));

	JTextField toolbarTextField = new JTextField(20);
	toolbarTextField.setText("input");
	members.add(toolbarTextField);
	commandGroupFactory = new CommandGroupFactoryBean("buttonStack", members.toArray());
	panel.add(new JLabel(getMessage("buttonStack.label")), cc.xy(1, 5));
	panel.add(commandGroupFactory.getCommandGroup().createButtonStack(), cc.xy(3, 5));

	return panel;
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:28,代码来源:ButtonStackBarSample.java

示例13: createEvenlySpacedBorder

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
public static Border createEvenlySpacedBorder(int spacePx) {
    return createEvenlySpacedBorder(Sizes.pixel(spacePx));
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:4,代码来源:GuiStandardUtils.java

示例14: createLeftAndRightBorder

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
public static Border createLeftAndRightBorder(int spacePx) {
    return createLeftAndRightBorder(Sizes.pixel(spacePx));
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:4,代码来源:GuiStandardUtils.java

示例15: createTopAndBottomBorder

import com.jgoodies.forms.layout.Sizes; //导入依赖的package包/类
public static Border createTopAndBottomBorder(int spacePx) {
    return createTopAndBottomBorder(Sizes.pixel(spacePx));
}
 
开发者ID:shevek,项目名称:spring-rich-client,代码行数:4,代码来源:GuiStandardUtils.java


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