Isaac Hewitt

Ranch Hand
+ Follow
since Jul 24, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Isaac Hewitt

I have 2 different bespoke table models.

When one is needed I simply add it to the table. In this case however whilst updating the model via table update in tableChanged method I have the impression of 2 identical models because the update happens twice (use of audio).
Is it not true that adding a new model cancels out the other ? I test for which model is attached to table and add the correct one depending on the data required.

10 years ago
I was able to find the solution which consists of a minor change to the charset.

The method now runs as intended through NetBeans or through standalone JRE.

Thank you for your attention in this matter Roel De Nijs.
11 years ago
The code runs as intended when run through the JRE provided with NetBeans. Java 7 Update 51
It throws exception when run on standalone JRE same version as above.
I have the exact same method instead using IO and it does not throw any exception.

11 years ago
Whilst using NIO to read a small text file, I have come across an exception with the following message : input length = 1


When the program is run through Netbeans 7.4 on java 7 update 51 there is no exception.

It only appears when the program is run on the standalone JRE same version as above.

I have searched the internet and not been able to find a solution.


I am using charset UTF-8

11 years ago
Yes 64 Bit. I have tried everything - Runtime exec() as well as -Djdk.lang.Process.allowAmbigousCommands=true

Have tried these workarounds : https://blogs.oracle.com/thejavatutorials/entry/changes_to_runtime_exec_problems

The code seems to hang because my busy Cursor indicates that. The busy Cursor is programmed to change to regular Cursor just before executing the code first presented above. I did not include that piece of code in the snippet above.

Alright, I have added that unseen snippet above which uses Java Native Acces code to change a value in the Windows registry.

As I have said it works fine on desktop computer - Windows registry value is changed and program starts up with no busy Cursor.
11 years ago
My code below works perfectly on my desktop computer, but does nothing on both my laptops. All three computers are running Windows 7 with Java 7 update 51. No exception is thrown when run on either of the 2 laptops.


11 years ago
Thank you Winston Gutkowski, Jayesh A Lalwani, fred rosenberger, and Jesper de Jong for your responses - all very thought provoking. I will see if I can apply these thoughts to the method at hand. Thanks.
11 years ago
It runs very quickly, but is it more effective than having the same variables at the class level in this case ? The method iterates several hundred times and does some String stuff along the way. Those variables at the top of the method are declared hundreds of times obviously. If declared once at class level, they are reused anyway ? The class itself is instantiated within a method so all is supposed to be disposed of through memory management thereafter and not hang around for the life of the program. ? Sorry if I seem daft ...



11 years ago
There will only be one instance of the class. Declaring them hundreds of times at method level whilst interating ?
11 years ago
I have a class that has one method that recursively visits hundreds of files and folders. Is it better to declare my several String variables for reuse at the class level or the method level ?
11 years ago
I am a my wit's end over the placement of JInternalFrame in the z-order.

I have 2 JInternalFrames that span the width and height of the JDesktop therefore I will have just 1 visible at any given time, hence that one will be in the number 1 position of the z-order.

int j gives me the 1 position in the z-order. The problem is that the code is not reading the position of the frames correctly where I have k = this.getComponentZOrder(inner_Fr); should work if k is not equal to j which is the desired z-order.

Please help !!

11 years ago
The code to fade out my JDialog works alright on one computer but not at all on the other even though both computers have Windows 7 and the latest version of Java.


11 years ago
Thank you to all of you who responded.

I have read your responses and it is alot of food for thought.

I do find that my GUI in several instances remains highly responsive if I use InvokeLater. Of course it is very subtle, but I think (perhaps I am wrong) that performance can degrade over time if one does not use this method in the right places.

I just was not too sure about things such as setting the cursor.

I use it on setting scrollbar positions, text, enabling/ disabling components, requesting focus etc, anything really that has to do with Swing.




Thank you once again to all of you.
12 years ago
I am programming a desktop app in Java 7 update 13 with netBeans. I am aware of the fact that GUI methods such as component.setText() should be used with invokeLater(), as well as component.setEnabled(), but I am unsure about other things such as setting the cursor etc. Is there a list somewhere for its usage invokeLater() ? thanks.
12 years ago
This exception thrown is what I get ' occasionally ' when the mouse is passed over my JTable. I have tried testing every which way for a null pointer with the method below and cannot find what it is. The second method was added recently but the exception has nothing to do with it - (exception was thrown before this addition) See exception code further down.







Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at film_titles.table.Table.getToolTipText(Unknown Source)
at javax.swing.ToolTipManager.checkForTipChange(ToolTipManager.java:589)
at javax.swing.ToolTipManager.mouseMoved(ToolTipManager.java:561)
at java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:330)
at java.awt.Component.processMouseMotionEvent(Component.java:6549)
at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:3339)
at java.awt.Component.processEvent(Component.java:6273)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4860)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4505)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2713)
at java.awt.Component.dispatchEvent(Component.java:4686)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:707)
at java.awt.EventQueue.access$000(EventQueue.java:101)
at java.awt.EventQueue$3.run(EventQueue.java:666)
at java.awt.EventQueue$3.run(EventQueue.java:664)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:680)
at java.awt.EventQueue$4.run(EventQueue.java:678)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:677)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
12 years ago