use of org.freeplane.core.ui.components.JAutoScrollBarPane in project freeplane by freeplane.
the class CollectionBoxController method createMoveButton.
private JButton createMoveButton(final String elementName) {
JButton btnMove = TranslatedElementFactory.createButtonWithIcon(elementName + ".move.icon", "collection.move");
btnMove.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
Vector<String> items = new Vector<>(collection.getSize());
for (int i = 1; i <= collection.getSize(); i++) {
items.addElement(i + ": " + collection.getElement(i - 1).getName());
}
final ComboBoxModel<String> elements = new DefaultComboBoxModel<>(items);
JList<String> targets = new JList<>(elements);
targets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
final String title = TextUtils.getText("collection.moveTo");
if (JOptionPane.showConfirmDialog(collectionComponent, new JAutoScrollBarPane(targets), title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION)
UndoableNamedElementCollection.of(collection).moveCurrentElementTo(targets.getSelectedIndex());
}
});
return btnMove;
}
use of org.freeplane.core.ui.components.JAutoScrollBarPane in project freeplane by freeplane.
the class PresentationController method createPanel.
private Component createPanel() {
final Component presentationEditor = presentationEditorController.createPanel(modeController);
presentationEditor.addHierarchyListener(new HierarchyListener() {
@Override
public void hierarchyChanged(HierarchyEvent e) {
if (0 != (e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED))
presentationState.setHighlightsNodes(e.getComponent().isShowing());
}
});
return new JAutoScrollBarPane(presentationEditor);
}
Aggregations