Swing Interview Questions
Questions Answers Views Company eMail

How are Swing and AWT be differentiated?

Wipro,

3 6216

What is the difference between AWT and Swing ?

TCS,

1 4388

I want to change the appearance of Frame in Runtime, what class can be used to do this?

TCS, Wipro,

2 5036




Name the method, to expand & collapse nodes in a Jtree?

Wipro,

1 5967

What things to do to make a web browser compatibale for swing components?

Tesco, Wipro, TracFone,

1 3517

Difference between AWT and Swing compenents?

3 3380

How to add and delete nodes in Jtree?

MindMill,

1 4347

How can you draw using Swing components?

1 3831




Does Swing contains any heavy weight component?

5 7277

What are all the components used in Swing?

1 5450

What are the benefits of using Swing over AWT?

5 23239

Name the borders provided by Swing?

Accenture,

1 5978

What are the features of JFC?

1 16749

What does x mean in javax.swing?

7 20524

What is the default look and feel of a Swing Component?

3 7524


Post New Swing Questions






Un-Answered Questions { Swing }

What is Java Swing?

15


am searching for the job based on java, swing, currently working small company. they are not giving any salary slip, offer letter. so if i try outside for MNC's they start with previous company details. what should i do..? please help me to get job and make my career.

1582


What is the class in swing to change the appearance of the frame in runtime?

13


What is the difference between applications and applets?

17


When we should go for codebase in applet?

17






I want to use the markerfor playing a video using the jmf.Suppose my video length is of 2 hours.I want it to play ex-15 mintue or 20 mintue and should stop after assigning the time.I am providing my piece of code............please help me.... package com.jha.cdac.lila.praveen; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.net.URL; import javax.media.ControllerAdapter; import javax.media.Manager; /** * * @author vinays */ import javax.media.Player; import javax.media.RealizeCompleteEvent; import javax.media.Time; import javax.swing.JFrame; public class PlayVideo extends javax.swing.JFrame{ Player player; Component center; Component south; // this code is required for playing the video file of mpeg,mp4,mp3,3gp,rm,flv, //wmf,mpv,vob,qt and the asf extension public PlayVideo() { File file = new File("Lesson1.mpg"); try { load(file); // load() } catch (Exception ex) { //Logger.getLogger(LessonNarrative.class.getName ()).log(Level.SEVERE, null, ex); System.out.println("Error while loading file............"+ex); } } //the piece of code given below is used to load the file which user want to play. public void load(final File file) //load the file throws Exception { URL url = file.toURL(); final Container contentPane = getContentPane(); if (player != null) { player.stop(); } // MediaLocator mediaLocator=new MediaLocator (file.toURL()); // DataSource dataSource=Manager.createDataSource (mediaLocator); // player=Manager.createPlayer(url); player = Manager.createRealizedPlayer(url); ControllerAdapter listener = new ControllerAdapter() { @Override public void realizeComplete( RealizeCompleteEvent event) { Component vc = player.getVisualComponent(); player.getVisualComponent(); if (vc != null) { contentPane.add(vc, BorderLayout.CENTER); center = vc; } else { if (center != null) { contentPane.remove(center); contentPane.validate(); } } Component cpc = player.getControlPanelComponent(); if (cpc != null) { contentPane.add(cpc, BorderLayout.SOUTH); south=cpc; } else { if (south != null) { contentPane.remove(south); contentPane.validate(); } } pack(); // //setTitle(file.getName()); //to get the title of Video or Audio File } }; Time tm=new Time(30.4402403); Time tm1=new Time(5.7256199); player.addControllerListener(listener); player.setMediaTime(tm1); player.setStopTime(tm); // player.setMediaTime(new Time(5.0)); //player.setStopTime(new Time(73)); player.realize(); player.start(); } public static void main(String args[]) throws ClassNotFoundException { PlayVideo pv = new PlayVideo(); JFrame f = new JFrame("Lesson1"); f.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { System.exit(0); } }); f.getContentPane().add("Center", pv); f.pack(); Dimension screenSize = Toolkit.getDefaultToolkit ().getScreenSize(); int w = 420; int h = 140; pv.setLocation(screenSize.width/2 - w/2, screenSize.height/2 - h/2); pv.setSize(w, h); pv.setVisible(true); }

3223


What method is used to specify a container's layout?

12


What are the benefits of swing over awt?

16


What is double buffering ?

13


What is difference between awt and swing?

13


What class is at the top of the AWT event hierarchy?

15


What is an event handler in swing?

19


What are heavy weight components ?

14


Why does JComponent have add() and remove() methods but Component does not?

16


What are the advantages of the event-delegation model over the event-inheritance model?

9