Java
  Home arrow Java arrow Page 4 - Creating Control Buttons with NetBeans IDE
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Creating Control Buttons with NetBeans IDE
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 3
    2006-05-17

    Table of Contents:
  • Creating Control Buttons with NetBeans IDE
  • The nucleus of JToggleButton
  • Working with JCheckBox
  • The nucleus of JCheckBox
  • Working with JRadioButton

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating Control Buttons with NetBeans IDE - The nucleus of JCheckBox


    (Page 4 of 5 )

    This is the continuation of the previous section. Further proceeding we have the following:

      private void btnShowActionPerformed(java.awt.event.ActionEvent
    evt) {
       
    // TODO add your handling code here:
         
    repaintTextBox();
     
    }

    The above code is the heart of our application. According to the code in the previous section, you can understand that when the button is hit, the JRE tries to execute "btnShowActionPerformed." The implementation for that method is as above. According to the above code, the event would simply execute another method, "repaintTextBox."

    "repaintTextBox" is my own method, which is defined below:

      private void repaintTextBox() {
        int style=0;
        if (this.chkBold.isSelected()) {
          style += java.awt.Font.BOLD;
        }
        if (this.chkItalic.isSelected()) {
          style += java.awt.Font.ITALIC;
        }
        this.txtMsg.setFont(this.txtMsg.getFont().deriveFont(style));
      }

    The above would simply test which check box is switched on (by using "isSelected") and apply the respective font style (bold or italic). This is very similar to what happened when we used the toggle buttons. The only issue is that the changes would not come about unless the "show" button is hit (unlike the previous example, in which they were automatic).

    More Java Articles
    More By Jagadish Chaterjee


       · Hello guys! another extension to the articles on NetBeans IDE. Enjoy and give me...
     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway