List of usage examples for com.jgoodies.common.collect ArrayListModel ArrayListModel
public ArrayListModel()
From source file:ch.fork.AdHocRailway.ui.routes.configuration.RoutesConfigurationDialog.java
License:Open Source License
@SuppressWarnings("unchecked") private void initComponents() { routeGroups = new ArrayListModel<RouteGroup>(); routeGroupModel = new SelectionInList<RouteGroup>((ListModel<?>) routeGroups); routeGroupList = BasicComponentFactory.createList(routeGroupModel); routeGroupList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); routeGroupList.setCellRenderer(new RouteGroupListCellRenderer()); routeGroupConfig = new RouteGroupConfigPanel(); addRouteGroupButton = new JButton(new AddRouteGroupAction()); editGroupButton = new JButton(new EditRouteGroupAction()); removeRouteGroupButton = new JButton(new RemoveRouteGroupAction()); routes = new ArrayListModel<Route>(); routesModel = new SelectionInList<Route>(); routesModel.setList(routes);//from w ww . j a v a2 s. c o m routesList = new JList<Object>(); routesList.setModel(routesModel); routesList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); routesList.setCellRenderer(new RouteListCellRenderer()); addRouteButton = new JButton(new AddRouteAction()); duplicateRouteButton = new JButton(new DuplicateRouteAction()); removeRouteButton = new JButton(new RemoveRouteAction()); okButton = new JButton("OK", ImageTools.createImageIconFromIconSet("dialog-ok-apply.png")); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { okPressed = true; setVisible(false); routeManager.removeRouteManagerListenerInNextEvent(RoutesConfigurationDialog.this); } }); }
From source file:ch.fork.AdHocRailway.ui.turnouts.configuration.TurnoutConfigurationDialog.java
License:Open Source License
private void initComponents() { turnoutGroups = new ArrayListModel<TurnoutGroup>(); turnoutGroupModel = new SelectionInList<TurnoutGroup>((ListModel<?>) turnoutGroups); turnoutGroupList = BasicComponentFactory.createList(turnoutGroupModel, new TurnoutGroupListCellRenderer()); turnoutGroupList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); turnoutGroupList.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "deleteTurnoutGroup"); turnoutGroupList.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "deleteTurnoutGroup"); turnoutGroupList.getActionMap().put("deleteTurnoutGroup", new RemoveTurnoutGroupAction()); groupScrollPane = new JScrollPane(turnoutGroupList); turnoutGroupConfig = new TurnoutGroupConfigPanel(); addGroupButton = new JButton(new AddTurnoutGroupAction()); editGroupButton = new JButton(new EditTurnoutGroupAction()); removeGroupButton = new JButton(new RemoveTurnoutGroupAction()); turnouts = new ArrayListModel<Turnout>(); turnoutModel = new SelectionInList<Turnout>(); turnoutModel.setList(turnouts);/*w ww. j a v a 2s .c o m*/ turnoutsTable = new JTable() { @Override public boolean getScrollableTracksViewportWidth() { return getPreferredSize().width < getParent().getWidth(); } }; turnoutsTable.setModel(new TurnoutTableModel(turnoutModel)); turnoutsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); turnoutsTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "deleteTurnout"); turnoutsTable.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "deleteTurnout"); turnoutsTable.getActionMap().put("deleteTurnout", new RemoveTurnoutAction()); final TableColumn typeColumn = turnoutsTable.getColumnModel().getColumn(1); typeColumn.setCellRenderer(new TurnoutTypeCellRenderer()); final TableColumn defaultStateColumn = turnoutsTable.getColumnModel().getColumn(8); defaultStateColumn.setCellRenderer(new TurnoutDefaultStateCellRenderer()); turnoutsTable.setRowHeight(30); turnoutTableScrollPane = new JScrollPane(turnoutsTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); turnoutsTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); tca = new TableColumnAdjuster(turnoutsTable, 10); addTurnoutButton = new JButton(new AddTurnoutAction()); removeTurnoutButton = new JButton(new RemoveTurnoutAction()); okButton = new JButton("OK", ImageTools.createImageIconFromIconSet("dialog-ok-apply.png")); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { okPressed = true; setVisible(false); turnoutManager.removeTurnoutManagerListenerInNextEvent(TurnoutConfigurationDialog.this); } }); }
From source file:ro.catalin.prata.testflightuploader.view.TFUploader.java
License:Apache License
/** * Updates the list of teams//www .j av a2 s .c o m * * @param teams list of teams to be displayed on the screen */ public void updateListOfTeams(ArrayList<Team> teams) { // create a new list model ArrayListModel<String> model = new ArrayListModel<String>(); for (Team team : teams) { // add all the teams in the list model model.add(team.getName()); } // set the new model containing the new team teamList.setModel(model); }