Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

JScrollPane

Thread view: 
Thorsten Kiefer - 20 Mar 2008 12:06 GMT
Hi,
I need scroll pane which does not resize its child.
I.e. the child must always keep its preferred size.
If the scroll pane it bigger than the child, the child should
be aligned to the scroll pane's center.

Is something like that available ?

Best wishes
Thorsten
Alex.From.Ohio.Java@gmail.com - 20 Mar 2008 15:01 GMT
> Hi,
> I need scroll pane which does not resize its child.
[quoted text clipped - 6 lines]
> Best wishes
> Thorsten

Just add additional container inside JScrollPane:

public class GUI {
    public static void main(String[] args) {
       JFrame frame=new JFrame();
       frame.setSize(500, 400);
       JButton button=new JButton("Click me");
       button.setPreferredSize(new Dimension(200, 40));
           JPanel panel=new JPanel();
           panel.add(button);
       JScrollPane scrollableArea = new JScrollPane(panel);
       frame.add(scrollableArea);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}

Alex.
http://www.myjavaserver.com/~alexfromohio/
Thorsten Kiefer - 20 Mar 2008 20:44 GMT
>> Hi,
>> I need scroll pane which does not resize its child.
[quoted text clipped - 26 lines]
> Alex.
> http://www.myjavaserver.com/~alexfromohio/

Cool, Thanks !!!
Roedy Green - 21 Mar 2008 00:43 GMT
On Thu, 20 Mar 2008 12:06:27 +0100, Thorsten Kiefer
<thorstenkiefer@gmx.de> wrote, quoted or indirectly quoted someone who
said :

>I need scroll pane which does not resize its child.
>I.e. the child must always keep its preferred size.

You could use setPreferredSize setMinimumSize setMaximumSize on the
child and see if it honours your request.
Signature


Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.