Jump to content
Sign in to follow this  
jpedro20

[Swing] Absolute Layout delay

Recommended Posts

jpedro20

Boa tarde,

Tenho o seguinte código que foi gerado pelo window builder pro no eclipse:


import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JButton;


public class Client extends JFrame {

/**
* Launch the application.
*/
public static void main(String[] args) {
	EventQueue.invokeLater(new Runnable() {
		public void run() {
			try {
				Client frame = new Client();
				frame.setVisible(true);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	});
}

/**
* Create the frame.
*/
public Client() {
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	setBounds(100, 100, 610, 433);
	getContentPane().setLayout(null);

   JButton btnNewButton = new JButton("New button");
   btnNewButton.setBounds(0, 0, 117, 411);
   getContentPane().add(btnNewButton);

}
}

O problema é que sempre que não defino um layout e executo o programa, os componentes (neste caso um simples botão) aparecem com um certo delay em relação à frame. Se definir um layout isto já não acontece. Alguém sabe porque isto acontece e métodos para resolver?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.