Valeu pessoal pelas dicas, e mais do que isso… a atenção.
Giliard, fiz um teste aqui com o Nimbus muito legal mesmo, segue o código para
quem quiser ver:
/****************************************************************/
/* Cad001 */
/* */
/****************************************************************/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.*;
/**
* Summary description for Cad001
*
*/
public class Cad001 extends JDialog
{
// Variables declaration
private JTabbedPane jTabbedPane1;
private JPanel contentPane;
//-----
private JPanel Painel_Botoes;
//-----
private JPanel jPanel3;
//-----
private JPanel jPanel4;
//-----
private JPanel jPanel6;
//-----
private JTextField jTextField1;
private JPanel jPanel8;
//-----
private JPanel jPanel9;
//-----
// End of variables declaration
public Cad001(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()
{
jTabbedPane1 = new JTabbedPane();
contentPane = (JPanel)this.getContentPane();
//-----
Painel_Botoes = new JPanel();
//-----
jPanel3 = new JPanel();
//-----
jPanel4 = new JPanel();
//-----
jPanel6 = new JPanel();
//-----
jTextField1 = new JTextField();
jPanel8 = new JPanel();
//-----
jPanel9 = new JPanel();
//-----
//
// jTabbedPane1
//
jTabbedPane1.addTab("jPanel3", jPanel3);
jTabbedPane1.addTab("jPanel4", jPanel4);
jTabbedPane1.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e)
{
jTabbedPane1_stateChanged(e);
}
});
//
// contentPane
//
contentPane.setLayout(new BorderLayout(0, 0));
contentPane.add(Painel_Botoes, BorderLayout.SOUTH);
contentPane.add(jTabbedPane1, BorderLayout.CENTER);
//
// Painel_Botoes
//
Painel_Botoes.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
Painel_Botoes.setPreferredSize(new Dimension(50, 50));
//
// jPanel3
//
jPanel3.setLayout(new BorderLayout(0, 0));
jPanel3.add(jPanel6, BorderLayout.SOUTH);
jPanel3.add(jPanel8, BorderLayout.NORTH);
jPanel3.add(jPanel9, BorderLayout.CENTER);
jPanel3.setBorder(BorderFactory.createLoweredBevelBorder());
//
// jPanel4
//
jPanel4.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
jPanel4.setBorder(BorderFactory.createLoweredBevelBorder());
//
// jPanel6
//
jPanel6.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
jPanel6.setBorder(new TitledBorder("Title"));
jPanel6.setPreferredSize(new Dimension(60, 60));
//
// jTextField1
//
jTextField1.setText("jTextField1");
jTextField1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
jTextField1_actionPerformed(e);
}
});
//
// jPanel8
//
jPanel8.setLayout(null);
jPanel8.setBorder(new TitledBorder("Title"));
jPanel8.setPreferredSize(new Dimension(60, 60));
addComponent(jPanel8, jTextField1, 88,23,178,22);
//
// jPanel9
//
jPanel9.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
jPanel9.setBorder(new TitledBorder("Title"));
//
// Cad001
//
this.setTitle("Cad001 - extends JDialog");
this.setLocation(new Point(10, 10));
this.setSize(new Dimension(443, 368));
}
/** 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 appropriate code in the following Event Handling Methods
//
private void jTabbedPane1_stateChanged(ChangeEvent e)
{
System.out.println("\njTabbedPane1_stateChanged(ChangeEvent e) called.");
// TODO: Add any handling code here
}
private void jTextField1_actionPerformed(ActionEvent e)
{
System.out.println("\njTextField1_actionPerformed(ActionEvent e) called.");
// TODO: Add any handling code here
}
//
// 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("javax.swing.plaf.metal.MetalLookAndFeel");
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
}
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 Cad001 --
new Cad001(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 =
}