本文整理汇总了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));
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
示例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());
}
示例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));
}