Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 30th, 2005, 12:44 AM   #1
susam_pal
Encoder
 
Join Date: Sep 2005
Location: India
Posts: 12
Rep Power: 0 susam_pal is on a distinguished road
Send a message via Yahoo to susam_pal
Rectangle in EAST is partially visible

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?
susam_pal is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:12 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC