use of java.awt.Insets in project pcgen by PCGen.
the class SummaryInfoTab method resetBasicsPanel.
private void resetBasicsPanel() {
basicsPanel.removeAll();
GridBagConstraints gbc = new GridBagConstraints();
{
//$NON-NLS-1$
JLabel label = createLabel("in_sumName");
gbc.anchor = java.awt.GridBagConstraints.WEST;
gbc.insets = new Insets(0, 0, 3, 0);
basicsPanel.add(label, gbc);
//$NON-NLS-1$
random.setText(LanguageBundle.getString("in_randomButton"));
random.setMargin(new Insets(0, 0, 0, 0));
gbc.insets = new Insets(0, 2, 3, 2);
basicsPanel.add(random, gbc);
gbc.insets = new Insets(0, 0, 3, 2);
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 1.0;
basicsPanel.add(characterNameField, gbc);
}
Insets insets = new Insets(0, 0, 3, 2);
Font labelFont = null;
//$NON-NLS-1$
addGridBagLayer(basicsPanel, labelFont, insets, "in_sumCharType", characterTypeComboBox);
//$NON-NLS-1$
addGridBagLayer(basicsPanel, labelFont, insets, "in_sumPlayer", playerNameField);
//$NON-NLS-1$
addGridBagLayer(basicsPanel, labelFont, insets, "in_sumTabLabel", tabLabelField);
if (genderComboBox.getModel().getSize() != 0) {
//$NON-NLS-1$
addGridBagLayer(basicsPanel, labelFont, insets, "in_sumGender", genderComboBox);
}
if (handsComboBox.getModel().getSize() != 0) {
//$NON-NLS-1$
addGridBagLayer(basicsPanel, labelFont, insets, "in_sumHanded", handsComboBox);
}
if (alignmentComboBox.getModel().getSize() != 0) {
//$NON-NLS-1$
addGridBagLayer(basicsPanel, labelFont, insets, "in_sumAlignment", alignmentComboBox);
}
if (deityComboBox.getModel().getSize() != 0) {
//$NON-NLS-1$
addGridBagLayer(basicsPanel, labelFont, insets, "in_domDeityLabel", deityComboBox);
}
gbc = new GridBagConstraints();
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.BOTH;
gbc.weighty = 1;
gbc.insets = new Insets(6, 2, 2, 2);
langScroll = new JScrollPane(languageTable);
basicsPanel.add(langScroll, gbc);
basicsPanel.revalidate();
}
use of java.awt.Insets in project pcgen by PCGen.
the class EquipInfoTab method initComponents.
private void initComponents() {
FontManipulation.small(newSetButton);
newSetButton.setMargin(new Insets(0, 0, 0, 0));
FontManipulation.small(removeSetButton);
removeSetButton.setMargin(new Insets(0, 0, 0, 0));
//$NON-NLS-1$
exportTemplateButton.setText(LanguageBundle.getString("in_equipExportTemplate"));
//$NON-NLS-1$
viewBrowserButton.setText(LanguageBundle.getString("in_equipViewBrowser"));
//$NON-NLS-1$
exportFileButton.setText(LanguageBundle.getString("in_equipExportFile"));
//$NON-NLS-1$
setNoteButton.setText(LanguageBundle.getString("in_equipSetNote"));
setOrientation(HORIZONTAL_SPLIT);
FlippingSplitPane splitPane = new FlippingSplitPane(VERTICAL_SPLIT, "EquipMain");
JPanel panel = new JPanel(new BorderLayout());
Box bar = Box.createHorizontalBox();
bar.add(Box.createHorizontalStrut(5));
//$NON-NLS-1$
bar.add(new JLabel(LanguageBundle.getString("in_equipView")));
bar.add(Box.createHorizontalStrut(5));
bar.add(equipViewBox);
bar.add(Box.createHorizontalStrut(5));
tableFilter = new SearchFilterPanel();
bar.add(tableFilter.getFilterComponent());
bar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
panel.add(bar, BorderLayout.NORTH);
equipmentTable.setAutoCreateColumnsFromModel(false);
equipmentTable.setColumnModel(createEquipmentColumnModel());
equipmentTable.setAutoCreateRowSorter(true);
panel.add(new JScrollPane(equipmentTable), BorderLayout.CENTER);
Box buttonsBox = Box.createHorizontalBox();
buttonsBox.add(Box.createHorizontalGlue());
equipButton.setHorizontalTextPosition(SwingConstants.LEADING);
buttonsBox.add(equipButton);
buttonsBox.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
panel.add(buttonsBox, BorderLayout.SOUTH);
splitPane.setTopComponent(panel);
splitPane.setBottomComponent(infoPane);
setLeftComponent(splitPane);
panel = new JPanel(new BorderLayout());
Box equipPane = Box.createVerticalBox();
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
//$NON-NLS-1$
box.add(new JLabel(LanguageBundle.getString("in_equipSetLabel")));
box.add(Box.createHorizontalStrut(3));
box.add(equipSetBox);
box.add(Box.createHorizontalStrut(3));
box.add(newSetButton);
box.add(Box.createHorizontalStrut(3));
box.add(removeSetButton);
box.add(Box.createHorizontalGlue());
//$NON-NLS-1$
box.add(new JLabel(LanguageBundle.getString("in_equipWeightLabel")));
box.add(Box.createHorizontalStrut(5));
box.add(weightLabel);
box.add(Box.createHorizontalGlue());
//$NON-NLS-1$
box.add(new JLabel(LanguageBundle.getString("in_equipLoadLabel")));
box.add(Box.createHorizontalStrut(5));
box.add(loadLabel);
// box.add(Box.createHorizontalGlue());
// box.add(new JLabel("Limit:"));
box.add(Box.createHorizontalStrut(5));
box.add(limitLabel);
box.add(Box.createHorizontalGlue());
equipPane.add(Box.createVerticalStrut(3));
equipPane.add(box);
equipPane.add(Box.createVerticalStrut(3));
box = Box.createHorizontalBox();
box.add(exportTemplateButton);
exportTemplateButton.setEnabled(false);
box.add(Box.createHorizontalStrut(3));
box.add(viewBrowserButton);
viewBrowserButton.setEnabled(false);
box.add(Box.createHorizontalStrut(3));
box.add(exportFileButton);
exportFileButton.setEnabled(false);
box.add(Box.createHorizontalStrut(3));
box.add(setNoteButton);
setNoteButton.setEnabled(false);
box.add(Box.createHorizontalStrut(3));
box.add(expandAllButton);
box.add(Box.createHorizontalStrut(3));
box.add(collapseAllButton);
equipPane.add(box);
equipPane.add(Box.createVerticalStrut(3));
panel.add(equipPane, BorderLayout.NORTH);
EquipmentModel.initializeTreeTable(equipmentSetTable);
panel.add(new JScrollPane(equipmentSetTable), BorderLayout.CENTER);
Box selPanelbuttonsBox = Box.createHorizontalBox();
selPanelbuttonsBox.add(Box.createHorizontalStrut(3));
selPanelbuttonsBox.add(unequipButton);
selPanelbuttonsBox.add(Box.createHorizontalStrut(3));
selPanelbuttonsBox.add(unequipAllButton);
selPanelbuttonsBox.add(Box.createHorizontalStrut(3));
selPanelbuttonsBox.add(moveUpButton);
selPanelbuttonsBox.add(Box.createHorizontalStrut(3));
selPanelbuttonsBox.add(moveDownButton);
selPanelbuttonsBox.add(Box.createHorizontalGlue());
selPanelbuttonsBox.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
panel.add(selPanelbuttonsBox, BorderLayout.SOUTH);
setRightComponent(panel);
}
use of java.awt.Insets in project pcgen by PCGen.
the class SummaryInfoTab method initLevelPanel.
private void initLevelPanel(JPanel panel) {
panel.setLayout(new GridBagLayout());
//$NON-NLS-1$
JLabel addLabel = createLabel("in_sumAddLevels");
//$NON-NLS-1$
JLabel removeLabel = createLabel("in_sumRemoveLevels");
JLabel darrowLabel = new JLabel(Icons.button_arrow_down.getImageIcon());
JLabel uarrowLabel = new JLabel(Icons.button_arrow_up.getImageIcon());
addLevelsButton.setMargin(new Insets(0, 8, 0, 8));
addLevelsField.setValue(1);
addLevelsField.setHorizontalAlignment(SwingConstants.RIGHT);
removeLevelsButton.setMargin(new Insets(0, 8, 0, 8));
removeLevelsField.setValue(1);
removeLevelsField.setHorizontalAlignment(SwingConstants.RIGHT);
GridBagConstraints gbc1 = new GridBagConstraints();
GridBagConstraints gbc2 = new GridBagConstraints();
gbc1.weightx = gbc2.weightx = 0.5;
gbc1.insets = new Insets(1, 0, 1, 0);
gbc2.insets = new Insets(1, 0, 1, 0);
gbc2.gridwidth = GridBagConstraints.REMAINDER;
panel.add(addLabel, gbc1);
panel.add(removeLabel, gbc2);
gbc1.ipadx = 30;
panel.add(addLevelsField, gbc1);
gbc2.ipadx = 30;
panel.add(removeLevelsField, gbc2);
gbc1.ipadx = 0;
panel.add(addLevelsButton, gbc1);
gbc2.ipadx = 0;
panel.add(removeLevelsButton, gbc2);
panel.add(darrowLabel, gbc1);
panel.add(uarrowLabel, gbc2);
ClassLevelTableModel.initializeTable(classLevelTable);
gbc2.weightx = 0;
gbc2.weighty = 1;
gbc2.fill = GridBagConstraints.BOTH;
panel.add(new JScrollPane(classLevelTable), gbc2);
}
use of java.awt.Insets in project pcgen by PCGen.
the class PortraitPane method getPreferredSize.
@Override
public Dimension getPreferredSize() {
Insets insets = getInsets();
int width = 0;
int height = 0;
if (insets != null) {
width += insets.left + insets.right;
height += insets.top + insets.bottom;
}
if (portrait != null) {
if (scale < 1) {
width += (int) (scale * portrait.getWidth());
height += (int) (scale * portrait.getHeight());
} else {
width += portrait.getWidth();
height += portrait.getHeight();
}
}
return new Dimension(width, height);
}
use of java.awt.Insets in project pcgen by PCGen.
the class PortraitPane method paintComponent.
@Override
protected void paintComponent(Graphics g) {
Insets insets = getInsets();
if (scale < 1) {
int width, height;
width = (int) (scale * portrait.getWidth());
height = (int) (scale * portrait.getHeight());
g.drawImage(portrait, insets.left, insets.top, width, height, this);
} else {
g.drawImage(portrait, insets.left, insets.top, this);
}
g.setColor(Color.BLACK);
g.setXORMode(Color.WHITE);
if (cropRect != null) {
if (scale < 1) {
g.drawRect(((int) (cropRect.x * scale)) + insets.left, ((int) (cropRect.y * scale)) + insets.top, (int) (cropRect.width * scale), (int) (cropRect.height * scale));
} else {
g.drawRect(cropRect.x + insets.left, cropRect.y + insets.top, cropRect.width, cropRect.height);
}
}
}
Aggregations