< prev index next >

## src/com/sun/javatest/agent/AgentMonitorTool.java

Print this page

    @@ -176,11 +176,11 @@
                 fc.gridwidth = GridBagConstraints.REMAINDER;
                 fc.weightx = 1;
                 add(timeoutField, fc);
                 timeoutLabel.setLabelFor(timeoutField);

    -            listData = new DefaultListModel();
    +            listData = new DefaultListModel<>();
                 list = uif.createList("tool.pool", listData);
                 list.setPrototypeCellValue("abcdefghiklmnopqrstuvwxyz");
                 list.setVisibleRowCount(3);
                 GridBagConstraints c = new GridBagConstraints();
                 c.fill = GridBagConstraints.BOTH;

    @@ -337,12 +337,12 @@
             private JCheckBox listeningCheck;
             private JLabel portLabel;
             private JTextField portField;
             private JLabel timeoutLabel;
             private JTextField timeoutField;
    -        private JList list;
    -        private DefaultListModel listData;
    +        private JList<String> list;
    +        private DefaultListModel<String> listData;
         }

         private class CurrentAgentsSubpanel extends JPanel
             implements ListSelectionListener, AgentManager.Observer
         {

    @@ -350,17 +350,17 @@
                 setName("tool.curr");
                 setBorder(uif.createTitledBorder("tool.curr"));
                 setLayout(new GridBagLayout());
                 uif.setToolTip(this, "tool.curr");

    -            listData = new DefaultListModel();
    +            listData = new DefaultListModel<>();
                 list = uif.createList("tool.list.curr", listData);
                 list.setVisibleRowCount(5);

                 list.setCellRenderer(new DefaultListCellRenderer() {
                     public Component getListCellRendererComponent(JList list, Object o, int index, boolean isSelected, boolean cellHasFocus) {
    -                    String name = ((Entry)o).toString();
    +                    String name = o.toString();
                         return super.getListCellRendererComponent(list, name, index, isSelected, cellHasFocus);
                     }
                 });

                 list.addListSelectionListener(this);

    @@ -419,11 +419,11 @@

                 agentManager.addObserver(this);
             }

             public synchronized void valueChanged(ListSelectionEvent ev) {
    -            Entry e = (Entry)(list.getSelectedValue());
    +            Entry e = list.getSelectedValue();
                 if (e == null) {
                     addressField.setText("");
                     tagField.setText("");
                     requestField.setText("");
                     execField.setText("");

    @@ -468,11 +468,11 @@

                     EventQueue.invokeLater(cmd);
                 }
                 else {
                     for (int i = 0; i < listData.size(); i++) {
    -                    Entry e = (Entry)(listData.elementAt(i));
    +                    Entry e = listData.elementAt(i);
                         if (e.connection == c) {
                             listData.removeElement(e);
                             break;
                         }
                     }   // for

    @@ -502,12 +502,12 @@
                 String executable;
                 String[] args;
                 boolean localizeArgs;
             }

    -        private JList list;
    -        private DefaultListModel listData;
    +        private JList<Entry> list;
    +        private DefaultListModel<Entry> listData;
             private Entry selectedEntry;
             private JLabel addressLabel;
             private JTextField addressField;
             private JLabel tagLabel;
             private JTextField tagField;

< prev index next >