下面列出了javax.swing.JButton#setText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public ItemListControl(final ItemEditorFactory<T> ief) {
this.itemEditorFactory = ief;
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
this.comboBox = new JComboBox<>();
this.comboBox.setPreferredSize(new Dimension(100, 24));
this.comboBox.setEditable(false);
final JButton editButton = new JButton();
editButton.setAction(new EditAction(false));
editButton.setText("Edit");
final JButton addButton = new JButton();
addButton.setAction(new EditAction(true));
addButton.setText("Add");
final JButton removeButton = new JButton();
removeButton.setAction(new RemoveAction());
removeButton.setText("Remove");
this.add(this.comboBox);
this.add(editButton);
this.add(addButton);
this.add(removeButton);
}
public ValueRenderer(Color colors[]) {
super(colors);
buttonIconRenderer = new JButton();
buttonIconRenderer.setBorderPainted(false);
buttonIconRenderer.setContentAreaFilled(false);
buttonIconRenderer.setText("(for AbstractButtons only)");
radioIconRenderer = new JRadioButton();
radioIconRenderer.setBorderPainted(false);
radioIconRenderer.setText("for JRadioButtons only)");
checkboxIconRenderer = new JCheckBox();
checkboxIconRenderer.setBorderPainted(false);
checkboxIconRenderer.setText("for JCheckBoxes only)");
menuItemIconRenderer = new JMenuItem();
menuItemIconRenderer.setBorderPainted(false);
menuItemIconRenderer.setText("(for JMenuItems only)");
}
protected JButton makeNavigationButton(String imageName, String actionCommand, String toolTipText, String altText) {
// Look for the image.
String imgLocation = "images/" + imageName + ".gif";
URL imageURL = ToolBarDemo.class.getResource(imgLocation);
// Create and initialize the button.
JButton button = new JButton();
button.setActionCommand(actionCommand);
button.setToolTipText(toolTipText);
button.addActionListener(this);
if (imageURL != null) { // image found
button.setIcon(new ImageIcon(imageURL, altText));
} else { // no image found
button.setText(altText);
System.err.println("Resource not found: " + imgLocation);
}
return button;
}
public SignIn(JFrame parent){
this.parent = parent;
setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
setBackground(new Color(0x000a1f));
createFields();
JButton submit = styleButtons();
submit.setText("SIGN IN");
add(Box.createRigidArea(new Dimension(0, 25)));
add(submit);
/*submit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("login");
}
});*/
submit.addActionListener(this);
}
public ReportEditorTest() {
setSize(1200, 800);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
JPanel panel = new JPanel(new BorderLayout());
XMLDiagram diagram = new XMLDiagram();
ReportEditor editor = new ReportEditor(diagram);
setContentPane(panel);
JScrollPane pane = new JScrollPane(editor);
panel.add(pane, BorderLayout.CENTER);
JToolBar bar = new JToolBar();
panel.add(bar, BorderLayout.NORTH);
for (Action action : editor.getActions()) {
JButton button = bar.add(action);
button.setText((String) action.getValue(Action.ACTION_COMMAND_KEY));
}
}
@Override
public Component getToolbarExtrasDevicePLUs() {
JButton btnDevicePLUs = new JButton();
btnDevicePLUs.setText(AppLocal.getIntString("button.uploadplu"));
btnDevicePLUs.setVisible(app.getDevicePLUs() != null);
btnDevicePLUs.addActionListener(new java.awt.event.ActionListener() {
@Override
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnExtrasDevicePLUsActionPerformed(evt);
}
});
return btnDevicePLUs;
}
@Override
public void actionPerformed(ActionEvent e) {
JButton button = (JButton) e.getSource();
button.setText("...");
button.setFocusable(true);
button.requestFocusInWindow();
}
/**
* Sets up JButtons
*/
private JButton prepareButton(String iconName, String buttonName, ArrayList<JButton> bList) {
JButton button = new JButton(buttonName);
button.addActionListener(this);
// Get the normal icon
File file = new MegaMekFile(Configuration.widgetsDir(), "/MapEditor/"+iconName+".png").getFile(); //$NON-NLS-1$ //$NON-NLS-2$
Image imageButton = ImageUtil.loadImageFromFile(file.getAbsolutePath());
if (imageButton != null) {
button.setIcon(new ImageIcon(imageButton));
// When there is an icon, then the text can be removed
button.setText("");
}
// Get the hover icon
file = new MegaMekFile(Configuration.widgetsDir(), "/MapEditor/"+iconName+"_H.png").getFile(); //$NON-NLS-1$ //$NON-NLS-2$
imageButton = ImageUtil.loadImageFromFile(file.getAbsolutePath());
if (imageButton != null) {
button.setRolloverIcon(new ImageIcon(imageButton));
}
// Get the disabled icon, if any
file = new MegaMekFile(Configuration.widgetsDir(), "/MapEditor/"+iconName+"_G.png").getFile(); //$NON-NLS-1$ //$NON-NLS-2$
imageButton = ImageUtil.loadImageFromFile(file.getAbsolutePath());
if (imageButton != null) {
button.setDisabledIcon(new ImageIcon(imageButton));
}
String tt = Messages.getString("BoardEditor."+iconName+"TT");
if (tt.length() != 0) {
button.setToolTipText(tt); //$NON-NLS-1$ //$NON-NLS-2$
}
button.setMargin(new Insets(0,0,0,0));
if (bList != null) bList.add(button);
return button;
}
private static BeanContext fill(BeanContext context) {
context.add(new JLabel("label"));
context.add(new JButton("button"));
JButton button = new JButton();
button.setText("another button");
context.add(button);
return context;
}
protected void setViewQueryButton( JButton _viewQueryButton, Dimension preferredButtonSize, JTextPane sqlEditorArea ) {
_viewQueryButton.setIcon(ImageCache.getInstance().getImage(ImageCache.GLOBE));
_viewQueryButton.setToolTipText(VIEW_QUERY_TOOLTIP);
_viewQueryButton.setText("");
_viewQueryButton.setPreferredSize(preferredButtonSize);
_viewQueryButton.addActionListener(e -> {
String sqlText = sqlEditorArea.getText().trim();
if (sqlText.length() > 0) {
if (!sqlText.toLowerCase().startsWith("select")) {
JOptionPane.showMessageDialog(this, "Viewing of data is allowed only for SELECT statements.", "WARNING",
JOptionPane.WARNING_MESSAGE, null);
return;
}
}
final LogConsoleController logConsole = new LogConsoleController(pm);
JFrame window = guiBridge.showWindow(logConsole.asJComponent(), "Console Log");
new Thread(() -> {
boolean hadErrors = false;
try {
logConsole.beginProcess("Run query");
hadErrors = viewSpatialQueryResult(null, sqlText, pm, false);
} catch (Exception ex) {
pm.errorMessage(ex.getLocalizedMessage());
hadErrors = true;
} finally {
logConsole.finishProcess();
logConsole.stopLogging();
if (!hadErrors) {
logConsole.setVisible(false);
window.dispose();
}
}
}, "DatabaseViewer->run query and view geometries").start();
});
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
mainpanel = new JPanel();
mainpanel.setLayout(new GridLayoutManager(7, 6, new Insets(0, 0, 0, 0), -1, -1));
final JScrollPane scrollPane1 = new JScrollPane();
mainpanel.add(scrollPane1, new GridConstraints(3, 1, 1, 4, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, new Dimension(500, 200), new Dimension(500, 200), new Dimension(500, 200), 0, false));
exerciselist = new CustomCheckBoxList();
scrollPane1.setViewportView(exerciselist);
final JLabel label1 = new JLabel();
label1.setText("Select exercises");
mainpanel.add(label1, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer1 = new Spacer();
mainpanel.add(spacer1, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
downloadButton = new JButton();
downloadButton.setText("Download");
mainpanel.add(downloadButton, new GridConstraints(5, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
cancelButton = new JButton();
cancelButton.setText("Cancel");
mainpanel.add(cancelButton, new GridConstraints(5, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer2 = new Spacer();
mainpanel.add(spacer2, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, 1, new Dimension(10, -1), new Dimension(10, -1), new Dimension(10, -1), 0, false));
final Spacer spacer3 = new Spacer();
mainpanel.add(spacer3, new GridConstraints(3, 5, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, 1, new Dimension(10, -1), new Dimension(10, -1), new Dimension(10, -1), 0, false));
final Spacer spacer4 = new Spacer();
mainpanel.add(spacer4, new GridConstraints(2, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_FIXED, new Dimension(-1, 10), new Dimension(-1, 10), new Dimension(-1, 10), 0, false));
final Spacer spacer5 = new Spacer();
mainpanel.add(spacer5, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_FIXED, new Dimension(-1, 10), new Dimension(-1, 10), new Dimension(-1, 10), 0, false));
final Spacer spacer6 = new Spacer();
mainpanel.add(spacer6, new GridConstraints(4, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_FIXED, new Dimension(-1, 10), new Dimension(-1, 10), new Dimension(-1, 10), 0, false));
final Spacer spacer7 = new Spacer();
mainpanel.add(spacer7, new GridConstraints(6, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_FIXED, new Dimension(-1, 10), new Dimension(-1, 10), new Dimension(-1, 10), 0, false));
selectAllButton = new JButton();
selectAllButton.setText("Toggle all");
mainpanel.add(selectAllButton, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
}
private static BeanContext fill(BeanContext context) {
context.add(new JLabel("label"));
context.add(new JButton("button"));
JButton button = new JButton();
button.setText("another button");
context.add(button);
return context;
}
public static JButton createOpenFileButton(String toolTip) {
JButton button = new JButton();
button.setText("");
button.setToolTipText(toolTip);
button.setIcon(new ImageIcon(JPlagCreator.class.getResource("/atujplag/data/open.gif")));
button.setPreferredSize(new java.awt.Dimension(24, 24));
button.setBackground(JPlagCreator.SYSTEMCOLOR);
return button;
}
private void initComponents() {
keboardPanel = new JPanel();
keboardPanel.setBackground(Colors.DARK);
for (int i=0; i < keys.length; i++) {
JButton btn = new JButton();
btn.setBackground(Colors.DARK);
btn.setForeground(Colors.FONT_WHITE);
btn.setText(String.valueOf(keys[i]));
btn.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
refreshData(btn.getText());
super.mouseClicked(e);
}
});
keboardPanel.add(btn);
}
ImageIcon sendingIcon = new ImageIcon(getClass().getResource("/image/loading7.gif"));
loadingProgress.setIcon(sendingIcon);
loadingProgress.setVisible(false);
keboardPanel.add(loadingProgress, new GBC(0, 0).setFill(GBC.BOTH).setWeight(1, 1).setInsets(0, 0, 0, 0));
contactsListView = new RCListView();
}
private void refreshPadButton(final Pad pad) {
final String htmlLabel = htmlSamples(pad);
final JButton button = padButtons[pad.getElementIndex()];
if (button != null) {
button.setText(htmlLabel);
}
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
jpanel1 = new JPanel();
jpanel1.setLayout(new GridLayoutManager(5, 7, new Insets(0, 0, 0, 0), -1, -1));
final JLabel label1 = new JLabel();
label1.setText("Code submitted to TMC pastebin");
jpanel1.add(label1, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
textField1 = new JTextField();
textField1.setText("");
jpanel1.add(textField1, new GridConstraints(2, 1, 1, 5, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
copyToClipboardButton = new JButton();
copyToClipboardButton.setText("Copy to clipboard");
jpanel1.add(copyToClipboardButton, new GridConstraints(3, 5, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
viewPasteButton = new JButton();
viewPasteButton.setText("View paste");
jpanel1.add(viewPasteButton, new GridConstraints(3, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
okButton = new JButton();
okButton.setText("Ok");
jpanel1.add(okButton, new GridConstraints(3, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer1 = new Spacer();
jpanel1.add(spacer1, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_FIXED, new Dimension(-1, 10), new Dimension(-1, 10), new Dimension(-1, 10), 0, false));
final Spacer spacer2 = new Spacer();
jpanel1.add(spacer2, new GridConstraints(4, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_FIXED, new Dimension(-1, 10), new Dimension(-1, 10), new Dimension(-1, 10), 0, false));
final Spacer spacer3 = new Spacer();
jpanel1.add(spacer3, new GridConstraints(1, 6, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, 1, new Dimension(10, -1), new Dimension(10, -1), new Dimension(10, -1), 0, false));
final Spacer spacer4 = new Spacer();
jpanel1.add(spacer4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_FIXED, 1, new Dimension(10, -1), new Dimension(10, -1), new Dimension(10, -1), 0, false));
}
@Override
protected void createButtons(ButtonGroup group) {
JToggleButton button1 = createOpenViewButton(group, editorView);
button1.setSelected(true);
buttonsPanel.add(button1);
buttonsPanel.add(createOpenViewButton(group, htmlView));
Iterator<DocBookExporter> iterator = AdditionalPluginLoader
.loadProviders(DocBookExporter.class);
while (iterator.hasNext()) {
final DocBookExporter exporter = iterator.next();
JButton tb = new JButton();
tb.setText(exporter.getActionName());
tb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
exporter.createReport(getFramework(),
new ReportLoadCallback() {
@Override
public InputStream getDocBookInputStream() {
// TODO Auto-generated method stub
return null;
}
});
}
});
buttonsPanel.add(tb);
}
}
/** Creates toolbar. */
private JToolBar createToolBar() {
// Definition of toolbar.
JToolBar toolBar = new JToolBar();
toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); //NOI18N
toolBar.setFloatable (false);
toolBar.setName (NbBundle.getBundle(ImageViewer.class).getString("ACSN_Toolbar"));
toolBar.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ImageViewer.class).getString("ACSD_Toolbar"));
JButton outButton = new JButton(SystemAction.get(ZoomOutAction.class));
outButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_ZoomOut"));
outButton.setMnemonic(NbBundle.getBundle(ImageViewer.class).getString("ACS_Out_BTN_Mnem").charAt(0));
outButton.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ImageViewer.class).getString("ACSD_Out_BTN"));
outButton.setText("");
toolBar.add(outButton);
toolbarButtons.add(outButton);
JButton inButton = new JButton(SystemAction.get(ZoomInAction.class));
inButton.setToolTipText (NbBundle.getBundle(ImageViewer.class).getString("LBL_ZoomIn"));
inButton.setMnemonic(NbBundle.getBundle(ImageViewer.class).getString("ACS_In_BTN_Mnem").charAt(0));
inButton.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(ImageViewer.class).getString("ACSD_In_BTN"));
inButton.setText("");
toolBar.add(inButton);
toolbarButtons.add(inButton);
toolBar.addSeparator(new Dimension(11, 0));
JButton button;
toolBar.add(button = getZoomButton(1,1));
toolbarButtons.add(button);
toolBar.addSeparator(new Dimension(11, 0));
toolBar.add(button = getZoomButton(1,3));
toolbarButtons.add(button);
toolBar.add(button = getZoomButton(1,5));
toolbarButtons.add(button);
toolBar.add(button = getZoomButton(1,7));
toolbarButtons.add(button);
toolBar.addSeparator(new Dimension(11, 0));
toolBar.add(button = getZoomButton(3,1));
toolbarButtons.add(button);
toolBar.add(button = getZoomButton(5,1));
toolbarButtons.add(button);
toolBar.add(button = getZoomButton(7,1));
toolbarButtons.add(button);
toolBar.addSeparator(new Dimension(11, 0));
// SystemAction sa = SystemAction.get(CustomZoomAction.class);
// sa.putValue (Action.SHORT_DESCRIPTION, NbBundle.getBundle(ImageViewer.class).getString("LBL_CustomZoom"));
toolBar.add (button = getZoomButton ());
toolbarButtons.add(button);
toolBar.addSeparator(new Dimension(11, 0));
toolBar.add(button = getGridButton());
toolbarButtons.add(button);
// Image Dimension
toolBar.addSeparator(new Dimension(11, 0));
toolBar.add(new JLabel(NbBundle.getMessage(ImageViewer.class, "LBL_ImageDimensions", imageWidth, imageHeight)));
// Image File Size in KB, MB
if (imageSize != -1) {
toolBar.addSeparator(new Dimension(11, 0));
double kb = 1024.0;
double mb = kb * kb;
final double size;
final String label;
if (imageSize >= mb) {
size = imageSize / mb;
label = "LBL_ImageSizeMb"; // NOI18N
} else if (imageSize >= kb) {
size = imageSize / kb;
label = "LBL_ImageSizeKb"; // NOI18N
} else {
size = imageSize;
label = "LBL_ImageSizeBytes"; //NOI18N
}
toolBar.add(new JLabel(NbBundle.getMessage(ImageViewer.class, label, formatter.format(size))));
}
for (JButton jb : toolbarButtons) {
jb.setFocusable(false);
}
return toolBar;
}
@SuppressWarnings("unchecked")
public ScenarioDialog(final JFrame frame, Player[] pa) {
super(frame, Messages.getString("MegaMek.ScenarioDialog.title"), true); //$NON-NLS-1$
m_frame = frame;
m_players = pa;
m_labels = new JLabel[pa.length];
m_typeChoices = new JComboBox[pa.length];
m_camoButtons = new JButton[pa.length];
playerTypes = new int[pa.length];
for (int x = 0; x < pa.length; x++) {
final IPlayer curPlayer = m_players[x];
curPlayer.setColorIndex(x);
m_labels[x] = new JLabel(pa[x].getName(), SwingConstants.LEFT);
m_typeChoices[x] = new JComboBox<String>();
m_typeChoices[x].addItem(Messages
.getString("MegaMek.ScenarioDialog.me")); //$NON-NLS-1$
m_typeChoices[x].addItem(Messages
.getString("MegaMek.ScenarioDialog.otherh")); //$NON-NLS-1$
m_typeChoices[x].addItem(Messages
.getString("MegaMek.ScenarioDialog.bot")); //$NON-NLS-1$
m_typeChoices[x].addItem(Messages
.getString("MegaMek.ScenarioDialog.otherbot")); //$NON-NLS-1$
m_camoButtons[x] = new JButton();
final JButton curButton = m_camoButtons[x];
curButton.setText(Messages.getString("MegaMek.NoCamoBtn")); //$NON-NLS-1$
curButton.setPreferredSize(new Dimension(84, 72));
final CamoChoiceDialog dialog = new CamoChoiceDialog(frame,
curButton);
dialog.setPlayer(curPlayer);
curButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dialog.setVisible(true);
}
});
}
getContentPane().setLayout(new BorderLayout());
JPanel choicePanel = new JPanel();
choicePanel.setLayout(new GridLayout(pa.length + 1, 0));
choicePanel.add(new JLabel(Messages
.getString("MegaMek.ScenarioDialog.pNameType"))); //$NON-NLS-1$
choicePanel.add(new JLabel(Messages
.getString("MegaMek.ScenarioDialog.Camo"))); //$NON-NLS-1$
for (int x = 0; x < pa.length; x++) {
JPanel typePanel = new JPanel();
typePanel.setLayout(new GridLayout(0, 1));
typePanel.add(m_labels[x]);
typePanel.add(m_typeChoices[x]);
choicePanel.add(typePanel);
choicePanel.add(m_camoButtons[x]);
}
getContentPane().add(choicePanel, BorderLayout.CENTER);
JPanel butPanel = new JPanel();
butPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
JButton bOkay = new JButton(Messages.getString("Okay")); //$NON-NLS-1$
bOkay.setActionCommand("okay"); //$NON-NLS-1$
bOkay.addActionListener(this);
JButton bCancel = new JButton(Messages.getString("Cancel")); //$NON-NLS-1$
bCancel.setActionCommand("cancel"); //$NON-NLS-1$
bCancel.addActionListener(this);
butPanel.add(bOkay);
butPanel.add(bCancel);
getContentPane().add(butPanel, BorderLayout.SOUTH);
pack();
setResizable(false);
setLocation((frame.getLocation().x + (frame.getSize().width / 2))
- (getSize().width / 2), (frame.getLocation().y
+ (frame.getSize().height / 2)) - (getSize().height / 2));
}
@Override
public Component getToolbarPresenter() {
JButton btn = new JButton(this);
btn.setText("");
return btn;
}