如何添加此畫布的按鈕ontop?像浮動...頂部,而不是使用添加(按鈕)在網格中;如何在Java的畫布內添加此按鈕?
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Myscreensaver extends Window
{
private static final Canvas canvas = new Canvas();
private Button button;
public Myscreensaver()
{
setLayout(new GridLayout(2,2));
canvas.setPreferredSize(new Dimension(200, 200));
add(canvas);
//add(button); no add the button in the canvas not in the grid, then it looks odd.
}
}