Gary Frick

Greenhorn
+ Follow
since Sep 13, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Gary Frick

Thanks Jim for the suggestion. I'll play with this to see how it plays out. Gary
21 years ago
I would never have guessed that working at the byte level in Java would be so tough. I'm having to work with a structured blob that is retrieved from a database. The structured blob is a series of tokenized data in the following form:
2-byte (int) Token ID
2-byte (int) Date Type
2-byte (int) Data Length
n-byte (?) Data value
If I load this structured blob into a byte array, how do I extract these binary and other values from the array and put them into particular variables?
21 years ago
I'm trying to limit input to only numerics, but when I try to stop the character from appearing, I am only successful with characters beyond the first one. I can't figure out why the event is getting through and the first character always remains.

Thanks
21 years ago
Yes, specifying a 'new' vector on each pass was the silver bullet. Apparently it was adding the same rowData vector that always had the same pointer under the covers. I always thought that each new vector element created a new instance which was not related to the source data used to create the element.
Much Appreciated,
Gary
22 years ago
In the following code, the vector of arrays, all contain the same value, yet as you can see, by the System.out display, there are definitely unique values in the Iterator. Why are all of the vector entries being overwritten by the last values inserted? I orginally tried this as loading a vector of vectors and that had problems too, so I moved to a vector of String arrays.
Vector data = new Vector();
public void loadTableData(Map BBtally)
{
Collection entries = BBtally.entrySet();
Iterator it = entries.iterator();
String[] rowData = {"",""};
while(it.hasNext())
{
Map.Entry em = (Map.Entry)it.next();
rowData[0] = em.getKey().toString();
System.out.println(em.getKey());
rowData[1] = em.getValue().toString();
System.out.println(em.getValue());
data.addElement(rowData);
}
}
Values as they appear in Vector afterwards. As I step through debug I can see these values change to the last value loaded into rowData.
data = Vector
[0] =(string[])
[0] = "2004"
[1] = "1"
[1] =(string[])
[0] = "2004"
[1] = "1"
[2] =(string[])
[0] = "2004"
[1] = "1"
[3] =(string[])
[0] = "2004"
[1] = "1"

Values being displayed in System.out:
2001
2
2002
4
2003
1
2004
Appreciatively,
Gary
22 years ago
I'm not sure how to adequately state my problem, but... The initial window allows a user to setup the options, select values from lists and then perform a login. After traversing to succeeding frames relating to the application, the user may wish to start all over. This means tearing down a session, establishing new options and selections. I used setVisible() method in Navigating through these JFrames, including the home JFrame. But if the user chooses to go back to the home page, I want to re-enter it as though it were the first time with all buttons unselected, lists cleared and connections closed. What is the best way of doing this?
22 years ago
I need to enable and disable events from firing in a JList where I am dynamically changing the contents. I want to disable events when changing list contents, but enable them to get user selection. If I don't disable them, then the action of dynamically changing contents fires a 'value changed' event and so the 'getSelectedIndex' is set inappropriately.
OpsTool.java [451:1] enableEvents(long) has protected access in java.awt.Component
HostList.enableEvents(AWTEvent.ITEM_EVENT_MASK);
^
OpsTool.java [467:1] disableEvents(long) has protected access in java.awt.Component
HostList.disableEvents(AWTEvent.ITEM_EVENT_MASK);
22 years ago
Can someone tell me why I am not seeing the effect of updateInt on the row in resultSet.
Scenario:
1). I do a query to recieve one record in my resultSet.
2). Display record for user to verify.
3). If user changes a field value, I apply the users change to the field value in the resultSet row via an updateInt() method.
4). I pass the resultSet to a class/method that handles the inserts
5). Method inserts updated record into another table in same Database.
Problem:
Since I am inserting the modifed record into another DB, I don't do the updateRow() method. Instead I do a separate Insert using the modified resultSet. However, the ResultSet isn't reflecting the change. I even attempt to display the ResultSet after doing the updateInt but it doesn't show the change either.
rs.updateInt(<value>,<pos> ;
rs.first();
rs.getString(<value> ;
Ken,
I don't have an option on the server side. Besides I need to pull it to the client-side for visual checks and such before inserting it into another table (which is in the same DB). So, I'm trying to find the stream-lined way of taking the record from the ResultSet and inserting it into a look-a-like table.
What is the best way to move a record from one table to another? In other words, I need to do a query, do some checking on the record, and then insert into another table. Do I have to get each field by its respective type and build a new statement, or is there a simpler approach?
Is it possible to return to a previous class that defines it's own GUI interface? In other words, my application consists of a several windows that are each invoked/instantiated by the previous GUI class. So each class file defines its own separate window environment. Each window accepts input and passes those values on when it instatiates the next GUI window. However I want to be able to traverse backwards to previous window and maintain its previous state and variables. I'm not sure if this is possible. As I go forward and backward I want to make each window visible or invisble depending upon who is active or not active.
22 years ago
For some time now I thought that my data wasn't displaying because it wasn't getting process from the array properly. As it turns out, the data is there but won't display until I resize the frame or click on the table. I am firing the 'fireTableChanged(null)' event but this doesn't seem to be the problem. What is causing this?
Here is my method that is part of my AbstractTableModel.
public void loadTableData(Map Cycletally)
{
Collection entries = Cycletally.entrySet();
Iterator it = entries.iterator();
//data = new Vector();
String[] rowData;
int i = 0;
while(it.hasNext())
{
rowData = new String[2];
Map.Entry em = (Map.Entry)it.next();
rowData[0] = em.getKey().toString();
rowData[1] = em.getValue().toString();
data[i] = rowData;
i++;
}
fireTableChanged(null);
}
22 years ago
Paul,
After taking out some debug stuff, it is now working. I don't have a good explanation, since I put in the debug code specifically to catch the problem. Anyway it's working.
Sorry for the bother
22 years ago
Paul,
My code is essentially identical. So I'm not sure what other setting(s) may be affecting this outcome. In debug, if I breakpoint on the 'If' statement, e.getClickCount() always == 1.
Gary
table.addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() == 2)
{
Point p = e.getPoint();
int row = table.rowAtPoint(p);
int column = table.columnAtPoint(p); // This is the view column!
22 years ago
Can anyone tell me why the getClickCount is always returning a value of 1 even for double-clicks?
Thanks,
Gary
22 years ago