Tags:JAVA Questions | 109 views
1) Can a class be it’s own event handler? Explain how to implement this.
Answer: Sure. an example could be a class that extends Jbutton and implements ActionListener. In the actionPerformed method, put the code to perform when the button is pressed.
2) Why does JComponent have add() and remove() methods but Component does not?
Answer: because JComponent [...]
Tags:JAVA Questions | 40 views
JInternalFrame
Java Swing Tutorial Explaining the JInternalFrame class. A JInternalFrame is confined to a visible area of a container it is placed in. JInternalFrame a top level swing component that has a contentpane.
It can be iconified — in this case the icon remains in the main application container.
It can be maximized — Frame consumes the main [...]
Tags:JAVA Questions | 62 views
Java JFrame class example
JFrame
Java Swing Tutorial Explaining the JFrame class. The components added to the frame are referred to as its contents; these are managed by the contentPane. To add a component to a JFrame, we must use its contentPane instead.JFrame is a Window with border, title and buttons. When JFrame is set visible, an [...]
Tags:JAVA Questions | 573 views
What is the difference between Swing and AWT components?AWT components are heavy-weight, whereas Swing components are lightweight. Hence Swing works faster than AWT. Heavy weight components depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component. Pluggable look and feel possible using java Swing. Also, we can switch from one look [...]