please see the following code:-
import javax.swing.*;
import java.awt.*;
import java.awt.geom.*;
public class ForumRect
{
public static void main(String[] args)
{
TestFrame frame = new TestFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.show();
}
}
class TestFrame extends JFrame
{
public TestFrame()
{
Container contentPane = getContentPane();
contentPane.add(new TestPanel(), BorderLayout.CENTER);
contentPane.add(new TestPanel(), BorderLayout.EAST);
setBounds(0,0, 200, 200);
}
}
class TestPanel extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
Rectangle2D rect = new Rectangle2D.Double(0,0,100,100);
g2.draw(rect);
}
}
when you run the code, you will find the rectangle on the EAST is not completely withing the frame. even if you expand the window, its still out of the frame.
it seems as if the width of the EASTern side is limited.
what can i do so that the rectangle on the EAST is completely visible in the frame?