473,781 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scrollbar

80 New Member
Hi friends

How can i add a vertical and horizontal scroll bar inside a Textarea..
While i created a textarea i cant read the topics down the screen ...
i add a scrollbar but it seperates from textarea , i want to attach that scrollbar with my textarea how is it possible...

Expand|Select|Wrap|Line Numbers
  1. JTextArea area = new JTextArea(40,40);
  2. JScrollBar scr = new JScrollBar();
  3.  
  4.  
i call this textarea and scrollbar inside a panel...but it seperates ...
Apr 12 '07 #1
5 3288
JosAH
11,448 Recognized Expert MVP
Hi friends

How can i add a vertical and horizontal scroll bar inside a Textarea..
While i created a textarea i cant read the topics down the screen ...
i add a scrollbar but it seperates from textarea , i want to attach that scrollbar with my textarea how is it possible...

Expand|Select|Wrap|Line Numbers
  1. JTextArea area = new JTextArea(40,40);
  2. JScrollBar scr = new JScrollBar();
  3.  
  4.  
i call this textarea and scrollbar inside a panel...but it seperates ...
Let the TextArea determine for itself whether or not it needs scrollbars. There's
a contructor that does the job:

public TextArea(String text, int rows, int columns, int scrollbars)

... also have a look at the API docs for this class.

kind regards,

Jos

ps. are you sure you don't want Swing's JTextArea instead?
Apr 12 '07 #2
reon
80 New Member
I tried something with JScrollPane , trying,but didnt completed..
i am using swing from javax and awt from java...

public TextArea(String text, int rows, int columns, int scrollbars)
would you please tell me wats the use of String text.bcoz i think textarea needed int columns and rows...wats the use of string there...

Let the TextArea determine for itself whether or not it needs scrollbars. There's
a contructor that does the job:

public TextArea(String text, int rows, int columns, int scrollbars)

... also have a look at the API docs for this class.

kind regards,

Jos

ps. are you sure you don't want Swing's JTextArea instead?
Apr 12 '07 #3
JosAH
11,448 Recognized Expert MVP
public TextArea(String text, int rows, int columns, int scrollbars)
would you please tell me wats the use of String text.bcoz i think textarea needed int columns and rows...wats the use of string there...
Did you read the API docs for this constructor? I bet you didn't.

kind regards,

Jos
Apr 13 '07 #4
BSCode266
38 New Member
The way i have used it before isnt probably the best way but it works. You can add the textarea to the scrollbar. And then the scrollbar to the panel.

i think its just one of the scrollbar.add() method.

BSCode266
Apr 13 '07 #5
JosAH
11,448 Recognized Expert MVP
The way i have used it before isnt probably the best way but it works. You can add the textarea to the scrollbar. And then the scrollbar to the panel.

i think its just one of the scrollbar.add() method.

BSCode266
That's not necessary: the TextArea can take care of all that itself. See my
previous replies.

kind regards,

Jos
Apr 13 '07 #6

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

Similar topics

7
26050
by: Sujan | last post by:
Hello all, Is it possible to remove scrollbar(s) without using frames. Is there any code which could be applied in body tag to remove scrollbar(s). Thanks in adv, Sujan
4
4403
by: Price Brattin | last post by:
I dragged a datagrid onto a VB.Net WinForm and used the properties page and a few lines of code to set it up, including the DataSource. No wizard setup was used. It works fine except for one thing: there is no vertical scrollbar even there are more lines than can be shown on the datagrid. There is plenty room on the right for the scrollbar but it is not there. If there is a scrollbar property for the .Net datagrid like in the VB6 DBgrid,...
9
4322
by: kjs | last post by:
Is there any was to control the color of the scrollbars when using the 'overflow: scroll' attribute? TIA, Karl
0
1026
by: h-h | last post by:
BODY { scrollbar-face-color: #f5f5f5; scrollbar-highlight-color: #666666; scrollbar-shadow-color: #666666; scrollbar-3dlight-color: #ffffff; scrollbar-arrow-color: #666666; scrollbar-track-color: #ffffff; scrollbar-darkshadow-color: #ffffff; background-color:white;
1
1485
by: Shun | last post by:
Hello, How to the add a blue color scrollbar to the browser Left and bottom. Thanx Shun
0
2626
by: d.steininger | last post by:
Hi there! Is there a way to bind a Textbox.Text to a ScrollBar.Value (not the Textbox-own Scrollbar) and vice versa? The Problem: I have to deal with two controls. The Textbox should accept integers as input, limited by a ScrollBar's Minimum- and Maximum. Changing the ScrollBar-Value should update the Textbox-Text and vice versa. So the textbox-text and scrollbar-value represent the same value. The user is
14
3957
by: Michael Weis | last post by:
Hello all, as a non-professional in these things, I searched for this topic but found no satisfying answer: I have to create a site with 3 frames. (Please no diskussion about the sense of using frames...) The main frame has to show a vertical scrollbar if content is bigger than one display page. This works well, but:
2
10659
by: kurt sune | last post by:
How do I render the scrollbars by CSS in a listbox? I have understood that an asp listbox gets rendered as a select element. So I tried first by adding a style element: ..TA {scrollbar-3dlight-color:aqua; scrollbar-arrow-color:fuchsia; scrollbar-base-color:fuchsia;
3
3208
by: nicky77 | last post by:
Hi, before you say it i know frames are bad practice - but i'm developing dynamic content on a site which has already been designed, so alas there's no option but to use them. Anyway, I just want to add simple styling to the scrollbar of the left hand frame of the page, but the styling i've applied isn't working for some reason. The site is at http://www.maguiresonline.co.uk/new_website/index.html It's the scrollbar in the middle of the...
1
13744
by: Tom | last post by:
First, I posted a similar request for help in another group and now don't find the posting. Problem with my newsreader perhaps ... but apologies if this appears as a cross posting. My code is inconsistent in the detection of a vertical scrollbar. This involves situations when less than the client area is needed to hold the small amount of data. The inconsistency is when adjusting the panel size within or just below the bottom row....
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10076
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.