From 5a718d7d99221656c4adc0d1f5de8aa91e2f70f6 Mon Sep 17 00:00:00 2001 From: marmoure Date: Sat, 13 Jan 2024 22:26:49 +0100 Subject: [PATCH 1/2] [bugfix] restore the ui form code to a state that's acceptable for beans IDE This happen due to manual changes to the code --- .../tei/completer/GUI/newSuggestionForm.form | 73 ++++++------ .../tei/completer/GUI/newSuggestionForm.java | 109 +++++++----------- 2 files changed, 78 insertions(+), 104 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 98b2d4b..4932654 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 @@ -1,10 +1,12 @@ + +
@@ -29,34 +31,31 @@ - + - - - - - - - - - - - - - - - - - + + + + + + + + - + + + + + + + - + @@ -70,16 +69,16 @@ - + - + - + @@ -100,23 +99,17 @@ - + - - - - - - - + @@ -125,10 +118,18 @@ + + + + + + + + - + @@ -144,8 +145,7 @@ - - +
@@ -162,11 +162,6 @@ - - - <Editor/> - <Renderer/> - </Column> </TableColumnModel> </Property> <Property name="columnSelectionAllowed" type="boolean" value="true"/> 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 a2cec28..4b0dde9 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 @@ -84,7 +84,7 @@ private void initComponents() { restultsJTable = new javax.swing.JTable(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("Custom lookup"); + cancleJButton.setText("Cancel"); cancleJButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -96,16 +96,26 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { jLabel1.setText("Custom lookup"); dependentJLabel.setText("Dependent:"); - dependentJLabel.setToolTipText(""); - dependentJTextField.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - dependentJTextFieldActionPerformed(evt); + 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() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -115,16 +125,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { restultsJTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { + }, new String [] { - "Value", "Description" + "Value", "Description" } ) { Class[] types = new Class [] { - java.lang.String.class, java.lang.String.class + java.lang.String.class, java.lang.String.class }; boolean[] canEdit = new boolean [] { - false, false + false, false }; public Class getColumnClass(int columnIndex) { @@ -144,11 +155,6 @@ public void mousePressed(java.awt.event.MouseEvent evt) { jScrollPane2.setViewportView(restultsJTable); restultsJTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - restultsJTable.setCellSelectionEnabled(false); - restultsJTable.setRowSelectionAllowed(true); - - restultsJTable.getColumnModel().getColumn(0).setPreferredWidth(120); - restultsJTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( @@ -159,22 +165,20 @@ public void mousePressed(java.awt.event.MouseEvent evt) { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(cancleJButton)) - .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 460, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jLabel1) - .addGroup(layout.createSequentialGroup() - .addGap(6, 6, 6) - .addComponent(dependentJLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(dependentJTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createSequentialGroup() - .addGap(16, 16, 16) - .addComponent(selectionJLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(selectionJTextField)) - .addComponent(fetchjButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(0, 0, Short.MAX_VALUE))) + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 706, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel1) + .addGroup(layout.createSequentialGroup() + .addGap(8, 8, 8) + .addComponent(selectionJLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(selectionJTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createSequentialGroup() + .addGap(6, 6, 6) + .addComponent(dependentJLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(dependentJTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 306, Short.MAX_VALUE)) + .addComponent(fetchjButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); layout.setVerticalGroup( @@ -189,7 +193,7 @@ public void mousePressed(java.awt.event.MouseEvent evt) { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(selectionJLabel) - .addComponent(selectionJTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(selectionJTextField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(8, 8, 8) .addComponent(fetchjButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) @@ -199,36 +203,6 @@ public void mousePressed(java.awt.event.MouseEvent evt) { .addContainerGap()) ); - 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 @@ -238,10 +212,6 @@ private void cancleJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN dispose(); }//GEN-LAST:event_cancleJButtonActionPerformed - private void dependentJTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dependentJTextFieldActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_dependentJTextFieldActionPerformed - private void fetchjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fetchjButtonActionPerformed // TODO add your handling code here: @@ -296,6 +266,15 @@ 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 // */ @@ -340,13 +319,13 @@ private void restultsJTableMousePressed(java.awt.event.MouseEvent evt) {//GEN-FI // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton cancleJButton; + private javax.swing.JLabel dependentJLabel; private javax.swing.JTextField dependentJTextField; private javax.swing.JButton fetchjButton; private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTable restultsJTable; private javax.swing.JLabel selectionJLabel; - private javax.swing.JLabel dependentJLabel; private javax.swing.JTextField selectionJTextField; // End of variables declaration//GEN-END:variables From e15a7989ab12a3c5c3332756475a4859b8b0c75b Mon Sep 17 00:00:00 2001 From: marmoure <tinky93winky@gmail.com> Date: Fri, 19 Jan 2024 11:29:51 +0100 Subject: [PATCH 2/2] [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 @@ </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> @@ -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> 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(); }// </editor-fold>//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 // */