Results 1 to 6 of 6

Thread: AbstractButton class of java

  1. #1
    Join Date
    Dec 2009
    Posts
    32

    AbstractButton class of java

    Hello guys,

    I have to discuss one of my query related to the java inbuilt classes. I want to be aware about the AbstractButton class. I don't know nothing about the AbstractButton class of java programming. I have referred many websites for AbstractButton class, but nothing was helpful. If you knows anything about the AbstractButton class then please let me aware about that. I would greatly appreciate your any help.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,949

    Re: AbstractButton class of java

    Hi,

    A AbstractButton class of java is used for to describe common behaviors of menu items and buttons. This class is hired from 'javax.swing.JComponent' package of java. This java class implements many interfaces such as ImageObserver, ItemSelectable, MenuContainer, Serializable, SwingConstants. There are three direct subclasses of AbstractButton class and which are namely JButton, JMenuItem, JToggleButton.

  3. #3
    Join Date
    May 2008
    Posts
    2,015

    Re: AbstractButton class of java

    Hi friend,

    Please refer following example of AbstractButton of java:
    Code:
    import javax.swing.AbstractButton;
    import javax.swing.JFrame;
    
    public class AbstractButtonDemo {
    
      public static void main(String[] amb) {
        JFrame frame1 = new JFrame();
        frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
        AbstractButton bn1 = new JButton();
        bn1.setMultiClickThreshhold(1000);
        
         bn.addActionListener(new ActionListener(){
          public void actionPerformed(ActionEvent e) {
            System.out.println("action");      }
         };
    
        frame1.add(bn1);
    
        frame1.setSize(400, 200);
        frame1.setVisible(true);
      }
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,010

    Re: AbstractButton class of java

    Hello friend,

    I suggest you to go through the following some methods of 'AbstractButton class':
    • setVerticalTextPosition(int txtPosition)
    • setVerticalAlignment(int align)
    • setSelectedIcon(Icon icn)
    • setRolloverSelectedIcon(Icon icn)
    • setRolloverIcon(Icon icn)

  5. #5
    Join Date
    May 2008
    Posts
    2,302

    Re: AbstractButton class of java

    Following example will show you how to use methods of 'AbstractButton class'
    Code:
    import javax.swing.JFrame;
    import javax.swing.AbstractButton;
    
    public class HTMLAbstractButtonDM 
    {
    
      public static void main(String[] aw) {
        JFrame bck = new JFrame();
        bck.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    
        AbstractButton bn = new JButton();
        bn.setText ("<html>Last Name<br><font face='courier new'"
            + " color=red> (mandatory) </font></html>");
        bck.add(bn);
    
        bck.setSize(400, 200);
        bck.setVisible(true);
      }
    
    }

  6. #6
    Join Date
    Oct 2005
    Posts
    2,394

    Re: AbstractButton class of java

    Hi,

    If you want to know about the nested classes of AbstractButton class of java, then refer following classes:
    1. AbstractButton.ButtonChangeListener
    2. Component.FlipBufferStrategy
    3. Container.AccessibleAWTContainer
    4. AbstractButton.AccessibleAbstractButton
    5. Component.AccessibleAWTComponent

Similar Threads

  1. Converting java class to java bean class
    By Ucchal in forum Software Development
    Replies: 6
    Last Post: 09-08-2010, 10:24 AM
  2. KeyboardFocusManager class of java
    By Gokul20 in forum Software Development
    Replies: 4
    Last Post: 05-03-2010, 02:38 PM
  3. JDesktopPane class of java
    By Sonam Goenka in forum Software Development
    Replies: 5
    Last Post: 18-02-2010, 07:14 AM
  4. RecordStore class in java
    By Level8 in forum Software Development
    Replies: 4
    Last Post: 12-12-2009, 01:12 PM
  5. Java Programming Language Basics: Reflection Basics and Class Class
    By mayuri_gunjan in forum Guides & Tutorials
    Replies: 6
    Last Post: 29-08-2005, 12:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •