Skip to content

Commit

Permalink
Merge pull request #40 from evolvedbinary/fix/overflow
Browse files Browse the repository at this point in the history
Refactor the Code For Netbeans UI designer
  • Loading branch information
adamretter authored Jan 23, 2024
2 parents a1329c8 + e15a798 commit 517b49f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 79 deletions.
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"/>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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..."/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fetchjButtonActionPerformed"/>
Expand All @@ -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>
Expand All @@ -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"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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() {
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) {
Expand All @@ -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) {
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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)
Expand All @@ -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();
Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -296,6 +284,7 @@ private void restultsJTableMousePressed(java.awt.event.MouseEvent evt) {//GEN-FI

}//GEN-LAST:event_restultsJTableMousePressed


// /**
// * @param args the command line arguments
// */
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 517b49f

Please sign in to comment.