<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Java Interview Questions &#187; swings interview questions</title>
	<atom:link href="http://www.bestjavainterviewquestions.com/category/swings-interview-questions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bestjavainterviewquestions.com</link>
	<description>Java Interview Questions &#124; Core Java Interview Questions &#124; Advanced Java Interview Questions &#124; EJB Interview Questions &#124; J2EE Interview Questions &#124; Hibernate Interview Questions</description>
	<lastBuildDate>Fri, 03 Feb 2012 10:23:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Java Swings Interview Questions</title>
		<link>http://www.bestjavainterviewquestions.com/java-swings-interview-questions-2/</link>
		<comments>http://www.bestjavainterviewquestions.com/java-swings-interview-questions-2/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 17:23:26 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[swings interview questions]]></category>
		<category><![CDATA[java swings interview questions]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=55</guid>
		<description><![CDATA[Q) In which package are most of the AWT events that support the event-delegation model defined? A) Most of the AWT-related events of the event-delegation model are defined in the java.awt.event package. The AWTEvent class is defined in the java.awt package. Q) Which class is the immediate superclass of the MenuComponent class? A) Object Q) [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Q) In which package are most of the AWT events that support the event-delegation model defined?<br />
A)</strong> Most of the AWT-related events of the event-delegation model are defined in the java.awt.event package. The AWTEvent class is defined in the java.awt package.</p>
<p><strong>Q) Which class is the immediate superclass of the MenuComponent class?<br />
A)</strong> Object</p>
<p>Q) Which containers may have a MenuBar?<br />
A) Frame<br />
<strong><br />
Q) What is the relationship between the Canvas class and the Graphics class?<br />
A)</strong> A Canvas object provides access to a Graphics object via its paint() method.</p>
<p><strong>Q) How are the elements of a BorderLayout organized?<br />
A)</strong> The elements of a BorderLayout are organized at the borders (North, South, East, and West) and the center of a container.</p>
<p><strong>Q) What is the difference between a Window and a Frame?<br />
A)</strong> The Frame class extends Window to define a main application window that can have a menu bar.<br />
<strong><br />
Q) What is the difference between the Font and FontMetrics classes?<br />
A) </strong>The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object.</p>
<p><strong>Q) How are the elements of a CardLayout organized?<br />
A)</strong> The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.</p>
<p><strong>Q) What is the relationship between clipping and repainting?<br />
A) </strong>When a window is repainted by the AWT painting thread, it sets the clipping regions to the area of the window that requires repainting.</p>
<p><strong>Q) What is the relationship between an event-listener interface and an event-adapter class?<br />
A)</strong> An event-listener interface defines the methods that must be implemented by an event handler for a particular kind of event. An event adapter provides a default implementation of an event-listener interface.</p>
<p><strong>Q) How can a GUI component handle its own events?<br />
A)</strong> A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.</p>
<p><strong>Q) How are the elements of a GridBagLayout organized?<br />
A) </strong>The elements of a GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes.<br />
<strong><br />
Q) What advantage do Java&#8217;s layout managers provide over traditional windowing systems?<br />
A) </strong>Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java&#8217;s layout managers aren&#8217;t tied to absolute sizing and positioning, they are able to accomodate platform-specific differences among windowing systems.</p>
<p><strong>Q) What is the difference between the paint() and repaint() methods?<br />
A) </strong>The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.</p>
<p><strong>Q) How can the Checkbox class be used to create a radio button?<br />
A)</strong> By associating Checkbox objects with a CheckboxGroup</p>
<p><strong>Q) Difference between paint() and paintComponent()?<br />
A)</strong> The key point is that the paint() method invokes three methods in the following order:<br />
a) paintComponent()</p>
<p>b) paintBorder()</p>
<p>c) paintChildren()<br />
As a general rule, in Swing, you should be overriding the paintComponent method unless you know what you are doing.<br />
gaintComponent() paints only component (panel) but paint() paints component and all its children.</p>
<p><strong>Q) What is the difference between paint(), repaint() and update() methods within an applet which contains images?<br />
A)</strong> paint : is only called when the applet is displayed for the first time, or when part of the applet window has to be redisplayed after it was hidden.<br />
repaint : is used to display the next image in a continuous loop by calling the update method.<br />
update : you should be aware that, if you do not implement it yourself, there is a standard update method that does the following : it will reset the applet window to the current background color (i.e. it will erase the current image)  it will call paint to construct the new image</p>
<p><strong>Q) What is the name of the design pattern that Java uses for all Swing components?<br />
A)</strong> MVC(Model View Controller) pattern</p>
<p><strong>Q) Name few LayoutManagers in Java.<br />
A) </strong><br />
Flow Layout Manager<br />
Grid   Layout Manager<br />
Border Layout Manager<br />
Box Layout Manager<br />
Card Layout Manager<br />
GridBag Layout Manager</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>November 8, 2008 -- <a href="http://www.bestjavainterviewquestions.com/which-of-the-collection-classes-will-not-allow-duplicate-values/" title="Which of the Collection Classes will not allow duplicate values">Which of the Collection Classes will not allow duplicate values</a> (1)</li><li>August 24, 2008 -- <a href="http://www.bestjavainterviewquestions.com/define-servletoutputstream-object-in-jsp/" title="Define ServletOutputStream object in Jsp">Define ServletOutputStream object in Jsp</a> (0)</li><li>May 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/basic-java-interview-question/" title="Basic Java Interview Question">Basic Java Interview Question</a> (1)</li><li>August 15, 2008 -- <a href="http://www.bestjavainterviewquestions.com/defining-life-cycle-of-thread/" title="Defining Life Cycle of Thread">Defining Life Cycle of Thread</a> (0)</li><li>September 2, 2008 -- <a href="http://www.bestjavainterviewquestions.com/difference-between-sessionsave-and-sessionsaveorupdate/" title="Difference between session.save() and session.saveOrUpdate()">Difference between session.save() and session.saveOrUpdate()</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/java-swings-interview-questions-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swings Interview Questions</title>
		<link>http://www.bestjavainterviewquestions.com/swings-interview-questions/</link>
		<comments>http://www.bestjavainterviewquestions.com/swings-interview-questions/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 17:21:21 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[swings interview questions]]></category>
		<category><![CDATA[swings questions]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=53</guid>
		<description><![CDATA[Q) What is the difference between a Choice and a List? A) A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Q) What is the difference between a Choice and a List?<br />
A)</strong> A Choice is displayed in a compact form that requires you to pull it down to see the list of available choices. Only one item may be selected from a Choice. A List may be displayed in such a way that several List items are visible. A List supports the selection of one or more List items.<br />
<strong><br />
Q) What interface is extended by AWT event listeners?<br />
A)</strong> All AWT event listeners extend the java.util.EventListener interface.</p>
<p><strong>Q) What is a layout manager?<br />
A) </strong>A layout manager is an object that is used to organize components in a container.<br />
<strong><br />
Q) Which Component subclass is used for drawing and painting?<br />
A)</strong> Canvas</p>
<p><strong>Q) What is the difference between a Scrollbar and a ScrollPane?<br />
A)</strong> A Scrollbar is a Component, but not a Container.A ScrollPane is a Container. A ScrollPane handles its own events and performs its own scrolling.</p>
<p><strong>Q) Which Swing methods are thread-safe?<br />
A) </strong>The only thread-safe methods are repaint(), revalidate(), and invalidate()</p>
<p><strong>Q) Which containers use a border Layout as their default layout?<br />
A)</strong> The Window, Frame and Dialog classes use a border layout as their default layout</p>
<p><strong>Q) What is the preferred size of a component?<br />
A)</strong> The preferred size of a component is the minimum component size that will allow the component to display normally</p>
<p><strong>Q) Which containers use a FlowLayout as their default layout?<br />
A)</strong> The Panel and Applet classes use the FlowLayout as their default layout</p>
<p><strong>Q) What is the immediate superclass of the Applet class?<br />
A)</strong> Panel</p>
<p><strong>Q) Name three Component subclasses that support painting?<br />
A)</strong> The Canvas, Frame, Panel, and Applet classes support painting</p>
<p><strong>Q) What is the immediate superclass of the Dialog class?<br />
A)</strong> Window</p>
<p><strong>Q) What is clipping?<br />
A)</strong> Clipping is the process of confining paint operations to a limited area or shape.</p>
<p><strong>Q) What is the difference between a MenuItem and a CheckboxMenuItem?<br />
A) </strong>The CheckboxMenuItem class extends the MenuItem class to support a menu item that may be checked or unchecked.<br />
<strong><br />
Q) What class is the top of the AWT event hierarchy?<br />
A) </strong>The java.awt.AWTEvent class is the highest-level class in the AWT event-class hierarchy</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>May 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/java-lang-package-interview-questions/" title="Java lang package interview questions">Java lang package interview questions</a> (2)</li><li>September 20, 2008 -- <a href="http://www.bestjavainterviewquestions.com/difference-between-sessionsave-and-sessionsaveorupdate-3/" title="Difference between session.save() and session.saveOrUpdate()">Difference between session.save() and session.saveOrUpdate()</a> (0)</li><li>August 24, 2008 -- <a href="http://www.bestjavainterviewquestions.com/define-session-bean-and-entity-bean/" title="Define Session Bean and Entity Bean">Define Session Bean and Entity Bean</a> (0)</li><li>September 7, 2008 -- <a href="http://www.bestjavainterviewquestions.com/define-stateless-session/" title="Define Stateless Session">Define Stateless Session</a> (0)</li><li>May 22, 2008 -- <a href="http://www.bestjavainterviewquestions.com/core-java-inteview-questions/" title="Core Java Inteview Questions">Core Java Inteview Questions</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/swings-interview-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Swings Interview Questions</title>
		<link>http://www.bestjavainterviewquestions.com/java-swings-interview-questions/</link>
		<comments>http://www.bestjavainterviewquestions.com/java-swings-interview-questions/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 17:00:33 +0000</pubDate>
		<dc:creator>Ramakrishna</dc:creator>
				<category><![CDATA[swings interview questions]]></category>

		<guid isPermaLink="false">http://www.bestjavainterviewquestions.com/?p=50</guid>
		<description><![CDATA[Q) Can a class be it’s own event handler? Explain how to implement this. A: 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. Q) Why does JComponent have add() and remove() methods but Component does not? [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Q) Can a class be it’s own event handler? Explain how to implement this.<br />
A:</strong> 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.</p>
<p><strong>Q) Why does JComponent have add() and remove() methods but Component does not?<br />
A: </strong>because JComponent is a subclass of Container, and can contain other components and jcomponents.</p>
<p><strong>Q) How would you create a button with rounded edges?<br />
A: </strong>there’s 2 ways. The first thing is to know that a JButton’s edges are drawn by a Border. so you can override the Button’s paintComponent(Graphics) method and draw a circle or rounded rectangle (whatever), and turn off the border. Or you can create a custom border that draws a circle or rounded rectangle around any component and set the button’s border to it.</p>
<p><strong>Q) If I wanted to use a SolarisUI for just a JTabbedPane, and the Metal UI for everything else, how would I do that?<br />
A: </strong>in the UIDefaults table, override the entry for tabbed pane and put in the SolarisUI delegate. (I don’t know it offhand, but I think it’s &#8220;com.sun.ui.motiflookandfeel.MotifTabbedPaneUI&#8221; &#8211; anything simiar is a good answer.)</p>
<p><strong>Q) What is the difference between the ‘Font’ and ‘FontMetrics’ class?<br />
A: </strong>The Font Class is used to render ‘glyphs’ &#8211; 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)</p>
<p><strong>Q) What class is at the top of the AWT event hierarchy?<br />
A: </strong>java.awt.AWTEvent. if they say java.awt.Event, they haven’t dealt with swing or AWT in a while.</p>
<p><strong>Q) Explain how to render an HTML page using only Swing.<br />
A: </strong>Use a JEditorPane or JTextPane and set it with an HTMLEditorKit, then load the text into the pane.</p>
<p><strong>Q) How would you detect a keypress in a JComboBox?<br />
A:</strong> This is a trick. most people would say ‘add a KeyListener to the JComboBox’ &#8211; but the right answer is ‘add a KeyListener to the JComboBox’s editor component.’</p>
<p><strong>Q) Why should the implementation of any Swing callback (like a listener) execute quickly?<br />
A: </strong>Because callbacks are invoked by the event dispatch thread which will be blocked processing other events for as long as your method takes to execute.<br />
<strong><br />
Q) In what context should the value of Swing components be updated directly?<br />
A: </strong>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?</p>
<p><strong>Q) Why would you use SwingUtilities.invokeAndWait or SwingUtilities.invokeLater?<br />
A:</strong> I want to update a Swing component but I’m not in a callback. If I want the update to happen immediately (perhaps for a progress bar component) then I’d use invokeAndWait. If I don’t care when the update occurs, I’d use invokeLater.</p>
<p><strong>Q) If your UI seems to freeze periodically, what might be a likely reason?<br />
A:</strong> 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.</p>
<p><strong>Q) Which Swing methods are thread-safe?<br />
A:</strong> The only thread-safe methods are repaint(), revalidate(), and invalidate()<br />
<strong><br />
Q) Why won’t the JVM terminate when I close all the application windows?<br />
A: </strong>The AWT event dispatcher thread is not a daemon thread. You must explicitly call System.exit to terminate the JVM.</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>January 26, 2009 -- <a href="http://www.bestjavainterviewquestions.com/uploading-file-name-of-image-to-database/" title="Uploading file name or image to DataBase">Uploading file name or image to DataBase</a> (0)</li><li>June 8, 2008 -- <a href="http://www.bestjavainterviewquestions.com/applet-interview-question/" title="Applet Interview Question">Applet Interview Question</a> (4)</li><li>August 9, 2008 -- <a href="http://www.bestjavainterviewquestions.com/applets-tutorial-with-some-important-methods/" title="How to use Applets">How to use Applets</a> (0)</li><li>October 16, 2008 -- <a href="http://www.bestjavainterviewquestions.com/explain-the-instance-variables-in-servlets/" title="Explain the Instance Variables in Servlets">Explain the Instance Variables in Servlets</a> (0)</li><li>October 4, 2008 -- <a href="http://www.bestjavainterviewquestions.com/explain-executeupdate-method/" title="Explain executeUpdate Method">Explain executeUpdate Method</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.bestjavainterviewquestions.com/java-swings-interview-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

