Application Techniques

Using Text Buttons

How to use the text button control on a form.

About this technique



Java Client Techniques> Version 2 AWT-based controls


You'll learn about:

You can run this technique code from:

NOTE   First make sure that database is running on your localhost SilverStream Server

Related reading

See the chapter on the Form Designer in the Tools Guide

Changing a text button label programmatically   Top of page

The following code uses the getText()and setText()methods to change the text of button tbTextButton each time the user clicks the button.

This code is from the actionPerformed event of btnChangeText.

  if (tbTextButton.getText().equals("Push Me"))  
     // If the button text is 'Push Me', change it to 'Press Me'  
     tbTextButton.setText("Press Me");  
     // Otherwise,change it to 'Push Me'  
     tbTextButton.setText("Push Me") 

Simulating a clicked event on a text button   Top of page

The following code shows how to use the simulateClick() method to simulate a user-clicked event on the Text button btnTextButton.

This code is from the actionPerformed of btnSimulateClick.

  // Get the text button to fire its Clicked event  

Copyright © 2000, SilverStream Software, Inc. All rights reserved.