472,365 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,365 software developers and data experts.

Scroll bar attached to text area

I'm trying to set u a scroll bar to be attached to the text area with a border around it. The problem is my text area appears as a small screen above the bordered/scrolled text area.

Here is my code:

Expand|Select|Wrap|Line Numbers
  1. notesText = new JTextArea();
  2. notesText.setLineWrap(true);
  3. notesText.setWrapStyleWord(true);
  4.  
  5. JScrollPane scroll = new JScrollPane(notesText);
  6. scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  7. scroll.setPreferredSize(new Dimension(400, 300));
  8. scroll.setBorder(BorderFactory.createCompoundBorder (BorderFactory.createCompoundBorder (BorderFactory.createTitledBorder("Enter extracts from book"), BorderFactory.createEmptyBorder (5, 5, 5, 5)), scroll.getBorder()));
Your help is very much appreciated.

Petra
Jul 19 '07 #1
2 1893
nickyeng
254 100+
scroll.setBorder(BorderFactory.createCompoundBorde r (BorderFactory.createCompoundBorder (BorderFactory.createTitledBorder("Enter extracts from book"), BorderFactory.createEmptyBorder (5, 5, 5, 5)), scroll.getBorder()));

your above line is causing the problem i think...why not make it easier by seperate it ?

too long in a line for setBorder...
Jul 20 '07 #2
JosAH
11,448 Expert 8TB
I'm trying to set u a scroll bar to be attached to the text area with a border around it. The problem is my text area appears as a small screen above the bordered/scrolled text area.

Here is my code:

Expand|Select|Wrap|Line Numbers
  1. notesText = new JTextArea();
  2. notesText.setLineWrap(true);
  3. notesText.setWrapStyleWord(true);
  4.  
  5. JScrollPane scroll = new JScrollPane(notesText);
  6. scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  7. scroll.setPreferredSize(new Dimension(400, 300));
  8. scroll.setBorder(BorderFactory.createCompoundBorder (BorderFactory.createCompoundBorder (BorderFactory.createTitledBorder("Enter extracts from book"), BorderFactory.createEmptyBorder (5, 5, 5, 5)), scroll.getBorder()));
Your help is very much appreciated.

Petra
What happens when you get rid of that complicated border and the preferred
size for that scroll pane? (set the number of rows and columns in the JTextArea
instead).

kind regards,

Jos
Jul 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: syed_saqib_ali | last post by:
Please take a look at and run the code snippet shown below. It creates a canvas with vertical & Horizontal scroll-bars. If you shrink the window to smaller than the area of the canvas, the...
3
by: Rithish Saralaya | last post by:
Is there a way to scroll a selected OPTION into view? I have a combination of text box and SELECT list. A user can key in text in the text box, and depending on the entry made, the respective...
3
by: cmay | last post by:
I am trying to use scrollIntoView to programatically scroll an area on one of my pages. It wors just like you would expect it to when the page itself doesn't have any scrolling (the page is...
5
by: Aidan | last post by:
Greetings all, I'm trying to build a div based layout for a mambo template (work in progress), and I'm having a strange problem, 2 acctually, with scroll bars in IE. I've tried everything I can...
2
by: Workgroups | last post by:
I need to scroll a virtual grid that is 1.2M pixels x 1.28M pixels in size. I think this is too large of a size for a control or a form, so I think I need to "fake it" with a custom drawn control....
1
by: Raffi | last post by:
Hi, I have an application screen with a CSS scroll area. Users click links in the scroll area which open small popup windows to enter data. When the data is submitted, the popup reloads the...
14
by: mbatestblrock | last post by:
Okay, So trust me I have googled, and searched this board before posting.. Maybe I dont know the correct searching phrase. I want to be able to recreate a text area for news on my site, and I...
3
by: Italio Novuas | last post by:
Hi all, let me begin by saying that I *ALMOST* have this complete! What I'm trying to do is make it so my text area shows the innerHTML of any select item with the same value. For example, if I...
1
by: spalanivel | last post by:
Hi, I need to plot the wave format on the usercontrol screen with the use of text file(having input values). Horizontal Scrollbar is placed on the panel . Read the values from 2 text files ...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.