I had a requirement to display a list of choices in a window. Furthermore I wanted the dialog to be dismissed as soon as the user pressed a key. Turns out the JDialog was the class I needed. Mapped the keys of interest to a listener and I was good to go. But then I needed to handle the display of the dialog.
I must confess that I really did not have that much experience with JDialogs. Found out that it defaults to a BorderLayout. For my application, I needed more of a GridLayout. I surveyed a bunch of code on the web while searching for my solution. Learned that I could call the pack() method to size the dialog with the minimal amount of space required to fit the contents.
I had one hiccup where I wanted to map the keys with the JRootPane. Thought I needed to do that when I created the JRootPane in createRootPane(). Unfortunately that method gets called from the superclass. I could not pass it any data. That's okay. I found I could later call getRootPane() and handle my business.
Salary Comparison Failure - Read a post that stated top bug bounty hunters make 3X the salary of average developers. Umm what? Who cares what those top people make? You got to compar...
4 weeks ago