Questions tagged [jscrollbar]

JScrollBar is a Java Swing component to indicate the current position and the visible area size (by length of knob) if horizontal or vertical scrolling is involved so only part of the view is visible.

JScrollBar is a Java Swing component to indicate the current position and the visible area size (by the thumb length) if horizontal or vertical scrolling is involved so only part of the view is visible.

266 questions
2
votes
1 answer

How to add scrollbar to panel in java, without borderlayout?

Here is my code: //this is a JPanel, the gray panel behind the A4 paper public Panel(int w, int h) { //w=624, h=600 this.w = w; this.h = h; ownlayout(); setLocation(0, 0); setSize(w,h); setBackground(Color.gray); …
victorio
  • 6,224
  • 24
  • 77
  • 113
2
votes
1 answer

How to make my JScrollBar work or dynamically resize a JPanel to fit components?

I've thoroughly searched for an answer to my question and tried multiple things but none of these things worked for me. I have a button that opens a JDialog allowing the user to attribute and change colors for three types of objects/constraints. The…
2
votes
2 answers

How to modify a JPanel's size inside a JScrollPane?

I just can't get this right. I have a slider to increase my JPanel's size (used as a canvas to draw on). Whenever the JPanel receives the event, I resize it with setBounds() and I can see it resizing for a split second, but a next Paint or something…
sekmet64
  • 1,635
  • 4
  • 19
  • 30
2
votes
1 answer

How can I make this JEditorPane display the way I want?

It starts off displaying like this: Then as expected, when you fill it with text beyond the bottom limit it looks like this: But the text trails off the side a bit, which definitely has something to do with the horizontal scroll bar it activates,…
Samuel Finzhry
  • 35
  • 1
  • 10
2
votes
2 answers

Move JScrollPane scroll to the right SWING

I am using JscrollPane that I add elements and when I have more than 7, the JScrollBar inside my JScrollPane is activated. I need that when I introduce a new element, the Scroll bar is moved to the right public void addElement(String nombre,…
Transy
  • 59
  • 1
  • 1
  • 10
2
votes
1 answer

How to scroll down a vertical scroll bar on a JScrollPane?

I use Netbeans with Java/Swing and I have a problem with my scroll pane. First of all I have two JPanel components inside my scroll panel. When I init all components I make not visible the second panel. I wanted that when I click on a button, the…
Roberto García
  • 115
  • 1
  • 11
2
votes
0 answers

JScrollBar custom scrollbar ui graphics leaves trail

I am making a custom JScrollBar. ScrollBar.java public class ScrollBar extends JScrollBar { ScrollBar() { super(); setUI(new CustomScrollBarUI()); } } CustomScrollBarUI.java public class CustomScrollBarUI extends…
Moon Cheesez
  • 2,489
  • 3
  • 24
  • 38
2
votes
1 answer

How to properly change pane content while dragging a jscrollbar handle

I have a pane that contains image content which changes during scrolling. The content is properly updated via a scrollwheel event because I implemented a wheel listener which repaints the image before setting the new scroll value. However, when the…
hepcat72
  • 890
  • 4
  • 22
2
votes
2 answers

How to set size of JList with Scrollbar in swing?

How to set scrollbar in JList and how to set the size of JList. I have a jList and in JList I want to set fix height. If I have data more then that height I want to show a scrollbar.
A.K.
  • 2,284
  • 3
  • 26
  • 35
2
votes
1 answer

Java Graphics and Bordering Problems in JScrollPane

I have found a CustomScrollbarUIExample, and I am trying to change it completely into my own (with attribution, of course, this is legal). I have immediately run into a problem. What I am trying to achieve is put a border around not the JScrollPane…
user3636058
2
votes
1 answer

swing JTable with ScrollBar - color of square between headers and track

I have a JTable with BasicScrollBarUI, I set the headers background color: table.getTableHeader().setBackground(GuiConstants.backgroundColor); and the scrolbar background color: public class ScrollBarUI extends BasicScrollBarUI…
Danielle
  • 860
  • 10
  • 13
2
votes
2 answers

Getting scroll bars to "always on" in scroll pane

I have two scroll panes that I am trying to set the scroll bars to always be visible. For some reason when I try to use the code (scroll code) below, I get an error that "The method setHorizontalScrollBarPolicy(int) is undefined for the type…
Kevin Schultz
  • 886
  • 3
  • 20
  • 42
2
votes
1 answer

Issue with changing JScrollBars value in a JScrollPane: 90 is the magic number apparently

OK, so my basic premise is that I have the following setup (https://i.stack.imgur.com/IsFGJ.png): And my problem is only in relation to the main image window. All the little black boxes surround POI picked out by a Harris Detector and I want the…
2
votes
1 answer

How to make a corner component always visible in a JScrollPane

Given import javax.swing.*; public class TestCornerComponent { public static void main(String args[]) { JTable table = new JTable(); final JScrollPane scrollPane = new JScrollPane(table); /* button to put in corner */ …
hiraethus
  • 43
  • 1
  • 6
2
votes
1 answer

How to disable scrollbar of Jtextarea

How to Disable automatic scrolling of JtextArea. JtextArea1.setColumns (100); JtextArea1.setLineWrap (true); JtextArea1.setWrapStyleWord (false);
Code Hungry
  • 3,930
  • 22
  • 67
  • 95