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.
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.
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);
}
}
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)
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);
}
}
Re: AbstractButton class of java
Hi,
If you want to know about the nested classes of AbstractButton class of java, then refer following classes:
- AbstractButton.ButtonChangeListener
- Component.FlipBufferStrategy
- Container.AccessibleAWTContainer
- AbstractButton.AccessibleAbstractButton
- Component.AccessibleAWTComponent