Hi, I am new to Swing and want to write a simple panel using swing. The requiremnets are as follows: 1) will have 3 radio buttons 2) just below that have a scroll panel and based on which radio button is selected, show different text in the scroll panel. Kindly help me with the code or guide me to some tutorial
In a nutshell you need to: 1) Create JRadioButton instances 2) Add an action listener while creating them. 3) Create some JTextComponent instance 4) Create a container for these components(typically some panel) 5) Add all the child components to the panel using your favorite layout manager 6) Put the panel in a JFrame and display it. 7) In the action listener, figure out which button was clicked and display the text accordingly.
similarly i added all the radio buttons and the scroll panel also but on running the prog, i see only one radio button in short m unable to set the layout/coordinates for the elements. kindly help me with it