What is JTable and what is its purpose?

Answers were Sorted based on User's Feedback



What is JTable and what is its purpose?..

Answer / sathiq

JTable is a Swing Componenet which is used to show the datas
in table format. It contains many custom models

Is This Answer Correct ?    78 Yes 9 No

What is JTable and what is its purpose?..

Answer / p.sakthivel

We can make it like spreadsheet and we can modify the
cells for JTextField, JCheckBox , JComboBox etc., by using
TableCellEditor.

To design an input dialog for Student database
we can make it by simple table by using JTable and
TableModel no need to design dialog with JButton and
JLabels with Layout

Is This Answer Correct ?    44 Yes 7 No

What is JTable and what is its purpose?..

Answer / shrikrishna kashid

With the JTable class you can display tables of data,
optionally allowing the user to edit the data. JTable does
not contain or cache data; it is simply a view of your data.

Is This Answer Correct ?    15 Yes 12 No

What is JTable and what is its purpose?..

Answer / narmada

The JTable is used to display and edit regular two-dimensional tables of cells.

The JTable has many facilities that make it possible to customize its rendering and editing but provides defaults for these features so that simple tables can be set up easily. For example, to set up a table with 10 rows and 10 columns of numbers:

TableModel dataModel = new AbstractTableModel() {
public int getColumnCount() { return 10; }
public int getRowCount() { return 10;}
public Object getValueAt(int row, int col) { return new Integer(row*col); }
};
JTable table = new JTable(dataModel);
JScrollPane scrollpane = new JScrollPane(table);

Is This Answer Correct ?    10 Yes 9 No

Post New Answer

More Swing Interview Questions

What is java swing used for?

0 Answers  


What is swing and awt in java?

0 Answers  


What is pane in swing?

0 Answers  


What are swing components in java?

0 Answers  


Why are swing components called lightweight components?

0 Answers  






Which is better swing or awt?

0 Answers  


Is swing still used?

0 Answers  


What is the difference between AWT & Swing?

21 Answers   BeBo Technologies, Deshaw, TCS,


What are the components of java swing?

0 Answers  


What is swing delegation event model in java?

0 Answers  


Why swing is used in java?

0 Answers  


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); }

0 Answers  


Categories