jscrollpane

How to prevent JScrollPane arrow key handling from moving caret when Scroll Pane wraps Text Pane

喜夏-厌秋 提交于 2019-12-19 11:54:31
问题 I have the following requirements: I need a scrollable JTextPane. The user may type into this text pane, or text may be inserted into it that is not typed by the user. Think something like an IM window. Although the window must be scrollable to allow the user to review text previously typed, the caret should never move from its position at the end of the text. Any text entered by the user will always appear at the end. In JTextPane, when the user scrolls with the scroll bar, the caret does

How to prevent JScrollPane arrow key handling from moving caret when Scroll Pane wraps Text Pane

▼魔方 西西 提交于 2019-12-19 11:54:13
问题 I have the following requirements: I need a scrollable JTextPane. The user may type into this text pane, or text may be inserted into it that is not typed by the user. Think something like an IM window. Although the window must be scrollable to allow the user to review text previously typed, the caret should never move from its position at the end of the text. Any text entered by the user will always appear at the end. In JTextPane, when the user scrolls with the scroll bar, the caret does

JTextPane prevents scrolling in the parent JScrollPane

偶尔善良 提交于 2019-12-19 08:58:13
问题 I have the following "tree" of objects: JPanel JScrollPane JPanel JPanel JScrollPane JTextPane When using the mouse wheel to scroll over the outer JScrollPane I encounter one annoying problem. As soon as the mouse cursor touches the inner JScrollPane, it seems that the scrolling events get passed into that JScrollPane and are not processed anymore by the first one. That means that scrolling the "parent" JScrollPane stops. Is it possible to disable only the mouse wheel on the inner JScrollPane

Scroll Event of a JScrollPane

萝らか妹 提交于 2019-12-19 05:08:22
问题 It's strange that JScrollPane doesn't have a method addAdjustmentListener() . Yet adjustmentListener is said to be used with scrollbars. I want something to happen whenever the JScrollPane is scrolled in either way. How to achieve such a thing? 回答1: Why don't you get the actual scrollbars, and then add adjustment listeners to them? JScrollBar has a method called addAdjustmentListener() . And you can use getVerticalScrollBar() and getHorizontalScrollBar() to get a JScrollBar from a JScrollPane

Scroll Event of a JScrollPane

时光总嘲笑我的痴心妄想 提交于 2019-12-19 05:08:07
问题 It's strange that JScrollPane doesn't have a method addAdjustmentListener() . Yet adjustmentListener is said to be used with scrollbars. I want something to happen whenever the JScrollPane is scrolled in either way. How to achieve such a thing? 回答1: Why don't you get the actual scrollbars, and then add adjustment listeners to them? JScrollBar has a method called addAdjustmentListener() . And you can use getVerticalScrollBar() and getHorizontalScrollBar() to get a JScrollBar from a JScrollPane

Add a Jlist to a JScrollPane

拟墨画扇 提交于 2019-12-19 04:18:29
问题 I have a JList that I need to Place inside a scroll Pane because I am getting the JList from the database and the values can increase greatly. I need to be able to scroll them down so I wrote: import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; public class Checkboxlistener extends

How to hide the arrow buttons in a JScrollBar

十年热恋 提交于 2019-12-18 15:49:47
问题 I need to hide the arrow buttons of java.awt.Scrollbar(VERTICAL) in an AWT application. Does anyone know how this can be achieved? I saw an example here, but the code just hides the buttons. The vacant space for the buttons still remains; it is not occupied by the scroll bar. To be more exact, here is the screenshot of what I should achieve. I am not sure which direction to go about it. Update : I was looking for a solution in AWT. But now I am open to suggestions in Swing as well. 回答1: Try

JScrollPane scrolling with arrow keys

时间秒杀一切 提交于 2019-12-18 11:32:01
问题 I've a JTextArea component inside JScrollPane and the text area is not editable. I would like to enable scrolling of the text area with up and down arrow keys (i.e. pressing the arrow keys will scroll the text area by one line). Any ideas how to achieve this? 回答1: Yes Key Bindings is the way to go, but you don't always need to create your own actions. Swing components come with default Actions that you can often reuse. See Key Bindings for a complete list of these Actions. Now that you know

How to make JScrollPane (In BorderLayout, containing JPanel) smoothly autoscroll

谁说我不能喝 提交于 2019-12-18 09:55:28
问题 I'm trying to have a JPanel of varying size (potentially much wider than the standard screen) inside of a JScrollPanel. Currently it works out great, and I have configured the scrollbars to work fine manually, however I would like the JPanel to "scroll" constantly to the left, so that over time the whole thing is displayed. All of the answers I found are specific to JTextArea and use Carets, or use rectToVisible. Neither of these will work because I'm trying to scroll internally to a single

recursive calls to AdjustmentListener - StackOverFlow Error Swing Java

左心房为你撑大大i 提交于 2019-12-18 09:29:07
问题 I have to synchronize the horizontal scrolling of tables. The columns would be the same only property that can be changed for the columns is their size. Now the following code shows 3 tables with synchronised scrolling. But as i change size of any one column in any of the table and then try to scroll, i get an Stack Overflow error and the gui is distorted. I am trying to achieve it by setting the viewport position of rest of the tables to the column which comes first on the left hand side. If