bcelldelete = resources.getButton("deleteCellButton", null);
cbx = new JComboBox();
cbx.setEditable(false);
cbx.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
CardLayout cl = (CardLayout) (cards.getLayout());
int index = cbx.getSelectedIndex();
if (index >= 0) {
TextPropertiesPanel tpp = (TextPropertiesPanel) TextArrayPropertiesPanel.this.textPanels.get(index);
tpp.updateSourceTree();
cl.show(cards, Integer.toString(index));
}
}
});
bcelldelete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int index = cbx.getSelectedIndex();
textPanels.remove(index);
updateCells();
// Disable delete button in case there is only one cell.
bcelldelete.setEnabled(textPanels.size() > 1);
if (index > (textPanels.size() - 1)) {
index = textPanels.size() - 1;
}
TextPropertiesPanel tpp = (TextPropertiesPanel) TextArrayPropertiesPanel.this.textPanels.get(index);
tpp.updateSourceTree();
((CardLayout) (cards.getLayout())).show(cards, Integer.toString(index));
}
});
bcelladd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JPropertiesPanel textPanel = createTextPropertiesPanel(false,Builtin.resources.getString("TextArray") );
// New cell has same properties as the last cell created
JPropertiesPanel textPanelModel = (JPropertiesPanel) textPanels.get(textPanels.size() - 1);
String[] props = textPanelModel.getPropertyNames();
if (props != null) {
for (int j = 0; j < props.length; j++) {
String pname = props[j];
textPanel.setPropertyValue(pname, textPanelModel.getPropertyValue(pname));
}
}
// fin test
// Set new panel owner
textPanel.setOwner(TextArrayPropertiesPanel.this.getOwner());
// Add to the list of text cells panels
textPanels.add(textPanel);
// Disable delete button in case there is only one cell.
bcelldelete.setEnabled(textPanels.size() > 1);
updateCells();
int index = textPanels.size() - 1;
cbx.setSelectedIndex(index);
TextPropertiesPanel tpp = (TextPropertiesPanel) TextArrayPropertiesPanel.this.textPanels.get(index);
tpp.updateSourceTree();
((CardLayout) (cards.getLayout())).show(cards, Integer.toString(index));
enableFontChoosers(!cbSameFont.isSelected());
}
});
cards = new JPanel();
cards.setLayout(new CardLayout());
cbSameFont = new ActionCheckBox(resources.getString("UseAUniqueFontForTheWholeArray"), true) {
public void actionPerformed(ActionEvent e) {
if (cbSameFont.isSelected()) {
JPropertiesPanel jp = (JPropertiesPanel) TextArrayPropertiesPanel.this.textPanels.get(cbx
.getSelectedIndex());