GeekInterview.com
Series: Subject: Topic:

Java Swing FAQs

Showing Questions 1 - 20 of 76 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

When two or more objects are added as listeners for the same event, which listener is first invoked to handle the event?

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) the first object that was added as listener.B) the last object that was added as listener.C) there is no way to determine which listener will be invoked first.D) it is impossible to have more than one listener for a given event.

Answered by: deepak on: Mar 12th, 2013

Process from the last added to first

Answered by: ABHISHEK SINGH on: Jan 17th, 2013

C) There is no way to determine which listener will be invoked first.

The layout of a container can be altered by using which of the following methods :-

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) setlayout(alayoutmanager)b) layout(alayoutmanager)c) addlayout(alayoutmanager)d) setlayoutmanager(alayoutmanager)

Answered by: jazib on: Jan 31st, 2013

B) layout(aLayoutManager)

Answered by: Britto Parthalomew on: Aug 21st, 2008

A
setLayout();

Which of the following methods are invoked by the awt to support paint and repaint operations?

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) paint( )b) repaint( )c) draw( )d) redraw( )

Answered by: Veena Kondawar on: Nov 14th, 2012

B) repaint()

Answered by: savita on: Jun 23rd, 2012

repaint( )

What is the difference between applet and frame in Java?

Asked By: s | Asked On: Oct 13th, 2006

Answered by: rajvinder kaur on: Sep 29th, 2011

applet is subclass of panel class. but frame is subclass of window class .applet has no menu bar .frame has menu bar.applet has no border.but frame has border.applet has no title bar but frame has.app...

Answered by: VenkitaKrishnan on: Apr 20th, 2009

The difference is based on whether you want a Console based application or a Browser based application. For console applications use Frame and for browser applications use Applet.The other different i...

Which method will cause a frame to be displayed?

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) show( )b) setvisible( )c) display( )d) displayframe( )

Answered by: jha on: Aug 15th, 2011

a.showWindow
b. setVisible

Answered by: MANISHA PATHAK on: Oct 26th, 2006

A) show()

B) setVisible()

ex Frame fr=new Frame("MyFrame");

fr.show();

or

fr.setVisible(true);

Setselectioninterval and addselectioninterval

Asked By: mani_theblues | Asked On: Jul 8th, 2011

Can somebody let me know what is the difference between setselectioninterval and addselectioninterval with example?

What is the use of immutable string class in Java?

Asked By: Ram kishor Meena | Asked On: Jan 24th, 2006

Answered by: javabuddy on: Jan 26th, 2011

String is a special class and it has handled specially in JAVA.There are several benefits of String being immutable and there are certain things which are possible only because String is immutable.1) ...

Answered by: rsaneve on: Jul 19th, 2006

String are made immutable because 1. better memory management.Generally thousands of string literals objects are created in any of the application.To avoid the individual memory allocation to all the ...

In jtable how to set background color for particular rows based on some conditions?

Asked By: shaikvali | Asked On: Oct 28th, 2007

Answered by: JavaFan1212 on: Apr 18th, 2010

Create a cell renderer class that implements TableCellRenderer. Create a subclass of JTable and override the method  getCellRenderer and in this method set the background color based on a particular row.

Answered by: harshagvs on: Jan 6th, 2008

Create a cellRenderer and set the required color based on the condition, then install this Renderer on all the cells

How to create the tabbed pane in swings?

Asked By: venu | Asked On: Jun 12th, 2006

Answered by: mugesh on: Dec 19th, 2009

JTabbedPane jtp=new JTabbedPane();//u can add tabs to d panejtp.addTab("xxx");

Answered by: kailuprakash on: Oct 27th, 2006

jTabbedPane = new javax.swing.JTabbedPane();

And u can add properties like preferred size,layot and name ..

jTabbedPane.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);

jTabbedPane.setName("Tabbed Panne");

jTabbedPane.setPreferredSize(new java.awt.Dimension(600, 500));

Swing background color

Asked By: mugesh | Asked On: Dec 19th, 2009

How to change default background color in swing?

What do you mean by content pane, root pane and scroll pane? What are its use?

Asked By: rani | Asked On: Jul 25th, 2007

Answered by: LaksRao on: Sep 20th, 2009

Content Pane holds the container's visible components excluding Menu Bar.Every Top level container has a root pane which includes glass pane ( to intercept user events like mouse clicks), layered ...

Which layout should you use to organize the components of a container in a tabular form?

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) cardlayoutb) borederlayoutc) flowlayoutd) gridlayout

Answered by: amiraer on: Mar 4th, 2009

The correct answer is: D

Grid Layout divide the container in a tabular fashion.

Answered by: MANISHA PATHAK on: Oct 26th, 2006

Answer   D)GridLayout is used to organize the components of a container in a tabular form

All swing components are light weight componants except for (select multiple)

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) jwindow, jframeb) jdialogc) jappletd) jpanel

Answered by: Jags_vision on: Dec 12th, 2008

all AWT components are heavyweight and all Swing  components are lightweight (except for the top-level ones: JWindow, JFrame,  JDialog, and JApplet),

Answered by: sujith.k01 on: Dec 5th, 2008

JApplet

Why swing is called as light weighted component?

Asked By: Srinivasa Moorthi V | Asked On: Oct 11th, 2007

Answered by: shilpad on: Sep 5th, 2008

A heavyweight component is one that is associated with its own  native screen resource (commonly known as a peer). A lightweight component(swing) is one that "borrows" the screen resou...

Answered by: Kinjal Das on: Aug 25th, 2008

Let try to understand what is heavywheight component. If We see AWT Components (Earlier Java versions), while painting the components a very thick 3D frame is drawn. Hence the name of Heavy weight.And...

Which of the following may contain a menu bar?

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) a panelb) a framec) an appletd) a menu bar

Answered by: cnvreddy on: Aug 15th, 2008

Frame
Panel
Applet
Menubar
Menu

Answered by: MANISHA PATHAK on: Oct 25th, 2006

Frame

Which classes and interfaces does applet class consist? (select multiple)

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) the applet classb) appletcontext interface.C) appletstub interfaced) audioclip interface

Answered by: nomstradamus on: Jun 8th, 2008

All of the above
I looked it up in Javadocs hence it is right

Why some of components like jdialog,jframe are called as heavy weight components , event they are in Javax.Swing ?

Asked By: sachinsree | Asked On: Jan 6th, 2006

Answered by: Tamilarasan on: Feb 11th, 2006

Because JFrame , JTable , and JWindows are does not have Java peer. Even though they are in Swing Package they are still uses the Native Peer . An another Resons is They are directly InHerited by Heavy wight Components like Window, Applet, Frame...

The command ‘codebase’ is used in applets when

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) when the applet class file is not in the same directoryb) when the applet class file is in the same directoryc) when we need to get the parameters of the appletd) none of the above

Answered by: rubin2008 on: May 26th, 2008

c

Answered by: sudesha on: Apr 26th, 2006

A

Which of the following classes have a paint( ) method? (select multiple)

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) canvasb) imagec) framed) graphics

Answered by: lijo055 on: Mar 24th, 2008

Canvas
image

Answered by: pallavr on: Jun 30th, 2006

A) Only Canvass class has the paint method.

Any class which will extend the componet class will have the paint method inherited into it.

Which of the following are true about mouselistenerinterfaces? (select multiple)

Asked By: Interview Candidate | Asked On: Dec 10th, 2005

A) the mouselistener interface defines methods for handling mouse clicks.B) the mousemotionlistener interface defines methods for handling mouse clicks.C) the mouseclicklistener interface defines methods for handling mouse clicks.D) the mouselistenerinheritance interface defines methods for handling...

Answered by: zibyphilip on: Feb 13th, 2008

The following options are correct:A) TrueExplanation: MouseListener Interface defines the methods for mouse clicks, mouse pressed etc. Hence this is true.B) TrueExplanation: The MouseMotionListener de...

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.