Search in sources :

Example 16 with FocusListener

use of java.awt.event.FocusListener in project ExperienceUI by Garnica1999.

the class ExUtilities method addFocusBorder.

public static void addFocusBorder(ColorUI colorUI, JPanel contenedor) {
    for (int i = 0; i < contenedor.getComponentCount(); i++) {
        if (contenedor.getComponent(i) instanceof JTextField) {
            final JTextField texto = ((JTextField) contenedor.getComponent(i));
            texto.addFocusListener(new FocusListener() {

                @Override
                public void focusGained(FocusEvent e) {
                    ExUtilities.addFocusOnSelectedComponent(texto, colorUI.getColorPrincipal());
                }

                @Override
                public void focusLost(FocusEvent e) {
                    ExUtilities.addFocusOnSelectedComponent(texto, colorUI.getColorBorde());
                }
            });
        } else if (contenedor.getComponent(i) instanceof JComboBox) {
            final JComboBox comp = ((JComboBox) contenedor.getComponent(i));
            comp.addFocusListener(new FocusListener() {

                @Override
                public void focusGained(FocusEvent e) {
                    ExUtilities.addFocusOnSelectedComponent(comp, colorUI.getColorPrincipal());
                }

                @Override
                public void focusLost(FocusEvent e) {
                    ExUtilities.addFocusOnSelectedComponent(comp, colorUI.getColorBorde());
                }
            });
        }
    }
}
Also used : JComboBox(javax.swing.JComboBox) JTextField(javax.swing.JTextField) FocusListener(java.awt.event.FocusListener) FocusEvent(java.awt.event.FocusEvent)

Example 17 with FocusListener

use of java.awt.event.FocusListener in project triplea by triplea-game.

the class StringProperty method getEditorComponent.

@Override
public JComponent getEditorComponent() {
    final JTextField text = new JTextField(m_value);
    text.addActionListener(e -> m_value = text.getText());
    text.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(final FocusEvent e) {
        }

        @Override
        public void focusLost(final FocusEvent e) {
            m_value = text.getText();
        }
    });
    final Dimension ourMinimum = new Dimension(80, 20);
    text.setMinimumSize(ourMinimum);
    text.setPreferredSize(ourMinimum);
    return text;
}
Also used : Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) FocusListener(java.awt.event.FocusListener) FocusEvent(java.awt.event.FocusEvent)

Example 18 with FocusListener

use of java.awt.event.FocusListener in project browsermator by pcalkins.

the class ActionView method AddLoopListeners.

public void AddLoopListeners(Action action, SeleniumTestTool STAppFrame, SeleniumTestToolData STAppData, Procedure newbug, ProcedureView newbugview) {
    // if (STAppData.hasStoredVar)
    // {
    AddSetVarFocusListeners(STAppFrame, STAppData, newbug, action);
    // }
    if (newbugview.Type.equals("Dataloop")) {
        addJTextFieldFocusListener(new FocusListener() {

            @Override
            public void focusGained(FocusEvent e) {
                newbugview.ShowFieldInstructions(true, 1, newbugview.index, action.index);
                newbugview.setLastSelectedField(1, newbugview.index, action.index);
            }

            @Override
            public void focusLost(FocusEvent e) {
                newbugview.ShowFieldInstructions(false, 1, newbugview.index, action.index);
                newbugview.clearLastSelectedValues();
            }
        });
        addJTextField2FocusListener(new FocusListener() {

            @Override
            public void focusGained(FocusEvent e) {
                newbugview.ShowFieldInstructions(true, 2, newbugview.index, action.index);
                newbugview.setLastSelectedField(2, newbugview.index, action.index);
            }

            @Override
            public void focusLost(FocusEvent e) {
                newbugview.ShowFieldInstructions(false, 2, newbugview.index, action.index);
                newbugview.clearLastSelectedValues();
            }
        });
    }
}
Also used : FocusListener(java.awt.event.FocusListener) FocusEvent(java.awt.event.FocusEvent)

Example 19 with FocusListener

use of java.awt.event.FocusListener in project browsermator by pcalkins.

the class STAppController method AddNewHandlers.

public void AddNewHandlers(SeleniumTestTool STAppFrame, SeleniumTestToolData STAppData, ProcedureView newbugview, Procedure newbug) {
    newbugview.addJSpinnerLimitListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            newbug.limit = (Integer) newbugview.JSpinnerLimit.getValue();
        }
    });
    newbugview.addJCheckBoxRandomActionListener((ActionEvent evt) -> {
        STAppFrame.saveState();
        newbug.random = newbugview.JCheckBoxRandom.isSelected();
    });
    newbugview.addJButtonOKActionListener((ActionEvent evt) -> {
        STAppFrame.saveState();
        String ACommand = evt.getActionCommand();
        if (ACommand.equals("Update")) {
            newbugview.Disable();
            newbug.Disable();
            newbugview.Locked = true;
            newbug.Locked = true;
        }
        if (ACommand.equals("Edit")) {
            newbugview.Enable();
            newbug.Enable();
            newbugview.Locked = false;
            newbug.Locked = false;
        }
    });
    newbugview.addRightClickPanelListener(this, newbug, newbugview, STAppFrame, STAppData);
    newbugview.addJComboBoxMoveToIndex((ItemEvent e) -> {
        if ((e.getStateChange() == ItemEvent.SELECTED)) {
            if (newbugview.jComboBoxMoveToIndex.getSelectedIndex() > 0) {
                MoveProcedureToIndex(STAppFrame, newbugview.index, (int) newbugview.jComboBoxMoveToIndex.getSelectedItem());
            }
        }
    });
    // newbugview.addJButtonMoveProcedureUpActionListener((ActionEvent evt) -> {
    // STAppFrame.saveState();
    // MoveProcedure(STAppFrame, newbugview.index, -1);
    // });
    // newbugview.addJButtonMoveProcedureDownActionListener((ActionEvent evt) -> {
    // STAppFrame.saveState();
    // MoveProcedure(STAppFrame, newbugview.index, 1);
    // });
    newbugview.addJButtonRunTestActionListener((ActionEvent evt) -> {
        RunSingleTest(newbug, newbugview, STAppFrame, STAppData);
    });
    newbugview.addJTextFieldBugTitleDocListener(new DocumentListener() {

        @Override
        public void changedUpdate(DocumentEvent documentEvent) {
            newbug.setProcedureTitle(newbugview.JTextFieldBugTitle.getText());
        // Window.changes = true;
        }

        @Override
        public void insertUpdate(DocumentEvent documentEvent) {
            newbug.setProcedureTitle(newbugview.JTextFieldBugTitle.getText());
        // Window.changes = true;
        }

        @Override
        public void removeUpdate(DocumentEvent documentEvent) {
            newbug.setProcedureTitle(newbugview.JTextFieldBugTitle.getText());
        // Window.changes = true;
        }
    });
    newbugview.addJButtonDeleteBugActionListener((ActionEvent evt) -> {
        STAppFrame.saveState();
        STAppData.DeleteBug(newbugview.index);
        STAppFrame.DeleteBugView(newbugview.index);
        STAppFrame.UpdateDisplay();
    });
    newbugview.addJButtonGoActionActionListener((ActionEvent evt) -> {
        STAppFrame.saveState();
        GoAction thisActionToAdd = new GoAction("");
        GoActionView thisActionViewToAdd = new GoActionView();
        STAppFrame.AddActionViewToArray(thisActionViewToAdd, newbugview);
        STAppData.AddActionToArray(thisActionToAdd, newbug, newbugview);
        thisActionViewToAdd.AddListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        thisActionViewToAdd.AddLoopListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        STAppFrame.UpdateDisplay();
        STAppFrame.ScrollActionPaneDown(newbugview);
        newbugview.refreshjComboBoxAddAtPosition();
        STAppData.changes = true;
    });
    newbugview.addJButtonClickAtXPATHActionListener((ActionEvent evt) -> {
        STAppFrame.saveState();
        ClickXPATHAction thisActionToAdd = new ClickXPATHAction("", false, false);
        ClickXPATHActionView thisActionViewToAdd = new ClickXPATHActionView();
        STAppFrame.AddActionViewToArray(thisActionViewToAdd, newbugview);
        STAppData.AddActionToArray(thisActionToAdd, newbug, newbugview);
        thisActionViewToAdd.AddListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        thisActionViewToAdd.AddLoopListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        STAppFrame.UpdateDisplay();
        STAppFrame.ScrollActionPaneDown(newbugview);
        newbugview.refreshjComboBoxAddAtPosition();
        STAppData.changes = true;
    });
    newbugview.addJButtonTypeAtXPATHActionListener((ActionEvent evt) -> {
        STAppFrame.saveState();
        TypeAtXPATHAction thisActionToAdd = new TypeAtXPATHAction("", "", false);
        TypeAtXPATHActionView thisActionViewToAdd = new TypeAtXPATHActionView();
        STAppFrame.AddActionViewToArray(thisActionViewToAdd, newbugview);
        STAppData.AddActionToArray(thisActionToAdd, newbug, newbugview);
        thisActionViewToAdd.AddListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        thisActionViewToAdd.AddLoopListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        STAppFrame.UpdateDisplay();
        STAppFrame.ScrollActionPaneDown(newbugview);
        newbugview.refreshjComboBoxAddAtPosition();
        STAppData.changes = true;
    });
    newbugview.addJButtonFindXPATHPassFailListener((ActionEvent evt) -> {
        STAppFrame.saveState();
        FindXPATHPassFailAction thisActionToAdd = new FindXPATHPassFailAction("", false);
        FindXPATHPassFailActionView thisActionViewToAdd = new FindXPATHPassFailActionView();
        STAppFrame.AddActionViewToArray(thisActionViewToAdd, newbugview);
        STAppData.AddActionToArray(thisActionToAdd, newbug, newbugview);
        thisActionViewToAdd.AddListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        thisActionViewToAdd.AddLoopListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        STAppFrame.UpdateDisplay();
        STAppFrame.ScrollActionPaneDown(newbugview);
        newbugview.refreshjComboBoxAddAtPosition();
        STAppData.changes = true;
    });
    newbugview.addJButtonDoNotFindXPATHPassFailListener((ActionEvent evt) -> {
        STAppFrame.saveState();
        FindXPATHPassFailAction thisActionToAdd = new FindXPATHPassFailAction("", true);
        NOTFindXPATHPassFailActionView thisActionViewToAdd = new NOTFindXPATHPassFailActionView();
        STAppFrame.AddActionViewToArray(thisActionViewToAdd, newbugview);
        STAppData.AddActionToArray(thisActionToAdd, newbug, newbugview);
        thisActionViewToAdd.AddListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        thisActionViewToAdd.AddLoopListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        STAppFrame.UpdateDisplay();
        STAppFrame.ScrollActionPaneDown(newbugview);
        newbugview.refreshjComboBoxAddAtPosition();
        STAppData.changes = true;
    });
    newbugview.addJButtonYesNoPromptPassFailListener((ActionEvent evt) -> {
        STAppFrame.saveState();
        YesNoPromptPassFailAction thisActionToAdd = new YesNoPromptPassFailAction("");
        YesNoPromptPassFailActionView thisActionViewToAdd = new YesNoPromptPassFailActionView();
        STAppFrame.AddActionViewToArray(thisActionViewToAdd, newbugview);
        STAppData.AddActionToArray(thisActionToAdd, newbug, newbugview);
        thisActionViewToAdd.AddListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        thisActionViewToAdd.AddLoopListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
        STAppFrame.UpdateDisplay();
        STAppFrame.ScrollActionPaneDown(newbugview);
        newbugview.refreshjComboBoxAddAtPosition();
        STAppData.changes = true;
    });
    newbugview.addDoActionItemListener((ItemEvent e) -> {
        if ((e.getStateChange() == ItemEvent.SELECTED)) {
            STAppFrame.saveState();
            Object ActionType = e.getItem();
            String ActionToAdd = ActionType.toString();
            ActionsMaster newActionsMaster = new ActionsMaster();
            HashMap<String, Action> ActionHashMap = newActionsMaster.ActionHashMap;
            HashMap<String, ActionView> ActionViewHashMap = newActionsMaster.ActionViewHashMap;
            newbugview.JComboBoxDoActions.setSelectedIndex(0);
            if (ActionHashMap.containsKey(ActionToAdd)) {
                Action thisActionToAdd = ActionHashMap.get(ActionToAdd);
                ActionView thisActionViewToAdd = ActionViewHashMap.get(ActionToAdd);
                STAppFrame.AddActionViewToArray(thisActionViewToAdd, newbugview);
                STAppData.AddActionToArray(thisActionToAdd, newbug);
                thisActionViewToAdd.AddListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
                thisActionViewToAdd.AddLoopListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
                STAppFrame.UpdateDisplay();
                STAppFrame.ScrollActionPaneDown(newbugview);
                newbugview.refreshjComboBoxAddAtPosition();
                STAppData.changes = true;
            }
        }
    });
    newbugview.addPassFailActionsItemListener((ItemEvent e) -> {
        if ((e.getStateChange() == ItemEvent.SELECTED)) {
            STAppFrame.saveState();
            Object PassFailActionType = e.getItem();
            String PassFailActionToAdd = PassFailActionType.toString();
            ActionsMaster newActionsMaster = new ActionsMaster();
            HashMap<String, Action> PassFailActionHashMap = newActionsMaster.PassFailActionHashMap;
            HashMap<String, ActionView> PassFailActionViewHashMap = newActionsMaster.PassFailActionViewHashMap;
            newbugview.JComboBoxPassFailActions.setSelectedIndex(0);
            if (PassFailActionHashMap.containsKey(PassFailActionToAdd)) {
                Action thisActionToAdd = PassFailActionHashMap.get(PassFailActionToAdd);
                ActionView thisActionViewToAdd = PassFailActionViewHashMap.get(PassFailActionToAdd);
                STAppFrame.AddActionViewToArray(thisActionViewToAdd, newbugview);
                STAppData.AddActionToArray(thisActionToAdd, newbug, newbugview);
                thisActionViewToAdd.AddListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
                thisActionViewToAdd.AddLoopListeners(thisActionToAdd, STAppFrame, STAppData, newbug, newbugview);
                STAppFrame.UpdateDisplay();
                STAppFrame.ScrollActionPaneDown(newbugview);
                newbugview.refreshjComboBoxAddAtPosition();
                STAppData.changes = true;
            }
        }
    });
    newbugview.addJTextBugTitleFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            newbugview.fieldBugTitleOnFocus = newbug.BugTitle;
        }

        @Override
        public void focusLost(FocusEvent e) {
            if (!newbug.BugTitle.equals(newbugview.fieldBugTitleOnFocus)) {
                STAppFrame.saveState();
            }
        }
    });
    AddLoopHandlers(STAppFrame, STAppData, newbugview, newbug);
    STAppFrame.addjCheckBoxShowReportActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        STAppData.ShowReport = STAppFrame.getjCheckBoxShowReport();
        if (STAppData.ShowReport == false) {
            STAppFrame.setShowReportView(false);
            STAppFrame.setjCheckBoxIncludeScreenshotsEnabled(false);
        } else {
            STAppFrame.setShowReportView(true);
            STAppData.EmailReportFail = false;
            STAppData.EmailReport = false;
            STAppData.ExitAfter = false;
        }
    });
    STAppFrame.addjButtonClearUniqueListActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            String visited_list_file_path = BrowsermatorAppFolder + "browsermator_" + STAppFrame.short_filename + "_visited_url_log.xml";
            File fileCheck = new File(visited_list_file_path);
            if (fileCheck.exists()) {
                if (fileCheck.canWrite()) {
                    fileCheck.delete();
                    STAppFrame.jButtonClearUniqueList.setEnabled(false);
                    Prompter donePrompt = new Prompter(fileCheck.getPath(), "The Unique File List has been cleared.", false, 0, 0);
                }
            }
        }
    });
    STAppFrame.addjSpinnerWaitTimeChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            STAppData.setWaitTime(STAppFrame.GetWaitTime());
        }
    });
    STAppFrame.addjSpinnerSessionsChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            STAppData.setSessions(STAppFrame.getSessions());
        }
    });
    STAppFrame.addjCheckBoxIncludeScreenshotsActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        STAppData.IncludeScreenshots = STAppFrame.getIncludeScreenshots();
    });
    STAppFrame.addjCheckBoxPromptToCloseActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        STAppData.PromptToClose = STAppFrame.getjCheckBoxPromptToClose();
    });
    STAppFrame.addjCheckBoxExitAfterActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        STAppData.ExitAfter = STAppFrame.getjCheckBoxExitAfter();
        if (STAppData.ExitAfter) {
            STAppFrame.setjCheckBoxShowReportSelected(false);
            STAppFrame.setjCheckBoxIncludeScreenshotsEnabled(false);
            STAppData.ShowReport = false;
        }
    });
    STAppFrame.addjRadioButtonUniquePerFileActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        if (STAppFrame.getjRadioButtonUniquePerFile()) {
            STAppFrame.setjRadioButtonUniqueGlobalSelected(false);
            STAppData.UniqueOption = "file";
        } else {
            STAppFrame.setjRadioButtonUniqueGlobalSelected(true);
            STAppData.UniqueOption = "global";
        }
    });
    STAppFrame.addjRadioButtonUniqueGlobalActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        if (STAppFrame.getjRadioButtonUniqueGlobalSelected()) {
            STAppFrame.setjRadioButtonUniquePerFileSelected(false);
            STAppData.UniqueOption = "global";
        } else {
            STAppFrame.setjRadioButtonUniquePerFileSelected(true);
            STAppData.UniqueOption = "file";
        }
    });
    STAppFrame.addjCheckBoxUniqueURLsActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        STAppData.UniqueList = STAppFrame.getjCheckBoxUniqueURLsSelected();
        STAppFrame.setjRadioButtonUniquePerFileEnabled(STAppData.UniqueList);
        STAppFrame.setjRadioButtonUniqueGlobalEnabled(STAppData.UniqueList);
        if (!STAppFrame.getjRadioButtonUniquePerFileSelected() && !STAppFrame.getjRadioButtonUniqueGlobalSelected()) {
            STAppData.setUniqueFileOption("file");
        }
    });
    STAppFrame.addjCheckBoxEmailReportActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        STAppData.EmailReport = STAppFrame.getjCheckBoxEmailReportSelected();
        if (STAppData.EmailReport == true) {
            STAppFrame.setjCheckBoxIncludeScreenshotsEnabled(false);
            STAppData.IncludeScreenshots = false;
            STAppFrame.setjCheckBoxShowReportSelected(false);
            STAppData.ShowReport = false;
            STAppFrame.setjCheckBoxEmailReportFailSelected(false);
            STAppData.EmailReportFail = false;
        }
    });
    STAppFrame.addjCheckBoxEnableMultiSessionActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        if (STAppFrame.getjCheckBoxEnableMultiSessionSelected()) {
            STAppFrame.setjSpinnerSessionsEnabled(true);
            STAppData.MultiSession = true;
        } else {
            STAppFrame.setjSpinnerSessionsEnabled(false);
            STAppData.MultiSession = false;
        }
    });
    STAppFrame.addjCheckBoxEmailReportFailActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        STAppData.EmailReportFail = STAppFrame.getjCheckBoxEmailReportFailSelected();
        if (STAppData.EmailReportFail == true) {
            STAppFrame.setjCheckBoxIncludeScreenshotsEnabled(false);
            STAppData.IncludeScreenshots = false;
            STAppFrame.setjCheckBoxShowReportSelected(false);
            STAppData.ShowReport = false;
            STAppFrame.setjCheckBoxEmailReportSelected(false);
            STAppData.EmailReport = false;
        }
    });
    STAppFrame.addjCheckBoxOSTypeWindows32ActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        if (STAppFrame.getjCheckBoxOSTypeWindows32Selected()) {
            STAppData.OSType = "Windows32";
            STAppFrame.setjCheckBoxOSTypeWindows64Selected(false);
            STAppFrame.setjCheckBoxOSTypeMacSelected(false);
            STAppFrame.setjCheckBoxOSTypeLinux32Selected(false);
            STAppFrame.setjCheckBoxOSTypeLinux64Selected(false);
        }
    });
    STAppFrame.addjCheckBoxOSTypeWindows64ActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        if (STAppFrame.getjCheckBoxOSTypeWindows64Selected()) {
            STAppData.OSType = "Windows64";
            STAppFrame.setjCheckBoxOSTypeWindows32Selected(false);
            STAppFrame.setjCheckBoxOSTypeMacSelected(false);
            STAppFrame.setjCheckBoxOSTypeLinux32Selected(false);
            STAppFrame.setjCheckBoxOSTypeLinux64Selected(false);
        }
    });
    STAppFrame.addjCheckBoxOSTypeMacActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        if (STAppFrame.getjCheckBoxOSTypeMacSelected()) {
            STAppData.OSType = "Mac";
            STAppFrame.setjCheckBoxOSTypeWindows32Selected(false);
            STAppFrame.setjCheckBoxOSTypeLinux32Selected(false);
            STAppFrame.setjCheckBoxOSTypeLinux64Selected(false);
            STAppFrame.setjCheckBoxOSTypeWindows64Selected(false);
        }
    });
    STAppFrame.addjCheckBoxOSTypeLinux32ActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        if (STAppFrame.getjCheckBoxOSTypeLinux32Selected()) {
            STAppData.OSType = "Linux-32";
            STAppFrame.setjCheckBoxOSTypeMacSelected(false);
            STAppFrame.setjCheckBoxOSTypeWindows32Selected(false);
            STAppFrame.setjCheckBoxOSTypeLinux64Selected(false);
            STAppFrame.setjCheckBoxOSTypeWindows64Selected(false);
        }
    });
    STAppFrame.addjCheckBoxOSTypeLinux64ActionListener((ActionEvent e) -> {
        STAppFrame.saveState();
        if (STAppFrame.getjCheckBoxOSTypeLinux64Selected()) {
            STAppData.OSType = "Linux-64";
            STAppFrame.setjCheckBoxOSTypeMacSelected(false);
            STAppFrame.setjCheckBoxOSTypeLinux32Selected(false);
            STAppFrame.setjCheckBoxOSTypeWindows32Selected(false);
            STAppFrame.setjCheckBoxOSTypeWindows64Selected(false);
        }
    });
}
Also used : DocumentListener(javax.swing.event.DocumentListener) ItemEvent(java.awt.event.ItemEvent) ActionEvent(java.awt.event.ActionEvent) FocusEvent(java.awt.event.FocusEvent) ChangeListener(javax.swing.event.ChangeListener) DocumentEvent(javax.swing.event.DocumentEvent) ChangeEvent(javax.swing.event.ChangeEvent) ActionListener(java.awt.event.ActionListener) FocusListener(java.awt.event.FocusListener) File(java.io.File)

Example 20 with FocusListener

use of java.awt.event.FocusListener in project artisynth_core by artisynth.

the class AddPropertyPane method addListeners.

private void addListeners() {
    myPropField.getTextField().addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            if (!isEditable) {
                setEditable(true);
            }
            sendFocusMeEvent();
        // compNameField.getTextField().requestFocus();
        // System.out.println("clicked on compNameField");
        }
    });
    myPropField.getTextField().addFocusListener(new FocusListener() {

        public void focusGained(FocusEvent e) {
        // System.out.println("focus gained by txt box");
        }

        public void focusLost(FocusEvent e) {
            // System.out.println("focus lost by txt box");
            // setEditable(false);
            updateAppearance();
        }
    });
    JComboBox propBox = myPropField.getPropertySelector().getComboBox();
    propBox.addMouseListener(new MouseAdapter() {

        public void mouseClicked(MouseEvent e) {
            // System.out.println("clicked on propSelectBox");
            sendFocusMeEvent();
        }
    });
}
Also used : MouseEvent(java.awt.event.MouseEvent) JComboBox(javax.swing.JComboBox) MouseAdapter(java.awt.event.MouseAdapter) FocusListener(java.awt.event.FocusListener) FocusEvent(java.awt.event.FocusEvent)

Aggregations

FocusListener (java.awt.event.FocusListener)87 FocusEvent (java.awt.event.FocusEvent)80 ActionEvent (java.awt.event.ActionEvent)24 ActionListener (java.awt.event.ActionListener)23 JLabel (javax.swing.JLabel)20 JTextField (javax.swing.JTextField)17 Dimension (java.awt.Dimension)16 JPanel (javax.swing.JPanel)16 JButton (javax.swing.JButton)15 KeyEvent (java.awt.event.KeyEvent)12 JComboBox (javax.swing.JComboBox)11 BorderLayout (java.awt.BorderLayout)9 Component (java.awt.Component)9 MouseEvent (java.awt.event.MouseEvent)9 KeyListener (java.awt.event.KeyListener)8 JCheckBox (javax.swing.JCheckBox)8 ChangeListener (javax.swing.event.ChangeListener)8 Color (java.awt.Color)7 GridBagConstraints (java.awt.GridBagConstraints)7 MouseAdapter (java.awt.event.MouseAdapter)7