1 package SnowMailClient.view.actions; 2 3 import SnowMailClient.SnowMailClientApp; 4 import SnowMailClient.model.folders.*; 5 import SnowMailClient.model.*; 6 import SnowMailClient.view.folders.*; 7 import SnowMailClient.view.*; 8 import SnowMailClient.Language.Language; 9 10 import java.awt.*; 11 import java.awt.event.*; 12 import javax.swing.*; 13 import javax.swing.event.*; 14 import javax.swing.table.*; 15 16 17 19 public final class AddToSpamAction extends AbstractAction 20 { 21 FolderView folderView; 22 23 public AddToSpamAction(FolderView _folderView) 24 { 25 super(Language.translate("Set selected messages as Spam")); 26 this.folderView = _folderView; 27 28 30 31 putValue(AbstractAction.SMALL_ICON, SnowMailClientApp.loadImageIcon("pics/addtospam.PNG")); 32 33 34 folderView.getTableSelectionModel().addListSelectionListener( new ListSelectionListener() 35 { 36 public void valueChanged(ListSelectionEvent e) 37 { 38 setEnabled(folderView.getTableSelectionCount()>0); 39 } 40 }); 41 setEnabled(folderView.getTableSelectionCount()>0); 42 43 } 45 public void actionPerformed(ActionEvent e) 46 { 47 MailMessage[] messs = folderView.getSelectedMessages(); 48 for(MailMessage mess: messs) 49 { 50 mess.setSPAM(true); 51 52 56 59 } 60 } 62 63 64 65 } | Popular Tags |