Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Swing less functionality than AWT?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Randyl, post: 2984853"] Greetings: Recently I finished developing a Java applet that reads a file and produces a report from the data. This applet is localized and uses the mechanism of the ResourceBundle files. I am happy with this. Part of the controls on the applet display area are a series of Checkbox radio buttons so that the user can select which language will be used to display program-progress messages and what language will be used for the report itself. Each Checkbox radio button has a label (setLabel), retrieved from a ResourceBundle, a name (setName), hardcoded, and a locale (setLocale), also hardcoded. In this fashion I can use getName to retrieve the proper ResourceBundle and getLocale to control various date and time localized formatting issues, all independently from each other. The Checkbox radio buttons are all grouped in one CheckboxGroup object. Up to this point everything is fine. However, once I decided to change the controls from AWT to Swing is when the proverbial seven-shades-of-you-know-what hit the fan. First, the Checkbox button had to become JRadioButtons and the setLabel had to become setText; no problem. The setName and setLocale remained as-is. So far so good. This is where the wheels fall of this wagon. The previous AWT CheckboxGroup was changed to a Swing ButtonGroup in order to accommodate the new Swing JRadioButton buttons. During run-time the currently-selected button for an AWT CheckboxGroup is retrieved via getSelectedCheckbox which returns the actual Checkbox object and I can set the ResourceBundle file and the locale appropriately, but a Swing ButtonGroup retrieves the currently-selected button via getSelection which returns this lousy ButtonModel object that has only one pitiful String. For some reason or the other I expected to be able to access the JRadioButton but never discovered how to do this or how to set and retrieve any other property on this ButtonModel monstrosity. Question: Why in the world would a Swing ButtonGroup have LESS functionality than an AWT CheckboxGroup? Why would a JRadioButton be transmogrified into a ButtonModel and there not be a corresponding method of ButtonModel Class to go get the original object? What advantage is there in making the JRadioButton object inaccessible? Is this the way things are supposed to be or did I miss something in the documentation? Best Regards, Randyl Kent Plampin [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Swing less functionality than AWT?
Top