org.owasp.jbrofuzz.encode.HashPanelRightClick Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jbrofuzz-encoder Show documentation
Show all versions of jbrofuzz-encoder Show documentation
JBroFuzz is a stateless web application fuzzer for requests
being made over HTTP and/or HTTPS. Its purpose is to provide a single,
portable application that offers stable web protocol fuzzing capabilities.
As a tool, it emerged from the needs of penetration testing.
/**
* JbroFuzz 2.5
*
* JBroFuzz - A stateless network protocol fuzzer for web applications.
*
* Copyright (C) 2007 - 2010 [email protected]
*
* This file is part of JBroFuzz.
*
* JBroFuzz is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* JBroFuzz is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with JBroFuzz. If not, see .
* Alternatively, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Verbatim copying and distribution of this entire program file is
* permitted in any medium without royalty provided this notice
* is preserved.
*
*/
package org.owasp.jbrofuzz.encode;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.KeyStroke;
import javax.swing.text.JTextComponent;
import org.owasp.jbrofuzz.version.ImageCreator;
final class HashPanelRightClick {
/**
*
* Method for setting up the right click copy paste cut and select all menu.
*
*
* It passes the parameters of which options in the right click menu are
* enabled.
*
*
* @param area
* JTextComponent
*/
protected static final void popupText(final JTextComponent area) {
final JPopupMenu popmenu = new JPopupMenu();
final JMenuItem i1_cut = new JMenuItem("Cut");
final JMenuItem i2_copy = new JMenuItem("Copy");
final JMenuItem i3_paste = new JMenuItem("Paste");
final JMenuItem i4_select = new JMenuItem("Select All");
i1_cut.setIcon(ImageCreator.IMG_CUT);
i2_copy.setIcon(ImageCreator.IMG_COPY);
i3_paste.setIcon(ImageCreator.IMG_PASTE);
i4_select.setIcon(ImageCreator.IMG_SELECTALL);
i1_cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,
ActionEvent.CTRL_MASK));
i2_copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
ActionEvent.CTRL_MASK));
i3_paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
ActionEvent.CTRL_MASK));
i4_select.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,
ActionEvent.CTRL_MASK));
popmenu.add(i1_cut);
popmenu.add(i2_copy);
popmenu.add(i3_paste);
popmenu.addSeparator();
popmenu.add(i4_select);
i1_cut.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
area.cut();
}
});
i2_copy.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
area.copy();
}
});
i3_paste.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (area.isEditable()) {
area.paste();
}
}
});
i4_select.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
area.selectAll();
}
});
area.addMouseListener(new MouseAdapter() {
private void checkForTriggerEvent(final MouseEvent e) {
if (e.isPopupTrigger()) {
area.requestFocus();
popmenu.show(e.getComponent(), e.getX(), e.getY());
}
}
@Override
public void mousePressed(final MouseEvent e) {
checkForTriggerEvent(e);
}
@Override
public void mouseReleased(final MouseEvent e) {
checkForTriggerEvent(e);
}
});
}
}