Swing components should be updated directly only in the context of callback methods invoked from the event dispatch thread. Any other context is not thread safe.
All IT and Non IT Interview Questions, MCQs, Online Quiz Questions, Engineering VIVA Questions
Home » All posts
Tuesday, 14 February 2012
What is the difference between the ‘Font’ and ‘FontMetrics’ class? | Core Java
The Font Class is used to render ‘glyphs’ - the characters you see on the screen.
FontMetrics encapsulates information about a specific font on a specific Graphics object. (width of the characters, ascent, descent)
FontMetrics encapsulates information about a specific font on a specific Graphics object. (width of the characters, ascent, descent)
Can a class be it’s own event handler? Explain how to implement this? | Core Java
Class has it’s own event handler. 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.
Give us the Name of the List LayoutManagers in Java?
There are so many LayoutManagers in Java :
- Flow Layout Manager
- Grid Layout Manager
- Box Layout Manager
- Border Layout Manager
- Card Layout Manager
- GridBag Layout Manager.
Difference between paint() and paintComponent()?
The Key point is that the paint() method invokes three methods in the following order :
- PaintComponent()
- paintBorder()
- paintChildren()
As a general rule, in Swing, we should be overriding the paintComponent method unless we know what we are doing paintComponent() paints only component (panel) but paint() paints component and all its children.
How are the elements of a GridBagLayout organized? | Core Java
The Elements of a GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than row or column of the grid. In addition, the rows and columns may have diff sizes.
How are the elements of a borderLayout organized? | Core Java
The Elements of a BorderLayout are organized at the borders(North, South, East and West) and the center of a container.
Subscribe to:
Posts (Atom)