jscrollpane

GWT: I am using jScrollPane with jquery, is it messing with my ClickHandlers?

时光怂恿深爱的人放手 提交于 2019-12-13 02:40:34
问题 I implemented the JScrollPane for a cleaner look inside my Page. function scrollPane() { $(".gwt-content").jScrollPane(); } A custom Widget gets added: $(".jspPane").append($(new Content()); works $(html).click(new Function() { public boolean f(Event e) { System.out.println("yo"); return true; } }); doesn't html.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { System.out.println("yo1"); } }); html is a HTML Widget with some Text and another HTML widget in

Force JEditorPane within JScrollPane to shrink + re-wrap

谁说我不能喝 提交于 2019-12-13 02:14:24
问题 Having an issue with a JScrollPane expanding its child JEditorPane just fine but forcing horizontal scroll bars when resizing it down again (instead of forcing the JEditorPane to recalculate wrapping). The basic flow of code is as follows: JFrame f = new JFrame(); JEditorPane jep = new JEditorPane(); JScrollPane jsp = new JScrollPane(jep); f.add(jsp); 回答1: It's a hack, but the best way I could find (without using ugly ScrollPaneManager s) was to implement a ComponentListener on the

How to set autoscrolling in a JTextArea while it is set to NOT editable?

自古美人都是妖i 提交于 2019-12-13 01:32:47
问题 I have used this answer to get the functionality of Autoscrolling on a JTextArea. But it seems that it works only when the setEditable property of the same JTextArea is set to TRUE. Of course, i use a JScrollPane. I'm developing a chat application as a college project. The area where the messages are displayed is the very same JTextArea. I've used the 2nd set of code in the 1st answer in the above link. But I need it to make it work when setEditable is set to FALSE. It wont work even after

How to make the horizontal scroll bar appear in a JScrollPane that contains a JTextPane component

百般思念 提交于 2019-12-13 01:30:21
问题 I can't make the horizontal scrollbar appear. I've tried using JTextPane.setSize(), JTextPane.setPreferredSize() and no size method for JTextPane. I'm also using JScrollPane.setPreferredSize(). The vertical scroll bar appears, but the horizontal one doesn't. Here is an example: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Test { private int textPaneWidth = 500; private int textPaneHeigth = 200; private int scrollPaneWidth = 100; private int scrollPaneHeigth =

Java - Setting position of jScrollBar

心不动则不痛 提交于 2019-12-13 01:25:55
问题 I have a JTable in a JScrollPane, and the table gets new rows of data every once in a while. Eventually there are more rows of data than can be displayed at once and so the ScrollPane kicks in. I want the Scroll Pane to jump to the bottom (to its maximum value) every time new data is added, so I wrote this, which is called right after the new row is added: jScrollPane1.getVerticalScrollBar().setValue(jScrollPane1.getVerticalScrollBar().getMaximum()); It works quite well, but there is a

Painting on a JPanel inside a JScrollPane doesn't paint in the right location

断了今生、忘了曾经 提交于 2019-12-13 01:24:10
问题 So I have a JPanel that's inside a JScrollPane . Now I am trying to paint something on the panel, but it's always in same spot. I can scroll in all directions but it's not moving. Whatever I paint on the panel does not get scrolled. I already tried: A custom JViewPort switching between Opaque = true and Opaque = false Also I considered overriding the paintComponent method of the panel but that would be really hard to implement in my code. public class ScrollPanePaint{ public ScrollPanePaint()

Adding buttons to JScrollpane

孤街醉人 提交于 2019-12-13 00:55:42
问题 I am using Java and SWING, and I have a scrollpane with a rather large image added to it which works just fine right now, which means the scrolling functionality is working as intended. However in different locations on this image I need to add jButtons and be able to act on mouseclicks on these At the moment I got the following bit of code: (snippets, let me know if you require anything else) jButton1 = new JButton("CLICK"); jButton1.setBounds(0, 0, 100, 100); After that I add my

How to get the size of JPanel which is not visible yet

◇◆丶佛笑我妖孽 提交于 2019-12-13 00:32:18
问题 I have a resizable JScrollPane inside a JDialog. That JScrollPane has a JPanel(called container) All these JScrollPane,JPanel and Jdialog are resizable. At the run time, another JPanel(called child) is added to the previous jPanel which is inside the JScrollPane of the JDialog.I want to get the size of the 'child' JPanel size. Before and after adding the 'child' JPanel to the 'container' JPanel, sizes of 'child' and 'container' JPanels are shown as 0 0. ( child.getSize() , container.getSize()

JTextArea no scroll bar

邮差的信 提交于 2019-12-12 20:24:26
问题 private JPanel contentPane; public Driver() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 867, 502); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); final JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setBounds(10, 11, 831, 393); JScrollPane scroll = new JScrollPane(textArea); scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR

How do I add a bunch of JPanels to my JFrame using Java Swing?

狂风中的少年 提交于 2019-12-12 18:16:50
问题 I generate a bunch of JPanels and then pass them into a class that extends JFrame. How do I add an indefinite number of JPanels to this JFrame. I was also reading about JScrollPane should I incorporate this somehow into the design? Example Code: class foo extends JPanel { //generate JPanels } class bar extends JFrame { //grab some amount of foo classes and put them into this JFrame and show it } Also is there anything I need to watch out for when showing this JFrame? Thanks 回答1: How do I add