1-) Java - SAĞTARAFA YADA FLOWLAYOUT.LEFT YAZARSAN SOL TARAFA DAYALI BUTTONLAR OLUSTURUR
public class flowlayout extends JFrame implements ActionListener{
JPanel panel;
public int sayi = 0;
public flowlayout() {
//super("Add component on JFrame at runtime");
//setLayout(new FlowLayout());
//setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
panel=new JPanel();
FlowLayout experimentLayout = new FlowLayout();
experimentLayout.setAlignment(FlowLayout.TRAILING);
panel.setLayout(experimentLayout);
//panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
add(panel);
for(int i=0;i<10;i++) {
JButton button=new JButton("CLICK HERE");
button.setText(String.valueOf(sayi)+" nolu");
//button.setBounds(0, sayi * 20, 10, 10);
panel.add(button);
button.addActionListener(this);
sayi++; }
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(500,500);
setVisible(true); }
public void actionPerformed(ActionEvent evt) {
panel.add(new JButton("Button"));
panel.revalidate();
//validate();
JButton b = (JButton) evt.getSource();
System.out.println(b.getText()); }
public static void main(String[] args) {
flowlayout acojfar=new flowlayout();
//for (Component c : jPanel1.getComponents())
//{
// if (c instanceof JLabel)
// {
// System.out.println("label var");
// JLabel ll = (JLabel) c;
// ll.setText("deneme");
// }
}}