Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JRadioButton w/a JButton

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to display a JDialog box that shows the choice the user made when a user selects the
a radio button and hits the process button. Can someone point out whats wrong with the code?
thanks

[ May 07, 2002: Message edited by: Dirk Schreckmann ]
 
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is your problem? Are you getting a compile error or just the wrong results?
 
Sean Richards
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

generates a compiler error. How can this be done in another way?
[ May 07, 2002: Message edited by: Dirk Schreckmann ]
 
Ronnie Phelps
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you should try being more specific and just using a small sample of code because looking at all that code makes it seem like too much stuff to read and it could scare people away from attempting to help you.
If you have a Button let's call it rGroup and you have button1 and button2...I know of two ways you can check and see which one is selected either you can check this way.
if(rgroup.getSelection().equals(button1.getModel()){
//button 1 is selected
}
another way you can check is
if(rgroup.isSelected(button2.getModel())){
//button 2 is selected
}
look at the api for
javax.swing.JRadioButton
javax.swing.AbstractButton
javax.swing.ButtonGroup
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
maximillion2001,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change yer display name to comply with The JavaRanch Naming Policy.
Thanks Pardner!
 
Warning! Way too comfortable! Do not sit! Try reading this tiny ad instead:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic