From e15a7989ab12a3c5c3332756475a4859b8b0c75b Mon Sep 17 00:00:00 2001 From: marmoure Date: Fri, 19 Jan 2024 11:29:51 +0100 Subject: [PATCH] [bugfix] reinstate missing feature --- .../tei/completer/GUI/newSuggestionForm.form | 6 -- .../tei/completer/GUI/newSuggestionForm.java | 56 +++++++++++-------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/src/main/java/org/humanistika/oxygen/tei/completer/GUI/newSuggestionForm.form b/src/main/java/org/humanistika/oxygen/tei/completer/GUI/newSuggestionForm.form index 4932654..1d743d5 100644 --- a/src/main/java/org/humanistika/oxygen/tei/completer/GUI/newSuggestionForm.form +++ b/src/main/java/org/humanistika/oxygen/tei/completer/GUI/newSuggestionForm.form @@ -108,9 +108,6 @@ - - - @@ -123,9 +120,6 @@ - - - diff --git a/src/main/java/org/humanistika/oxygen/tei/completer/GUI/newSuggestionForm.java b/src/main/java/org/humanistika/oxygen/tei/completer/GUI/newSuggestionForm.java index 4b0dde9..4e699fc 100644 --- a/src/main/java/org/humanistika/oxygen/tei/completer/GUI/newSuggestionForm.java +++ b/src/main/java/org/humanistika/oxygen/tei/completer/GUI/newSuggestionForm.java @@ -97,24 +97,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { dependentJLabel.setText("Dependent:"); - dependentJTextField.addInputMethodListener(new java.awt.event.InputMethodListener() { - public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { - } - public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { - dependentJTextFieldInputMethodTextChanged(evt); - } - }); - selectionJLabel.setText("Selection:"); selectionJTextField.setMinimumSize(new java.awt.Dimension(200, 22)); - selectionJTextField.addInputMethodListener(new java.awt.event.InputMethodListener() { - public void caretPositionChanged(java.awt.event.InputMethodEvent evt) { - } - public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) { - selectionJTextFieldInputMethodTextChanged(evt); - } - }); fetchjButton.setText("Search..."); fetchjButton.addActionListener(new java.awt.event.ActionListener() { @@ -203,6 +188,39 @@ public void mousePressed(java.awt.event.MouseEvent evt) { .addContainerGap()) ); + + // this will break the UI design in netbeans IDE but no alternative + // was found to get the text change event + selectionJTextField.getDocument().addDocumentListener(new DocumentListener() { + public void insertUpdate(DocumentEvent e) { + textChanged(); + } + + public void removeUpdate(DocumentEvent e) { + textChanged(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + + } + }); + + dependentJTextField.getDocument().addDocumentListener(new DocumentListener() { + public void insertUpdate(DocumentEvent e) { + textChanged(); + } + + public void removeUpdate(DocumentEvent e) { + textChanged(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + + } + }); + pack(); }// //GEN-END:initComponents @@ -267,14 +285,6 @@ private void restultsJTableMousePressed(java.awt.event.MouseEvent evt) {//GEN-FI }//GEN-LAST:event_restultsJTableMousePressed - private void dependentJTextFieldInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_dependentJTextFieldInputMethodTextChanged - // TODO add your handling code here: - }//GEN-LAST:event_dependentJTextFieldInputMethodTextChanged - - private void selectionJTextFieldInputMethodTextChanged(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_selectionJTextFieldInputMethodTextChanged - // TODO add your handling code here: - }//GEN-LAST:event_selectionJTextFieldInputMethodTextChanged - // /** // * @param args the command line arguments // */