• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setting value as zero in Textbox

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...I have 4 text boxes,which should show value as '0' by default while display.I have two modes 'Insert' & 'Modify'.When i give insert mode,i can give values for that textboxes.when i select 'modify' i can edit the values.The thing is,i should get all my textbox value as '0' for insert mode and i should get values which i entered and stored for those text boxes when i select 'modify' mode;

1. 0 should be shown,when i select insert
2. Stored value should be shown when i selected modify

Code as follows:
// for insert mode
protected void insertThresholdDetail() {

getMajorPctField().setText("0");
getCriticalPctField().setText("0");
getMajorPctNERField().setText("0");
getCriticalPctNERField().setText("0");
getMajorPctALOCField().setText("0");
getCriticalPctALOCField().setText("0");
getMajorPctNREField().setText("0");
getCriticalPctNREField().setText("0");
}


protected void modifyThresholdDetail() {
getCriticalPctNERField().setText(""+detailedThreshold.getCriticalPctNER());
getMajorPctALOCField().setText(""+detailedThreshold.getMajorPctALOC());
getCriticalPctALOCField().setText(""+detailedThreshold.getCriticalPctALOC());
getMajorPctField().setText(""+detailedThreshold.getMajorPct());
getCriticalPctField().setText(""+detailedThreshold.getCriticalPct());
getMajorPctNREField().setText("0"+detailedThreshold.getMajorPctNRE());
getCriticalPctNREField().setText("0"+detailedThreshold.getCriticalPctNRE());
}


How should i do this...please help me...!!!
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you should be having the Event Handlers for your Insert and Modify events? And if you have- then you can call these methods in the respective event handlers. If not, then you would have to create Event handlers and then go ahead. If you are using JButton- then look at ActionListener.

Also please wrap your code with code tags - UseCodeTags
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic