我有一个网格包布局,我在其中初始化了一个 gbc.insets = Insets(0,0,0,); 稍后我想在发生某些操作时调整此插图的大小。我试过改变这个值,然后做一个 repaint() 但这不起作用?我需要做什么?非常感谢你!
class myGraph {
private Insets myInsets = new Insets(0,0,0,0);
...
gbc.insets = myInsets; // setting Gridbag constraints.
Action Listener {
...............
myInsets.top =30;
myInsets.bottom =40;
myGraph.repaint();
}
}