Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7800427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:38:03+00:00 2026-06-02T00:38:03+00:00

How will I enable scroll bars to display on the custom.StyledText? It displays the

  • 0

How will I enable scroll bars to display on the custom.StyledText?
It displays the scroll bars but does not allow the custom.StyledText to scroll?

package app;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;



import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.custom.ScrolledComposite;
public class myapp {

protected Shell shlWhois;
private Text text;

/**
 * Launch the application.
 * @param args
 */
public static void main(String[] args) {
    try {
        myapp window = new myapp();
        window.open();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

/**
 * Open the window.
 */
public void open() {
    Display display = Display.getDefault();
    createContents();
    shlWhois.open();
    shlWhois.layout();
    while (!shlWhois.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
}

/**
 * Create contents of the window.
 */
protected void createContents() {
    shlWhois = new Shell();
    shlWhois.setSize(450, 300);
    shlWhois.setText("Whois");

    Label lblDomain = new Label(shlWhois, SWT.NONE);
    lblDomain.setBounds(10, 10, 55, 15);
    lblDomain.setText("Domain");

    text = new Text(shlWhois, SWT.BORDER);

    text.setBounds(72, 4, 260, 21);

    final ScrolledComposite scrolledComposite_1 = new ScrolledComposite(shlWhois, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite_1.setAlwaysShowScrollBars(true);
    final Composite c = new Composite(scrolledComposite_1, SWT.NONE);
    scrolledComposite_1.setMinHeight(1000);
    scrolledComposite_1.setExpandVertical(true);
    scrolledComposite_1.setExpandHorizontal(true);
    scrolledComposite_1.setBounds(10, 31, 403, 221);

    final StyledText styledText = new StyledText(scrolledComposite_1, SWT.BORDER | SWT.WRAP);

    scrolledComposite_1.setContent(styledText);
    scrolledComposite_1.setMinSize(styledText.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    Button btnWhois = new Button(shlWhois, SWT.NONE);
    btnWhois.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseDown(MouseEvent arg0) {



        }
    });
    btnWhois.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent arg0) {
        }
    });
    btnWhois.setBounds(338, 2, 75, 25);
    btnWhois.setText("Search");



}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:38:05+00:00Added an answer on June 2, 2026 at 12:38 am

    You don’t need the ScrolledComposite, use SWT.V_SCROLL style on the StyledText. Here is an example, with layouts instead of the setBounds :

    /**
     * Create contents of the window.
     */
    protected void createContents() {
        shlWhois = new Shell();
        shlWhois.setSize(450, 300);
        shlWhois.setText("Whois");
        shlWhois.setLayout(new GridLayout(2, false));
    
        Label lblDomain = new Label(shlWhois, SWT.NONE);
        lblDomain.setLayoutData(GridDataFactory.fillDefaults().create());
        lblDomain.setText("Domain");
    
        text = new Text(shlWhois, SWT.BORDER);
        text.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    
        final StyledText styledText = new StyledText(shlWhois, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP);
        styledText.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).span(2, 1).create());
    
        Button btnWhois = new Button(shlWhois, SWT.NONE);
        btnWhois.setText("Search");
    }
    

    You can use the styles SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI if you also want an horizontal scrollbar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ambiguous question, I know. But anyway, I'm developing a client's site that will enable
Since File API will enable access to the content of local files it is
I looking for a script that will enable me to select an area in
I am trying to make something that will enable all controls if a SubString
I would like to know the process and service providers who will enable me
I am creating a Silverlight application which will be heavily javascripted against. To enable
I am trying to make a mobile app that would allow a drag and
I have made an app which will be a FB page tab. Now I
I want to imitate the iPhone scroll behavior in a Flash app I am
I'm trying to make an autoscroll enabled panel that will scroll if the mouseposition.x

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.