Java FlowLayout

Posted: September 20, 2014 in Java
Tags:

Layoutlar Javada görsel uygulamalarda bileşenlerin yerini belirlemede kullanılır.Bu tip bileşenleri soldan sağa doğru sıralar.

Aşağıdaki örneğimizde biz “center” parametresiyle bunu ortaya getirdik.

import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

public class x {

public static void main(String[] args) {

FlwLayout window= new FlwLayout();
window.setSize(300, 400);
window.setTitle(“hermes”);
window.setLocationRelativeTo(null);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setVisible(true);

}

}

class FlwLayout extends JFrame{

public FlwLayout(){

FlowLayout a = new FlowLayout(FlowLayout.CENTER,10,20);
setLayout(a);
add(new JLabel(“Name”));
add(new JTextField(25));
add(new JLabel(“Surname”));
add(new JTextField(25));

}

}

11

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s