/* * Software Name : ATK * * Copyright (C) 2007 - 2012 France Télécom * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * ------------------------------------------------------------------ * File Name : JFrameList.java * * Created : 05/06/2009 * Author(s) : Yvain Leyral */ /* * NewJFrame1.java * * Created on 4 juin 2009, 17:11:36 */ package com.orange.atk.atkUI.guiHopper.actions; import com.orange.atk.atkUI.guiHopper.HopperMouseListener; /** * * @author ywil8421 */ public class JFrameList extends javax.swing.JFrame { private static final long serialVersionUID = 1L; private String[] strings=null; private HopperMouseListener listener; public String[] getStrings() { return strings; } public void setStrings(String[] strings) { this.strings = strings; } public int[] getIndices() { return indices; } public void setIndices(int[] indices) { this.indices = indices; } private int[] indices; /** Creates new form NewJFrame1 */ public JFrameList(HopperMouseListener listener, String strings[]) { this.listener = listener; initComponents(strings); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents(final String[] strings ) { this.strings=strings; jScrollPane1 = new javax.swing.JScrollPane(); jList1 = new javax.swing.JList(); jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jList1.setModel(new javax.swing.AbstractListModel() { /** * */ private static final long serialVersionUID = 1L; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jList1.setDoubleBuffered(true); jScrollPane1.setViewportView(jList1); getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER); jLabel1.setText("Hopper Test Available"); getContentPane().add(jLabel1, java.awt.BorderLayout.PAGE_START); jButton1.setText("Add Selected"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); getContentPane().add(jButton1, java.awt.BorderLayout.PAGE_END); pack(); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { indices =jList1.getSelectedIndices(); listener.notifySelectedIndices(indices,strings); // TODO add your handling code here: } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JList jList1; private javax.swing.JScrollPane jScrollPane1; // End of variables declaration }