hello everyone,
help me in centering the frame which i developed using swing. Here is the code:

import javax.swing.*;
public class RSAInterface extends JFrame
{
	public RSAInterface()
	{
		setTitle("RSA by adil");
		setBounds(200,200,300,300);
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		JPanel panel = new RSAPanel();
		this.add(panel);
	}
}
import javax.swing.*;
public class RSAInterfaceTest
{
	public static void main(String ar[])
	{
		JFrame f = new RSAInterface();
		f.setVisible(true);
	}
}

To center the frame use this method:

setLocationRelativeTo(null);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.