createAndShowGUI

1 resposta
silva.fernandes

Gente, desculpe tanta ignorancia, sou novo em programação, principalmente em Java, estou lendo muitas coisas sobre o assunto e estou colocando em pratica.
Gostaria da ajuda de vcs … Estou começando montar o Layout d um aplicativo no Eclipse, mas queria no formato Windows, mas gostaria de mudar a GUI para Java … estou rachando a cabeça agora resolvi apelar para ajuda de vcs… alguem pode me ajudar ?

package aplication;

import java.awt.BorderLayout;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.SwingUtilities;

public class Aplicativo {

private JFrame jFrame;

private JPanel jContentPane;

/**
 * @param args
 */
public static void main(String[] args) {
	// TODO Auto-generated method stub
	SwingUtilities.invokeLater(new Runnable() {
		public void run() {
			Aplicativo application = new Aplicativo();
			application.getJFrame().setVisible(true);
		}
	});
}

/**
 * Este método inicializa a  jFrame
 * 
 * @return javax.swing.JFrame
 */
private JFrame getJFrame() {
	if (jFrame == null) {
		jFrame = new JFrame();
		jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jFrame.setSize(300, 200);
		jFrame.setContentPane(getJContentPane());
		jFrame.setTitle("Application");
	}
	return jFrame;
}

/**
 * Este método inicializa a jContentPane
 * 
 * @return javax.swing.JPanel
 */
private JPanel getJContentPane() {
	if (jContentPane == null) {
		jContentPane = new JPanel();
		jContentPane.setLayout(new BorderLayout());
	}
	return jContentPane;
}

}

1 Resposta

_fs

http://java.sun.com/docs/books/tutorial/uiswing/misc/plaf.html

Para setar o default do Java (metal):

UIManager.setLookAndFeel( "javax.swing.plaf.metal.MetalLookAndFeel" );

Mas para você que está começando com Java, recomendo que use uma tecnologia de interfaces mais simples que Swing (que é bastante complexo):
http://thinlet.sourceforge.net/home.html
É bem simples de usar e fica bonito.

Criado 30 de maio de 2006
Ultima resposta 30 de mai. de 2006
Respostas 1
Participantes 2