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.
The layout of a container can be altered by using which of the following methods :-
A) setlayout(alayoutmanager)b) layout(alayoutmanager)c) addlayout(alayoutmanager)d) setlayoutmanager(alayoutmanager)
B) layout(aLayoutManager)
A
setLayout();
Which of the following methods are invoked by the awt to support paint and repaint operations?
A) paint( )b) repaint( )c) draw( )d) redraw( )
B) repaint()
repaint( )
What is the difference between applet and frame in Java?
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...
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?
A) show( )b) setvisible( )c) display( )d) displayframe( )
a.showWindow
b. setVisible
A) show()
B) setVisible()
ex Frame fr=new Frame("MyFrame");
fr.show();
or
fr.setVisible(true);
Setselectioninterval and addselectioninterval
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?
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) ...
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?
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.
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?
JTabbedPane jtp=new JTabbedPane();//u can add tabs to d panejtp.addTab("xxx");
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));
How to change default background color in swing?
What do you mean by content pane, root pane and scroll pane? What are its use?
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?
A) cardlayoutb) borederlayoutc) flowlayoutd) gridlayout
The correct answer is: D
Grid Layout divide the container in a tabular fashion.
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)
A) jwindow, jframeb) jdialogc) jappletd) jpanel
all AWT components are heavyweight and all Swing components are lightweight (except for the top-level ones: JWindow, JFrame, JDialog, and JApplet),
JApplet
Why swing is called as light weighted component?
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...
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?
A) a panelb) a framec) an appletd) a menu bar
Frame
Panel
Applet
Menubar
Menu
Frame
Which classes and interfaces does applet class consist? (select multiple)
A) the applet classb) appletcontext interface.C) appletstub interfaced) audioclip interface
All of the above
I looked it up in Javadocs hence it is right
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
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
Which of the following classes have a paint( ) method? (select multiple)
A) canvasb) imagec) framed) graphics
Which of the following are true about mouselistenerinterfaces? (select multiple)
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...
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...
Process from the last added to first
C) There is no way to determine which listener will be invoked first.