java left logo
java middle logo
java right logo
 

Home arrow Other API Tips
 
 
Main Menu
Home
Java Tutorials
Book Reviews
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Java Network
Java Forums
Java Blog




Most Visited Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews
Top Rated Tips
Java SE Tips
Java ME Tips
Java EE Tips
Other API Tips
Java Applications
Java Libraries
Java Games
Book Reviews


Statistics
Registered Users: 4092
Java SE Tips: 614
Java ME Tips: 202
Java EE Tips: 183
Other API Tips: 779
Java Applications: 298
Java Libraries: 209
Java Games: 16
Book Reviews:
 
 
 
How to make View scrollable in SWT E-mail
User Rating: / 19
PoorBest 

Sometimes more than one view is placed on the same perspective. In this condition it is not possible to see the whole view without maximizing it.

But in some situations you may need to see all the views completely at the same time without maximizing them.

This can be possible by making the view scrollable. View can be made scrollable by using Scrollable Composite.

Following is the snapshot of the Scrollable View:


Image

Implementation Code:

1. public class scrollbarcomposite extends ViewPart {
2.  Composite composite=null;
3.   public void createPartControl(Composite parent) {
4.  ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL |   
  SWT.V_SCROLL | SWT.BORDER);
5.    composite = new Composite(sc, SWT.NONE);
6.         composite.setLayout(new FillLayout());
7.         composite.setSize(400,400);
8.         sc.setContent(composite);
9.         sc.setExpandHorizontal(true);
10        sc.setExpandVertical(true);
11.       sc.setMinSize(composite.computeSize(10001000));
12. 
13.}

In the above code first ScrollableComposite is created (In step 4) and set the minimum size of the Scrollable Composite (In step 11). Now Composite having the Controls is added to the Scrollable composite (In step 5).

When the size of the view reduced to the minimum size of the ScrollableComposite then scrollbar will automatically appears.


 Related Tips

 
< Prev   Next >

Page 1 of 0 ( 0 comments )

You can share your information about this topic using the form below!

Please do not post your questions with this form! Thanks.


Name (required)


E-Mail (required)

Your email will not be displayed on the site - only to our administrator
Homepage(optional)



Comment Enable HTML code : Yes No



 
       
         
     
 
 
 
   
 
 
java bottom left
java bottom middle
java bottom right
RSS 0.91 FeedRSS 1.0 FeedRSS 2.0 FeedATOM FeedOPML Feed

Home - About Us - Privacy Policy
Copyright 2005 - 2008 www.java-tips.org
Java is a trademark of Sun Microsystems, Inc.