-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor the Code For Netbeans UI designer #40
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
|
||
<!-- | ||
TEI-Completer UI form | ||
@author: Adam Retter | ||
@version: 1.0 | ||
14 Nov 2023 | ||
--> | ||
|
||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> | ||
<Properties> | ||
<Property name="defaultCloseOperation" type="int" value="2"/> | ||
|
@@ -29,34 +31,31 @@ | |
<DimensionLayout dim="0"> | ||
<Group type="103" groupAlignment="0" attributes="0"> | ||
<Group type="102" attributes="0"> | ||
<EmptySpace max="-2" attributes="0"/> | ||
<EmptySpace min="-2" max="-2" attributes="0"/> | ||
<Group type="103" groupAlignment="0" attributes="0"> | ||
<Group type="102" alignment="1" attributes="0"> | ||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> | ||
<Component id="cancleJButton" min="-2" max="-2" attributes="0"/> | ||
</Group> | ||
<Component id="jScrollPane2" pref="460" max="32767" attributes="0"/> | ||
<Group type="102" attributes="0"> | ||
<Group type="103" groupAlignment="0" max="-2" attributes="0"> | ||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/> | ||
<Group type="102" alignment="0" attributes="0"> | ||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/> | ||
<Component id="dependentJLabel" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace max="-2" attributes="0"/> | ||
<Component id="dependentJTextField" min="-2" pref="109" max="-2" attributes="0"/> | ||
</Group> | ||
<Group type="102" alignment="0" attributes="0"> | ||
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/> | ||
<Component id="selectionJLabel" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace max="-2" attributes="0"/> | ||
<Component id="selectionJTextField" max="32767" attributes="0"/> | ||
</Group> | ||
<Component id="fetchjButton" alignment="1" min="-2" pref="92" max="-2" attributes="0"/> | ||
<Component id="jScrollPane2" pref="706" max="32767" attributes="0"/> | ||
<Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0"> | ||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/> | ||
<Group type="102" alignment="0" attributes="0"> | ||
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/> | ||
<Component id="selectionJLabel" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace max="-2" attributes="0"/> | ||
<Component id="selectionJTextField" max="32767" attributes="0"/> | ||
</Group> | ||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> | ||
<Group type="102" alignment="0" attributes="0"> | ||
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/> | ||
<Component id="dependentJLabel" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace max="-2" attributes="0"/> | ||
<Component id="dependentJTextField" pref="306" max="32767" attributes="0"/> | ||
</Group> | ||
<Component id="fetchjButton" alignment="1" min="-2" pref="92" max="-2" attributes="0"/> | ||
</Group> | ||
</Group> | ||
<EmptySpace max="-2" attributes="0"/> | ||
<EmptySpace min="-2" max="-2" attributes="0"/> | ||
</Group> | ||
</Group> | ||
</DimensionLayout> | ||
|
@@ -70,16 +69,16 @@ | |
<Component id="dependentJLabel" alignment="3" min="-2" max="-2" attributes="0"/> | ||
<Component id="dependentJTextField" alignment="3" min="-2" max="-2" attributes="0"/> | ||
</Group> | ||
<EmptySpace min="-2" max="-2" attributes="0"/> | ||
<EmptySpace max="-2" attributes="0"/> | ||
<Group type="103" groupAlignment="3" attributes="0"> | ||
<Component id="selectionJLabel" alignment="3" min="-2" max="-2" attributes="0"/> | ||
<Component id="selectionJTextField" alignment="3" min="-2" max="-2" attributes="0"/> | ||
<Component id="selectionJTextField" alignment="3" max="32767" attributes="0"/> | ||
</Group> | ||
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/> | ||
<Component id="fetchjButton" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace type="unrelated" max="-2" attributes="0"/> | ||
<Component id="jScrollPane2" pref="307" max="32767" attributes="0"/> | ||
<EmptySpace max="-2" attributes="0"/> | ||
<EmptySpace min="-2" max="-2" attributes="0"/> | ||
<Component id="cancleJButton" min="-2" max="-2" attributes="0"/> | ||
<EmptySpace min="-2" max="-2" attributes="0"/> | ||
</Group> | ||
|
@@ -100,35 +99,31 @@ | |
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | ||
<Font name="Segoe UI" size="18" style="0"/> | ||
</Property> | ||
<Property name="text" type="java.lang.String" value="Custom Lookup"/> | ||
<Property name="text" type="java.lang.String" value="Custom lookup"/> | ||
</Properties> | ||
</Component> | ||
<Component class="javax.swing.JLabel" name="dependentJLabel"> | ||
<Properties> | ||
<Property name="text" type="java.lang.String" value="Dependent:"/> | ||
<Property name="toolTipText" type="java.lang.String" value=""/> | ||
</Properties> | ||
<AuxValues> | ||
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="newSuggestionForm_dependentJLabel"/> | ||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/> | ||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/> | ||
</AuxValues> | ||
</Component> | ||
<Component class="javax.swing.JTextField" name="dependentJTextField"> | ||
<Events> | ||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="dependentJTextFieldActionPerformed"/> | ||
</Events> | ||
</Component> | ||
<Component class="javax.swing.JLabel" name="selectionJLabel"> | ||
<Properties> | ||
<Property name="text" type="java.lang.String" value="Selection:"/> | ||
</Properties> | ||
</Component> | ||
<Component class="javax.swing.JTextField" name="selectionJTextField"> | ||
<Properties> | ||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | ||
<Dimension value="[200, 22]"/> | ||
</Property> | ||
</Properties> | ||
</Component> | ||
<Component class="javax.swing.JButton" name="fetchjButton"> | ||
<Properties> | ||
<Property name="text" type="java.lang.String" value="Search"/> | ||
<Property name="text" type="java.lang.String" value="Search..."/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to rename the text on this button? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is that? It doesn't seem related to the title of the PR? |
||
</Properties> | ||
<Events> | ||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fetchjButtonActionPerformed"/> | ||
|
@@ -144,8 +139,7 @@ | |
<Component class="javax.swing.JTable" name="restultsJTable"> | ||
<Properties> | ||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor"> | ||
<Table columnCount="3" rowCount="1"> | ||
<Column editable="false" title="#" type="java.lang.Integer"/> | ||
<Table columnCount="2" rowCount="0"> | ||
<Column editable="false" title="Value" type="java.lang.String"/> | ||
<Column editable="false" title="Description" type="java.lang.String"/> | ||
</Table> | ||
|
@@ -162,11 +156,6 @@ | |
<Editor/> | ||
<Renderer/> | ||
</Column> | ||
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true"> | ||
<Title/> | ||
<Editor/> | ||
<Renderer/> | ||
</Column> | ||
</TableColumnModel> | ||
</Property> | ||
<Property name="columnSelectionAllowed" type="boolean" value="true"/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ private void initComponents() { | |
restultsJTable = new javax.swing.JTable(); | ||
|
||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); | ||
setTitle("Custom lookup"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to remove the title? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Erm... okay, but why? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This String is already Set in newSuggestionForm.form And this is now duplicated. |
||
|
||
cancleJButton.setText("Cancel"); | ||
cancleJButton.addActionListener(new java.awt.event.ActionListener() { | ||
public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
|
@@ -96,16 +96,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { | |
jLabel1.setText("Custom lookup"); | ||
|
||
dependentJLabel.setText("Dependent:"); | ||
dependentJLabel.setToolTipText(""); | ||
|
||
dependentJTextField.addActionListener(new java.awt.event.ActionListener() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to remove this listener? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay... but why did you decide to remove it? |
||
public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
dependentJTextFieldActionPerformed(evt); | ||
} | ||
}); | ||
|
||
selectionJLabel.setText("Selection:"); | ||
|
||
selectionJTextField.setMinimumSize(new java.awt.Dimension(200, 22)); | ||
|
||
fetchjButton.setText("Search..."); | ||
fetchjButton.addActionListener(new java.awt.event.ActionListener() { | ||
public void actionPerformed(java.awt.event.ActionEvent evt) { | ||
|
@@ -115,16 +110,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 +140,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 +150,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 +178,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,6 +188,9 @@ 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(); | ||
|
@@ -238,10 +230,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 +284,7 @@ private void restultsJTableMousePressed(java.awt.event.MouseEvent evt) {//GEN-FI | |
|
||
}//GEN-LAST:event_restultsJTableMousePressed | ||
|
||
|
||
// /** | ||
// * @param args the command line arguments | ||
// */ | ||
|
@@ -340,13 +329,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 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to rename the text of this label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that? It doesn't seem related to the title of the PR?