29.07.2013 Views

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

}<br />

setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));<br />

add(Box.createVerticalStrut(Definitions.getSpaceL()));<br />

add(informationTextArea);<br />

add(Box.createVerticalStrut(Definitions.getSpaceL()));<br />

add(new JScrollPane(list));<br />

add(Box.createVerticalStrut(Definitions.getSpaceL()));<br />

private class buttonPanel extends JPanel<br />

{<br />

public buttonPanel()<br />

{<br />

addressTextField = new JTextField();<br />

}<br />

}<br />

ImageButton addButton = new ImageButton("gradient", "Add");<br />

addButton.addActionListener(new actionListener());<br />

ImageButton removeButton = new ImageButton("gradient", "Remove");<br />

removeButton.addActionListener(new actionListener());<br />

setLayout(new BoxLayout(this, BoxLayout.X_AXIS));<br />

add(Box.createHorizontalGlue());<br />

add(addressTextField);<br />

add(Box.createHorizontalStrut(5));<br />

add(addButton);<br />

add(Box.createHorizontalStrut(5));<br />

add(removeButton);<br />

add(Box.createHorizontalGlue());<br />

private class actionListener implements ActionListener<br />

{<br />

public void actionPerformed(ActionEvent e)<br />

{<br />

if(e.getActionCommand().equals("Add"))<br />

{<br />

try<br />

{<br />

control.addToWhitelist(addressTextField.getText());<br />

addressTextField.setText("");<br />

}<br />

catch(Exception ex)<br />

{<br />

Debugger.debug(getClass(), 1, ex.getMessage(), ex);<br />

frame.showError(ex.getMessage());<br />

}<br />

}<br />

else<br />

{<br />

//Debugger.debug(getClass(), 3, "Get Coin pressed.");<br />

if(list.isSelectionEmpty())<br />

{<br />

frame.showError("Please select which address to remove, before<br />

pressing 'Remove'");<br />

return;<br />

}<br />

try<br />

{<br />

control.removeFromWhitelist((InternetAddress)list.getSelectedValue());<br />

}<br />

catch(Exception ex)<br />

{<br />

Debugger.debug(getClass(), 1, "Could not remove address.", ex);<br />

frame.showError("Could not remove address.");<br />

}<br />

}<br />

260

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!