Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JRadioButton w/a JButton

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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!
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic