Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #5321

Re: How to clip child from layout manager

From markspace <markspace@nospam.nospam>
Newsgroups comp.lang.java.gui
Subject Re: How to clip child from layout manager
Date 2013-04-05 16:28 -0700
Organization A noiseless patient Spider
Message-ID <kjnmhk$fb4$1@dont-email.me> (permalink)
References <7a07006d-a3a8-4e09-b3a3-1cd9ee01328f@googlegroups.com>

Show all headers | View raw


On 4/5/2013 10:03 AM, FredK wrote:
> I have a custom layout manager.
> If the Swing container that uses this manager is too small to layout
> the children at preferred sizes, I want to clip one or more of them.
>
> I do not want to set the child's size smaller than its desired size.
>
> For example, suppose the child's desired width is 100. I want to
> place it at x=250 with width = 100, but I want to clip part of it so
> that the first 40 pixels are clipped. The end result will be
> that its position is [250,350] but only the child's [60,100] part
> is visible ( occupying the region [290,350] ).
>

I think this happens automatically.  I think the clip region of the 
Graphic2D is already set for you when your layout manager is called. 
Just call setBounds() on each object you want to lay out.  They'll be 
drawn at that position, even if only partly visible.  If not visible it 
won't be drawn at all, the underlying graphics tool is smart like that.

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How to clip child from layout manager FredK <fred.l.kleinschmidt@gmail.com> - 2013-04-05 10:03 -0700
  Re: How to clip child from layout manager markspace <markspace@nospam.nospam> - 2013-04-05 16:28 -0700
    Re: How to clip child from layout manager FredK <fred.l.kleinschmidt@gmail.com> - 2013-04-08 07:38 -0700
      Re: How to clip child from layout manager markspace <markspace@nospam.nospam> - 2013-04-08 10:00 -0700
  Re: How to clip child from layout manager Roedy Green <see_website@mindprod.com.invalid> - 2013-04-05 20:51 -0700
  Re: How to clip child from layout manager Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-04-08 14:08 -0700

csiph-web