This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!

Sam Ritter

Ranch Hand
+ Follow
since Jan 23, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sam Ritter

I'm not sure what you are saying. Then in theory my implementation should work?
2 days ago
Thanks for the replies. I tried keys bindings but it didn't work. From my research the binding only works if the window is active. Since it seems I cannot bind a key to a JDialog, I had to bind it to the parent. Since the parent is not active, the JDialog is, the key press is not seen. Here is how I had to implement the binding ('dialog' is my JDialog component):

The println never happens.
3 days ago
My JDialog starts an audio clip when it opens. I want to use the space bar to close that clip.
4 days ago
I have a JDialog with a bunch of buttons to take various actions. However, I want to add one thing and that is to detect when the space bar is pressed. I have read about key bindings and keylisteners but it is not clear which is the correct/best one to use. Which should I use to detect ONLY a space bar press to keep is simple? TIA.
4 days ago
I have been struggling with a Pexpect script. I am 'expect'ing a couple of strings or a timeout. When the strings are found, that works fine. However, when I get a timeout I want to get the output at that point, if any, but cannot find a way to do it. It seems like 'before', 'after' and 'readline' do not work in an 'except proc.TIMEOUT' block. Actually I cannot get 'readline' to work at all. How do I determine if there was any output and if so get it? TIA.
3 weeks ago
That is the information I was looking for. Although a bit counter intuitive, I guess that is why using setters/getters is considered good programming practice. Thanks.
3 weeks ago
Example of direct variable access.

3 weeks ago
Given a singleton class (only one instance ever) is it more efficient to access a variable directly rather than using setter/getters? Or is the difference sufficiently insignificant that getters/setters are still better programming practice? TIA.
3 weeks ago
No zoom. What they see is what they get.
3 weeks ago
Thanks. I guess it comes down to the definition of "ideal,"  as opposed to personal preference. I would characterize it as the largest possible without clipping. I'll have to look at the toolkit class as I am not familiar with that.
3 weeks ago
I have a JPanel that is added to a JFrame set to maximum screen size (there is no resizing). However, as I try different devices with different screen sizes (smaller ones in particular) the fonts start getting cut off in the JPanel. Given that I know the size of the JPanel and number of lines, what is the best way to calculate the ideal font size and vertical spacing, assuming standard fonts? In my case, if it matters, I'm using Times New Roman. TIA.
3 weeks ago
Thanks. I'll see if those help.
4 weeks ago
This may not really be a java issue any more. I'm thinking the better solution is to figure out how to change the Pi configuration to make the correct mixer the default.
4 weeks ago
Yes, I did that and found that the 2nd mixer, rather than the default works. My next problem is to determine the specific OS in order to use that just for the Pi. When I get the OS from System.getProperties("os.name") it just returns 'Linux'. That is not sufficient to determine if it is Raspbarian rather than some other distro.
4 weeks ago
Not sure what you are asking for. Everything after the hypen (-) is e.toString. That is all the message there is. Are you looking for the traceback?
1 month ago