use of javax.swing.JPanel in project pcgen by PCGen.
the class PortraitInfoPane method initComponents.
private void initComponents() {
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
Utility.buildConstraints(gbc, 0, 0, 2, 1, 0, 0);
panel.add(new JLabel(LanguageBundle.getString("in_largePortrait")), gbc);
Utility.buildConstraints(gbc, 0, 1, 2, 1, 0, 0);
panel.add(portraitPane, gbc);
Utility.buildConstraints(gbc, 0, 2, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST);
panel.add(loadButton, gbc);
Utility.buildConstraints(gbc, 1, 2, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
panel.add(clearButton, gbc);
Utility.buildConstraints(gbc, 2, 1, 1, 1, 0, 0, GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);
zoomSlider.setInverted(true);
zoomSlider.setPreferredSize(new Dimension(20, 10));
panel.add(zoomSlider, gbc);
Utility.buildConstraints(gbc, 3, 0, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
panel.add(new JLabel(LanguageBundle.getString("in_thumbnailPortrait")), gbc);
Utility.buildConstraints(gbc, 3, 1, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTH);
panel.add(tnPane, gbc);
this.setViewportView(panel);
}
use of javax.swing.JPanel in project pcgen by PCGen.
the class CompanionInfoTab method initComponents.
private void initComponents() {
{
DefaultTableColumnModel model = new DefaultTableColumnModel();
TableColumn column = new TableColumn(0);
column.setResizable(true);
model.addColumn(column);
column = new TableColumn(1, 120, new ButtonCellRenderer(), null);
column.setMaxWidth(120);
column.setResizable(false);
model.addColumn(column);
companionsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
companionsTable.getTableHeader().setResizingAllowed(false);
companionsTable.setAutoCreateColumnsFromModel(false);
companionsTable.setColumnModel(model);
}
companionsTable.setIntercellSpacing(new Dimension(0, 0));
companionsTable.setFocusable(false);
companionsTable.setRowHeight(23);
companionsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
setLeftComponent(new JScrollPane(companionsTable));
JPanel rightPane = new JPanel(new BorderLayout());
infoPane.setOpaque(false);
infoPane.setEditable(false);
infoPane.setFocusable(true);
//$NON-NLS-1$
infoPane.setContentType("text/html");
rightPane.add(new JScrollPane(infoPane), BorderLayout.CENTER);
JPanel buttonPane = new JPanel(new FlowLayout());
buttonPane.add(loadButton);
rightPane.add(buttonPane, BorderLayout.SOUTH);
setRightComponent(rightPane);
}
use of javax.swing.JPanel in project pcgen by PCGen.
the class SplashScreen method initComponents.
private void initComponents() {
JComponent pane = new JPanel(new BorderLayout());
pane.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3));
Component splashLabel = new JLabel(Icons.SplashPcgen_Ennie.getImageIcon());
pane.add(splashLabel, BorderLayout.NORTH);
loadingLabel.setBorder(BorderFactory.createEmptyBorder(10, 7, 10, 10));
pane.add(loadingLabel, BorderLayout.CENTER);
loadProgress.setStringPainted(true);
pane.add(loadProgress, BorderLayout.SOUTH);
Container cont = getContentPane();
cont.setLayout(new GridLayout(1, 1));
cont.add(pane);
pack();
setLocationRelativeTo(null);
}
use of javax.swing.JPanel in project pcgen by PCGen.
the class PCGenFrame method buildMessageLabelPanel.
//TODO: This should be in a utility class.
/**
* Builds a JPanel containing the supplied message, split at each new
* line and an optional checkbox, suitable for use in a showMessageDialog
* call. This is generally useful for showing messges which can turned
* off either in preferences or when they are displayed.
*
* @param message The message to be displayed.
* @param checkbox The optional checkbox to be added - may be null.
* @return JPanel A panel containing the message and the checkbox.
*/
public static JPanel buildMessageLabelPanel(String message, JCheckBox checkbox) {
JPanel panel = new JPanel();
JLabel label;
String part;
panel.setLayout(new GridBagLayout());
GridBagConstraints cons = new GridBagConstraints();
cons.gridx = cons.gridy = 0;
cons.gridwidth = GridBagConstraints.REMAINDER;
cons.gridheight = 1;
cons.anchor = GridBagConstraints.WEST;
cons.insets = new Insets(0, 0, 3, 0);
cons.weightx = 1;
cons.weighty = 0;
cons.fill = GridBagConstraints.NONE;
int start = 0;
int sepPos = -1;
do {
//$NON-NLS-1$
sepPos = message.indexOf("\n", start);
if (sepPos >= 0) {
part = message.substring(start, sepPos);
start = sepPos + 1;
} else {
part = message.substring(start);
start = -1;
}
label = new JLabel(part, SwingConstants.LEADING);
panel.add(label, cons);
cons.gridy++;
} while (start >= 0);
if (checkbox != null) {
//$NON-NLS-1$
label = new JLabel("", SwingConstants.LEADING);
panel.add(label, cons);
cons.gridy++;
panel.add(checkbox, cons);
cons.gridy++;
}
return panel;
}
use of javax.swing.JPanel in project pcgen by PCGen.
the class PCGenFrame method showMatureDialog.
private void showMatureDialog(String text) {
Logging.errorPrint("Warning: The following datasets contains mature themes. User discretion is advised.");
Logging.errorPrint(text);
final JDialog aFrame = new JDialog(this, LanguageBundle.getString("in_matureTitle"), true);
final JPanel jPanel1 = new JPanel();
final JPanel jPanel3 = new JPanel();
final JLabel jLabel1 = new //$NON-NLS-1$
JLabel(//$NON-NLS-1$
LanguageBundle.getString("in_matureWarningLine1"), SwingConstants.CENTER);
final JLabel jLabel2 = new //$NON-NLS-1$
JLabel(//$NON-NLS-1$
LanguageBundle.getString("in_matureWarningLine2"), SwingConstants.CENTER);
//$NON-NLS-1$
final JCheckBox jCheckBox1 = new JCheckBox(LanguageBundle.getString("in_licShowOnLoad"));
//$NON-NLS-1$
final JButton jClose = new JButton(LanguageBundle.getString("in_close"));
//$NON-NLS-1$
jClose.setMnemonic(LanguageBundle.getMnemonic("in_mn_close"));
jPanel1.setLayout(new BorderLayout());
jPanel1.add(jLabel1, BorderLayout.NORTH);
jPanel1.add(jLabel2, BorderLayout.SOUTH);
HtmlPanel htmlPanel = new HtmlPanel();
HtmlRendererContext theRendererContext = new SimpleHtmlRendererContext(htmlPanel, new SimpleUserAgentContext());
htmlPanel.setHtml(text, "", theRendererContext);
jPanel3.add(jCheckBox1);
jPanel3.add(jClose);
final PropertyContext context = PCGenSettings.OPTIONS_CONTEXT;
jCheckBox1.setSelected(context.getBoolean(PCGenSettings.OPTION_SHOW_MATURE_ON_LOAD));
jClose.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
aFrame.dispose();
}
});
jCheckBox1.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent evt) {
context.setBoolean(PCGenSettings.OPTION_SHOW_MATURE_ON_LOAD, jCheckBox1.isSelected());
}
});
aFrame.getContentPane().setLayout(new BorderLayout());
aFrame.getContentPane().add(jPanel1, BorderLayout.NORTH);
aFrame.getContentPane().add(htmlPanel, BorderLayout.CENTER);
aFrame.getContentPane().add(jPanel3, BorderLayout.SOUTH);
aFrame.setSize(new Dimension(456, 176));
Utility.setComponentRelativeLocation(this, aFrame);
aFrame.setVisible(true);
}
Aggregations