olah…
se fosse possivel gostaria q algum membro do forum podesse mim indicar algum tutorial…site…ou ateh msm
algum exemplo
de como exibir um jdialog q contenha uma jtable??
obrigado
olah…
se fosse possivel gostaria q algum membro do forum podesse mim indicar algum tutorial…site…ou ateh msm
algum exemplo
de como exibir um jdialog q contenha uma jtable??
obrigado
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
Pronto!
/****************************************************************/
/* Exemplo */
/* */
/****************************************************************/
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
/**
* Summary description for Exemplo
*
*/
public class Exemplo extends JDialog
{
// Variables declaration
private JTable table;
private JScrollPane scroll;
private JPanel painel;
// End of variables declaration
public Exemplo(Frame w)
{
super(w);
initializeComponent();
//
// TODO: Add any constructor code after initializeComponent call
//
this.setVisible(true);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always regenerated
* by the Windows Form Designer. Otherwise, retrieving design might not work properly.
* Tip: If you must revise this method, please backup this GUI file for JFrameBuilder
* to retrieve your design properly in future, before revising this method.
*/
private void initializeComponent()
{
table = new JTable();
scroll = new JScrollPane();
painel = (JPanel)this.getContentPane();
//
// table
//
table.setModel(new DefaultTableModel(4, 4));
//
// scroll
//
scroll.setViewportView(table);
//
// painel
//
painel.setLayout(null);
addComponent(painel, scroll, 39,32,275,166);
//
// Exemplo
//
this.setTitle("Exemplo - extends JDialog");
this.setLocation(new Point(10, 10));
this.setSize(new Dimension(360, 260));
}
/** Add Component Without a Layout Manager (Absolute Positioning) */
private void addComponent(Container container,Component c,int x,int y,int width,int height)
{
c.setBounds(x,y,width,height);
container.add(c);
}
//
// TODO: Add any method code to meet your needs in the following area
//
//============================= Testing ================================//
//= =//
//= The following main method is just for testing this class you built.=//
//= After testing,you may simply delete it. =//
//======================================================================//
public static void main(String[] args)
{
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch (Exception ex)
{
System.out.println("Failed loading L&F: ");
System.out.println(ex);
}
final JFrame w = new JFrame("Owner Window");
JButton btn = new JButton("Show Dialog");
btn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e)
{
//-- Create a Exemplo --
new Exemplo(w);
//-------------------
}});
JPanel p = new JPanel();
p.add(btn);
w.getContentPane().add(p);
w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
w.setSize(500,360);
w.setLocation(150,36);
w.setVisible(true);
}
//= End of Testing =
}
kkkkkk…poxa…valew ViniGodoy…agora ficou bem mais simples…
ehhh q ainda nao tenho muita experiencia…mais vou aprendendo com o tempo…e com o auxilio de vcs é claro
lauronolasco muito obrigado tbm…seu exemplo foi show de bola
vcs taum manajando em
fiz em 10 segunndos… :lol:
pra vc q ta começando… procura pelo JFrameBuideer… foi o programinha em q fiz esse exemplo!