jscrollpane

Java JScrollPane- Multiple components

a 夏天 提交于 2019-12-31 02:48:04
问题 I'm trying to add 2 images inside the JScrollPane. the first image is a background and the second one overlap the first one. The problem shows only the second image when i run my program! please help ImageIcon ii = new ImageIcon("mini_map.png"); JLabel label1=new JLabel(ii); Icon icon = new ImageIcon("Mg.gif"); JLabel label2 = new JLabel(icon); JScrollPane jsp=new JScrollPane(); jsp.getViewport().add(label1); jsp.getViewport().add(label2 ); 回答1: JViewport is a single-child container, you can

Autocomplete jquery UI plugin with custom scrollbars

拥有回忆 提交于 2019-12-30 10:33:34
问题 did someone try to make custom scrollbars for jquery UI autocomplete widget? I'm trying to use jScrollPane jquery component in combination with autocomplete widget, but so far didn't have any success. If someone knows about some jquery autocomplete component with custom scrollbars, or knows how to change jquery ui autocomplete widget to support jscrollpane component, I would appreciate it. 回答1: DEMO: http://so.lucafilosofi.com/autocomplete-jquery-ui-plugin-with-custom-scrollbars UPDATED: 22

Autocomplete jquery UI plugin with custom scrollbars

隐身守侯 提交于 2019-12-30 10:31:10
问题 did someone try to make custom scrollbars for jquery UI autocomplete widget? I'm trying to use jScrollPane jquery component in combination with autocomplete widget, but so far didn't have any success. If someone knows about some jquery autocomplete component with custom scrollbars, or knows how to change jquery ui autocomplete widget to support jscrollpane component, I would appreciate it. 回答1: DEMO: http://so.lucafilosofi.com/autocomplete-jquery-ui-plugin-with-custom-scrollbars UPDATED: 22

JTable with autoresize, horizontal scrolling and shrinkable first column

僤鯓⒐⒋嵵緔 提交于 2019-12-30 04:58:07
问题 I am having trouble creating a JTable with scrollbars. I want a JTable with 2 columns and no visible scrollbars. If I enlarge one of the columns the scrollbars should become visible and the columns resize. I followed this answer How to make JTable both AutoResize and horizontall scrollable? and works fine which basically comes down to: JTable table = new JTable() { @Override public boolean getScrollableTracksViewportWidth() { return getPreferredSize().width < getParent().getWidth(); } };

How to make JTextPane scroll horizontally

丶灬走出姿态 提交于 2019-12-29 09:30:10
问题 I have a JTextPane , when there are too many lines, a vertical scroll bar appears, but when a line is too long, instead of appearing a horizontal scroll bar, the line breaks into two lines, how to make the horizontal bar appear instead of breaking into two lines, my jTextPane is added like this: JScrollPane jScrollPane1 = new JScrollPane(); jScrollPane1.setViewportView(jTextPane1); 回答1: As presented here by our very own Rob Camick, you could try using something like... JTextPane tp = new

Resize Graphics2d into JScrollPane

流过昼夜 提交于 2019-12-29 09:05:54
问题 In connection with question Resizing a component without repainting is my question how to create resiziable custom Graphics2d in form import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ZoomWithSelectionInViewport implements MouseWheelListener { private JComponent b; private int hexSize = 3; private int zoom = 80; private JScrollPane view; public ZoomWithSelectionInViewport() throws Exception { b = new JComponent() { private static final long serialVersionUID = 1L;

How do I make JScrollPane scroll to follow input focus?

*爱你&永不变心* 提交于 2019-12-29 04:45:08
问题 I have a Swing app with a large panel which is wrapped in a JScrollPane . Users normally move between the panel's subcomponents by tabbing, so when they tab to something out view, I want the scroll pane to autoscroll so the component with input focus is always visible. I've tried using KeyboardFocusManager to listen for input focus changes, and then calling scrollRectToVisible. Here's an SSCCE displaying my current strategy (just copy/paste and run!): import java.awt.KeyboardFocusManager;

JScrollPane - Zoom relative to mouse position

混江龙づ霸主 提交于 2019-12-29 03:41:43
问题 I need to calculate the new position of the viewport when zooming in to an image. The UI is built up as follows: ImagePanel draws the image ImagePanelWrapper is a JPanel wrapping around the imagePanel JScrollPane contains the ImagePanelWrapper When zooming in or out, the ImagePanel's zoom factor is changed and the preferred size of the ImagePanel is being recalculated. Therefore the image on this panel moves, even though the ImagePanel stays at the same viewport point. The following methods

Why JScrollPane does not react to mouse wheel events?

故事扮演 提交于 2019-12-28 04:18:06
问题 I have a JScrollPane containing a panel with a BoxLayout (PAGE AXIS). My problem is that the JScrollPane does not react to mouse wheel events. To make it scroll using the mouse wheel i need to be on the JScrollBar . I found this thread and i have no MouseMotionListener or MouseWheelListener , only a MouseListener . I think my problem come from the fact that my JScrollPane act on a JPanel that contains other panels itself. So when the mouse is on a panel within the JScrollPane it seems that

Java / Swing : JTextArea in a JScrollPane, how to prevent auto-scroll?

ⅰ亾dé卋堺 提交于 2019-12-28 02:08:11
问题 here's a runnable piece of code that shows what my "problem" is. I've got a JTextArea wrapped in a JScrollPane . When I change the text of the JTextArea , the JScrollPane scrolls automatically to the end of the text and I don't want that. Here are my requirements: the application should not scroll vertically automatically but... the user should be able to scroll vertically the user should not be able to scroll horizontally the application should never scroll horizontally the JTextArea must