jscrollbar

JScrollPane adjustmentListener and scrollRectToVisible

戏子无情 提交于 2019-12-11 05:53:47
问题 I need to handle event from JScrollPane when user scrolls it. In here it is suggested to use addAdjustmentListener to either JViewport or Vertical/HorizontalScrollBar. Is there any difference, which method should I choose? I would like also to use scrollRectToVisible for the same JScrollPane , should I anticipate AdjustmentListener working for this method? Also I wonder whether scrollRectToVisible tries to do minimum scrolling to make required rectangular visible or it tries to make it

synchronize scrolling of N number of jtables in java swing

孤人 提交于 2019-12-10 18:17:56
问题 I have a requirement of having N number of tables arranged in a grid pane side by side provided height of the scrollpanes of all the jtables remains same. Now i want to synchronize scroll of all the jtables means if i scroll the first jtable then rest of the jtables should scroll automatically by the same amount. Anyone has any idea about this ? 回答1: Try sharing the model of the scrollbar. Something like: JScrollPane scrollPane1 = new JScrollPane(...); JScrollPane scrollPane2 = new

JScrollPane- Only Vertical Scroll?

﹥>﹥吖頭↗ 提交于 2019-12-10 17:47:03
问题 I have the following line of code: JSplitPane VPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,(new class1()),new JScrollPane(new class2())); I'd like class2 to ONLY have vertical scrolling please? Since my layout falls to bits otherwise. I am using GridBagLayout and it's too late to change the layout now. Is there a method to fix this? 回答1: +1 to trashgods comment. It doesn't seem to work- I'm just getting errors =[ To illustrate this: JScrollPane js=...; //Create a variable reference to the

java coloured scroll bar search result

拜拜、爱过 提交于 2019-12-04 14:11:03
问题 How would I go about customizing a scroll bar in Java so that I could have a search that acts like chrome, that's to say puts coloured stripes where the results are? I don't want a library as I'd prefer to code it myself. Plus I don't want to loose my L&F that I have. Examples welcome. Actually it will be to view a large text file or a long jtable, and does anyone have any good ideas for how I could have an efficient scroll bar to view this? ... should I have a double scroll bar one beginning

How to add scrollbar to panel?

依然范特西╮ 提交于 2019-12-02 15:20:30
问题 I need help. I have one panel which can need to have width 1000px. I need to add lot of buttons with different size ( I add with flow layout and it works fine). Problem is that I have height on screen example 500px but when I add buttons panel has bigger size. How to add scrollbar to panel ? 回答1: Add your panel to scrollpane and add that pane where you are adding your panel instead of panel JScrollPane jScrollPane = new JScrollPane(panel); 来源: https://stackoverflow.com/questions/5790525/how

Java Textarea ScrollPane

若如初见. 提交于 2019-12-02 12:04:56
I have created a textarea, and i need a scrollbar applied to the textarea when necessary (when the text gets too long down and it cant be read anymore). this is the code i have written, but for some reason, the scrollbar doesnt really come up? final JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setBounds(10, 152, 456, 255); textArea.setBorder(border); textArea.setLineWrap(true); sbrText = new JScrollPane(textArea); sbrText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); panel_1.add(textArea); see this import javax.swing.*; public class

How to add scrollbar to panel?

寵の児 提交于 2019-12-02 10:53:53
I need help. I have one panel which can need to have width 1000px. I need to add lot of buttons with different size ( I add with flow layout and it works fine). Problem is that I have height on screen example 500px but when I add buttons panel has bigger size. How to add scrollbar to panel ? Add your panel to scrollpane and add that pane where you are adding your panel instead of panel JScrollPane jScrollPane = new JScrollPane(panel); 来源: https://stackoverflow.com/questions/5790525/how-to-add-scrollbar-to-panel

I'm having trouble getting JScrollPanes to actually display scroll bars

孤街浪徒 提交于 2019-12-01 23:34:41
问题 I've found some examples scattered around the internet involving getting an image or a textbox to display scroll bars, but they all involve a program that basically displays its entire contents in a scroll pane. What I need to get it to do is stick a JPanel somewhere, pile a bunch of text, icons, etc into that panel until its too big for the space I've got for it, and then scroll across it. I'm probably going to need to be able to null-layout that panel, too, because I'm probably going to

I'm having trouble getting JScrollPanes to actually display scroll bars

非 Y 不嫁゛ 提交于 2019-12-01 21:05:00
I've found some examples scattered around the internet involving getting an image or a textbox to display scroll bars, but they all involve a program that basically displays its entire contents in a scroll pane. What I need to get it to do is stick a JPanel somewhere, pile a bunch of text, icons, etc into that panel until its too big for the space I've got for it, and then scroll across it. I'm probably going to need to be able to null-layout that panel, too, because I'm probably going to have to manually position things within it sooner or later. So I tried to make a pretty simply program

How to know if a JScrollBar has reached the bottom of the JScrollPane?

情到浓时终转凉″ 提交于 2019-12-01 18:28:45
I'd like to know if there is a way to know when a JScrollBar (vertical in my case) has reached the bottom of his containing JScrollPane . At first i have though of using an AdjustmentListener on the scroll bar but i don't know how to interpret the value attribute of the JScrollBar . Also i'm not sure to properly understand what the maximum represents and if i can use with the value to get the information i need. Edit : scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { @Override public void adjustmentValueChanged(AdjustmentEvent ae) { System.out.println("Value: