java


How to listen override RadioButtons in Java


I'm new with Java and I need little help to solve my problem with my application. I've got this app myApplication
My RadioButton class look like this
public class XRadioButton extends JPanel implements ActionListener {
/**
*
*/
public static final long serialVersionUID = 2L;
public JRadioButton radioButton;
public JLabel label;
public double price = 0.0;
public XRadioButton() {
setLayout(new GridBagLayout());
add(getRadioButton());
add(getLabel());
}
public XRadioButton(Icon icon, String text) {
this();
setIcon(icon);
setText(text);
}
public JRadioButton getRadioButton() {
if (radioButton == null) {
radioButton = new JRadioButton();
}
return radioButton;
}
public boolean isSelected() {
return radioButton.isSelected();
}
public JLabel getLabel() {
if (label == null) {
label = new JLabel();
label.setLabelFor(getRadioButton());
}
return label;
}
public void addActionListener() {
radioButton.addActionListener(new ActionListener() {
#Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
}
});
}
}
the CheckBox buttons are similar to this one
all of the buttons have different value of price
I created buttons like this
XRadioButton tSummerRB = new XRadioButton(tireS.getImgIcon(), "Summer Tires");
XRadioButton tWinterRB = new XRadioButton(tireW.getImgIcon(), "Winter Tires");
XRadioButton rimsRRB = new XRadioButton(rimsR.getImgIcon(), "Racing Rims");
XRadioButton rimsSRB = new XRadioButton(rimsS.getImgIcon(), "Sport Rims");
XRadioButton rimsCRB = new XRadioButton(rimsC.getImgIcon(), "City Rims");
XRadioButton bodyBlackRB = new XRadioButton(gtrB.getImgIcon(), "Black Edition");
XRadioButton bodyWhiteRB = new XRadioButton(gtrW.getImgIcon(), "White Edition");
tSummerRB.addActionListener();
tWinterRB.addActionListener();
rimsRRB.addActionListener();
rimsSRB.addActionListener();
rimsCRB.addActionListener();
bodyBlackRB.addActionListener();
bodyWhiteRB.addActionListener();
And the label for the TOTAL SUMMARY is
double totalSummary = 0.0;
JLabel sumInfoL = new JLabel("Total Sum ... " + totalSummary) ;
The problem is that I want my "Total Sum..." to display dynamic value , which is the summary of the selected RadioButtons and CheckButtons

Related Links

HashMap Object reference confusion
Stop Netbeans IDE form opening class tree in projects tree view
Confusion over Java generic method type inference
Using additional Saveables in Eclipse AbstractTextEditor
JPanel does not appear when i try to add it to ContentPane
Error LazyInitializationException on hibernate criteria + restriction (Spring)
How to copy a string that starts and ends with specific characters in a text file using Java
Inaccessible i18n messages and script from grails binary plugin
How do I invalidate a login session initialized in one servlet in another servlet with a href in between?
Values are overriden in my ArrayList [duplicate]
Insert Template by Placeholder
Changing database in eclipse/hibernate project
Android Audio Not Playing
org.hibernate.exception.LockAcquisitionException - Threads
currentThread() is always the currentThread()?
Java Database Connectivity doesn't work

Categories

HOME
urbancode
azure-data-factory
appx
hashmap
react-redux
tizen-web-app
amazon-ecs
microservices
google-project-tango
enterprise-library-5
networkx
swagger-ui
upload
contact
nano-server
jplayer
visual-studio-cordova
jsprit
fatal-error
windows-7-x64
jsdoc
viewport
google-pagespeed
swingx
immutable.js
xlsxwriter
orleans
css-animations
lcd
status
url-scheme
bootstrap-duallistbox
phpfox
maxmind
strncpy
publish
large-file-upload
functor
google-qpx-express-api
typed.js
kendo-ui-grid
abstract-class
ansible-playbook
opshub
azure-ml
jvm-languages
password-encryption
no-www
bootstrap-dialog
babel-core
logfiles
revapi
gabor-filter
brightcove
darcs
forever
gcsfuse
smart-table
topbeat
pycaffe
httplistener
intrusion-detection
login-control
pcf
nsviewcontroller
persist
react-native-listview
pickadate
goose
freelancer.com-api
maven-tomcat-plugin
fouc
content-length
deis
interrupted-exception
graph-drawing
fluid-dynamics
dundas
device-orientation
umbraco6
pick
issuu
fluentautomation
phpthumb
mysql-error-1062
rtmfp
didselectrowatindexpath
cloud-connect
fmod
easy-install
free-variable
path-separator
online-compilation
removeclass
adk
whoosh
subgurim-maps
cinema-4d
table-footer
wise
gin
jquery-ui-droppable
webkit.net
xetex

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App