2

So in css you can set overflow on a div, for eg, and force it to show any overflowing elements appended to it. Can you do that with swing?

JLabel outside=new JLabel();
outside.setBounds(100,100,400,400);
JLabel inside=new JLabel();
inside.setBounds(0,0,500,400);
outside.add(inside); // show the cropped parts?  

I'm aware I've omitted a bucket load of other code. This is more just theory. I did google 'JLabel overflow' as well as 'Swing Component overflow' but couldn't find anything concrete.

If there's no simple answer, just type 'No' and I'll leave it alone.

Thanks

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Nikki
  • 3,664
  • 2
  • 15
  • 14
  • 1
    In any meaningful way, no, I can't think of a way – MadProgrammer Sep 26 '12 at 05:30
  • I hope I understood it in the right sense, that you wanted to place a JLabel on top of another. If Yes, then you can do that, simply you have to set the Layout for the JLabel in that case. Here is one [quick example](http://stackoverflow.com/a/10245045/1057230) for you for further help ask anything that you couldn't understand. Though actually how you intend to use this, will determine how good is this approach :-) – nIcE cOw Sep 26 '12 at 05:35
  • still wasting everybody's time (as in http://stackoverflow.com/q/12541673/203657) ... again: learn how layout works in swing. – kleopatra Sep 26 '12 at 08:33
  • @kleopatra Even while I read javadocs, I get ideas and questions pop into my head. When I can't get a definite answer from oracle's pages, I search elsewhere. And in case you didn't notice, I only asked for a simple answer. I wasn't asking for someone to write my program for me, do my homework or my job, like most of the questions around here. – Nikki Sep 26 '12 at 09:42

0 Answers0