use of javax.swing.JScrollPane in project pcgen by PCGen.
the class RunConvertPanel method setupDisplay.
/**
* @see pcgen.gui2.converter.panel.ConvertSubPanel#setupDisplay(javax.swing.JPanel, pcgen.cdom.base.CDOMObject)
*/
@Override
public void setupDisplay(JPanel panel, CDOMObject pc) {
panel.setLayout(new GridBagLayout());
JLabel introLabel = new JLabel("Conversion in progress");
GridBagConstraints gbc = new GridBagConstraints();
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(0, 10, 5, 10);
panel.add(introLabel, gbc);
JLabel explainLabel = new JLabel("<html>The LST data is being converted. In the log, " + "LSTERROR rows are errors that need to be manually corrected in the source data. " + "LSTWARN rows indicate changes the converter is making. " + "See " + changeLogFile.getAbsolutePath() + " for a log of all data changes.</html>");
explainLabel.setFocusable(true);
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(0, 10, 5, 10);
panel.add(explainLabel, gbc);
progressBar = getProgressBar();
Dimension d = progressBar.getPreferredSize();
d.width = 400;
progressBar.setPreferredSize(d);
progressBar.setStringPainted(true);
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0);
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(progressBar, gbc);
messageAreaContainer = new JScrollPane(getMessageArea());
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 1.0);
gbc.fill = GridBagConstraints.BOTH;
panel.add(messageAreaContainer, gbc);
panel.setPreferredSize(new Dimension(800, 500));
}
use of javax.swing.JScrollPane in project pcgen by PCGen.
the class CampaignPanel method setupDisplay.
/**
* @see pcgen.gui2.converter.panel.ConvertSubPanel#setupDisplay(javax.swing.JPanel, pcgen.cdom.base.CDOMObject)
*/
@Override
public void setupDisplay(JPanel panel, final CDOMObject pc) {
panel.setLayout(new GridBagLayout());
JLabel introLabel = new JLabel("Please select the Campaign(s) to Convert:");
GridBagConstraints gbc = new GridBagConstraints();
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
gbc.insets = new Insets(25, 25, 5, 25);
panel.add(introLabel, gbc);
final CampaignTableModel model = new CampaignTableModel(gameModeCampaigns, folderName);
final JTable table = new JTable(model) {
//Implement table cell tool tips.
@Override
public String getToolTipText(MouseEvent e) {
java.awt.Point p = e.getPoint();
int rowIndex = rowAtPoint(p);
int colIndex = columnAtPoint(p);
String tip = String.valueOf(getValueAt(rowIndex, colIndex));
return tip;
}
};
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
pc.removeListFor(ListKey.CAMPAIGN);
int[] selRows = table.getSelectedRows();
if (selRows.length == 0) {
saveSourceSelection(pc);
fireProgressEvent(ProgressEvent.NOT_ALLOWED);
} else {
for (int row : selRows) {
Campaign selCampaign = (Campaign) model.getValueAt(row, 0);
pc.addToListFor(ListKey.CAMPAIGN, selCampaign);
}
saveSourceSelection(pc);
fireProgressEvent(ProgressEvent.ALLOWED);
}
}
});
JScrollPane listScroller = new JScrollPane(table);
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 1.0);
gbc.fill = GridBagConstraints.BOTH;
panel.add(listScroller, gbc);
initSourceSelection(model, table);
}
use of javax.swing.JScrollPane in project pcgen by PCGen.
the class SummaryPanel method setupDisplay.
/**
* @see pcgen.gui2.converter.panel.ConvertSubPanel#setupDisplay(javax.swing.JPanel, pcgen.cdom.base.CDOMObject)
*/
@Override
public void setupDisplay(JPanel panel, CDOMObject pc) {
panel.setLayout(new GridBagLayout());
JLabel introLabel = new JLabel("Ready to convert.");
GridBagConstraints gbc = new GridBagConstraints();
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
gbc.insets = new Insets(50, 25, 10, 25);
panel.add(introLabel, gbc);
JLabel instructLabel = new JLabel("Press Next to begin converting using the following settings:");
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
gbc.insets = new Insets(10, 25, 20, 25);
panel.add(instructLabel, gbc);
JLabel[] labels = new JLabel[4];
JComponent[] values = new JComponent[4];
labels[0] = new JLabel("Source Folder:");
labels[1] = new JLabel("Destination Folder:");
labels[2] = new JLabel("Game mode:");
labels[3] = new JLabel("Sources:");
values[0] = new JLabel(pc.get(ObjectKey.DIRECTORY).getAbsolutePath());
values[1] = new JLabel(pc.get(ObjectKey.WRITE_DIRECTORY).getAbsolutePath());
values[2] = new JLabel(pc.get(ObjectKey.GAME_MODE).getDisplayName());
List<Campaign> campaigns = pc.getSafeListFor(ListKey.CAMPAIGN);
StringBuilder campDisplay = new StringBuilder();
for (int i = 0; i < campaigns.size(); i++) {
campDisplay.append(campaigns.get(i).getDisplayName());
campDisplay.append("\n");
}
JTextArea campText = new JTextArea(campDisplay.toString());
campText.setEditable(false);
JScrollPane scrollPane = new JScrollPane(campText);
values[3] = scrollPane;
// Place the labels on the page and lay them out
Font plainFont = FontManipulation.plain(panel.getFont());
for (int i = 0; i < labels.length; i++) {
Utility.buildRelativeConstraints(gbc, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
gbc.insets = new Insets(10, 25, 10, 10);
panel.add(labels[i], gbc);
if (i < labels.length - 1) {
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, 1, 1.0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
} else {
Utility.buildRelativeConstraints(gbc, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 1.0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
}
gbc.insets = new Insets(10, 10, 10, 25);
panel.add(values[i], gbc);
values[i].setFont(plainFont);
}
}
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();
}
Aggregations