jscrollpane

How do I prevent arrow key press in JTextField from scrolling JScrollPane?

╄→尐↘猪︶ㄣ 提交于 2019-12-02 00:46:25
I'd like to add a custom arrow key listener for my JTextField . But looks like the arrow keys are bound to the JScrollPane on which I put my text field. How do I unbind them? You could try replacing the key bindings on the scroll pane, but it might make sense to keep them to allow the user to scroll the pane when they are not focused in your text field. Instead, you can add key bindings to the text field that do nothing, which will consume the event and prevent them from begin sent to the scroll pane, for example.... import java.awt.BorderLayout; import java.awt.Dimension; import java.awt

JScrollPane on JComboBox

倾然丶 夕夏残阳落幕 提交于 2019-12-02 00:25:13
问题 I made a combobox but some of the elements are wider than the width of my box. So I tried to add a horizontal scrolpane and the only I could see is a scrolpane with a combobox inside! Certanly something I do wrong. So here is my code without the jscrolpane. issuerdocumentJComboBox=new JComboBox<>(issuermodel);//the compo box issuerdocumentJComboBox.setBounds(430, 120, 100, 30); searchDocumentesJPanel.add(issuerdocumentJComboBox); How can I add to the combobox a horizontal scrollpane? Thank

JTextArea expands as I enter text even though I have a JScrollPane, but the scrollbar doesn't show up either

老子叫甜甜 提交于 2019-12-02 00:16:18
I have this JTextArea and it keeps expanding as text is entered. I know this looks like a repeat question but I've followed the answers and they haven't worked for me. I also have a JScrollPane attached to it but no scrollbar is showing up. I want the JTextArea to remain a constant size and to have it scrollable. Please take a look at my code and tell me what's wrong, because I have no idea! Here is my code: package com.robot; import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.*; public class GUI extends JFrame implements Runnable { //start of the constructor method for GUI

Scrolling limitation with JScrollPane and JViewport maximum sizes smaller than contents

别来无恙 提交于 2019-12-01 23:42:51
问题 I have a JFrame containing a JScrollPane containing a JPanel . The JPanel contains a bunch of JTextArea s. I'm loading a lot of text into them (about 8k-10k characters). The layout works fine, though the scrolling is a bit laggy. The real issue is that it seems JPanel , JScrollPane and JViewport have a hard 32767 size limit, so when any JTextArea grows higher than that, it can't be scrolled any further to show the last 1/3 of the text. Below you can see a minimal example for the problem. I

Adding a JScrollPane component to a JTable column

喜欢而已 提交于 2019-12-01 23:36:09
问题 I'm trying to add scrolling capabilities to a certain column in my JTable. I've implemented a custom TableCellRenderer component and I can see the scroll pane inside the table just fine, but I am not able to scroll it. I've tried implementing TableCellEditor as well and didn't have any luck. public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) { return scrollPane; } Does anyone have any ideas how to make those cells which contain a

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

JScrollPane on JComboBox

有些话、适合烂在心里 提交于 2019-12-01 22:44:31
I made a combobox but some of the elements are wider than the width of my box. So I tried to add a horizontal scrolpane and the only I could see is a scrolpane with a combobox inside! Certanly something I do wrong. So here is my code without the jscrolpane. issuerdocumentJComboBox=new JComboBox<>(issuermodel);//the compo box issuerdocumentJComboBox.setBounds(430, 120, 100, 30); searchDocumentesJPanel.add(issuerdocumentJComboBox); How can I add to the combobox a horizontal scrollpane? Thank you! It is possible!! Here's a little program I wrote to show my solution: import java.awt.Component;

Scrolling limitation with JScrollPane and JViewport maximum sizes smaller than contents

Deadly 提交于 2019-12-01 22:33:30
I have a JFrame containing a JScrollPane containing a JPanel . The JPanel contains a bunch of JTextArea s. I'm loading a lot of text into them (about 8k-10k characters). The layout works fine, though the scrolling is a bit laggy. The real issue is that it seems JPanel , JScrollPane and JViewport have a hard 32767 size limit, so when any JTextArea grows higher than that, it can't be scrolled any further to show the last 1/3 of the text. Below you can see a minimal example for the problem. I used the NetBeans JFrame designer so it might be a bit lengthy but the only thing I have changed from the

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

Adding a JScrollPane component to a JTable column

◇◆丶佛笑我妖孽 提交于 2019-12-01 20:53:21
I'm trying to add scrolling capabilities to a certain column in my JTable. I've implemented a custom TableCellRenderer component and I can see the scroll pane inside the table just fine, but I am not able to scroll it. I've tried implementing TableCellEditor as well and didn't have any luck. public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) { return scrollPane; } Does anyone have any ideas how to make those cells which contain a scrollPane scrollable? With TableCellRenderer it's not possible to add any scrolling behaviour, as it does not