Search in sources :

Example 6 with FlatButtonMouseAdapter

use of com.jsql.view.swing.ui.FlatButtonMouseAdapter in project jsql-injection by ron190.

the class DialogAbout method initializeButtonWebpage.

private JButton initializeButtonWebpage() {
    final var buttonWebpage = new JButton("Webpage");
    buttonWebpage.setBorder(BorderFactory.createCompoundBorder(UiUtil.BORDER_FOCUS_GAINED, BorderFactory.createEmptyBorder(2, 20, 2, 20)));
    buttonWebpage.addActionListener(ev -> {
        try {
            Desktop.getDesktop().browse(new URI((String) MediatorHelper.model().getMediatorUtils().getPropertiesUtil().getProperties().get("github.url")));
        } catch (IOException | URISyntaxException | UnsupportedOperationException e) {
            LOGGER.log(LogLevel.CONSOLE_ERROR, "Browsing to Url failed", e);
        }
    });
    buttonWebpage.setContentAreaFilled(false);
    buttonWebpage.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    buttonWebpage.setBackground(new Color(200, 221, 242));
    buttonWebpage.addMouseListener(new FlatButtonMouseAdapter(buttonWebpage));
    return buttonWebpage;
}
Also used : Color(java.awt.Color) JButton(javax.swing.JButton) FlatButtonMouseAdapter(com.jsql.view.swing.ui.FlatButtonMouseAdapter) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Example 7 with FlatButtonMouseAdapter

use of com.jsql.view.swing.ui.FlatButtonMouseAdapter in project jsql-injection by ron190.

the class DialogAbout method initializeButtonClose.

private void initializeButtonClose(ActionListener escapeListener) {
    this.buttonClose = new JButton("Close");
    this.buttonClose.setBorder(BorderFactory.createCompoundBorder(UiUtil.BORDER_FOCUS_GAINED, BorderFactory.createEmptyBorder(2, 20, 2, 20)));
    this.buttonClose.addActionListener(escapeListener);
    this.buttonClose.setContentAreaFilled(false);
    this.buttonClose.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    this.buttonClose.setBackground(new Color(200, 221, 242));
    this.buttonClose.addMouseListener(new FlatButtonMouseAdapter(this.buttonClose));
}
Also used : Color(java.awt.Color) JButton(javax.swing.JButton) FlatButtonMouseAdapter(com.jsql.view.swing.ui.FlatButtonMouseAdapter)

Example 8 with FlatButtonMouseAdapter

use of com.jsql.view.swing.ui.FlatButtonMouseAdapter in project jsql-injection by ron190.

the class AbstractManagerShell method initializeRunButtonPanel.

private JPanel initializeRunButtonPanel() {
    this.defaultText = "SHELL_RUN_BUTTON_LABEL";
    var lastLine = new JPanel();
    lastLine.setLayout(new BoxLayout(lastLine, BoxLayout.X_AXIS));
    lastLine.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, UiUtil.COLOR_COMPONENT_BORDER), BorderFactory.createEmptyBorder(1, 0, 1, 1)));
    this.run = new JButtonStateful(this.defaultText);
    I18nViewUtil.addComponentForKey(this.defaultText, this.run);
    this.run.setToolTipText(I18nUtil.valueByKey("SHELL_RUN_BUTTON_TOOLTIP"));
    this.run.setEnabled(false);
    this.run.setContentAreaFilled(false);
    this.run.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    this.run.setBackground(new Color(200, 221, 242));
    this.run.addMouseListener(new FlatButtonMouseAdapter(this.run));
    this.run.addActionListener(new ActionCreationShell());
    this.privilege = new JLabel(I18nUtil.valueByKey("PRIVILEGE_LABEL"), UiUtil.ICON_SQUARE_GREY, SwingConstants.LEFT);
    I18nViewUtil.addComponentForKey("PRIVILEGE_LABEL", this.privilege);
    this.privilege.setBorder(BorderFactory.createMatteBorder(2, 0, 0, 0, UiUtil.COLOR_DEFAULT_BACKGROUND));
    this.privilege.setToolTipText(I18nUtil.valueByKey("PRIVILEGE_TOOLTIP"));
    lastLine.add(this.privilege);
    lastLine.add(Box.createHorizontalStrut(5));
    lastLine.add(Box.createHorizontalGlue());
    lastLine.add(this.run);
    return lastLine;
}
Also used : JButtonStateful(com.jsql.view.swing.manager.util.JButtonStateful) JPanel(javax.swing.JPanel) BoxLayout(javax.swing.BoxLayout) Color(java.awt.Color) FlatButtonMouseAdapter(com.jsql.view.swing.ui.FlatButtonMouseAdapter) JLabel(javax.swing.JLabel)

Example 9 with FlatButtonMouseAdapter

use of com.jsql.view.swing.ui.FlatButtonMouseAdapter in project jsql-injection by ron190.

the class ManagerFile method initializeRunButton.

private void initializeRunButton() {
    this.defaultText = "FILE_RUN_BUTTON_LABEL";
    this.run = new JButtonStateful(this.defaultText);
    I18nViewUtil.addComponentForKey("FILE_RUN_BUTTON_LABEL", this.run);
    this.run.setToolTipText(I18nUtil.valueByKey("FILE_RUN_BUTTON_TOOLTIP"));
    this.run.setEnabled(false);
    this.run.setContentAreaFilled(false);
    this.run.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    this.run.setBackground(new Color(200, 221, 242));
    this.run.addMouseListener(new FlatButtonMouseAdapter(this.run));
    this.run.addActionListener(actionEvent -> {
        if (this.listFile.getSelectedValuesList().isEmpty()) {
            LOGGER.log(LogLevel.CONSOLE_ERROR, "Select at least one file to read in the list");
            return;
        }
        new Thread(() -> {
            if (ManagerFile.this.run.getState() == StateButton.STARTABLE) {
                ManagerFile.this.run.setText(I18nViewUtil.valueByKey("FILE_RUN_BUTTON_STOP"));
                ManagerFile.this.run.setState(StateButton.STOPPABLE);
                ManagerFile.this.loader.setVisible(true);
                MediatorHelper.managerWebshell().clearSelection();
                MediatorHelper.managerSqlshell().clearSelection();
                try {
                    this.readFile(this.listFile.getSelectedValuesList());
                } catch (InterruptedException e) {
                    LOGGER.log(LogLevel.CONSOLE_JAVA, e, e);
                    Thread.currentThread().interrupt();
                } catch (Exception e) {
                    LOGGER.log(LogLevel.CONSOLE_ERROR, e, e);
                }
            } else {
                MediatorHelper.model().getResourceAccess().stopSearchingFile();
                ManagerFile.this.run.setEnabled(false);
                ManagerFile.this.run.setState(StateButton.STOPPING);
            }
        }, "ThreadReadFile").start();
    });
}
Also used : JButtonStateful(com.jsql.view.swing.manager.util.JButtonStateful) Color(java.awt.Color) FlatButtonMouseAdapter(com.jsql.view.swing.ui.FlatButtonMouseAdapter) JSqlException(com.jsql.model.exception.JSqlException) ExecutionException(java.util.concurrent.ExecutionException)

Example 10 with FlatButtonMouseAdapter

use of com.jsql.view.swing.ui.FlatButtonMouseAdapter in project jsql-injection by ron190.

the class ManagerScan method initializeRunButton.

private void initializeRunButton(final DnDList dndListScan) {
    this.defaultText = "SCAN_RUN_BUTTON_LABEL";
    this.run = new JButtonStateful(this.defaultText);
    I18nViewUtil.addComponentForKey("SCAN_RUN_BUTTON_LABEL", this.run);
    this.run.setToolTipText(I18nUtil.valueByKey("SCAN_RUN_BUTTON_TOOLTIP"));
    this.run.setContentAreaFilled(false);
    this.run.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
    this.run.setBackground(new Color(200, 221, 242));
    this.run.addMouseListener(new FlatButtonMouseAdapter(this.run));
    this.run.addActionListener(actionEvent -> {
        if (dndListScan.getSelectedValuesList().isEmpty()) {
            LOGGER.log(LogLevel.CONSOLE_ERROR, "Select URL(s) to scan");
            return;
        }
        new Thread(() -> {
            if (ManagerScan.this.run.getState() == StateButton.STARTABLE) {
                ManagerScan.this.run.setText(I18nViewUtil.valueByKey("SCAN_RUN_BUTTON_STOP"));
                ManagerScan.this.run.setState(StateButton.STOPPABLE);
                ManagerScan.this.loader.setVisible(true);
                DefaultListModel<ItemList> listModel = (DefaultListModel<ItemList>) dndListScan.getModel();
                for (var i = 0; i < listModel.getSize(); i++) {
                    listModel.get(i).reset();
                }
                this.scan(dndListScan.getSelectedValuesList());
            } else {
                MediatorHelper.model().getResourceAccess().setScanStopped(true);
                MediatorHelper.model().setIsStoppedByUser(true);
                ManagerScan.this.run.setEnabled(false);
                ManagerScan.this.run.setState(StateButton.STOPPING);
            }
        }, "ThreadScan").start();
    });
}
Also used : JButtonStateful(com.jsql.view.swing.manager.util.JButtonStateful) Color(java.awt.Color) ItemList(com.jsql.view.swing.list.ItemList) FlatButtonMouseAdapter(com.jsql.view.swing.ui.FlatButtonMouseAdapter) DefaultListModel(javax.swing.DefaultListModel)

Aggregations

FlatButtonMouseAdapter (com.jsql.view.swing.ui.FlatButtonMouseAdapter)10 Color (java.awt.Color)9 JButtonStateful (com.jsql.view.swing.manager.util.JButtonStateful)6 BoxLayout (javax.swing.BoxLayout)4 JPanel (javax.swing.JPanel)4 JButton (javax.swing.JButton)3 JLabel (javax.swing.JLabel)3 JSqlException (com.jsql.model.exception.JSqlException)1 ActionCheckIP (com.jsql.view.swing.action.ActionCheckIP)1 ItemList (com.jsql.view.swing.list.ItemList)1 ActionBruteForce (com.jsql.view.swing.manager.util.ActionBruteForce)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 FlowLayout (java.awt.FlowLayout)1 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ExecutionException (java.util.concurrent.ExecutionException)1 DefaultListModel (javax.swing.DefaultListModel)1 BasicProgressBarUI (javax.swing.plaf.basic.BasicProgressBarUI)1