Example usage for javax.swing JList equals

List of usage examples for javax.swing JList equals

Introduction

In this page you can find the example usage for javax.swing JList equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:fr.eurecom.hybris.demogui.HybrisDemoGui.java

public void keyReleased(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_DELETE) {

        JList<String> jlist = (JList<String>) e.getComponent();
        if (jlist.getSelectedIndex() >= 0) {

            if (jlist.equals(lstAmazon)) {
                new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.AWS,
                        jlist.getSelectedValue(), null)).start();
                System.out.println("Removed " + jlist.getSelectedValue() + " from Amazon S3.");
                corruptedItems.remove("amazon" + jlist.getSelectedValue());
            } else if (jlist.equals(lstAzure)) {
                new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.AZURE,
                        jlist.getSelectedValue(), null)).start();
                System.out.println("Removed " + jlist.getSelectedValue() + " from Azure.");
                corruptedItems.remove("azure" + jlist.getSelectedValue());
            } else if (jlist.equals(lstGoogle)) {
                new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.GOOGLE,
                        jlist.getSelectedValue(), null)).start();
                System.out.println("Removed " + jlist.getSelectedValue() + " from Google.");
                corruptedItems.remove("google" + jlist.getSelectedValue());
            } else if (jlist.equals(lstRackspace)) {
                new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.RACKSPACE,
                        jlist.getSelectedValue(), null)).start();
                System.out.println("Removed " + jlist.getSelectedValue() + " from Rackspace.");
                corruptedItems.remove("rackspace" + jlist.getSelectedValue());
            } else if (jlist.equals(lstHybris)) {
                new Thread(cm.new BackgroundWorker(OperationType.DELETE, ClientType.HYBRIS,
                        jlist.getSelectedValue(), null)).start();
                System.out.println("Removed " + jlist.getSelectedValue() + " from Hybris.");
            }/*www.  jav a  2 s . co  m*/
        }
    } else if (e.getKeyChar() == 'c') {
        JList<String> jlist = (JList<String>) e.getComponent();
        if (jlist.getSelectedIndex() >= 0) {

            byte[] corruptedPayload = "I_AM_THE_BOGUS_PAYLOAD".getBytes();

            if (jlist.equals(lstAmazon)) {
                JOptionPane.showMessageDialog(frame, "Corrupted " + jlist.getSelectedValue() + " on Amazon S3.",
                        "Corruption", JOptionPane.WARNING_MESSAGE);
                System.out.println("Corrupted " + jlist.getSelectedValue() + " on Amazon S3.");
                corruptedItems.add("amazon" + jlist.getSelectedValue());
                new Thread(cm.new BackgroundWorker(OperationType.PUT, ClientType.AWS, jlist.getSelectedValue(),
                        corruptedPayload)).start();
            } else if (jlist.equals(lstAzure)) {
                System.out.println("Corrupted " + jlist.getSelectedValue() + " on Azure.");
                JOptionPane.showMessageDialog(frame, "Corrupted " + jlist.getSelectedValue() + " on Azure.",
                        "Corruption", JOptionPane.WARNING_MESSAGE);
                corruptedItems.add("azure" + jlist.getSelectedValue());
                new Thread(cm.new BackgroundWorker(OperationType.PUT, ClientType.AZURE,
                        jlist.getSelectedValue(), corruptedPayload)).start();
            } else if (jlist.equals(lstGoogle)) {
                JOptionPane.showMessageDialog(frame, "Corrupted " + jlist.getSelectedValue() + " on Google.",
                        "Corruption", JOptionPane.WARNING_MESSAGE);
                System.out.println("Corrupted " + jlist.getSelectedValue() + " on Google.");
                corruptedItems.add("google" + jlist.getSelectedValue());
                new Thread(cm.new BackgroundWorker(OperationType.PUT, ClientType.GOOGLE,
                        jlist.getSelectedValue(), corruptedPayload)).start();
            } else if (jlist.equals(lstRackspace)) {
                JOptionPane.showMessageDialog(frame, "Corrupted " + jlist.getSelectedValue() + " on Rackspace.",
                        "Corruption", JOptionPane.WARNING_MESSAGE);
                System.out.println("Corrupted " + jlist.getSelectedValue() + " on Rackspace.");
                corruptedItems.add("rackspace" + jlist.getSelectedValue());
                new Thread(cm.new BackgroundWorker(OperationType.PUT, ClientType.RACKSPACE,
                        jlist.getSelectedValue(), corruptedPayload)).start();
            }
        }
    }
}