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


Java Filler类代码示例

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


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

示例1: calculateGridSize

import javax.swing.Box.Filler; //导入依赖的package包/类
private void calculateGridSize() {       
    int scrollPaneWidth = scrollPane.getWidth();
    int scrollPaneHeight = scrollPane.getHeight();
    int items = components.size();
    int columns = scrollPaneWidth / width - 1;
    int rows = scrollPaneHeight / height;
    if(columns<1) {
        columns =1;
    }
    
    gridPane.removeAll();
    for (int i = 0; i < components.size(); i++) {
        gridPane.add(components.get(i));
    }

    if (items < (rows * columns)) {
        for (int i = 0; i < (rows * columns - items); i++) {
            gridPane.add(new Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 0)));
        }
    }

    gridPane.setLayout(new java.awt.GridLayout(-1, columns));
}
 
开发者ID:Fidentis,项目名称:Analyst,代码行数:24,代码来源:GridPanel.java

示例2: TaskTitleBar

import javax.swing.Box.Filler; //导入依赖的package包/类
/**
 * Creates a new instance.
 *
 * @param icon     the icon to show on the left of the bar
 * @param titleKey the key to the title to show on the bar, retrieved from the {@link MessageBundle}
 */
public TaskTitleBar(FontAwesomeGlyph icon, String titleKey) {
    /* The basics. */
    super();

    /* The icon. */
    this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    this.add(new GlyphIcon(icon));

    /* The title. */
    JLabel title = new JLabel(MessageBundle.get(titleKey));
    title.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, FILLER_MARGIN));
    this.add(title);

    /* An opaque filler (1px height -> horizontal line). */
    Filler filler = new Filler(new Dimension(0, FILLER_HEIGHT), new Dimension(0, FILLER_HEIGHT),
            new Dimension(Short.MAX_VALUE, FILLER_HEIGHT));
    filler.setBackground(Color.BLACK);
    filler.setOpaque(true);
    this.add(filler);

    /* An "add" button. */
    GlyphButton addButton = new GlyphButton(FontAwesomeGlyph.PLUS);
    addButton.setBorder(BorderFactory.createEmptyBorder(0, FILLER_MARGIN, 0, 0));
    this.add(addButton);
}
 
开发者ID:cyChop,项目名称:daily-tasks,代码行数:32,代码来源:TaskTitleBar.java

示例3: getPrecedingLabel

import javax.swing.Box.Filler; //导入依赖的package包/类
public String getPrecedingLabel() {
    Container container = component.getParent();
    if (container == null) {
        return null;
    }
    List<Component> allComponents = findAllComponents();
    // Find labels in the same row (LTR)
    // In the same row: labelx < componentx, labely >= componenty
    Point locComponent = component.getLocationOnScreen();
    List<Component> rowLeft = new ArrayList<Component>();
    for (Component label : allComponents) {
        Point locLabel = label.getLocationOnScreen();
        if (!(label instanceof JPanel) && locLabel.getX() < locComponent.getX() && locLabel.getY() >= locComponent.getY()
                && locLabel.getY() <= locComponent.getY() + component.getHeight() && !(label instanceof Filler)) {
            rowLeft.add(label);
        }
    }
    Collections.sort(rowLeft, new Comparator<Component>() {
        @Override public int compare(Component o1, Component o2) {
            Point locO1 = o1.getLocationOnScreen();
            Point locO2 = o2.getLocationOnScreen();
            return (int) (locO1.getX() - locO2.getX());
        }
    });
    if (rowLeft.size() > 0 && rowLeft.get(rowLeft.size() - 1) instanceof JLabel) {
        return stripLastColon(((JLabel) rowLeft.get(rowLeft.size() - 1)).getText().trim());
    }
    return null;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:30,代码来源:JavaElementPropertyAccessor.java

示例4: initFiller

import javax.swing.Box.Filler; //导入依赖的package包/类
private void initFiller() {
    Filler filler = new Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(32767, 32767));
    filler.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseEntered(MouseEvent me) {
            mainFrame.getGlassPane().setVisible(false);
        }
    });
    add(filler, BorderLayout.CENTER);
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:11,代码来源:SimpleDock.java

示例5: getLeftFiller

import javax.swing.Box.Filler; //导入依赖的package包/类
private Filler getLeftFiller() {
    Filler filler = new Filler(
            new Dimension(0, 0),
            new Dimension(0, 0),
            new Dimension(32767, 32767));
    filler.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent me) {
            mainFrame.getGlassPane().setVisible(false);
        }
    });

    return filler;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:15,代码来源:SimpleDock.java

示例6: getAnotherObject

import javax.swing.Box.Filler; //导入依赖的package包/类
protected Filler getAnotherObject() {
    return null; // TODO: could not update property
    // return new Filler(
    //        new Dimension(9, 8),
    //        new Dimension(7, 6),
    //        new Dimension(5, 4));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:javax_swing_Box_Filler.java

示例7: IconlessLabel

import javax.swing.Box.Filler; //导入依赖的package包/类
IconlessLabel() {
	setLayout(new BorderLayout());
	setOpaque(true);
	label.setOpaque(true);
	add(label,BorderLayout.CENTER);
	Dimension dim = new Dimension(1, 24);
	box = new Filler(dim, dim, dim);
	box.setOpaque(true);
	add(box,BorderLayout.EAST);
}
 
开发者ID:PGWelch,项目名称:com.opendoorlogistics,代码行数:11,代码来源:ButtonCellRenderer.java

示例8: buildGui

import javax.swing.Box.Filler; //导入依赖的package包/类
private void buildGui() {
	
	// create components
	JPanel mainP = new JPanel(new BorderLayout(0, 20));
	Box butP = Box.createHorizontalBox();
	okB = new JButton(_okAction);
	cancelB = new JButton(_cancelAction);
	_mainPanel = createMainPanel();
	
	//layout components
	if(_isCreating) {
		_stayOpenCB = new JCheckBox("Don't close this dialog");
		_stayOpenCB.setSelected(false);
		butP.add(_stayOpenCB);
		butP.add(new Filler(new Dimension(0,0), new Dimension(30,0), 
				new Dimension(Short.MAX_VALUE, 0))
		);
	} else {
		butP.add(Box.createHorizontalGlue());
	}
	butP.add(okB);
	butP.add(Box.createHorizontalStrut(10));
	butP.add(cancelB);
	mainP.add(butP, BorderLayout.SOUTH);
	getContentPane().add(mainP);
	mainP.add(_mainPanel, BorderLayout.CENTER);

	mainP.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));

	this.addWindowListener(new WindowAdapter(){
	    public void windowClosing(WindowEvent e) {dispose();}
	});
	setDefaultActions(getRootPane());
}
 
开发者ID:jakubneubauer,项目名称:taskblocks,代码行数:35,代码来源:ConfigDialogStub.java

示例9: getObject

import javax.swing.Box.Filler; //导入依赖的package包/类
protected Filler getObject() {
    return new Filler(
            new Dimension(1, 2),
            new Dimension(3, 4),
            new Dimension(5, 6));
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:7,代码来源:javax_swing_Box_Filler.java


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