Возникла проблема. НЕ менется размер кнопки. Вот код
| Код | package Lab4; import java.awt.*; import java.awt.event.*;
@SuppressWarnings("serial") public class MyWindow extends Frame implements Runnable{ private MyButton mb1=new MyButton(10,50,5,5);
public MyWindow(String title){ super(title); add(mb1); } public MyWindow(String title, int width, int height){ this(title); this.setSize(width, height); addWindowListener(new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } } ); }
@Override public void run() { // TODO Auto-generated method stub this.setVisible(true); } } @SuppressWarnings("serial") class MyButton extends Button{ public MyButton(int x, int y){ super(); this.setLocation(x,y); this.setLabel("test"); this.setVisible(true); } public MyButton(int x, int y, int width, int height){ this(x,y); this.setSize(width, height); //Вот не работает } }
|
Что я неправильно сделал. |