JMenuItem panelWidthmenuItem = new JMenuItem();
menuAction = new MenuAction("Set Name Panel Width...", null, KeyEvent.VK_A) {
@Override
public void actionPerformed(ActionEvent e) {
MainPanel mainPanel = IGV.getInstance().getMainPanel();
String currentValue = String.valueOf(mainPanel.getNamePanelWidth());
String newValue = MessageUtils.showInputDialog("Enter track name panel width: ", currentValue);
if (newValue != null) {
try {
Integer w = Integer.parseInt(newValue);
if (w <= 0 || w == 1000) throw new NumberFormatException();
PreferenceManager.getInstance().put(PreferenceManager.NAME_PANEL_WIDTH, newValue);
mainPanel.setNamePanelWidth(w);
} catch (NumberFormatException ex) {
MessageUtils.showErrorMessage("Error: value must be a positive integer < 1000.", ex);
}
}
}