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 PurchaseModeFrame method initComponents.
private void initComponents() {
purchaseScoreMinEdit = new JTextField(3);
purchaseScoreMaxEdit = new JTextField(3);
statusBar = new JLabel();
currentPurchaseMethods = new JComboBoxEx();
currentPurchaseMethods.setAutoSort(true);
purchaseMethodPointsEdit = new JTextField(4);
removeMethodButton = new JButton();
AbstractButton okButton = new JButton();
okButton.addActionListener(e -> CustomData.writePurchaseModeConfiguration());
jScrollPane1 = new JScrollPane();
getContentPane().setLayout(new GridBagLayout());
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle(PurchaseModeFrame.TITLE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
exitForm();
}
});
Container jPanel1 = new JPanel();
jPanel1.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 5));
JLabel purchaseScoreMinLabel = new JLabel();
//$NON-NLS-1$
purchaseScoreMinLabel.setText(LanguageBundle.getString("in_Prefs_purchMin"));
//$NON-NLS-1$
purchaseScoreMinLabel.setToolTipText(LanguageBundle.getString("in_Prefs_purchMinTip"));
purchaseScoreMinLabel.setPreferredSize(new Dimension(140, 15));
jPanel1.add(purchaseScoreMinLabel);
purchaseScoreMinEdit.setHorizontalAlignment(SwingConstants.RIGHT);
purchaseScoreMinEdit.addActionListener(evt -> purchaseScoreMinValueActionPerformed());
purchaseScoreMinEdit.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
purchaseScoreMinValueActionPerformed();
}
});
jPanel1.add(purchaseScoreMinEdit);
AbstractButton purchaseScoreMinIncreaseButton = new JButton();
//$NON-NLS-1$
purchaseScoreMinIncreaseButton.setText(LanguageBundle.getString("in_Prefs_plus"));
//$NON-NLS-1$
purchaseScoreMinIncreaseButton.setToolTipText(LanguageBundle.getString("in_Prefs_incMin"));
purchaseScoreMinIncreaseButton.addActionListener(evt -> purchaseScoreMinIncreaseButtonActionPerformed());
jPanel1.add(purchaseScoreMinIncreaseButton);
AbstractButton purchaseScoreMinDecreaseButton = new JButton();
//$NON-NLS-1$
purchaseScoreMinDecreaseButton.setText(LanguageBundle.getString("in_Prefs_minus"));
//$NON-NLS-1$
purchaseScoreMinDecreaseButton.setToolTipText(LanguageBundle.getString("in_Prefs_decMin"));
purchaseScoreMinDecreaseButton.addActionListener(evt -> purchaseScoreMinDecreaseButtonActionPerformed());
jPanel1.add(purchaseScoreMinDecreaseButton);
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
getContentPane().add(jPanel1, gridBagConstraints);
Container jPanel2 = new JPanel();
jPanel2.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 5));
JLabel purchaseScoreMaxLabel = new JLabel();
//$NON-NLS-1$
purchaseScoreMaxLabel.setText(LanguageBundle.getString("in_Prefs_purchMax"));
//$NON-NLS-1$
purchaseScoreMaxLabel.setToolTipText(LanguageBundle.getString("in_Prefs_purchMaxTip"));
purchaseScoreMaxLabel.setPreferredSize(new Dimension(140, 15));
jPanel2.add(purchaseScoreMaxLabel);
purchaseScoreMaxEdit.setHorizontalAlignment(SwingConstants.RIGHT);
purchaseScoreMaxEdit.addActionListener(evt -> purchaseScoreMaxValueActionPerformed());
purchaseScoreMaxEdit.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
purchaseScoreMaxValueActionPerformed();
}
});
jPanel2.add(purchaseScoreMaxEdit);
AbstractButton purchaseScoreMaxIncreaseButton = new JButton();
//$NON-NLS-1$
purchaseScoreMaxIncreaseButton.setText(LanguageBundle.getString("in_Prefs_plus"));
//$NON-NLS-1$
purchaseScoreMaxIncreaseButton.setToolTipText(LanguageBundle.getString("in_Prefs_incMax"));
purchaseScoreMaxIncreaseButton.addActionListener(evt -> purchaseScoreMaxIncreaseButtonActionPerformed());
jPanel2.add(purchaseScoreMaxIncreaseButton);
AbstractButton purchaseScoreMaxDecreaseButton = new JButton();
//$NON-NLS-1$
purchaseScoreMaxDecreaseButton.setText(LanguageBundle.getString("in_Prefs_minus"));
//$NON-NLS-1$
purchaseScoreMaxDecreaseButton.setToolTipText(LanguageBundle.getString("in_Prefs_decMax"));
purchaseScoreMaxDecreaseButton.addActionListener(evt -> purchaseScoreMaxDecreaseButtonActionPerformed());
jPanel2.add(purchaseScoreMaxDecreaseButton);
GridBagConstraints bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 2;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
getContentPane().add(jPanel2, bagConstraints);
JComponent purchaseMethodPanel = new JPanel();
purchaseMethodPanel.setLayout(new GridBagLayout());
purchaseMethodPanel.setBorder(BorderFactory.createTitledBorder(//$NON-NLS-1$
LanguageBundle.getString("in_Prefs_allowPoints")));
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 3;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
getContentPane().add(purchaseMethodPanel, bagConstraints);
Container purchaseMethodNamePanel = new JPanel();
purchaseMethodNamePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 5));
JLabel savedMethodLabel = new JLabel();
//$NON-NLS-1$
savedMethodLabel.setText(LanguageBundle.getString("in_Prefs_savedMethods"));
savedMethodLabel.setPreferredSize(new Dimension(140, 15));
purchaseMethodNamePanel.add(savedMethodLabel);
purchaseMethodNamePanel.add(currentPurchaseMethods);
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 0;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
getContentPane().add(purchaseMethodNamePanel, bagConstraints);
purchaseMethodPanel.add(purchaseMethodNamePanel, bagConstraints);
Container purchaseMethodPointsPanel = new JPanel();
purchaseMethodPointsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 5));
JLabel methodPointsLabel = new JLabel();
//$NON-NLS-1$
methodPointsLabel.setText(LanguageBundle.getString("in_Prefs_points"));
methodPointsLabel.setPreferredSize(new Dimension(140, 15));
purchaseMethodPointsPanel.add(methodPointsLabel);
purchaseMethodPointsEdit.setHorizontalAlignment(SwingConstants.RIGHT);
purchaseMethodPointsEdit.setEditable(false);
//purchaseMethodPointsEdit.setText("10");
purchaseMethodPointsPanel.add(purchaseMethodPointsEdit);
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 1;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
// getContentPane().add(purchaseMethodPointsPanel, gridBagConstraints);
purchaseMethodPanel.add(purchaseMethodPointsPanel, bagConstraints);
currentPurchaseMethods.setPreferredSize(new Dimension(140, 21));
currentPurchaseMethods.addItemListener(evt -> currentPurchaseMethodsActionPerformed());
Container purchaseMethodButtonPanel = new JPanel();
purchaseMethodButtonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
AbstractButton addMethodButton = new JButton();
//$NON-NLS-1$
addMethodButton.setText(LanguageBundle.getString("in_Prefs_new"));
addMethodButton.addActionListener(evt -> addMethodButtonActionPerformed());
purchaseMethodButtonPanel.add(addMethodButton);
//$NON-NLS-1$
removeMethodButton.setText(LanguageBundle.getString("in_Prefs_remove"));
removeMethodButton.addActionListener(evt -> removeMethodButtonActionPerformed());
purchaseMethodButtonPanel.add(removeMethodButton);
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 2;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
purchaseMethodPanel.add(purchaseMethodButtonPanel, bagConstraints);
//$NON-NLS-1$
statusBar.setText(LanguageBundle.getString("in_Prefs_setCost"));
statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED));
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 6;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.ipadx = 1;
bagConstraints.ipady = 1;
bagConstraints.insets = new Insets(1, 1, 1, 1);
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
getContentPane().add(statusBar, bagConstraints);
Container jPanel3 = new JPanel();
jPanel3.setLayout(new FlowLayout(FlowLayout.RIGHT));
//$NON-NLS-1$
okButton.setText(LanguageBundle.getString("in_Prefs_OK"));
//$NON-NLS-1$
okButton.setToolTipText(LanguageBundle.getString("in_Prefs_OKTip"));
okButton.addActionListener(evt -> okButtonActionPerformed());
jPanel3.add(okButton);
AbstractButton resetButton = new JButton();
//$NON-NLS-1$
resetButton.setText(LanguageBundle.getString("in_Prefs_Reset"));
//$NON-NLS-1$
resetButton.setToolTipText(LanguageBundle.getString("in_Prefs_ResetTip"));
resetButton.addActionListener(evt -> resetButtonActionPerformed());
jPanel3.add(resetButton);
AbstractButton cancelButton = new JButton();
//$NON-NLS-1$
cancelButton.setText(LanguageBundle.getString("in_cancel"));
//$NON-NLS-1$
cancelButton.setToolTipText(LanguageBundle.getString("in_Prefs_CancelTip"));
cancelButton.addActionListener(evt -> cancelButtonActionPerformed());
jPanel3.add(cancelButton);
/////////////////////////////////////////////////
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 5;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.EAST;
bagConstraints.weightx = 1.0;
getContentPane().add(jPanel3, bagConstraints);
jScrollPane1.setViewportBorder(new BevelBorder(BevelBorder.LOWERED));
jScrollPane1.setPreferredSize(new Dimension(100, 200));
purchaseModel = new PurchaseModel();
renewAbilityScoreCostTable();
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 0;
bagConstraints.fill = GridBagConstraints.BOTH;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
bagConstraints.weighty = 1.0;
getContentPane().add(jScrollPane1, bagConstraints);
pack();
initializeCurrentPurchaseMethods();
}
use of javax.swing.JScrollPane in project pcgen by PCGen.
the class KitPanel method initComponents.
private void initComponents() {
renderer.setCharacter(character);
FlippingSplitPane topPane = new FlippingSplitPane("kitTop");
setTopComponent(topPane);
setOrientation(VERTICAL_SPLIT);
FilterBar<Object, KitFacade> bar = new FilterBar<>();
bar.addDisplayableFilter(new SearchFilterPanel());
//$NON-NLS-1$
qFilterButton.setText(LanguageBundle.getString("in_igQualFilter"));
bar.addDisplayableFilter(qFilterButton);
availableTable.setTreeViewModel(new KitTreeViewModel(character, true));
availableTable.setTreeCellRenderer(renderer);
JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTable, bar);
Box box = Box.createHorizontalBox();
box.add(Box.createHorizontalGlue());
addButton.setHorizontalTextPosition(SwingConstants.LEADING);
addButton.setAction(addAction);
box.add(addButton);
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, KitFacade> filterBar = new FilterBar<>();
filterBar.addDisplayableFilter(new SearchFilterPanel());
selectedTable.setDisplayableFilter(filterBar);
selectedTable.setTreeViewModel(new KitTreeViewModel(character, false));
selectedTable.setTreeCellRenderer(renderer);
selPanel.add(new JScrollPane(selectedTable), BorderLayout.CENTER);
topPane.setRightComponent(selPanel);
setBottomComponent(infoPane);
setResizeWeight(0.75);
}
Aggregations