Example usage for javax.swing.event ListSelectionListener ListSelectionListener

List of usage examples for javax.swing.event ListSelectionListener ListSelectionListener

Introduction

In this page you can find the example usage for javax.swing.event ListSelectionListener ListSelectionListener.

Prototype

ListSelectionListener

Source Link

Usage

From source file:org.openconcerto.erp.core.finance.accounting.ui.PlanComptableGPanel.java

public JTable creerJTable(ClasseCompte ccTmp) { // NO_UCD

    final PlanComptableGModel model;
    if (this.radioCompteDeveloppe.isSelected()) {
        model = new PlanComptableGModel(ccTmp, 3);
    } else if (this.radioCompteAbrege.isSelected()) {
        model = new PlanComptableGModel(ccTmp, 2);
    } else {/* w  w w .  j av a  2s .  c o m*/
        model = new PlanComptableGModel(ccTmp, 1);
    }

    final JTable table = new JTable(model) {
        public JToolTip createToolTip() {
            JMultiLineToolTip t = new JMultiLineToolTip();
            t.setFixedWidth(500);
            return t;
        }
    };

    table.getColumnModel().getColumn(0).setCellRenderer(new PlanComptableCellRenderer(0));
    table.getColumnModel().getColumn(1).setCellRenderer(new PlanComptableCellRenderer(0));

    // TODO calcul de la taille de la colone numero de compte
    table.getColumnModel().getColumn(0).setMaxWidth(90);

    table.getTableHeader().setReorderingAllowed(false);

    table.addMouseMotionListener(new MouseMotionAdapter() {
        int lastRow = -1;

        public void mouseMoved(final MouseEvent e) {

            final Point p = new Point(e.getX(), e.getY());

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    final int row = table.rowAtPoint(p);
                    if (lastRow != row) {
                        lastRow = row;
                        String strTmp = ((Compte) (model.getComptes().get(lastRow))).getInfos();

                        if (strTmp.length() != 0) {
                            table.setToolTipText(strTmp);
                        } else {
                            table.setToolTipText(null);
                        }

                    }
                }
            });

        }
    });

    if (this.actionClickDroit != null) {
        // System.out.println("Ajout menu droit");
        table.addMouseListener(new MouseAdapter() {

            public void mousePressed(MouseEvent e) {

                if (e.getButton() == MouseEvent.BUTTON3) {
                    actionDroitTable(e, table);
                }
            }
        });
    }

    // Enable row selection (default)
    /**
     * table.setColumnSelectionAllowed(false); table.setRowSelectionAllowed(true);
     * 
     * table.setSelectionMode(table.getSelectionModel().MULTIPLE_INTERVAL_SELECTION);
     */

    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        public void valueChanged(ListSelectionEvent e) {
            int selectedRow = table.getSelectedRow();
            if (selectedRow < 0) {
                // Pas de selection
                textInfos.setText("Pas de compte slctionn");
            } else {
                textInfos.setText(((Compte) (model.getComptes().get(selectedRow))).getInfos());
            }
        }
    });

    return table;
}

From source file:org.openconcerto.task.TodoListPanel.java

/**
 * @param addButton//from  w w w  . j a  va  2s.c om
 * @param removeButton
 */
private void initListeners() {
    this.t.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            updateDeleteBtn();
        }
    });
    this.removeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            removeSelectedTask();
        }
    });
    this.addButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addTask();
        }
    });
    this.detailCheckBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            // masque les colonnes "fait le" et "le"
            detailCheckBoxClicked();
        }
    });
    this.hideOldCheckBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            TodoListPanel.this.model.setHistoryVisible(e.getStateChange() == ItemEvent.DESELECTED);
            TodoListPanel.this.model.asynchronousFill();
        }
    });
    try {

    } catch (Exception e) {
        throw new RuntimeException();
    }
    this.model.addModelStateListener(TodoListPanel.this);
    this.addAncestorListener(new AncestorListener() {

        public void ancestorAdded(AncestorEvent event) {
        }

        public void ancestorMoved(AncestorEvent event) {
        }

        public void ancestorRemoved(AncestorEvent event) {
            TodoListPanel.this.model.removeModelStateListener(TodoListPanel.this);
            TodoListPanel.this.model.stopUpdate();
        }
    });
}

From source file:org.opendatakit.briefcase.ui.CharsetConverterDialog.java

protected void initialize() {
    DefaultListModel<CharsetEntry> defaultListModel = new DefaultListModel<CharsetEntry>();

    for (CharsetEntry commonCharsetEntry : commonCharsetEntries) {
        try {/*from w w  w .j  av  a 2s .c o m*/
            if (Charset.isSupported(commonCharsetEntry.getCharsetName())) {
                defaultListModel.addElement(commonCharsetEntry);
            }
        } catch (IllegalCharsetNameException e) {
            // just ignore it. It will happen for "Mac OS Roman" under Windows
        }
    }

    SortedMap<String, Charset> charsetSortedMap = Charset.availableCharsets();
    for (Map.Entry<String, Charset> charsetMapEntry : charsetSortedMap.entrySet()) {
        CharsetEntry charsetEntry = new CharsetEntry(charsetMapEntry.getValue().displayName(),
                charsetMapEntry.getKey());
        if (!defaultListModel.contains(charsetEntry)) {
            defaultListModel.addElement(charsetEntry);
        }
    }

    listCharset.setModel(defaultListModel);

    if (defaultListModel.size() > 0) {
        listCharset.setSelectedIndex(0);

        listCharset.addListSelectionListener(new ListSelectionListener() {

            @Override
            public void valueChanged(ListSelectionEvent e) {
                updatePreview();
            }
        });
    } else {
        JOptionPane.showMessageDialog(this,
                "It appears that your installed Java Runtime Environment does not support any charset encodings!",
                "Error!", JOptionPane.ERROR_MESSAGE);
    }
}

From source file:org.openflexo.technologyadapter.excel.view.ExcelSheetView.java

public ExcelSheetView(ExcelSheet sheet, FlexoController controller) {
    super(new BorderLayout());
    this.sheet = sheet;
    this.controller = controller;
    tableModel = new ExcelSheetTableModel();
    table = new MultiSpanCellTable(tableModel);
    table.setBackground(Color.WHITE);
    table.setShowGrid(true);//from   w w  w . j ava 2s  .  co m
    table.setGridColor(Color.LIGHT_GRAY);
    table.setRowMargin(0);
    table.getColumnModel().setColumnMargin(0);

    for (int i = 0; i < tableModel.getColumnCount(); i++) {
        TableColumn col = table.getColumnModel().getColumn(i);
        if (i == 0) {
            col.setWidth(25);
            col.setPreferredWidth(25);
            col.setMinWidth(25);
            col.setMaxWidth(100);
            // col.setResizable(false);
            col.setHeaderValue(null);
        } else {
            col.setWidth(sheet.getSheet().getColumnWidth(i - 1) / 40);
            col.setPreferredWidth(sheet.getSheet().getColumnWidth(i - 1) / 40);
            col.setHeaderValue("" + Character.toChars(i + 64)[0]);
        }
    }
    table.setDefaultRenderer(Object.class, new ExcelSheetCellRenderer());
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    add(new JScrollPane(table), BorderLayout.CENTER);

    cellIdentifier = new JTextField(6);
    cellIdentifier.setEditable(false);
    cellIdentifier.setHorizontalAlignment(SwingConstants.CENTER);
    cellValue = new JTextField();
    cellValue.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            valueEditedForSelectedCell(cellValue.getText());
        }
    });
    /*cellValue.getDocument().addDocumentListener(new DocumentListener() {
       @Override
       public void removeUpdate(DocumentEvent e) {
    valueEditedForSelectedCell(cellValue.getText());
       }
            
       @Override
       public void insertUpdate(DocumentEvent e) {
    valueEditedForSelectedCell(cellValue.getText());
       }
            
       @Override
       public void changedUpdate(DocumentEvent e) {
    valueEditedForSelectedCell(cellValue.getText());
       }
    });*/
    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.add(cellIdentifier, BorderLayout.WEST);
    topPanel.add(cellValue, BorderLayout.CENTER);
    add(topPanel, BorderLayout.NORTH);

    table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            selectionChanged();
        }
    });
    table.getColumnModel().addColumnModelListener(new TableColumnModelListener() {

        @Override
        public void columnSelectionChanged(ListSelectionEvent e) {
            selectionChanged();
        }

        @Override
        public void columnRemoved(TableColumnModelEvent e) {
        }

        @Override
        public void columnMoved(TableColumnModelEvent e) {
        }

        @Override
        public void columnMarginChanged(ChangeEvent e) {
        }

        @Override
        public void columnAdded(TableColumnModelEvent e) {
        }
    });

    updateRowHeights();

    validate();

    /*for (Object p : sheet.getSheet().getWorkbook().getAllPictures()) {
       System.out.println("Picture: " + p);
    }
            
    System.out.println("class = " + sheet.getSheet().getClass());
            
    if (sheet.getSheet() instanceof HSSFSheet) {
            
       List<HSSFShape> shapes = ((HSSFSheet) sheet.getSheet()).getDrawingPatriarch().getChildren();
       System.out.println("Prout=" + shapes);
       for (int i = 0; i < shapes.size(); i++) {
    System.out.println("hop avec " + shapes.get(i));
    if (shapes.get(i) instanceof HSSFPicture) {
       HSSFPicture pic = (HSSFPicture) shapes.get(i);
       HSSFPictureData picdata = ((HSSFSheet) sheet.getSheet()).getWorkbook().getAllPictures().get(pic.getPictureIndex());
            
       System.out.println("New picture found : " + pic);
       System.out.println("Anchor : " + pic.getAnchor());
       System.out.println("file extension " + picdata.suggestFileExtension());
            
       // int pictureIndex = this.newSheet.getWorkbook().addPicture( picdata.getData(), picdata.getFormat());
            
       // this.newSheet.createDrawingPatriarch().createPicture((HSSFClientAnchor)pic.getAnchor()r, pictureIndex);
            
    }
            
       }
    }*/
}

From source file:org.openmicroscopy.shoola.agents.measurement.view.IntensityResultsView.java

/** Builds and lays out the UI. */
private void buildGUI() {
    resultsModel = new ResultsTableModel();
    resultsModel.addColumn(AnnotationDescription.ROIID_STRING);
    resultsModel.addColumn("Z");
    resultsModel.addColumn("T");
    resultsModel.addColumn("Channel");
    resultsModel.addColumn("Text");
    resultsModel.addColumn("Min");
    resultsModel.addColumn("Max");
    resultsModel.addColumn("Sum");
    resultsModel.addColumn("Mean");
    resultsModel.addColumn("stdDev");
    results = new JTable(resultsModel);
    results.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            onFigureSelected();//  www .  j  a  v a2 s  .c  o m
        }
    });
    JPanel centrePanel = new JPanel();
    centrePanel.setLayout(new BorderLayout());
    JScrollPane scrollPane = new JScrollPane(results);
    centrePanel.add(scrollPane, BorderLayout.CENTER);
    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new FlowLayout());
    //bottomPanel.add(addButton);
    bottomPanel.add(addAllButton);
    bottomPanel.add(removeButton);
    bottomPanel.add(removeAllButton);
    bottomPanel.add(saveButton);
    JPanel containerPanel = new JPanel();
    containerPanel.setLayout(new BorderLayout());
    containerPanel.add(centrePanel, BorderLayout.CENTER);
    containerPanel.add(bottomPanel, BorderLayout.SOUTH);

    setLayout(new BorderLayout());
    add(containerPanel, BorderLayout.CENTER);
}

From source file:org.openuat.apps.BedaApp.java

/**
 * Creates a new instance of this class and launches the
 * actual application.//from   w  w w.  j  a v  a2s  .  co  m
 */
public BedaApp() {
    random = new SecureRandom();
    devices = new RemoteDevice[0];
    currentPeerUrl = null;
    currentChannel = null;
    isInitiator = false;

    // Initialize the logger. Use a wrapper around the log4j framework.
    /*LogFactory.init(new Log4jFactory());
    logger = LogFactory.getLogger(BedaApp.class.getName());
    logger.finer("Logger initiated!");*/

    mainWindow = new JFrame("Beda App");
    mainWindow.setSize(new Dimension(FRAME_WIDTH, FRAME_HIGHT));
    mainWindow.setPreferredSize(new Dimension(FRAME_WIDTH, FRAME_HIGHT));
    mainWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    mainWindow.getContentPane().setLayout(new FlowLayout());
    URL imgURL = getClass().getResource("/resources/Button_Icon_Blue_beda.png");
    ImageIcon icon = imgURL != null ? new ImageIcon(imgURL)
            : new ImageIcon("resources/Button_Icon_Blue_beda.png");
    mainWindow.setIconImage(icon.getImage());

    // prepare the button channels
    ActionListener abortHandler = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (e.getID() == ActionEvent.ACTION_PERFORMED) {
                logger.warning("Protocol run aborted by user");
                BluetoothRFCOMMChannel.shutdownAllChannels();
                alertError("Protocol run aborted.");
            }
        }
    };
    buttonChannels = new HashMap<String, OOBChannel>();
    ButtonChannelImpl impl = new AWTButtonChannelImpl(mainWindow.getContentPane(), abortHandler);
    OOBChannel c = new ButtonToButtonChannel(impl);
    buttonChannels.put(c.toString(), c);
    c = new FlashDisplayToButtonChannel(impl, false);
    buttonChannels.put(c.toString(), c);
    c = new TrafficLightToButtonChannel(impl);
    buttonChannels.put(c.toString(), c);
    c = new ProgressBarToButtonChannel(impl);
    buttonChannels.put(c.toString(), c);
    c = new PowerBarToButtonChannel(impl);
    buttonChannels.put(c.toString(), c);
    c = new ShortVibrationToButtonChannel(impl);
    buttonChannels.put(c.toString(), c);
    c = new LongVibrationToButtonChannel(impl);
    buttonChannels.put(c.toString(), c);

    // set up the menu bar
    menuBar = new JMenuBar();
    JMenu menu = new JMenu("Menu");
    final JMenuItem homeEntry = new JMenuItem("Home");
    final JMenuItem testEntry = new JMenuItem("Test channels");

    ActionListener menuListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            JMenuItem menuItem = (JMenuItem) event.getSource();
            if (menuItem == homeEntry) {
                showHomeScreen();
            } else if (menuItem == testEntry) {
                showTestScreen();
            }
        }
    };
    homeEntry.addActionListener(menuListener);
    testEntry.addActionListener(menuListener);

    menu.add(homeEntry);
    menu.add(testEntry);
    menuBar.add(menu);
    mainWindow.setJMenuBar(menuBar);

    // set up channel list
    OOBChannel[] channels = { new ButtonToButtonChannel(impl), new FlashDisplayToButtonChannel(impl, false),
            new TrafficLightToButtonChannel(impl), new ProgressBarToButtonChannel(impl),
            new PowerBarToButtonChannel(impl), new ShortVibrationToButtonChannel(impl),
            new LongVibrationToButtonChannel(impl) };
    channelList = new JList(channels);
    channelList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    channelList.setVisibleRowCount(15);
    channelList.setPreferredSize(new Dimension(LIST_WIDTH, LIST_HIGHT));

    // set up device list
    deviceList = new JList();
    deviceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    deviceList.setVisibleRowCount(15);
    deviceList.setPreferredSize(new Dimension(LIST_WIDTH, LIST_HIGHT));

    // enable double clicks on the two lists
    doubleClickListener = new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent event) {
            // react on double clicks
            if (event.getButton() == MouseEvent.BUTTON1 && event.getClickCount() == 2) {
                JList source = (JList) event.getSource();
                if (source == channelList && channelList.isEnabled()) {
                    currentChannel = (OOBChannel) channelList.getSelectedValue();
                    startAuthentication();
                } else if (source == deviceList) {
                    int index = deviceList.getSelectedIndex();
                    if (index > -1) {
                        String peerAddress = devices[index].getBluetoothAddress();
                        searchForService(peerAddress);
                    }
                }
            }
            event.consume();
        }
    };
    deviceList.addMouseListener(doubleClickListener);
    // note: this listener will be set on the channelList in the showHomeScreen method

    ListSelectionListener selectionListener = new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent event) {
            channelList.setEnabled(false);
        }
    };
    deviceList.addListSelectionListener(selectionListener);

    // create refresh button
    refreshButton = new JButton("Refresh list");
    ActionListener buttonListener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            if ((JButton) event.getSource() == refreshButton) {
                refreshButton.setEnabled(false);
                statusLabel.setText("Please wait... scanning for devices...");
                peerManager.startInquiry(false);
            }
        }
    };
    refreshButton.addActionListener(buttonListener);

    // set up the bluetooth peer manager
    BluetoothPeerManager.PeerEventsListener listener = new BluetoothPeerManager.PeerEventsListener() {
        public void inquiryCompleted(Vector newDevices) {
            refreshButton.setEnabled(true);
            statusLabel.setText("");
            updateDeviceList();
        }

        public void serviceSearchCompleted(RemoteDevice remoteDevice, Vector services, int errorReason) {
            // ignore
        }
    };

    try {
        peerManager = new BluetoothPeerManager();
        peerManager.addListener(listener);
    } catch (IOException e) {
        logger.log(Level.SEVERE, "Could not initiate BluetoothPeerManager.", e);
    }

    // set up the bluetooth rfcomm server
    try {
        btServer = new BluetoothRFCOMMServer(null, SERVICE_UUID, SERVICE_NAME, 30000, true, false);
        btServer.addAuthenticationProgressHandler(this);
        btServer.start();
        if (logger.isLoggable(Level.INFO)) {
            logger.info("Finished starting SDP service at " + btServer.getRegisteredServiceURL());
        }
    } catch (IOException e) {
        logger.log(Level.SEVERE, "Could not create bluetooth server.", e);
    }
    ProtocolCommandHandler inputProtocolHandler = new ProtocolCommandHandler() {
        @Override
        public boolean handleProtocol(String firstLine, RemoteConnection remote) {
            if (logger.isLoggable(Level.FINER)) {
                logger.finer("Handle protocol command: " + firstLine);
            }
            if (firstLine.equals(UACAPProtocolConstants.PRE_AUTH)) {
                inputProtocol(false, remote, null);
                return true;
            }
            return false;
        }
    };
    btServer.addProtocolCommandHandler(UACAPProtocolConstants.PRE_AUTH, inputProtocolHandler);

    // build staus bar
    statusLabel = new JLabel("");
    statusLabel.setPreferredSize(new Dimension(FRAME_WIDTH - 40, LABEL_HIGHT));

    // build initial screen (the home screen)
    showHomeScreen();

    // launch window
    mainWindow.pack();
    mainWindow.setVisible(true);
}

From source file:org.orbisgis.core.ui.plugins.views.geocatalog.Catalog.java

private JPanel getFilterPanel() {
    JPanel ret = new JPanel();
    ret.setBorder(BorderFactory.createTitledBorder(
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.filters")));
    ret.setLayout(new BorderLayout());

    GeocatalogFilterDecorator filter = new GeocatalogFilterDecorator("geocatalog.filters.AllExcludeSystemTable",
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.allExceptFilter"),
            new AllExcludeSytemTableFilter());
    listModel.getFilters().add(filter);/*from w  ww  .j  av  a2 s.co m*/

    filter = new GeocatalogFilterDecorator("geocatalog.filters.GeoFilter",
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.geoFilter"),
            new GeoFilter());
    listModel.getFilters().add(filter);

    filter = new GeocatalogFilterDecorator("geocatalog.filters.FilesFilter",
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.fileFilter"),
            new FilesFilter());
    listModel.getFilters().add(filter);

    filter = new GeocatalogFilterDecorator("geocatalog.filters.DBsFilter",
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.dbFilter"), new DBsFilter());
    listModel.getFilters().add(filter);

    filter = new GeocatalogFilterDecorator("geocatalog.filters.AlphanumericFilter",
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.alphanumericFilter"),
            new AlphanumericFilter());
    listModel.getFilters().add(filter);

    filter = new GeocatalogFilterDecorator("geocatalog.filters.WMSFilter",
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.wmsFilter"),
            new WMSFilter());
    listModel.getFilters().add(filter);

    filter = new GeocatalogFilterDecorator("geocatalog.filters.RasterFilter",
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.rasterFilter"),
            new RasterFilter());
    listModel.getFilters().add(filter);

    filter = new GeocatalogFilterDecorator("geocatalog.filters.VectorialFilter",
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.vectorialFilter"),
            new VectorialFilter());
    listModel.getFilters().add(filter);

    filter = new GeocatalogFilterDecorator("geocatalog.filters.SystemTableFilter",
            I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.systemTableFilter"),
            new TableSystemFilter());
    listModel.getFilters().add(filter);

    // TODO maybe improve the default filter set.
    // new GeocatalogFilterDecorator[1]
    lstFilters = new JList(
            listModel.getFilters().toArray(new GeocatalogFilterDecorator[1])/* getAvailableFilters() */);
    lstFilters.setCellRenderer(new DefaultListCellRenderer() {

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            return super.getListCellRendererComponent(list, ((GeocatalogFilterDecorator) value).getName(),
                    index, isSelected, cellHasFocus);
        }
    });
    lstFilters.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            doFilter();
        }
    });
    lstFilters.setVisibleRowCount(FILTER_VISIBLE_ROW_COUNT);
    JScrollPane scroll = new JScrollPane(lstFilters);
    ret.add(scroll, BorderLayout.CENTER);
    return ret;
}

From source file:org.orbisgis.core.ui.plugins.views.geocatalog.Catalog.java

private JPanel getTagPanel() {
    JPanel ret = new JPanel();
    ret.setBorder(BorderFactory/*  www.  j a v  a 2 s  . co  m*/
            .createTitledBorder(I18N.getString("orbisgis.org.orbisgis.core.ui.plugins.views.geocatalog.tags")));
    ret.setLayout(new BorderLayout());
    lstTags = new JList();
    tagListModel = new DefaultListModel();
    refreshTagModel();
    lstTags.setModel(tagListModel);
    lstTags.getSelectionModel().addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent e) {
            doFilter();
            btnDelTag.setEnabled(lstTags.getSelectedIndex() != -1);
        }
    });
    lstTags.setVisibleRowCount(FILTER_VISIBLE_ROW_COUNT - 1);
    JScrollPane scroll = new JScrollPane(lstTags);
    ret.add(scroll, BorderLayout.CENTER);
    JPanel pnlButtons = new JPanel();
    JButton btnAdd = getTagManagementButton(OrbisGISIcon.ADD, AC_BTN_ADD_TAG);
    btnAdd.setBorderPainted(false);
    btnAdd.setContentAreaFilled(false);
    btnDelTag = getTagManagementButton(OrbisGISIcon.DEL, AC_BTN_DEL_TAG);
    btnDelTag.setEnabled(false);
    btnDelTag.setBorderPainted(false);
    btnDelTag.setContentAreaFilled(false);
    pnlButtons.add(btnAdd);
    pnlButtons.add(btnDelTag);
    ret.add(pnlButtons, BorderLayout.SOUTH);
    return ret;
}

From source file:org.ow2.aspirerfid.demos.warehouse.management.UI.WarehouseManagement.java

/**
 * Initialize the contents of the frame/*from   w  ww .  j  a v a2 s  .c  o m*/
 */
private void initialize() {

    final JTabbedPane tabbedPane;
    final JPanel deliveryPanel;
    final JLabel entryDateLabel;
    final JLabel entryDateLabel_1;
    final JLabel entryDateLabel_2;
    final JLabel entryDateLabel_3;
    final JLabel entryDateLabel_3_1;
    final JLabel entryDateLabel_3_2;
    final JPanel shipmentPanel;
    final JLabel entryDateLabel_3_1_1;
    final JLabel entryDateLabel_3_1_2;
    final JScrollPane scrollPane;
    final JButton printReportButton;
    final JButton saveReportButton;
    final JButton activateDoorButton;
    final JButton deactivateDoorButton;
    final JButton clearReportButton;
    final JPanel panel;
    final JLabel entryDateLabel_3_3;
    final JLabel entryDateLabel_2_1;
    frame = new JFrame();
    frame.getContentPane().setLayout(new BorderLayout());
    frame.setTitle("Warehouse Management");
    frame.setBounds(100, 100, 1011, 625);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    tabbedPane = new JTabbedPane();
    frame.getContentPane().add(tabbedPane);

    deliveryPanel = new JPanel();
    deliveryPanel.setLayout(null);
    tabbedPane.addTab("Delivery Counter", null, deliveryPanel, null);

    entryDateLabel = new JLabel();
    entryDateLabel.setText("Entry Date .........");
    entryDateLabel.setBounds(533, 23, 117, 16);
    deliveryPanel.add(entryDateLabel);

    entryDateLabel_1 = new JLabel();
    entryDateLabel_1.setText("User ID ................");
    entryDateLabel_1.setBounds(10, 94, 117, 16);
    deliveryPanel.add(entryDateLabel_1);

    entryDateLabel_2 = new JLabel();
    entryDateLabel_2.setText("Invoice ID ............");
    entryDateLabel_2.setBounds(10, 23, 117, 16);
    deliveryPanel.add(entryDateLabel_2);

    entryDateLabel_3 = new JLabel();
    entryDateLabel_3.setText("Warehouse ID....");
    entryDateLabel_3.setBounds(10, 45, 117, 16);
    deliveryPanel.add(entryDateLabel_3);

    entryDateLabel_3_1 = new JLabel();
    entryDateLabel_3_1.setText("Zone ID ................");
    entryDateLabel_3_1.setBounds(10, 67, 117, 16);
    deliveryPanel.add(entryDateLabel_3_1);

    entryDateLabel_3_2 = new JLabel();
    entryDateLabel_3_2.setText("Entry Hour .........");
    entryDateLabel_3_2.setBounds(533, 45, 117, 16);
    deliveryPanel.add(entryDateLabel_3_2);

    entryDateLabel_3_1_1 = new JLabel();
    entryDateLabel_3_1_1.setText("Offering Date ....");
    entryDateLabel_3_1_1.setBounds(533, 70, 117, 16);
    deliveryPanel.add(entryDateLabel_3_1_1);

    entryDateLabel_3_1_2 = new JLabel();
    entryDateLabel_3_1_2.setText("Offering Hour ....");
    entryDateLabel_3_1_2.setBounds(533, 94, 117, 16);
    deliveryPanel.add(entryDateLabel_3_1_2);

    invoiceIDTextField = new JTextField();
    invoiceIDTextField.setBounds(105, 19, 365, 20);
    deliveryPanel.add(invoiceIDTextField);

    warehouseIDTextField = new JTextField();
    warehouseIDTextField.setBounds(105, 43, 365, 20);
    deliveryPanel.add(warehouseIDTextField);

    zoneIDTextField = new JTextField();
    zoneIDTextField.setBounds(105, 66, 365, 20);
    deliveryPanel.add(zoneIDTextField);

    userIDTextField = new JTextField();
    userIDTextField.setBounds(105, 90, 365, 20);
    deliveryPanel.add(userIDTextField);

    entryDateTextField = new JTextField();
    entryDateTextField.setBounds(623, 19, 365, 20);
    deliveryPanel.add(entryDateTextField);

    entryHourTextField = new JTextField();
    entryHourTextField.setBounds(623, 41, 365, 20);
    deliveryPanel.add(entryHourTextField);

    offeringDateTextField = new JTextField();
    offeringDateTextField.setBounds(623, 66, 365, 20);
    deliveryPanel.add(offeringDateTextField);

    offeringHourTextField = new JTextField();
    offeringHourTextField.setBounds(623, 90, 365, 20);
    deliveryPanel.add(offeringHourTextField);

    scrollPane = new JScrollPane();
    scrollPane.setBounds(10, 129, 978, 355);
    deliveryPanel.add(scrollPane);

    deliveryTableModel = new DefaultTableModel();// All Clients Items
    deliveryTableModel.addColumn("Company");
    deliveryTableModel.addColumn("Item Code");
    deliveryTableModel.addColumn("Description");
    deliveryTableModel.addColumn("Quantity Delivered");
    deliveryTableModel.addColumn("Expected Quantity");
    deliveryTableModel.addColumn("Quantity Remain");
    deliveryTableModel.addColumn("Delivery Date");
    deliveryTableModel.addColumn("Measurement ID");
    deliveryTableModel.addColumn("Quantity");
    deliveryTable = new JTable(deliveryTableModel);
    deliveryTable.setFont(new Font("Arial Narrow", Font.PLAIN, 10));
    deliveryTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

    scrollPane.setViewportView(deliveryTable);

    ListSelectionModel rowSM = deliveryTable.getSelectionModel();

    printReportButton = new JButton();
    printReportButton.setText("Print Report");
    printReportButton.setBounds(860, 520, 117, 26);
    deliveryPanel.add(printReportButton);

    saveReportButton = new JButton();
    saveReportButton.setText("Save Report");
    saveReportButton.setBounds(614, 520, 117, 26);
    deliveryPanel.add(saveReportButton);

    activateDoorButton = new JButton();
    activateDoorButton.addMouseListener(new ActivateDoorButtonMouseListener());
    activateDoorButton.setText("Activate Door");
    activateDoorButton.setBounds(50, 520, 117, 26);
    deliveryPanel.add(activateDoorButton);

    deactivateDoorButton = new JButton();
    deactivateDoorButton.addMouseListener(new DeactivateDoorButtonMouseListener());
    deactivateDoorButton.setText("Dectivate Door");
    deactivateDoorButton.setBounds(173, 520, 117, 26);
    deliveryPanel.add(deactivateDoorButton);

    clearReportButton = new JButton();
    clearReportButton.addMouseListener(new ClearReportButtonMouseListener());
    clearReportButton.setText("Clear Report");
    clearReportButton.setBounds(737, 520, 117, 26);
    deliveryPanel.add(clearReportButton);
    rowSM.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            // Ignore extra messages.
            if (e.getValueIsAdjusting())
                return;

            ListSelectionModel lsm = (ListSelectionModel) e.getSource();
            if (lsm.isSelectionEmpty()) {
                // no rows are selected
            } else {
                selectedRow = lsm.getMinSelectionIndex();
                System.out.println("selectedRow = " + selectedRow);

            }
        }
    });

    shipmentPanel = new JPanel();
    tabbedPane.addTab("Shipment", null, shipmentPanel, null);

    panel = new JPanel();
    panel.setLayout(null);
    tabbedPane.addTab("Door Config", null, panel, null);

    aleListeningPortTextField = new JTextField();
    aleListeningPortTextField.setText("9999");
    aleListeningPortTextField.setBounds(172, 41, 330, 20);
    panel.add(aleListeningPortTextField);

    epcisRepositoryURLTextField = new JTextField();
    epcisRepositoryURLTextField.setText("http://localhost:8080/aspire0.3.0EpcisRepository/capture");
    epcisRepositoryURLTextField.setBounds(172, 65, 330, 20);
    panel.add(epcisRepositoryURLTextField);

    entryDateLabel_3_3 = new JLabel();
    entryDateLabel_3_3.setText("EPCIS Rep. URL .........");
    entryDateLabel_3_3.setBounds(51, 67, 117, 16);
    panel.add(entryDateLabel_3_3);

    entryDateLabel_2_1 = new JLabel();
    entryDateLabel_2_1.setText("ALE Listening Port ....");
    entryDateLabel_2_1.setBounds(51, 43, 117, 16);
    panel.add(entryDateLabel_2_1);

}

From source file:org.panbox.desktop.common.gui.AddContactToShareWizard.java

public AddContactToShareWizard(java.awt.Frame parent, PanboxClient client, PanboxShare share,
        ContactListModel model) throws Exception {
    super(parent);
    this.client = client;
    this.share = share;
    this.mainModel = model;

    this.dbapi = (DropboxAPIIntegration) CSPAdapterFactory.getInstance(StorageBackendType.DROPBOX)
            .getAPIAdapter();//from   www.  ja  v  a  2  s . c o m

    this.hasParticipants = (share.getContacts().size() != 0);

    initComponents();
    setLocationRelativeTo(parent);

    this.contactList.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            changedStep();
        }
    });

    changedStep();
}