use of javax.swing.JScrollPane in project pcgen by PCGen.
the class TableUtils method createToggleButtonSelectionPane.
private static JScrollPane createToggleButtonSelectionPane(JTable table, JTable rowheaderTable, JToggleButton button) {
rowheaderTable.setAutoCreateColumnsFromModel(false);
// force the tables to share models
rowheaderTable.setModel(table.getModel());
rowheaderTable.setSelectionModel(table.getSelectionModel());
rowheaderTable.setRowHeight(table.getRowHeight());
rowheaderTable.setIntercellSpacing(table.getIntercellSpacing());
rowheaderTable.setShowGrid(false);
rowheaderTable.setFocusable(false);
TableColumn column = new TableColumn(-1);
column.setHeaderValue(new Object());
column.setCellRenderer(new TableCellUtilities.ToggleButtonRenderer(button));
rowheaderTable.addColumn(column);
rowheaderTable.setPreferredScrollableViewportSize(new Dimension(20, 0));
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(table);
scrollPane.setRowHeaderView(rowheaderTable);
return scrollPane;
}
use of javax.swing.JScrollPane 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 javax.swing.JScrollPane in project pcgen by PCGen.
the class SummaryInfoTab method initTodoPanel.
/**
* Initialise the "Things to be Done" panel. Creates the required components
* and places them in the panel.
*
* @param panel The panel to be initialised
*/
private void initTodoPanel(JPanel panel) {
panel.setLayout(new BorderLayout());
todoPane.setOpaque(false);
//$NON-NLS-1$
todoPane.setContentType("text/html");
// An HTMLDocument font size and family already defaults to the UI font default, no need to add that on top.
// String bodyRule =
// "body { font-family: " + textFont.getFamily() + "; " + "font-size: " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// textFont.getSize() + "pt; }"; //$NON-NLS-1$
// ((HTMLDocument) todoPane.getDocument()).getStyleSheet().addRule(
// bodyRule);
todoPane.setEditable(false);
JScrollPane scroll = new JScrollPane(todoPane);
scroll.setBorder(BorderFactory.createEmptyBorder());
panel.add(scroll, BorderLayout.CENTER);
}
use of javax.swing.JScrollPane in project pcgen by PCGen.
the class PurchaseInfoTab method initComponents.
private void initComponents() {
setOrientation(VERTICAL_SPLIT);
//$NON-NLS-1$
FlippingSplitPane splitPane = new FlippingSplitPane("PurchaseTop");
splitPane.setOrientation(HORIZONTAL_SPLIT);
{
// Top Left panel
FilterBar<CharacterFacade, EquipmentFacade> filterBar = new FilterBar<>();
{
// Filters
filterBar.addDisplayableFilter(new SearchFilterPanel());
FilterButton<CharacterFacade, EquipmentFacade> premadeFilter = //$NON-NLS-1$
new FilterButton<>("EqQualified");
//$NON-NLS-1$
premadeFilter.setText(LanguageBundle.getString("in_igQualFilter"));
premadeFilter.setFilter(CharacterFacade::isQualifiedFor);
FilterButton<CharacterFacade, EquipmentFacade> customFilter = //$NON-NLS-1$
new FilterButton<>("EqAffordable");
//$NON-NLS-1$
customFilter.setText(LanguageBundle.getString("in_igAffordFilter"));
customFilter.setFilter(new Filter<CharacterFacade, EquipmentFacade>() {
@Override
public boolean accept(CharacterFacade context, EquipmentFacade element) {
return context.getInfoFactory().getCost(element) <= context.getFundsRef().get().floatValue();
}
});
filterBar.addDisplayableFilter(premadeFilter);
filterBar.addDisplayableFilter(customFilter);
}
JPanel panel = new JPanel(new BorderLayout());
panel.add(filterBar, BorderLayout.NORTH);
availableTable.setTreeCellRenderer(equipmentRenderer);
availableTable.setDisplayableFilter(filterBar);
panel.add(new JScrollPane(availableTable), BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalStrut(5));
box.add(autoResizeBox);
box.add(Box.createHorizontalGlue());
addCustomButton.setHorizontalTextPosition(SwingConstants.LEADING);
box.add(addCustomButton);
box.add(Box.createHorizontalStrut(5));
addEquipmentButton.setHorizontalTextPosition(SwingConstants.LEADING);
box.add(addEquipmentButton);
box.add(Box.createHorizontalStrut(5));
box.setBorder(new EmptyBorder(0, 0, 5, 0));
panel.add(box, BorderLayout.SOUTH);
splitPane.setLeftComponent(panel);
}
{
// Top Right panel
FilterBar<CharacterFacade, EquipmentFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
JPanel panel = new JPanel(new BorderLayout());
panel.add(filterBar, BorderLayout.NORTH);
purchasedTable.setDisplayableFilter(filterBar);
purchasedTable.setTreeCellRenderer(equipmentRenderer);
panel.add(new JScrollPane(purchasedTable), BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalStrut(5));
box.add(removeEquipmentButton);
box.add(Box.createHorizontalGlue());
box.setBorder(new EmptyBorder(0, 0, 5, 0));
panel.add(box, BorderLayout.SOUTH);
splitPane.setRightComponent(panel);
}
setTopComponent(splitPane);
//$NON-NLS-1$
splitPane = new FlippingSplitPane("PurchaseBottom");
splitPane.setOrientation(HORIZONTAL_SPLIT);
{
// Bottom Left Panel
JPanel panel = new JPanel();
initMoneyPanel(panel);
splitPane.setLeftComponent(panel);
}
{
// Bottom Right Panel
//$NON-NLS-1$
infoPane.setTitle(LanguageBundle.getString("in_igEqInfo"));
splitPane.setRightComponent(infoPane);
}
splitPane.setResizeWeight(0.25);
setResizeWeight(1);
setBottomComponent(splitPane);
}
use of javax.swing.JScrollPane in project pcgen by PCGen.
the class RaceInfoTab method initComponents.
private void initComponents() {
FlippingSplitPane topPane = new FlippingSplitPane("RaceTop");
setTopComponent(topPane);
setOrientation(VERTICAL_SPLIT);
JPanel availPanel = new JPanel(new BorderLayout());
FilterBar<Object, RaceFacade> bar = new FilterBar<>();
bar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
noRacialHdFilterButton.setText(LanguageBundle.getString("in_irNoRacialHd"));
//$NON-NLS-1$
noRacialHdFilterButton.setToolTipText(LanguageBundle.getString("in_irNoRacialHdTip"));
bar.addDisplayableFilter(noRacialHdFilterButton);
//$NON-NLS-1$
qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
bar.addDisplayableFilter(qFilterButton);
raceTable.setDisplayableFilter(bar);
availPanel.add(bar, BorderLayout.NORTH);
raceTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
raceTable.setTreeCellRenderer(qualifiedRenderer);
availPanel.add(new JScrollPane(raceTable), BorderLayout.CENTER);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
selectRaceButton.setHorizontalTextPosition(SwingConstants.LEADING);
box.add(selectRaceButton);
box.add(Box.createHorizontalStrut(5));
box.setBorder(new EmptyBorder(0, 0, 5, 0));
availPanel.add(box, BorderLayout.SOUTH);
topPane.setLeftComponent(availPanel);
JPanel selPanel = new JPanel(new BorderLayout());
FilterBar<Object, RaceFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
selectedTable.setDisplayableFilter(filterBar);
selectedTable.setTreeCellRenderer(qualifiedRenderer);
JScrollPane scrollPane = new JScrollPane(selectedTable);
selPanel.add(scrollPane, BorderLayout.CENTER);
scrollPane.setPreferredSize(new Dimension(0, 0));
box = Box.createHorizontalBox();
box.add(Box.createHorizontalStrut(5));
box.add(removeButton);
box.add(Box.createHorizontalGlue());
box.setBorder(new EmptyBorder(0, 0, 5, 0));
selPanel.add(box, BorderLayout.SOUTH);
topPane.setRightComponent(selPanel);
topPane.setResizeWeight(0.75);
setBottomComponent(infoPane);
setResizeWeight(0.75);
}
Aggregations