This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- custom code pane refresh problem
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 07, 2013
03:37 AM
custom code pane refresh problem
Hi All,
I have created a custom code panel and it contains some jTable and some add, edit, delet buttons. At the very first time the panel button events are working fine and the jTable also getting updated properly but, if i press next or previous buttons in IA and then I tryied to add some more rows into the jTable at that time, the button events are not working properly and also the jTable data getting hidden. if I select the jTable then the data getting visible in the panel. Kindly do the needful
Regards
Baski
I have created a custom code panel and it contains some jTable and some add, edit, delet buttons. At the very first time the panel button events are working fine and the jTable also getting updated properly but, if i press next or previous buttons in IA and then I tryied to add some more rows into the jTable at that time, the button events are not working properly and also the jTable data getting hidden. if I select the jTable then the data getting visible in the panel. Kindly do the needful
Regards
Baski
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 08, 2013
02:31 AM
Hi,
Is there any database connection associated with it.According to your screenshot i feel there could be any connection database happenning over while moving back and forward around the panel.Because i have a custom panel which have combobox,Radio button,Checkbox ,All the events are working fine even though I press "Next" and "Previuos" button.Or else can you share your custom code .Below is the screen shot of my verified customcode panel.
Thanks,
Kshirabdhi
Is there any database connection associated with it.According to your screenshot i feel there could be any connection database happenning over while moving back and forward around the panel.Because i have a custom panel which have combobox,Radio button,Checkbox ,All the events are working fine even though I press "Next" and "Previuos" button.Or else can you share your custom code .Below is the screen shot of my verified customcode panel.
Thanks,
Kshirabdhi
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 12, 2013
01:49 AM
Hi kshirabdhi,
Thanks for your reply, and there is no database connection in my custom code, only thing is I am hiding a panel and showing another panel. below is my custom code(unable to attach file). kindly have a look and guide me if anything wrong.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ia.custompanel.panels;
import com.zerog.ia.api.pub.*;
import javax.swing.table.DefaultTableModel;
public class ExampleTableCustomPanel extends CustomCodePanel {
/**
* Creates new form ExampleTableCustomPanel
*/
private CustomCodePanelProxy ccpp;
String IA_JTable_Values = "";
boolean b_Edit = false;
public ExampleTableCustomPanel() {
}
@Override
public boolean setupUI(CustomCodePanelProxy customCodePanelProxy) {
//removeAll();
ccpp = customCodePanelProxy;
//new_initComponents();
initComponents();
jPanel1.setVisible(false);
this.repaint();
return true;
}
@Override
public String getTitle() {
return "Sample Table"; //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean okToContinue() {
return true;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
////GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
btn_add = new javax.swing.JButton();
btn_edit = new javax.swing.JButton();
btn_delete = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
txt_server_host = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
txt_port_range = new javax.swing.JTextField();
btn_ok = new javax.swing.JButton();
btn_cancel = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
txt_instance_name = new javax.swing.JTextField();
setMinimumSize(new java.awt.Dimension(3, 0));
setLayout(new javax.swing.OverlayLayout(this));
jTable1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Server Host", "Port Range", "Instance Name"
}
));
jScrollPane1.setViewportView(jTable1);
btn_add.setText("Add");
btn_add.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_addActionPerformed(evt);
}
});
btn_edit.setText("Edit");
btn_edit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_editActionPerformed(evt);
}
});
btn_delete.setText("Delete");
btn_delete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_deleteActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(56, 56, 56)
.addComponent(btn_add, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5)
.addComponent(btn_edit, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5)
.addComponent(btn_delete, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_add)
.addComponent(btn_edit)
.addComponent(btn_delete))
.addContainerGap())
);
add(jPanel2);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 322, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 236, Short.MAX_VALUE)
);
add(jPanel3);
jLabel1.setText("Server Host");
jLabel2.setText("Port Range");
btn_ok.setText("Ok");
btn_ok.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_okActionPerformed(evt);
}
});
btn_cancel.setText("Cancel");
btn_cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_cancelActionPerformed(evt);
}
});
jLabel3.setText("Instance Name");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(23, 23, 23)
.addComponent(txt_server_host, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(26, 26, 26)
.addComponent(txt_port_range, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(8, 8, 😎
.addComponent(txt_instance_name, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(btn_ok)
.addGap(5, 5, 5)
.addComponent(btn_cancel)))
.addContainerGap(75, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(txt_server_host, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(txt_port_range, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(txt_instance_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_ok)
.addComponent(btn_cancel))
.addGap(31, 31, 31))
);
add(jPanel1);
}// //GEN-END:initComponents
private void btn_addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_addActionPerformed
// TODO add your handling code here:
jPanel2.setVisible(false);
jPanel1.setVisible(true);
b_Edit = false;
this.repaint();
}//GEN-LAST:event_btn_addActionPerformed
private void btn_okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_okActionPerformed
// TODO add your handling code here:
javax.swing.table.DefaultTableModel model;
model = (DefaultTableModel)jTable1.getModel();
if(!"".equals(txt_instance_name.getText()) && !"".equals(txt_port_range.getText()) && !"".equals(txt_server_host.getText()))
{
Object[] row = new Object[3];
row[0] = txt_server_host.getText();
row[1] = txt_port_range.getText();
row[2] = txt_instance_name.getText();
if(b_Edit == false)
{
model.addRow(row);
}
else
{
model.removeRow(jTable1.getSelectedRow());
model.addRow(row);
}
//javax.swing.JOptionPane.showMessageDialog(null,b_Edit);
//javax.swing.JOptionPane.showMessageDialog(null,txt_instance_name.getText());
//javax.swing.JOptionPane.showMessageDialog(null,txt_port_range.getText());
//javax.swing.JOptionPane.showMessageDialog(null,txt_server_host.getText());
b_Edit = false;
txt_instance_name.setText("");
txt_port_range.setText("");
txt_server_host.setText("");
jPanel2.setVisible(true);
jPanel1.setVisible(false);
this.repaint();
String jTable_value = "";
int cols = jTable1.getColumnCount();
int rows = jTable1.getRowCount();
for(int i=0; i {
if (i>0){jTable_value += "|";}
for(int j=0; j {
jTable_value += (String)jTable1.getValueAt(i, j);
if (j }
}
ccpp.setVariable("IA_JTable_Values", jTable_value);
}
}//GEN-LAST:event_btn_okActionPerformed
private void btn_cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cancelActionPerformed
// TODO add your handling code here:
jPanel2.setVisible(true);
jPanel1.setVisible(false);
this.repaint();
}//GEN-LAST:event_btn_cancelActionPerformed
private void btn_editActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_editActionPerformed
// TODO add your handling code here:
b_Edit = true;
javax.swing.table.DefaultTableModel model;
model = (DefaultTableModel)jTable1.getModel();
//javax.swing.JOptionPane.showMessageDialog(null,jTable1.getSelectedRow());
//javax.swing.JOptionPane.showMessageDialog(null,(String)model.getValueAt(jTable1.getSelectedRow(),1));
txt_instance_name.setText((String)model.getValueAt(jTable1.getSelectedRow(),0));
txt_port_range.setText((String)model.getValueAt(jTable1.getSelectedRow(),1));
txt_server_host.setText((String)model.getValueAt(jTable1.getSelectedRow(),2));
jPanel2.setVisible(false);
jPanel1.setVisible(true);
this.repaint();
}//GEN-LAST:event_btn_editActionPerformed
private void btn_deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_deleteActionPerformed
// TODO add your handling code here:
javax.swing.table.DefaultTableModel model;
model = (DefaultTableModel)jTable1.getModel();
model.removeRow(jTable1.getSelectedRow());
}//GEN-LAST:event_btn_deleteActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btn_add;
private javax.swing.JButton btn_cancel;
private javax.swing.JButton btn_delete;
private javax.swing.JButton btn_edit;
private javax.swing.JButton btn_ok;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txt_instance_name;
private javax.swing.JTextField txt_port_range;
private javax.swing.JTextField txt_server_host;
// End of variables declaration//GEN-END:variables
}
Thanks
Baski
Thanks for your reply, and there is no database connection in my custom code, only thing is I am hiding a panel and showing another panel. below is my custom code(unable to attach file). kindly have a look and guide me if anything wrong.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ia.custompanel.panels;
import com.zerog.ia.api.pub.*;
import javax.swing.table.DefaultTableModel;
public class ExampleTableCustomPanel extends CustomCodePanel {
/**
* Creates new form ExampleTableCustomPanel
*/
private CustomCodePanelProxy ccpp;
String IA_JTable_Values = "";
boolean b_Edit = false;
public ExampleTableCustomPanel() {
}
@Override
public boolean setupUI(CustomCodePanelProxy customCodePanelProxy) {
//removeAll();
ccpp = customCodePanelProxy;
//new_initComponents();
initComponents();
jPanel1.setVisible(false);
this.repaint();
return true;
}
@Override
public String getTitle() {
return "Sample Table"; //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean okToContinue() {
return true;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
btn_add = new javax.swing.JButton();
btn_edit = new javax.swing.JButton();
btn_delete = new javax.swing.JButton();
jPanel3 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
txt_server_host = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
txt_port_range = new javax.swing.JTextField();
btn_ok = new javax.swing.JButton();
btn_cancel = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
txt_instance_name = new javax.swing.JTextField();
setMinimumSize(new java.awt.Dimension(3, 0));
setLayout(new javax.swing.OverlayLayout(this));
jTable1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Server Host", "Port Range", "Instance Name"
}
));
jScrollPane1.setViewportView(jTable1);
btn_add.setText("Add");
btn_add.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_addActionPerformed(evt);
}
});
btn_edit.setText("Edit");
btn_edit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_editActionPerformed(evt);
}
});
btn_delete.setText("Delete");
btn_delete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_deleteActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(56, 56, 56)
.addComponent(btn_add, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5)
.addComponent(btn_edit, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(5, 5, 5)
.addComponent(btn_delete, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_add)
.addComponent(btn_edit)
.addComponent(btn_delete))
.addContainerGap())
);
add(jPanel2);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 322, Short.MAX_VALUE)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 236, Short.MAX_VALUE)
);
add(jPanel3);
jLabel1.setText("Server Host");
jLabel2.setText("Port Range");
btn_ok.setText("Ok");
btn_ok.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_okActionPerformed(evt);
}
});
btn_cancel.setText("Cancel");
btn_cancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_cancelActionPerformed(evt);
}
});
jLabel3.setText("Instance Name");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(23, 23, 23)
.addComponent(txt_server_host, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(26, 26, 26)
.addComponent(txt_port_range, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(8, 8, 😎
.addComponent(txt_instance_name, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(btn_ok)
.addGap(5, 5, 5)
.addComponent(btn_cancel)))
.addContainerGap(75, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(txt_server_host, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(txt_port_range, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(txt_instance_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_ok)
.addComponent(btn_cancel))
.addGap(31, 31, 31))
);
add(jPanel1);
}//
private void btn_addActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_addActionPerformed
// TODO add your handling code here:
jPanel2.setVisible(false);
jPanel1.setVisible(true);
b_Edit = false;
this.repaint();
}//GEN-LAST:event_btn_addActionPerformed
private void btn_okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_okActionPerformed
// TODO add your handling code here:
javax.swing.table.DefaultTableModel model;
model = (DefaultTableModel)jTable1.getModel();
if(!"".equals(txt_instance_name.getText()) && !"".equals(txt_port_range.getText()) && !"".equals(txt_server_host.getText()))
{
Object[] row = new Object[3];
row[0] = txt_server_host.getText();
row[1] = txt_port_range.getText();
row[2] = txt_instance_name.getText();
if(b_Edit == false)
{
model.addRow(row);
}
else
{
model.removeRow(jTable1.getSelectedRow());
model.addRow(row);
}
//javax.swing.JOptionPane.showMessageDialog(null,b_Edit);
//javax.swing.JOptionPane.showMessageDialog(null,txt_instance_name.getText());
//javax.swing.JOptionPane.showMessageDialog(null,txt_port_range.getText());
//javax.swing.JOptionPane.showMessageDialog(null,txt_server_host.getText());
b_Edit = false;
txt_instance_name.setText("");
txt_port_range.setText("");
txt_server_host.setText("");
jPanel2.setVisible(true);
jPanel1.setVisible(false);
this.repaint();
String jTable_value = "";
int cols = jTable1.getColumnCount();
int rows = jTable1.getRowCount();
for(int i=0; i
if (i>0){jTable_value += "|";}
for(int j=0; j
jTable_value += (String)jTable1.getValueAt(i, j);
if (j
}
ccpp.setVariable("IA_JTable_Values", jTable_value);
}
}//GEN-LAST:event_btn_okActionPerformed
private void btn_cancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cancelActionPerformed
// TODO add your handling code here:
jPanel2.setVisible(true);
jPanel1.setVisible(false);
this.repaint();
}//GEN-LAST:event_btn_cancelActionPerformed
private void btn_editActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_editActionPerformed
// TODO add your handling code here:
b_Edit = true;
javax.swing.table.DefaultTableModel model;
model = (DefaultTableModel)jTable1.getModel();
//javax.swing.JOptionPane.showMessageDialog(null,jTable1.getSelectedRow());
//javax.swing.JOptionPane.showMessageDialog(null,(String)model.getValueAt(jTable1.getSelectedRow(),1));
txt_instance_name.setText((String)model.getValueAt(jTable1.getSelectedRow(),0));
txt_port_range.setText((String)model.getValueAt(jTable1.getSelectedRow(),1));
txt_server_host.setText((String)model.getValueAt(jTable1.getSelectedRow(),2));
jPanel2.setVisible(false);
jPanel1.setVisible(true);
this.repaint();
}//GEN-LAST:event_btn_editActionPerformed
private void btn_deleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_deleteActionPerformed
// TODO add your handling code here:
javax.swing.table.DefaultTableModel model;
model = (DefaultTableModel)jTable1.getModel();
model.removeRow(jTable1.getSelectedRow());
}//GEN-LAST:event_btn_deleteActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btn_add;
private javax.swing.JButton btn_cancel;
private javax.swing.JButton btn_delete;
private javax.swing.JButton btn_edit;
private javax.swing.JButton btn_ok;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField txt_instance_name;
private javax.swing.JTextField txt_port_range;
private javax.swing.JTextField txt_server_host;
// End of variables declaration//GEN-END:variables
}
Thanks
Baski
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)