下面列出了怎么用javax.swing.Box的API类实例代码及写法,或者点击链接到github查看源代码。
protected JPanel getObject() {
Box vBox = Box.createVerticalBox();
vBox.add(new JButton("button"));
vBox.add(Box.createVerticalStrut(10));
vBox.add(new JLabel("label"));
vBox.add(Box.createVerticalGlue());
vBox.add(new JButton("button"));
vBox.add(Box.createVerticalStrut(10));
vBox.add(new JLabel("label"));
Box hBox = Box.createHorizontalBox();
hBox.add(new JButton("button"));
hBox.add(Box.createHorizontalStrut(10));
hBox.add(new JLabel("label"));
hBox.add(Box.createHorizontalGlue());
hBox.add(new JButton("button"));
hBox.add(Box.createHorizontalStrut(10));
hBox.add(new JLabel("label"));
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(vBox);
panel.add(Box.createGlue());
panel.add(hBox);
return panel;
}
public static JPanel makeScaleOptionPanel(){
// create the side panel with scale change options
JPanel optionPanel = new JPanel();
optionPanel.add(Box.createVerticalStrut(20));
optionPanel.setLayout(new BoxLayout(optionPanel,BoxLayout.Y_AXIS));
optionPanel.add(makeScalePanel(pv1,"View (0,0)"));
optionPanel.add(Box.createVerticalStrut(20));
optionPanel.add(new Separator());
optionPanel.add(makeScalePanel(pv2,"View (0,1)"));
optionPanel.add(Box.createVerticalStrut(20));
optionPanel.add(new Separator());
optionPanel.add(makeScalePanel(pv3,"View (1,0)"));
optionPanel.add(Box.createVerticalStrut(20));
optionPanel.add(new Separator());
optionPanel.add(makeScalePanel(pv4,"View (1,1)"));
optionPanel.add(Box.createVerticalStrut(20));
return optionPanel;
}
void addLocation(final IdeLocation location) {
if (locations.contains(location)) return;
Box box = Box.createHorizontalBox();
box.setBackground(Color.WHITE);
final JCheckBox checkbox = new JCheckBox(location.getName());
checkbox.setBackground(Color.WHITE);
box.add(new JLabel(new ImageIcon(location.getIdeIcon())));
box.add(checkbox);
checkbox.setSelected(true);
checkbox.addActionListener(new ActionListener() {
@Override public void actionPerformed(ActionEvent e) {
location.selected = checkbox.isSelected();
fireSelectionChange();
}
});
if (location.hasLombok()) {
box.add(new JLabel(new ImageIcon(Installer.class.getResource("lombokIcon.png"))));
}
box.add(Box.createHorizontalGlue());
locations.add(location);
add(box);
getParent().doLayout();
fireSelectionChange();
}
/**
* Constructor
*
* @param parent
* Parent JFrame to center on
*/
public AboutDialog(JFrame parent) {
super(parent);
setTitle(EditorLabels.getLabel("about.header"));
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLayout(new BorderLayout(0, 0));
add(new JLabel(new ImageIcon(AboutDialog.class.getResource("about.png"))), BorderLayout.NORTH);
Box info = Box.createVerticalBox();
info.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
add(info, BorderLayout.CENTER);
info.add(createHeaderLabel("about.version"));
info.add(new JLabel(CommitInfo.COMMIT_HASH_SHORT));
info.add(createSpacer());
info.add(createHeaderLabel("about.developer"));
info.add(createListLabelLabel("developer.txt"));
info.add(createSpacer());
info.add(createHeaderLabel("about.translator"));
info.add(createListLabelLabel("translator.txt"));
pack();
setLocationRelativeTo(parent);
setModal(true);
}
private void initContents(Map<String,List<MockAction>> actions) {
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
tabbedPane = new JTabbedPane();
for (String cap : actions.keySet()) {
Component component = createActions(actions.get(cap));
tabbedPane.addTab(cap, component);
tabs.put(cap, component);
}
JPanel buttonBar = new JPanel(new BorderLayout());
JButton closeButton = new JButton(close);
buttonBar.add(closeButton, BorderLayout.PAGE_END);
panel.add(tabbedPane);
panel.add(Box.createVerticalStrut(10));
panel.add(buttonBar);
getContentPane().add(panel);
this.pack();
}
PCGenStatusBar(PCGenFrame frame)
{
this.frame = frame;
this.messageLabel = new JLabel();
this.progressBar = new JProgressBar();
this.loadStatusButton = new Button();
setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
add(messageLabel);
add(Box.createHorizontalGlue());
progressBar.setStringPainted(true);
progressBar.setVisible(false);
add(progressBar);
add(Box.createHorizontalGlue());
JFXPanel wrappedButton = GuiUtility.wrapParentAsJFXPanel(loadStatusButton);
//todo: calculate this rather than hard code
wrappedButton.setMaximumSize(new Dimension(750, 20000000));
add(wrappedButton);
loadStatusButton.setOnAction(this::loadStatusLabelAction);
}
private Box createWeightPanel(String title, int min, int max) {
Box weightPanel = new Box(BoxLayout.X_AXIS);
weightPanel.add(Box.createHorizontalStrut(10));
weightPanel.add(new JLabel(title));
weightPanel.add(Box.createHorizontalStrut(10));
weight = new JSlider(JSlider.HORIZONTAL, min, max, 1);
weight.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
setWeight(((JSlider) e.getSource()).getValue());
}
});
weightPanel.add(weight);
weightPanel.add(Box.createHorizontalStrut(10));
return weightPanel;
}
@Override
public JPanel getPanel() {
if (panel == null) {
panel = new QuickStartBackgroundPanel();
panel.add(
getSelectCheckBox(),
LayoutHelper.getGBC(0, 0, 1, 0.0D, DisplayUtils.getScaledInsets(5, 5, 5, 5)));
panel.add(
new JLabel(Constant.messages.getString("quickstart.label.withbrowser")),
LayoutHelper.getGBC(1, 0, 1, 0.0D, DisplayUtils.getScaledInsets(5, 5, 5, 5)));
panel.add(
getBrowserComboBox(),
LayoutHelper.getGBC(2, 0, 1, 0.0D, DisplayUtils.getScaledInsets(5, 5, 5, 5)));
panel.add(
new JLabel(""),
LayoutHelper.getGBC(3, 0, 1, 1.0D, DisplayUtils.getScaledInsets(5, 5, 5, 5)));
panel.add(Box.createHorizontalGlue());
}
return panel;
}
/**
* Adds the field.
*
* @param parentBox the parent box
* @param field the field
*/
private void addField(Box parentBox, FieldConfigBase field) {
if (field != null) {
field.createUI();
addFieldConfig(field);
fieldConfigManager.addField(field);
if (parentBox != null) {
parentBox.add(field.getPanel());
// Add any custom panels
if (field.getCustomPanels() != null) {
for (Component component : field.getCustomPanels()) {
parentBox.add(component);
}
}
}
}
}
@Override
protected Component createContents() {
JPanel panel = new JPanel(new VerticalLayout());
panel.add(new HyperLink(Actions.build("Pair Another Device", () -> submit(Action.PAIR_ANOTHER))).getComponent());
int remainingDevices = ((Collection<?>) input.getPairingSubsystem().get(PairingSubsystem.ATTR_PAIRINGDEVICES)).size();
if(remainingDevices > 0) {
panel.add(new HyperLink(Actions.build(String.format("Customize %d Remaining Devices", remainingDevices), () -> submit(Action.CUSTOMIZE_ANOTHER))).getComponent());
}
panel.add(new JSeparator(JSeparator.HORIZONTAL));
JButton dismissAll = new JButton(Actions.build("Dismiss All", () -> submit(Action.DISMISS_ALL)));
JPanel buttons = new JPanel();
buttons.setLayout(new BoxLayout(buttons, BoxLayout.X_AXIS));
buttons.add(Box.createGlue());
buttons.add(dismissAll);
panel.add(buttons);
return panel;
}
private void initComponents()
{
Container pane = getContentPane();
pane.setLayout(new BorderLayout());
pane.add(kitPanel, BorderLayout.CENTER);
Button closeButton = new Button(LanguageBundle.getString("in_close"));
closeButton.setOnAction(this::onClose);
Box buttons = Box.createHorizontalBox();
buttons.add(GuiUtility.wrapParentAsJFXPanel(closeButton));
pane.add(buttons, BorderLayout.PAGE_END);
Utility.installEscapeCloseOperation(this);
}
protected JPanel getObject() {
Box vBox = Box.createVerticalBox();
vBox.add(new JButton("button"));
vBox.add(Box.createVerticalStrut(10));
vBox.add(new JLabel("label"));
vBox.add(Box.createVerticalGlue());
vBox.add(new JButton("button"));
vBox.add(Box.createVerticalStrut(10));
vBox.add(new JLabel("label"));
Box hBox = Box.createHorizontalBox();
hBox.add(new JButton("button"));
hBox.add(Box.createHorizontalStrut(10));
hBox.add(new JLabel("label"));
hBox.add(Box.createHorizontalGlue());
hBox.add(new JButton("button"));
hBox.add(Box.createHorizontalStrut(10));
hBox.add(new JLabel("label"));
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
panel.add(vBox);
panel.add(Box.createGlue());
panel.add(hBox);
return panel;
}
private void initComponents()
{
Container pane = getContentPane();
pane.setLayout(new BorderLayout());
pane.add(kitPanel, BorderLayout.CENTER);
Button closeButton = new Button(LanguageBundle.getString("in_close"));
closeButton.setOnAction(this::onClose);
Box buttons = Box.createHorizontalBox();
buttons.add(GuiUtility.wrapParentAsJFXPanel(closeButton));
pane.add(buttons, BorderLayout.PAGE_END);
Utility.installEscapeCloseOperation(this);
}
public Dimension minimumLayoutSize(final Container parent) {
final Insets insets = parent.getInsets();
final Dimension d = new Dimension(insets.left + insets.right,
insets.top + insets.bottom);
int maxWidth = 0;
int visibleCount = 0;
for (Component comp : parent.getComponents()) {
if (comp.isVisible() && !(comp instanceof Box.Filler)) {
final Dimension size = comp.getPreferredSize();
maxWidth = Math.max(maxWidth, size.width);
d.height += size.height;
visibleCount++;
}
}
d.height += (visibleCount - 1) * vGap;
d.width += maxWidth;
return d;
}
private JPanel buttonPanel() {
return new JPanelBuilder()
.border(10)
.add(
new JPanelBuilder()
.borderLayout()
.addWest(
new JPanelBuilder()
.boxLayoutHorizontal()
.add(submitButton)
.add(Box.createHorizontalStrut(30))
.add(previewButton)
.build())
.addEast(
new JPanelBuilder()
.boxLayoutHorizontal()
.add(Box.createHorizontalStrut(70))
.add(cancelButton)
.build())
.build())
.build();
}
ScannerRequestPanel() {
HtmlButton go = new HtmlButton( "Go") {
@Override protected void actionPerformed() {
onGo();
}
};
VerticalPanel paramsPanel = new VerticalPanel();
paramsPanel.add( "Scan code", m_scanCode);
paramsPanel.add( "Instrument", m_instrument);
paramsPanel.add( "Location", m_location, Box.createHorizontalStrut(10), go);
paramsPanel.add( "Stock type", m_stockType);
paramsPanel.add( "Num rows", m_numRows);
setLayout( new BorderLayout() );
add( paramsPanel, BorderLayout.NORTH);
}
FlyweightContactItem() {
//this.setPaintFocus(true);
this.setLayout(new BorderLayout(View.GAP_DEFAULT, 0));
this.setMargin(View.MARGIN_SMALL);
mAvatar = new ComponentUtils.AvatarImage(View.AVATAR_LIST_SIZE);
this.add(mAvatar, BorderLayout.WEST);
mNameLabel = new WebLabel();
mNameLabel.setFontSize(View.FONT_SIZE_BIG);
mNameLabel.setDrawShade(true);
mStatusLabel = new WebLabel();
mStatusLabel.setForeground(Color.GRAY);
mStatusLabel.setFontSize(View.FONT_SIZE_TINY);
this.add(
new GroupPanel(View.GAP_SMALL, false,
mNameLabel,
new GroupPanel(GroupingType.fillFirst,
Box.createGlue(), mStatusLabel)
), BorderLayout.CENTER);
}
/**
* Creates the GUI.
*/
protected void createGUI() {
setSize(400, 300);
setContentPane(new JPanel(new BorderLayout()));
scrollpane = new JScrollPane(tables[0]);
if(tables.length>1) {
// create spinner
SpinnerModel model = new SpinnerNumberModel(0, 0, tables.length-1, 1);
spinner = new JSpinner(model);
JSpinner.NumberEditor editor = new JSpinner.NumberEditor(spinner);
editor.getTextField().setFont(tables[0].getFont());
spinner.setEditor(editor);
spinner.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
int i = ((Integer) spinner.getValue()).intValue();
scrollpane.setViewportView(tables[i]);
}
});
Dimension dim = spinner.getMinimumSize();
spinner.setMaximumSize(dim);
getContentPane().add(scrollpane, BorderLayout.CENTER);
JToolBar toolbar = new JToolBar();
toolbar.setFloatable(false);
toolbar.add(new JLabel(" index ")); //$NON-NLS-1$
toolbar.add(spinner);
toolbar.add(Box.createHorizontalGlue());
getContentPane().add(toolbar, BorderLayout.NORTH);
} else {
scrollpane.createHorizontalScrollBar();
getContentPane().add(scrollpane, BorderLayout.CENTER);
}
}
public void rebuild()
{
GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.weightx = 1;
constraints.gridx = 0;
constraints.gridy = 0;
markerView.removeAll();
for (final ScreenMarkerOverlay marker : plugin.getScreenMarkers())
{
markerView.add(new ScreenMarkerPanel(plugin, marker), constraints);
constraints.gridy++;
markerView.add(Box.createRigidArea(new Dimension(0, 10)), constraints);
constraints.gridy++;
}
boolean empty = constraints.gridy == 0;
noMarkersPanel.setVisible(empty);
title.setVisible(!empty);
markerView.add(noMarkersPanel, constraints);
constraints.gridy++;
markerView.add(creationPanel, constraints);
constraints.gridy++;
repaint();
revalidate();
}
public Editor()
{
cellPanel.setLayout(cardLayout);
cellPanel.setOpaque(true);
JButton addButton = Utilities.createSignButton(Sign.Plus);
JButton removeButton = Utilities.createSignButton(Sign.Minus);
addButton.setActionCommand(ADD_ID);
removeButton.setActionCommand(REMOVE_ID);
addButton.setFocusable(false);
removeButton.setFocusable(false);
addButton.addActionListener(this);
removeButton.addActionListener(this);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
box.add(addLabel);
box.add(Box.createHorizontalStrut(3));
box.add(addButton);
box.add(Box.createHorizontalStrut(2));
cellPanel.add(box, ADD_ID);
box = Box.createHorizontalBox();
box.add(Box.createHorizontalStrut(3));
box.add(cellLabel);
box.add(Box.createHorizontalGlue());
box.add(removeButton);
box.add(Box.createHorizontalStrut(2));
cellPanel.add(box, REMOVE_ID);
}
public CategoriesPanel(Frame owner) {
this.owner = owner;
setLayout(new BorderLayout());
buttonFlow = new JPanel(new FlowLayout(FlowLayout.RIGHT));
add(Box.createVerticalStrut(5), BorderLayout.NORTH);
add(Box.createHorizontalStrut(5),BorderLayout.WEST);
JPanel innerButtonPanel = new JPanel(new GridLayout(3, 1, 5, 5));
innerButtonPanel.add(addButton = new JButton("Add"));
innerButtonPanel.add(removeButton = new JButton("Remove"));
innerButtonPanel.add(editButton = new JButton("Edit"));
removeButton.setEnabled(false);
editButton.setEnabled(false);
addButton.addActionListener(this);
removeButton.addActionListener(this);
editButton.addActionListener(this);
buttonFlow.add(innerButtonPanel);
add(buttonFlow,BorderLayout.EAST);
setPreferredSize(new Dimension(380, 290));
//createList();
categoriesList = new JList(PrefManager.get().getCategories());
scrollPane = new JScrollPane(categoriesList);
categoriesList.addListSelectionListener(this);
add(scrollPane,BorderLayout.CENTER);
}
/**
* Adds fill components to empty cells in the first row and first column of the grid.
* This ensures that the grid spacing will be the same as shown in the designer.
* @param cols an array of column indices in the first row where fill components should be added.
* @param rows an array of row indices in the first column where fill components should be added.
*/
void addFillComponents( Container panel, int[] cols, int[] rows )
{
Dimension filler = new Dimension(10,10);
boolean filled_cell_11 = false;
CellConstraints cc = new CellConstraints();
if ( cols.length > 0 && rows.length > 0 )
{
if ( cols[0] == 1 && rows[0] == 1 )
{
/** add a rigid area */
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
filled_cell_11 = true;
}
}
for( int index = 0; index < cols.length; index++ )
{
if ( cols[index] == 1 && filled_cell_11 )
{
continue;
}
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
}
for( int index = 0; index < rows.length; index++ )
{
if ( rows[index] == 1 && filled_cell_11 )
{
continue;
}
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
}
}
/**
* Adds fill components to empty cells in the first row and first column of the grid.
* This ensures that the grid spacing will be the same as shown in the designer.
* @param cols an array of column indices in the first row where fill components should be added.
* @param rows an array of row indices in the first column where fill components should be added.
*/
void addFillComponents( Container panel, int[] cols, int[] rows )
{
Dimension filler = new Dimension(10,10);
boolean filled_cell_11 = false;
CellConstraints cc = new CellConstraints();
if ( cols.length > 0 && rows.length > 0 )
{
if ( cols[0] == 1 && rows[0] == 1 )
{
/** add a rigid area */
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
filled_cell_11 = true;
}
}
for( int index = 0; index < cols.length; index++ )
{
if ( cols[index] == 1 && filled_cell_11 )
{
continue;
}
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
}
for( int index = 0; index < rows.length; index++ )
{
if ( rows[index] == 1 && filled_cell_11 )
{
continue;
}
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
}
}
private JPanel makeMainPanel() {
JPanel mainPanel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.WEST;
c.weightx = .5;
c.gridy = 0;
c.insets = new Insets(4, 4, 4, 4);
// User name
c.gridx = 0;
c.gridy += 1;
mainPanel.add(userLabel, c);
c.gridx += 1;
userField.setMinimumSize(userField.getPreferredSize());
mainPanel.add(userField, c);
c.gridx += 1;
mainPanel.add(Box.createHorizontalGlue(), c);
// Password
c.gridx = 0;
c.gridy += 1;
mainPanel.add(passwordLabel, c);
c.gridx += 1;
passwordField.setMinimumSize(passwordField.getPreferredSize());
mainPanel.add(passwordField, c);
c.gridx += 1;
mainPanel.add(Box.createHorizontalGlue(), c);
// check label
c.gridx = 0;
c.gridy += 1;
c.gridwidth = 4;
c.weighty = 1;
checkLabel.setForeground(FAILURE_STATUS_COLOR);
mainPanel.add(checkLabel, c);
return mainPanel;
}
/**
* Creates the panel for user authentication. Username and password are included.
*
* @return JPanel Panel with checkbox to choose user and password
*/
private Component createAuthPane() {
mqttUser.setText(Constants.MQTT_USER_USERNAME);
mqttPwd.setText(Constants.MQTT_USER_PASSWORD);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
panel.add(Box.createHorizontalStrut(10));
panel.add(mqttUser);
panel.add(Box.createHorizontalStrut(10));
panel.add(mqttPwd);
panel.add(Box.createHorizontalStrut(10));
panel.add(resetUserNameAndPassword);
return panel;
}
public EnumControl(JComponent parent,
final String title, List<String> values, String current, final CommandQueue commandQueue) {
JLabel label = new JLabel(title);
parent.add(label);
parent.add(Box.createVerticalGlue());
comboBox = new JComboBox<String>();
for (String value : values) {
comboBox.addItem(value);
}
comboBox.setSelectedItem(current);
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!isUpdating) {
String newValue = (String)comboBox.getSelectedItem();
Command setCommand = new SetParameterValue();
setCommand.putAttribute(title, newValue);
try {
commandQueue.insertCommand(setCommand);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
});
parent.add(comboBox);
parent.add(Box.createVerticalStrut(40));
parent.revalidate();
}
/** Make the panel contents */
protected void makePanelContents()
{
setLayout(new BorderLayout());
JPanel boxPanel = new JPanel();
boxPanel.setLayout(new BoxLayout(boxPanel, BoxLayout.Y_AXIS));
add(boxPanel, BorderLayout.NORTH);
JLabel topLabel = new JLabel(I18nManager.getText("dialog.gpsbabel.filter.distance.intro"));
topLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
boxPanel.add(topLabel);
boxPanel.add(Box.createVerticalStrut(18)); // spacer
// Main three-column grid
JPanel gridPanel = new JPanel();
gridPanel.setLayout(new GridLayout(0, 3, 4, 4));
gridPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.distance.distance")));
_distField = new DecimalNumberField();
_distField.addKeyListener(_paramChangeListener);
gridPanel.add(_distField);
_distUnitsCombo = new JComboBox<String>(new String[] {I18nManager.getText("units.metres"), I18nManager.getText("units.feet")});
gridPanel.add(_distUnitsCombo);
gridPanel.add(new JLabel(I18nManager.getText("dialog.gpsbabel.filter.distance.time")));
_secondsField = new WholeNumberField(4);
_secondsField.addKeyListener(_paramChangeListener);
gridPanel.add(_secondsField);
gridPanel.add(new JLabel(I18nManager.getText("units.seconds")));
gridPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
boxPanel.add(gridPanel);
}
public ButtonPane(ActionListener listener, int spacing, String[]... items) {
super();
boolean addSpacer = false;
for (String[] item : items) {
if (addSpacer) {
add(Box.createHorizontalStrut(spacing));
}
RPCButton button = new RPCButton(item[0]);
button.setActionCommand(item[1]);
button.addActionListener(listener);
add(button);
addSpacer = true;
}
setBackground(UIConfig.background);
}
/**
* Adds fill components to empty cells in the first row and first column of the grid.
* This ensures that the grid spacing will be the same as shown in the designer.
* @param cols an array of column indices in the first row where fill components should be added.
* @param rows an array of row indices in the first column where fill components should be added.
*/
void addFillComponents( Container panel, int[] cols, int[] rows )
{
Dimension filler = new Dimension(10,10);
boolean filled_cell_11 = false;
CellConstraints cc = new CellConstraints();
if ( cols.length > 0 && rows.length > 0 )
{
if ( cols[0] == 1 && rows[0] == 1 )
{
/** add a rigid area */
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
filled_cell_11 = true;
}
}
for( int index = 0; index < cols.length; index++ )
{
if ( cols[index] == 1 && filled_cell_11 )
{
continue;
}
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
}
for( int index = 0; index < rows.length; index++ )
{
if ( rows[index] == 1 && filled_cell_11 )
{
continue;
}
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
}
}
/**
* Create a new instance of BiographyInfoPane.
*/
public BiographyInfoPane()
{
this.itemsPanel = new JPanel();
setLayout(new GridBagLayout());
Box vbox = Box.createVerticalBox();
itemsPanel.setLayout(new GridBagLayout());
itemsPanel.setBorder(new EmptyBorder(8, 5, 8, 5));
vbox.add(Box.createVerticalStrut(10));
detailsScroll = new JScrollPane(itemsPanel);
detailsScroll.setPreferredSize(detailsScroll.getMaximumSize());
detailsScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
detailsScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
detailsScroll.setMinimumSize(new Dimension(600, 0));
vbox.add(detailsScroll);
vbox.add(Box.createVerticalStrut(10));
Box hbox = Box.createHorizontalBox();
hbox.add(Box.createHorizontalGlue());
JButton addCustomItemButton = new JButton();
hbox.add(addCustomItemButton);
hbox.add(Box.createHorizontalGlue());
vbox.add(hbox);
vbox.add(Box.createVerticalGlue());
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.VERTICAL;
gbc.weighty = 1;
gbc.insets = new Insets(5, 5, 5, 5);
add(vbox, gbc);
}