Monday, 13 February 2012

If your UI seems to freeze periodically, what might be a likely reason? | Core Java

A callback implementation like ActionListener.actionPerformed or MouseListener.mouseClicked is taking a long time to execute thereby blocking the event dispatch thread from processing other UI events.

Why should the implementation of any Swing callback (like a listener) execute quickly? | Core Java

Any swing callback execute quickly should be implementation Because callbacks are invoked by the event dispatch thread which will be blocked processing other events for as long as our method takes to execute.

How would you detect a keypress in a JComboBox? | Core Java

"KeyListner in a JComboBox" is the abssically tyoe of the trick . many programmer is said thet: "add the  keyListner in a JComboBox ". But its main use in the  " add the  keyListner in a JComboBox as a editor component.

Explain how to render an HTML page using only Swing? | Java Swings

HTML page is bassically render the page using the JEditorPane or JTextPane and set it with the HTMLEditorKit, and load it that the use of swing in HTML pages.

What class is at the top of the AWT event hierarchy? | Core Java

 java.awt.AWTEvent is that class which is at the top of the AWT event hierarchy. if they say java.awt.Event, they haven't deal with swing or AWT in a while.

What is the difference between the "Font" and "FontMetrics" class? | Core Java

many diff are there which is defined as :
  •  The Font Class is used to render "glyphs", The characters we see on the screen.
  •  FontMetrics encapsulates information about a specific font on a specific Graphics object.

How would you create a button with rounded edges? | Core Java

there's 2 ways to create a button with rounded edges.
 The first thing is to know that a JButton's edges are drawn by a Border. so we can override the Button's paintComponent or Graphics method and draw a circle or rounded rectangle and turn off the border. Or we can create a custom border that draws a circle or rounded rectangle around any component and set the button's border to it.