Skip to content

Commit

Permalink
[bugfix] reinstate missing feature
Browse files Browse the repository at this point in the history
  • Loading branch information
marmoure committed Jan 19, 2024
1 parent 5a718d7 commit e15a798
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="dependentJTextField">
<Events>
<EventHandler event="inputMethodTextChanged" listener="java.awt.event.InputMethodListener" parameters="java.awt.event.InputMethodEvent" handler="dependentJTextFieldInputMethodTextChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="selectionJLabel">
<Properties>
Expand All @@ -123,9 +120,6 @@
<Dimension value="[200, 22]"/>
</Property>
</Properties>
<Events>
<EventHandler event="inputMethodTextChanged" listener="java.awt.event.InputMethodListener" parameters="java.awt.event.InputMethodEvent" handler="selectionJTextFieldInputMethodTextChanged"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="fetchjButton">
<Properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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();
}// </editor-fold>//GEN-END:initComponents

Expand Down Expand Up @@ -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
// */
Expand Down

0 comments on commit e15a798

Please sign in to comment.