Originally posted by Paul Stevens:
Compiled for me after commenting all references to GenSequencesGui. How about giving the line number that the compiler gave to you.
Paul,
Thanks for your quick response, I do appreciate it.
[email protected], Forte did not report the line number. Below is the actual errors:
C:\forte4j\com\teoco\GenSequences\NewExceptions.java: Invalid use of "this" selector syntax
C:\forte4j\com\teoco\GenSequences\NewExceptions.java: Invalid use of "this" selector syntax
C:\forte4j\com\teoco\GenSequences\NewExceptions.java: Invalid use of "this" selector syntax
C:\forte4j\com\teoco\GenSequences\NewExceptions.java: Invalid use of "this" selector syntax
Note: C:\forte4j\com\teoco\GenSequences\NewExceptions.java uses a deprecated API. Recompile with "-deprecation" for details.
4 errors
So here are a couple of the associated files. Maybe they will help in diagnosing the problem. Thanks again.
package com.teoco.GenSequences;
import java.io.File;
import java.awt.*;
import java.awt.TextField;
import java.awt.event.*;
import javax.swing.*;
import java.io.FileFilter;
import java.sql.*;
import java.util.Enumeration;
import com.teoco.GenSequences.*;
import com.teoco.Utilities.XmlInterface;
import java.util.Vector;
import java.util.Hashtable;
import org.xml.sax.AttributeList;
public class GenSequencesGui extends Frame implements ActionListener {
public GenSequencesGui()
{
//setIconImage(Toolkit.getDefaultToolkit().getImage("images/eplogo.gif"));
setTitle("GenSequences");
setLayout(new BorderLayout(0, 25));
setSize(500, 375);
setBackground(Color.lightGray);
addWindowListener(new WindowDestroyer());
Label northLabel = new Label();
add("North", northLabel);
Label eastLabel = new Label();
add("East", eastLabel);
Label westLabel = new Label();
add("West", westLabel);
Panel centerPanel = new Panel(new GridLayout(7, 2, 10, 10));
add("Center", centerPanel);
Label dbInstance = new Label("Database Instance");
centerPanel.add(dbInstance);
instance = new TextField();
centerPanel.add(instance);
Label dbHost = new Label("Database Host");
centerPanel.add(dbHost);
host = new TextField();
centerPanel.add(host);
Label dbPort = new Label("Port Number");
centerPanel.add(dbPort);
port = new TextField("1521");
centerPanel.add(port);
Label dbUsername = new Label("Username");
centerPanel.add(dbUsername);
username = new TextField();
centerPanel.add(username);
Label dbPassword = new Label("Password");
centerPanel.add(dbPassword);
password = new TextField();
centerPanel.add(password);
password.setEchoChar('*');
Label dbConfirmPassword = new Label("Confirm Password");
centerPanel.add(dbConfirmPassword);
confirmPassword = new TextField();
centerPanel.add(confirmPassword);
confirmPassword.setEchoChar('*');
Panel southPanel = new Panel(new BorderLayout());
add("South", southPanel);
TextField sField = new TextField();// This is the status bar field.
sField.setEditable(false);
southPanel.add("South", sField);
Label eLabel = new Label();
southPanel.add("East", eLabel);
Label wLabel = new Label();
southPanel.add("West", wLabel);
Panel sPanel = new Panel(new BorderLayout());
southPanel.add("North", sPanel);
Label sPanelELabel = new Label();
sPanel.add("East", sPanelELabel);
Label sPanelWLabel = new Label();
sPanel.add("West", sPanelWLabel);
Panel lastPanel = new Panel(new GridLayout(1, 3, 30, 0));
sPanel.add("Center", lastPanel);
Button genSeq = new Button("Generate Sequences");
lastPanel.add(genSeq);
genSeq.addActionListener(this);
Button testDBConn = new Button("Test Connection");
lastPanel.add(testDBConn);
testDBConn.addActionListener(this);
Button clearFields = new Button("Clear Fields");
lastPanel.add(clearFields);
clearFields.addActionListener(this);
Menu fileMenu = new Menu("File");
MenuItem gs = new MenuItem("Generate Sequences");
gs.addActionListener(this);
fileMenu.add(gs);
MenuItem tc = new MenuItem("Test Connection");
tc.addActionListener(this);
fileMenu.add(tc);
MenuItem cf = new MenuItem("Clear Fields");
cf.addActionListener(this);
fileMenu.add(cf);
MenuItem cs = new MenuItem("Check Sequences");
cs.addActionListener(this);
fileMenu.add(cs);
MenuItem exit = new MenuItem("Exit");
exit.addActionListener(this);
fileMenu.add(exit);
Menu viewMenu = new Menu("View");
MenuItem vl = new MenuItem("View Log");
vl.addActionListener(this);
viewMenu.add(vl);
MenuItem r = new MenuItem("Refresh");
r.addActionListener(this);
viewMenu.add(r);
MenuItem ed = new MenuItem("Exceptions Editor");
ed.addActionListener(this);
viewMenu.add(ed);
MenuBar mBar = new MenuBar();
mBar.add(fileMenu);
mBar.add(viewMenu);
setMenuBar(mBar);
}
public class PropertyEntry
{
PropertyEntry(String tblName, String tblField)
{
myExceptionTableName = tblName;
myExceptionTableField = tblField;
}
String getExceptionTableName()
{return myExceptionTableName;}
String getExceptionTableField()
{return myExceptionTableField;}
private String myExceptionTableName;
private String myExceptionTableField;
}
public void load()
{
XmlInterface xml = new XmlInterface();
try
{
xml.getAttributes(myExceptionsFile, new XmlHandler()); // Getting attributes of exceptions xml file.
}
catch(Exception ex)
{
String errorText = "Error parsing the exceptions file";
ErrorDialog fileCreateDialog = new ErrorDialog(new GenSequencesGui(), errorText, true);
}
}
private class XmlHandler implements XmlInterface.XmlAttributeHandler
{
// This method is called for every element name.
public void startElement(String name, AttributeList attrs)
{
Vector properties;
Vector temp;
if (name.equalsIgnoreCase("SEQUENCE"))
{
properties = new Vector();
seqName = attrs.getValue("name");
myExceptionsHash.put(seqName, properties);
}
if (name.equalsIgnoreCase("TABLE"))
{
temp = (Vector)myExceptionsHash.get(seqName);
PropertyEntry entry = new PropertyEntry(attrs.getValue("tbl_name"), attrs.getValue("fld_name"));
temp.add(entry);
}
}
}
public static void main(String[] args)
{
GenSequencesGui myGui = new GenSequencesGui();
myGui.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
String actionCommand = e.getActionCommand();
if(actionCommand.equals("Exceptions Editor"))
{
load();
ExceptionDialog ed = new ExceptionDialog(this, myExceptionsHash);
ed.setVisible(true);
}
if(actionCommand.equals("Exit"))
{
this.setVisible(false);
}
if(actionCommand.equals("Test Connection"))// Create a connection to the database. Show confirmation pop up.
{
String inst = instance.getText();
String h = host.getText();
int p = Integer.parseInt(port.getText());
String uname = username.getText();
String pwd = password.getText();
String conpwd = confirmPassword.getText();
DBConnect testConn = new DBConnect(h, p, inst, uname, pwd, conpwd);
testConn.testConnection();
}
if(actionCommand.equals("Generate Sequences"))
{
String inst = instance.getText();
String h = host.getText();
int p = Integer.parseInt(port.getText());
String uname = username.getText();
String pwd = password.getText();
String conpwd = confirmPassword.getText();
GenerateSequences genSeq = new GenerateSequences(h, p, inst, uname, pwd, conpwd);
}
if(actionCommand.equals("Clear Fields"))
{
instance.setText("");
host.setText("");
port.setText("");
username.setText("");
password.setText("");
confirmPassword.setText("");
}
}
public TextField instance;
public TextField host;
public TextField port;
public TextField username;
public TextField password;
public TextField confirmPassword;
public Hashtable myExceptionsHash = new Hashtable();
public String seqName;
public File myExceptionsFile = new File("com\\teoco\\GenSequences\\Exceptions.xml");
public Vector mySequenceNames = new Vector();
}
package com.teoco.GenSequences;
import java.awt.*;
import javax.swing.*;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.ListSelectionEvent;
import java.util.Hashtable;
import java.util.Enumeration;
public class ExceptionDialog extends javax.swing.JDialog
{
public ExceptionDialog(Frame parent, Hashtable exceptions)
{
super(parent);
myExceptionsHash = exceptions;
getContentPane().setLayout(new GridLayout(1,1,0,0));
setSize(405,305);
setVisible(false);
JPanel1.setLayout(new GridLayout(3,1,0,0));
getContentPane().add(JPanel1);
JPanel2.setLayout(new GridLayout(1,1,0,0));
JPanel1.add(JPanel2);
JPanel2.add(JScrollPane1);
JSequenceNamesTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
JSequenceNamesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
if (ALLOW_ROW_SELECTION) // true by default
{
ListSelectionModel rowSM = JSequenceNamesTable.getSelectionModel();
rowSM.addListSelectionListener(new ListSelectionListener()
{
public void valueChanged(ListSelectionEvent e) {
//Ignore extra messages.
if (e.getValueIsAdjusting()) return;
ListSelectionModel lsm = (ListSelectionModel)e.getSource();
if (lsm.isSelectionEmpty())
{
System.out.println("No rows are selected.");
}
else
{
SequenceExceptionsModel = null;
SequenceExceptionsModel = new DefaultTableModel();
SequenceExceptionsModel.setDataVector(new Vector(), myColumnNames);
int selectedRow = lsm.getMinSelectionIndex();
String temp = (String)mySequenceNames.get(selectedRow);
Vector values = (Vector)myExceptionsHash.get(temp);
for(int count = 0; count < values.size(); count++)
{
GenSequencesGui.PropertyEntry tempEntry = (GenSequencesGui.PropertyEntry)values.get(count);
String tableName = tempEntry.getExceptionTableName();
String fieldName = tempEntry.getExceptionTableField();
Vector row = new Vector();
row.add(tableName);
row.add(fieldName);
SequenceExceptionsModel.addRow(row);
}
JSequenceExceptionsTable.setModel(SequenceExceptionsModel);
int rowCount = SequenceExceptionsModel.getRowCount();
}
}
});
}
else
{
JSequenceNamesTable.setRowSelectionAllowed(false);
}
JScrollPane1.getViewport().add(JSequenceNamesTable);
JSequenceNamesTable.setBounds(0,0,228,34);
JPanel3.setLayout(new GridLayout(1,1,0,0));
JPanel1.add(JPanel3);
JPanel3.add(JScrollPane2);
JSequenceExceptionsTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
JScrollPane2.getViewport().add(JSequenceExceptionsTable);
JSequenceExceptionsTable.setBounds(0,0,152,34);
SequenceNamesModel = new DefaultTableModel();
SequenceExceptionsModel = new DefaultTableModel();
JSequenceNamesTable.setModel(SequenceNamesModel);
JSequenceExceptionsTable.setModel(SequenceExceptionsModel);
JPanel4.setLayout(new GridLayout(3,1,0,0));
JPanel1.add(JPanel4);
JPanel4.add(JPanel6);
JPanel4.add(JPanel7);
JPanel4.add(JPanel8);
JPanel7.setLayout(new GridLayout(1,3,50,50));
JPanel7.add(JAddButton);
JAddButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
JAddButton_actionPerformed(evt);
}
}
);
JPanel7.add(JEditButton);
JEditButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
JEditButton_actionPerformed(evt);
}
}
);
JPanel7.add(JExitButton);
JExitButton.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt)
{
JExitButton_actionPerformed(evt);
}
}
);
addItems();
}
private void addItems()
{
Enumeration enum = myExceptionsHash.keys();
while(enum.hasMoreElements())
{
String seqName = (String)enum.nextElement();
mySequenceNames.add(seqName);
}
Vector data = new Vector();
for(int count = 0; count < mySequenceNames.size(); count++)
{
Vector temp = new Vector();
String seqName = (String)mySequenceNames.get(count);
temp.add(seqName);
data.add(temp);
}
Vector columnNames = new Vector();
columnNames.add("SEQUENCE NAME");
SequenceNamesModel.setDataVector(data, columnNames);
Vector tempTwo = new Vector();
myColumnNames = new Vector();
myColumnNames.add("EXCEPTIONS TABLE");
myColumnNames.add("EXCEPTIONN FIELD");
SequenceExceptionsModel.setDataVector(tempTwo, myColumnNames);
}
private void JExitButton_actionPerformed(java.awt.event.ActionEvent evt)
{
this.setVisible(false);
}
private void JEditButton_actionPerformed(java.awt.event.ActionEvent evt)
{
this.setVisible(false);
}
private void JAddButton_actionPerformed(java.awt.event.ActionEvent evt)
{
NewExceptions ne = new NewExceptions(new GenSequencesGui(), true, myExceptionsHash);
ne.setVisible(true);
}
public ExceptionDialog()
{
this((Frame)null, null);
}
public ExceptionDialog(String sTitle)
{
this();
setTitle(sTitle);
}
public void setVisible(boolean b)
{
if (b)
setLocation(50, 50);
super.setVisible(b);
}
static public void main(String args[])
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch(Exception ex)
{
}
(new ExceptionDialog()).setVisible(true);
}
JPanel JPanel1 = new JPanel();
JPanel JPanel2 = new JPanel();
JScrollPane JScrollPane1 = new JScrollPane();
JTable JSequenceNamesTable = new JTable();
JPanel JPanel3 = new JPanel();
JPanel JPanel4 = new JPanel();
JButton JAddButton = new JButton("Add");
JButton JEditButton = new JButton("Edit");
JButton JExitButton = new JButton("Exit");
JScrollPane JScrollPane2 = new JScrollPane();
JTable JSequenceExceptionsTable = new JTable();
JPanel JPanel6 = new JPanel();
JPanel JPanel7 = new JPanel();
JPanel JPanel8 = new JPanel();
private DefaultTableModel SequenceNamesModel;
private DefaultTableModel SequenceExceptionsModel;
private boolean ALLOW_ROW_SELECTION = true;
private Vector mySequenceNames = new Vector();
private Hashtable myExceptionsHash = new Hashtable();
private Vector myColumnNames;
}