jscrollpane

Draw arrow on top left of scrollpane

て烟熏妆下的殇ゞ 提交于 2019-12-11 15:24:43
问题 I have a JPanel within a JScrollPane. In my program, the JPanel shows an image of map and it shows the current location of a vehicle. My program receives the location and current direction of the vehicle. I need to show this on the map. I'm having a problem showing the direction of the vehicle. I want to show an arrow on the top left of the map's visible area to show the direction. The following is the code that I have tried. But it throws an exception when I scroll down. Exception in thread

Custom scrollbar

巧了我就是萌 提交于 2019-12-11 14:44:18
问题 I am hoping to incorporate custom scrollbars in my site as there are divs with set heights that will overflow. I have managed to get exactly what I want using webkit styling in css however I am aware that there will be issues when looking at the site in Firefox or IE. As a result, I tried to incorporate the jScrollPane library into my site but its causing all sorts of js "clashes" which is throwing the whole site into a mess! Are there any simpler methods to customise my scroll bar so that I

Can't turn off tooltips for text area inside scroll pane

时光怂恿深爱的人放手 提交于 2019-12-11 14:04:23
问题 All Swing components in my app (except labels) have tooltips that can be annoying once the user knows what's going on, so I have a Preferences menu that allows turning them off. I could name every component and set its tooltip text to "" [e.g., txtPattern.setToolTipText(""); ] (and 10 others), but I decided (with SO aid that started awhile back) to write code that would be more elegant (a learning experience): private void tipsOff(Container container){ Component [] c = container.getComponents

Make JTextArea scroll so caret position is always displayed as user types more text

笑着哭i 提交于 2019-12-11 12:59:40
问题 How to make JTextArea scroll so caret position is always displayed as user types more text? This seems like a stupid question to me and I feel like it must have been asked before, yet I have searched and cannot find the answer. I have a multiline text area, embedded in a JScrollPane . If the user keeps typing until he fills the text area, eventually the caret becomes invisible (below the area shown) and the user cannot see what he is typing. It seems odd that this would be the default

How to get a JScrollPane to resize with its parent JPanel

做~自己de王妃 提交于 2019-12-11 12:42:50
问题 My question is similar to this one (How to get JScrollPanes within a JScrollPane to follow parent's resizing), but that question wasn't clear and the answer there didn't help me.. I have this SSCCE (using MigLayout): public static final int pref_height = 500; public static void main(String[] args) { JPanel innerPanel = new JPanel(new MigLayout()); innerPanel.setBorder(new LineBorder(Color.YELLOW, 5)); for(int i = 0; i < 15; i++) { JTextArea textArea = new JTextArea(); textArea.setColumns(20);

How can I freeze a JTable row selection inside a scroll pane

时光怂恿深爱的人放手 提交于 2019-12-11 11:04:26
问题 I've got a JTable that updates frequently. It sits inside of a scroll pane. Occasionally we'll see a message that we'd like to dig deeper into. Unfortunately due to the number of updates the message will scroll off the visible screen before we can finish looking at it. I'd like to be able to freeze the viewport/scrolling while we examine the message but still allow the table model to update with new messages. I can get the selected row to go to the top with this code: int firstSelectedRow =

The JScrollPane content doesn't refesh while scrolling

走远了吗. 提交于 2019-12-11 10:33:37
问题 I'm creating a simple gui of options that containing a JScrollPanel. The problem is when I'm scrolling all the content of the JPanel inside my JScrollPanel doesn't refresh like that : Bad Refresh Scrolling Another issues is that not all my text fields are well painted and the combobox fields are behind the first text field. Here my code : OptionsPanel.java the source of the problem package scroll; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event

Why is my JScrollPane not working?

戏子无情 提交于 2019-12-11 09:37:49
问题 Can someone work out why my JScrollPane is not working. Perhaps something I may have missed. I realize this might be silly without any more context than what I've shown but please ask and I shall be happy to provide more. public ApplicationFrame(String title, int x, int y, int width, int height) { // Constructor for the ApplicationFrame, no implicit Construc. setTitle(title); setResizable(true); setBounds(x, y, width, height); setLayout(new BorderLayout()); setDefaultCloseOperation(DISPOSE_ON

Scrolling JComponent in JScrollPane

非 Y 不嫁゛ 提交于 2019-12-11 08:28:10
问题 Say, I have a big JComponent: Dimension componentSize = new Dimension(5000,5000); And a smaller JScrollPane: Dimension scrollPaneSize = new Dimension(500,500); I want to display part of my JComponent in JScrollPane, like on the picture below: White rectangle is my JScrollPane, which currently displays part of JComponent from (x1,y1) to (x2,y2) . So, what have I tried: I have created a new JComponent: JComponent component = new JComponent(){ protected void paintComponent(Graphics g) { // Here

Why it shows scrollbar to JScrollPane when we use setPreferredSize for the JPanel which is added to JScrollPane

▼魔方 西西 提交于 2019-12-11 07:46:57
问题 Please see the following block of code import java.awt.Color; import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSplitPane; public class test extends JFrame { public test(){ this.setBounds(0,0,300,700); JPanel pnltemp= new JPanel(); //pnltemp.setBounds(0,0,400,1000); pnltemp.setPreferredSize(new Dimension(400,1000)); JScrollPane scrtemp= new JScrollPane(); scrtemp.getViewport().add(pnltemp); this.getContentPane(