2,712 questions
2
votes
1
answer
61
views
JScrollPane auto scroll to bottom using JEditorPane but remains to top using JTextField
I have a simple JFrame with a JPanel inside a JScrollPane. The JPanel is used to show a vertical list of either JTextField or JEditorPane components:
public class Test {
void showFrame() {
...
1
vote
2
answers
66
views
How to stop inner JScrollPanes from consuming mouse scroll wheel movements
I'm assembling a JPanel consisting of multiple JTables. Each JTable has an enclosing JScrollPane so the header values are displayed. The entire JPanel has an enclosing JScrollPane.
In this example, I ...
1
vote
2
answers
94
views
Java JSCrollPane won't resize below minimum size of JButton with text
I'm trying put a JPanel (GridLayout 0, 1) with JButtons it, within the ViewPort of a JScrollPane. This is easy enough to do, but it doesn't behave "properly" when resizing the parent JFrame....
0
votes
2
answers
89
views
Component not visible after using "setVisible(true)" on it and its parent
I've got a Java 8 app with a couple of JTextFields and a JButton to log into a database and a JTextArea inside a JScrollPane to display errors. Both the textarea and the scrollpane have to be hidden (...
0
votes
1
answer
110
views
Java/Swing: Can't get JScrollPane to show entire element
The goal is to draw a bunch of circles (each a separate JComponent instance) onto a JPanel, and to be able to scroll far enough in any direction to see all of them.
Here is the "main" code:
...
0
votes
2
answers
136
views
Create a list of JCheckBoxes and put them into a JScollPane (UR Robot - URCap)
It has been a while since I programmed with Java Swing, so I'm not an expert with all it's methods. Just to contextualize what I'm doing, I'm building an URCap UI that I'm using in a UR Cobot (That's ...
0
votes
1
answer
33
views
Java/Swing: How to combine both - fixed size and ability to scroll - for JScrollPane including JTextArea
So I have created a JTextArea (in my case TextArea - to override append and setText methods that include line breaks), to visualise end user what is going on at what time.
I have:
limited space
...
0
votes
1
answer
32
views
How to put image in a scroll pane in the upper left
I am displaying an image in a scroll pane and it works great when the pane is smaller than the image. When the pane is larger then the image, the image is centered vertically and left justified ...
0
votes
0
answers
34
views
How to make a FlowLayout JPanel nested inside a ScrollPanel go down the next row when reaching a fixed width [duplicate]
I have a JPanel with a FlowLayout inside of a viewPort of a JScrollPane. I can add components dinamically to this JPanel but when I reach the end of the JScrollPane what i want is for the components ...
0
votes
0
answers
71
views
Zoom to Point with JScrollPane
I found a few questions similar to the one I have, including this and this, but none that really answered the problem, and it's because I am using a JScrollPane. I found the code necessary for the ...
-2
votes
1
answer
66
views
Jscrollpane isn't scrolling
Here's the code I have for my GUI
public class gui extends JFrame{
JFrame mainF;
JPanel listPanel;
JTextArea jtArea;
ButtonGroup buttons;
ButtonGroup restoreButtons;
JRadioButton createButton;
...
0
votes
1
answer
74
views
JScrollPane with GridLayout Panel
I have a JFrame (frame) with a JScrollPane. The JScrollPane contains my ContainerJComponent (DebugPanel). This ContainerJComponent contains JComponentItems (DebugItem). This is an abstracted problem ...
0
votes
1
answer
69
views
Remove MouseWheelEvent/MouseWheelListener awaiting execution in Java Swing
I have an implementation where I want to reload data while scrolling a JList after scrolling every 100 records. I have a large database, and it takes around 7 seconds to load the JList. Therefore, a ...
0
votes
0
answers
44
views
How to implement temporarily disabling AdjustmentListener of JScrollPane in Java Swing
I have a code to load data when scroll is performed. Suppose I scroll, the loadData method is called and is in progress. If during this time I keep scrolling, even though the scrollbar is not moving ...
0
votes
1
answer
424
views
Why are there these weird visual artifacts when scrolling my BufferedImage? And how do I prevent them from happening?
I am creating an application that involves drawing a BufferedImage to a JComponent using Graphics2D in a paintComponent(Graphics) method.
I added the ability to zoom in and out of the image. The ...
1
vote
0
answers
50
views
Why does Document.insertString() auto-scroll with getLength()?
I noticed some interesting behavior with JScrollPane when manipulating the underlying document in a JTextPane. Consider this example:
public class Example {
public static void main(String[] args) ...
0
votes
1
answer
53
views
Java Swing - I don't know why my JScrollPane wont scroll down
I have some issues making a JScrollPane scrolling in Swing. I don't know why it is doing that.
It worked before when I just created a pane on top of the contentPane. But it is not working anymore now ...
1
vote
0
answers
171
views
Zoom to Mouse Pointer using AffineTransform and JScrollPane
my goal is to implement an image viewer, where one can zoom to the mouse position and the JScrollPane correctly response to this zoom gesture. Also the possibility to roate the image would be nice.
I'...
0
votes
0
answers
62
views
How to create a Scrolling Pane for a Chat System?
I've already created a working scrolling pane using JScrollPane, however, the current code works as follows: I type something into the chat input, press enter, it creates a JPanel and adds it to the ...
0
votes
0
answers
21
views
adding Commonest to jPanel with gridLayout
so I am making a program to study and I want to see and edit the words that you upload in a Jscrollpane and I have a JPanel with gridlayout(0,2) in the Jscrollpane (with maximum height of 700) and ...
1
vote
3
answers
134
views
adding a non-scrolling component to a JScrollPane
I'd like to add a non-scrolling element, always visible element (a "pinned" element) in a JScrollPane of a Swing GUI. Taking this example code:
public class Main {
public static void ...
-1
votes
1
answer
135
views
JPanel.getHeight() doesn't exactly work as intended [closed]
So I have a program that utilizes JFrame and JPanel and such. I have multiple JPanels with JTextAreas within them, like a list. I'm trying to create JScrollPane that allows me to scroll through all ...
0
votes
0
answers
42
views
Placeholder image in JViewport of JScrollPane for empty JTable
I have a JTable and want my user to drag&drop entries into that JTable.
To make that as obvious as possible, I want to display a placeholder image like "Please drag stuff HERE using your ...
0
votes
1
answer
45
views
How do I adjust the width of a JScrollPane based on the width of JTable Data?
My Java program has a JTable in a JScrollPane. For the table I set setAutoResizeMode(JTable.AUTO_RESIZE_OFF) and I adjust the column widths to match the data using resizeColumnWidth (shown in many ...
1
vote
0
answers
38
views
Unable to add components on a new line in this JPanel
I'd like to create in Java Swing a file manager-alike interface, with icons spanning horizontally unless no more horizontal space is possible to allocate, and then going to a new line.
This is my ...
1
vote
1
answer
130
views
JList - Horizontal list, visible amount of values
I'm trying to create a horizontal JList with seven items inside a JScrollPane and only three of those items need to be visible and the others accessible via a scrollbar. Here's an example of what I'm ...
0
votes
1
answer
50
views
JScrollPane doest not act correctly when image is resized
I searched and found tons of questions here about my problem, but it seems I cannot implement correctly the solutions I found.
I have a JScrollPane in which I put a custom JPanel.
This custom JPanel ...
0
votes
1
answer
59
views
How to add and remove scrollbars dynamically to a zoomable panel based on Rectangle's visibility
I am trying to manipulate some blue rectangles within a confined, much larger red rectangle.
I have this working along with a zoom-in and zoom-out function
The problem is I would like to display ...
0
votes
1
answer
230
views
How do i wrap text of a single JLabel in JScrollPane instead of horizontal scrolling without using JTextArea
(to note im new to programming so this may be a simple answer or my code is just written wrong) I have a larger program with a string that is constantly being appended and trimmed. Its written with ...
-1
votes
1
answer
57
views
JTable is only showing the first column of imported data. How do I show all columns?
I'm building a table of imported values from a csv sheet. I have 95 rows and 26 columns. I want to display all of the "dataS" values in my JTable, but I'm only getting the first column.
Is ...
0
votes
1
answer
153
views
Why am I not getting scroll-bars with MigLayout manager?
I'm writing a desktop application.
The environment is following:
Java SE 10
Eclipse IDE
Java Swing
MigLayout
The source-code, the important parts.
textPane = new JTextPane();
textPane....
2
votes
1
answer
56
views
JScrollBar Layout Manager and SpringLayout Manager not working together
public void createSpringLayout(SpringLayout spring, JLabel label, JScrollPane scrollPane, JPanel buttonPanel) {
spring.putConstraint(SpringLayout.NORTH, label, 10, SpringLayout.NORTH, this);
...
1
vote
2
answers
236
views
Java Swing trying to add a stationary JButton over a JScrollPane
I am trying to make a text editor with a button that appears at the bottom right of the editor regardless if you scroll up or down and appears over the text area
import javax.swing.*;
import java.awt.*...
0
votes
1
answer
43
views
JScrollPane for arbitrary buttons
At this site I have found a good example how to apply JScrollPane for a matrix of JButtons. The code is here below provided.
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame....
0
votes
1
answer
302
views
Swing - remove extra space from JScrollPane so that it only fits the table rows
I am a newbie to swing. I have created a table from an array list of objects. I want to know how I can remove the access white space from bellow the table- that is adjust the size of the JScrollPane ...
-1
votes
2
answers
46
views
My code is not working. How should I add a JScrollPane on a JTextArea that is in a JTabbedPane? [duplicate]
this is the code I have so far
public class WindowHelpGui extends JFrame{
JScrollPane scroll;
//constructor
public WindowHelpGui(){
//add window title
super("Help&...
-2
votes
1
answer
50
views
ScrollBar is added from scrach but not in the middle of work - java swing frame
I don't know where the problem is, when the sample code is run alone and from scratch, the scrollbars are displayed correctly, but when we try to add them to a task area in the middle of a prepared ...
-1
votes
1
answer
57
views
Making a scrolling JPanel with JButtons and adding it to JScrollPane [duplicate]
I'm trying to make an array of buttons go inside of a JPanel. From there, I want the JPanel to be added to a JScrollPane so if there are more buttons that are needed, I will be able to scroll through ...
-1
votes
1
answer
103
views
JScrollPane not scrolling in JTextArea and is staying disabled
I am trying to make a simple text editor using JTextArea, but when I type more text so that it goes off the screen, the JScrollPane is still not enabled and not letting me to scroll. I've looked for ...
0
votes
1
answer
48
views
Reliable object not resizing java JScrollPane
I'm trying to make a file view(JScrollPane) resizable for an ide, but when I try to resize it, It wont update unless I resize the window.
I try looking it up but I could not find anything usefull.
If ...
-1
votes
2
answers
218
views
How to check for multiple keys at once using keyTyped(event e)
I have the following code:
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax....
0
votes
3
answers
119
views
Horizontal JScrollPane inside vertical JScrollPane
Good afternoon! It is necessary to make a list (vertical) from lists of events (horizontal). There are at least 2 problems:
the area of the list of events (horizontal scrolling) expands beyond the ...
-1
votes
1
answer
71
views
Java Swing - JFrame GUI Elements made invisble on resize and open
I have a secondary JFrame for a settings panel, however, whenever it is opened or resized all elements inside it (a lot of textfields, sliders and so forth) go invisible.
I can get the GUI elements ...
0
votes
1
answer
279
views
Why is my scrolling textarea in java not scrolling?
I have a frame f, panel Fpanel. and textarea j.
This is a part of my code.
The scroll does not seem to be working on my text area.
JTextArea j=new JTextArea();
j....
0
votes
1
answer
203
views
How to individually set the width of a row on a table/scrollpane
i have a DefaultTableModel:
DefaultTableModel model = new DefaultTableModel(data, beschriftung)
{
// Returning the Class of each column will allow different
// ...
0
votes
0
answers
45
views
How do I add a JScrollPane to this JPanel?
I am making a chatbot using a Java GUI template and everything works fine it's just that I am unable to add a JScrollPane to a JPanel that was created in a customizer class. I want the panel to have a ...
0
votes
0
answers
32
views
JScrollPane scroll only appears at bottom
I have this JFrame that has a JScrollPane and a JTextArea inside it, it works okay but the scroll button only appears at the bottom, I want it to show at the top as default. How can I change this?
...
0
votes
1
answer
147
views
Java swing: Add scroll bar to textarea
I have a text area that updates a button press (this updating works fine). When it updates, a long list appears in the text area that requires a scroll bar. However, when I add the last two lines ...
0
votes
2
answers
72
views
Dialog empty with JScrollPane und JPanel
I am trying to add the content to the mainPanel and mainpanel to the mainScrollPane. However, an empty dialog is displayed.
IMPORTANT: it must be implemented with JPanel and JScrollPane...
`...
0
votes
0
answers
108
views
JScrollPane takes up whole JFrame
I'm trying to create a form for a Task List, that will have a list of tasks sitting in a JScrollPane, with some buttons below it, to essentially look like this:
The problem I'm running into is that ...