Skip to content
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

live window ID should formatted as hex #3

Open
holla2040 opened this issue Feb 13, 2017 · 0 comments
Open

live window ID should formatted as hex #3

holla2040 opened this issue Feb 13, 2017 · 0 comments

Comments

@holla2040
Copy link

holla2040 commented Feb 13, 2017

It seems like addresses in other windows are formatted as hex. Having live window ID as base 10 is kind of a pain. I poked around LiveTopComponent.java and tried to figure out where this takes place but then got dragged in swing's default table stuff and didn't want to create a customer renderer.

Here's my hack

diff --git a/CANtactCore/src/org/cantact/ui/LiveTopComponent.java b/CANtactCore/src/org/cantact/ui/LiveTopComponent.java
index 3791f18..b30703e 100644
--- a/CANtactCore/src/org/cantact/ui/LiveTopComponent.java
+++ b/CANtactCore/src/org/cantact/ui/LiveTopComponent.java
@@ -142,7 +142,7 @@ public final class LiveTopComponent extends TopComponent implements CanListener
             boolean inserted = false;
                    
             for (int i = 0; i < liveModel.getRowCount(); i++) {
-                if ((int)liveModel.getValueAt(i, 0) == frame.getId()) {
+                if (liveModel.getValueAt(i, 0).equals(String.format("0x%04X", frame.getId()))) {
                     liveModel.setValueAt((Object)frame.getDlc(), i, 1);
                     // get the existing cell data
                     try {
@@ -164,7 +164,7 @@ public final class LiveTopComponent extends TopComponent implements CanListener
             if (!inserted) {
                 LiveTableDataCell dataCell = new LiveTableDataCell();
                 dataCell.setCurrent(dataString);
-                Object[] rowData = {(Object)frame.getId(), (Object)frame.getDlc(), dataCell};
+                Object[] rowData = {(Object)String.format("0x%04X", frame.getId()), (Object)frame.getDlc(), dataCell};
                 liveModel.addRow(rowData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant