JTeaxtarea, scroll to position
Hello,
I have an app where a jtextarea has a lot of text, and when you click a line on a jtable, some text gets selected...
I am already marking the selected text with a DefaultHighlighter and scroll to it with txtTextToSearch.setCaretPosition(...).
The problem is that if the selected text is imediatelly outside the visible area of the textarea (like under the scrollpane's scrollbars), the scrollpane won't scroll.
In other words, let's say the text area has 100 lines of text. The visible lines are 50-60.
If I want to select text in the 55th line, it works ok, it was already visible.
If I want to select text in the 80th line, it works ok, scrolls to the correct position.
If I want to select text in the 61th line, it fails, doesn't scroll at all.
Is there any any to calculate the position of the text so I can use scrollRectToVisible()? Or am I doing this all wrong?
If I want to select text in the 61th line, it fails, doesn't scroll at all.I have never had problems using the setCaretPosition(...) method.
If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
Similar Messages
-
Hi,
I'm working on a feature triggered by scroll bar position of a string control changed.
But I could not find a good way to catch the scroll bar position changed event,
the scroll bar is controlled manually by mouse down → mouse move → mouse up, I want the get the Text.ScrollPos value when user mouse up, and compare with the maximum value.
But the problem is, mouse up on the scroll bar could not trigger String: Mouse up event!
So I have to get the Text.ScrollPos continuously in the background in Timeout event, but I think it’s not efficient.
Do you have any better idea on when to get the correct destination value of Text.ScrollPos?
I plan to store the value of Text.ScrollPos in the bottom(maximum value) in a shift register, then compare the current Text.ScrollPos value with the max one.
If it comes close to the bottom(90%~100% of the maximum value), then the close to bottom LED will turn on.
Attachments:
scroll bar pos changed.vi 15 KBHello Cecilia,
I don't think there is any build-in event for this.
One solution would be to create your own user event at the initialisation of you main and launch a thread which is going to be pulling the value of your scrollbar position:
Then you can build your main as if they were a scrollbar move event.
And dont forget to close the thread and destroy the event at the end.
Hope it helps.
Attachments:
Scrollbar event.PNG 10 KB -
Custom Horizontal Scroll Bar position on File Open
Fellow Forum Members,
I have a lot of PDF files that I want to open in a special way. I want them to open at 150% ZOOM and this was easy enough to setup in the PREFERENCES window.
However, what is proving to be a big problem is changing how the horizontal scroll bar has a default position all the way to the left. My objective is to have the horizontal scroll bar positioned all the way to the right and at a 150% everytime I open a PDF file.
The Preferences window doesn't seem to have a horizontal scroll bar position on open setting. Can anyone help me out and tell me how such a custom setting is possible with Acrobat 9 Extended? Any help will be greatly appreciated. Thanks.Does anyone have any ideas?
-
Get image Scroll bar position value
How to get an image component scrollbar position value in flex.
I have an image component in my application, when i scroll the horizontal scrollbar
i need the current scrolled position. How to get the scrolled position in an image component.
Kindly help in this issue.
Rajkumar.Are you sure you want to use setOnScroll to listen to scroll events rather than set the value of the scroll bar position via the tableView.scrollTo api (which I would recommend) or the scrollBar.setValue() api?
for (Node n: table.lookupAll(".scroll-bar")) {
if (n instanceof ScrollBar) {
ScrollBar bar = (ScrollBar) n;
System.out.println(bar.getOrientation() + ": range " + bar.getMin() + " => " + bar.getMax() + ", value " + bar.getValue());
if (bar.getOrientation().equals(Orientation.VERTICAL)) {
bar.setValue(0.5);
}If you did really, really want to use setOnScroll, then you could do something like this:
Node flow = table.lookup("VirtualFlow");
if (flow != null) {
final EventHandler<? super ScrollEvent> originalScrollHandler = flow.getOnScroll();
flow.setOnScroll(new EventHandler<ScrollEvent>() {
@Override public void handle(ScrollEvent event) {
System.out.println(event);
originalScrollHandler.handle(event);
} Though you would be better off just using an eventfilter rather than using the strange lookup and setOnScroll chaining method in the above code.
table.addEventFilter(ScrollEvent.ANY, new EventHandler<ScrollEvent>() {
@Override public void handle(ScrollEvent event) {
System.out.println(event);
// uncomment if you don't want the default table scroll events processing to take effect.
//event.consume();
}); -
I have an applet which will display 25 columns and n Number of rows. How can I change the cursor postion to a particular row while applet reloads?
setRowSelectionInterval(int, int) may move the cursor to the particular row. But The scrollbar is still in initial position. I need to change the scroll position.Use getCellRect(...) to get the rectangles of any cells you want to display, then create a Rectangle which circumscribes all of these, then use scrollRectToVisible(...) to adjust the view.
-
Easy question - scroll bar position in listbox problem
hello again
this time my question is simple...
is there a way to set the initial position of a vertical scroll bar of a listbox?
sometimes - if i make more runnings - remain in memory the last position...and if the new listbox is smaller then the last one i see a white listbox and i think that something went wrong in my program
Using LabVIEW 7.1
Solved!
Go to Solution.Hi gigi85,
Okay in that case,Please create property node with Multiple lines property, and click on the blue square shown in the diagram and expand it downwards, Labview should automatically add these parameters. added screenshot for your reference.
Let me know if u've any queries.
Thanks
uday,
Please Mark the solution as accepted if your problem is solved and help author by clicking on kudoes
Certified LabVIEW Associate Developer (CLAD) Using LV13
Attachments:
Screenshot_TopRow_PropertyNode.png 8 KB -
Is there a way to programmatically change the scroll bar position?
I am wanting to programmatically shift my front panel horizontally at a certain point during execution. I need a way of moving the scroll bar automatically. Does anyone have any suggestions?
Thanks!Use the VI property FP.Origin to scroll the panel in the window.
LabVIEW, C'est LabVIEW -
List vertical scroll bar position change issue
Hi all,
List selection makes the list jump (scroll) up moving the selected entry to top any idea on this issue.
regards,
karthikTry it in a simple test case. I don't think that is default behavior.
-
ScrollPane vertical scroll bar positioning
I have a ScrollPane that holds a number of number of sprites. The sprites are like rows and I would like them to fill the width of the ScrollPane.
My problem is that if there are not enough sprites to fill the vertical space of the ScrollPane, then no Scrollbar appears and there is a narrow gap left on the right side of the ScrollPane. If I make the sprites wider, when the vertical scroll bar does appear some of the sprite is cut off and the horizontal scroll bar appears (I never want the horizontal one to appear).
Is there a way to move the scrollBars? or perhaps another way to solve my issue?assign your sp's horizontalScrollPolicy (and/or verticalScrollPolicy) to "off".
-
DataTable Scroll bar Position Changing
Hi,
I have a datatable with scroll bar on 'A' screen and when I go to 'B' screen and come back to 'A' screen again the data table reloads and showing the table from the first record onwards instead of showing the selected n th record by holding the scroll bar state.
Is there any way to scroll the scroll bar of a data table to the particular record either by backend logic or by java script.
I used h:PanelGroup to the data table for scroll bar.That's getting harder. Put the tables in a block element, e.g. div, and onload set div.scrollTop to the amount of pixels it have to be scrolled. I am not going to give raw code here as you're here in a Java/JSF forum, not a Javascript/DHTML forum. If you still stucks, even after googling on the given keywords, consult DHTML forums like dhtmlcentral.com and dynamicdrive.com.
-
Scroll bar position in Content veiwer
When I look at folios (even the preloaded one from adobe) in content viewer on ipad air 2 (landscape only) the black scroll bar is in the center of the screen. Can anyone fix this?
Known issue. Being worked on.
-
Smooth Scroller und Position zurückgeben Flash CS3/4
Hallo
weiss jemand wie ich die Scroll Bewegung smoothen kann ?
mein zweites Problem:
Wenn ihr das Bild bis ans Ende scrollt und den Graureiher (also der 3. Graureiher)
anklickt kommt ein nächster Frame -wenn Ihr dann wieder auf zurück klickt - landet ihr
nicht da wo ihr hergekommen seid - sondern wieder an dern Anfang-
das soll so nicht sein - es soll der Ausschnitt gezeigt werden von dem man gekommen ist.
Ich bin Newbie... wäre nett wenn ihr mir Lösungsvorschläge geben könntet
dankeRenderers must report a correct measuredHeight based on a given
explicitWidth. You may need to override measure() method.
If the rows are so tall they don't fully fit in the DG, there may not be a
simple solution for MX DataGrid The Spark DataGrid should be able to handle
it -
ADF Treetable scrolling position resets to top on refresh
I have a master details page with the following components.
TreeTable with a Check Box on LHS and TabbedPannel on RHS.
So, users can select any row on the LHS and the corresponding details will be displayed on RHS in a new Tab. When user closes the Tab it will clear the Check Box on TreeTable.
Issue is, when user is at last row of TreeTable when there are more rows (Scroll bar will be at last), and user closes the Tab on RHS side, I will be clearing the checkbox binding and refresh the treetable using PPR to reflect the same.
This is causing the treetable scroll bar to be reset to the top. And User lost the old position on needs to scroll down again.
Can we control the Scroll bar position after PPR refresh (or)
Can we just clear off the CheckBox selection (only one row) with out refeshing the whole treetable
Environment:
JDev Version : 11.1.1.6.2
Component : ADF TreeTable with TreeModel binding (Not using BC)In my case, I am fine with disclosureState items. They do not collapse even after I remove the checkbox selection and refreshing the TreeTable component.
Only issue is scrollbar is resetting to top.
I can't use the disclosure event as they can do expandAll , select first compoenent scroll down and close the selection on RHS tab.
Which will reset the LHS scrolling position to top. -
hey,
i'm using jdeveloper11g and I use a RichTable to display data of a ViewObject. The data associated with the view object changes and i need to update RichTable accordingly. However, as I update using Poll the scroll position of the table is changed to top most position. What i need is to preserve the scroll position even after the refresh...any hints would be a gr8 help
thanxThat's not as easy as it sounds :-(
As far as I know there is no method to get the scroll bar position itself.
The problem is to get hold of the position the iterator is in when the poll event occurs.
You execute the underlying query again to show new data. Depending on the query (i.e. sort) the result might be different after the refresh. The user might be confused about the new result, but I guess you thought out this.
You can play with this EL #{bindings.YourView.iteratorBinding.rangeStart}and save the value before you re execute the query and after execution set the position back.
Timo
P.S.:
I did not test this with scrollable views (which are the preferred views to use with faces). so you might allays get 0 as result. In this case you can try to save the current record (if you have one selected) and go back to this record after refresh.
Edited by: Timo Hahn on 29.09.2009 14:14 -
Scroll position does not reset on datasets
Forgive me if this is somewhere else, but I cannot find it. In using spry datasets in CS4, when the data in a container is long enough to need a scroll bar, the scroll position does not reset to the top when you chose the next item in the dataset. By example, if I choose Grapefruit, and the description container has several paragraphs that i have scrolled down to read, then I choose Pear, and the description content displays in the same scroll-down position (perhaps in the middle or the end) instead of resetting at the beginning of the paragraph. Is this a bug or is there something I am doing wrong?
Thanks!!!Argh! I have this exact same problem when working with Master/Detail.
When I scroll down to the bottom of a detail area, and then click another item in the master column, it displays the bottom of the new detail area. This is not what I want. Whenever I click on a new item in the master column, I need to be positioned at the top of the new detail area. How can I make that happen?
Please help! Thanks!
SC
Maybe you are looking for
-
itunes é legal, mas quando está sincronizando é um lixo, nem isso porque minha lixeira levanta a tampa mais rápido que o itunes... ¬¬ Quando você coloca ele pra sincronizar por exempolo com o iphone (qualquer versão), o itunes deixa de ser um player
-
Document saved(no automatic clearing) during VF11
Hi experts, I cancelled an invoice document through VF11. Cancellation invoice was also created, but when i save this, i get the message "Document xxxxxxxxx saved(no automatic clearing)". Note:Invoice is of zero value. This doesnt financially affect
-
Connect oracle 8 client to oracle 9i server
hi friends, I have earlier oracle 8.0.4 installed on my network. Now i upgraded server to oracle 9i release 1. How can i make connectivity between oracle 8.0.4 client to oracle 9i server? Should i install oracle 9i client on every machine? what will
-
PI Basis 2006_1_700
Hi, In my Solution manager 7.0 system PI_Basis 2005_1_700 is installed. To go to PI Basis 2006_1_700 do i need to do upgrade or installation of PI Basis 2006_1_700 through SAINT. Thanks, Rohan
-
Assignaments of authorization objects for tcodes PC00_M99_CIPE, PCP0
Dear Gurus- How I do can assing the objetct P_ORGIN, with the field VDSK1 (Organizational Key) for the t.code PC00_M99_CIPE, PCP0. For example , I want that the system check that the employee that execute this t.code have in the rol assigned the valu