jscrollpane

How to add JButton on JScrollPane?

≡放荡痞女 提交于 2019-12-10 17:42:29
问题 Hi i am trying to make a desktop application in swing here i am using jscrollpane. i want to add multipul button in jscrollpane. i am able to add only single button there how can i do this My code is given below public class AddingToJScrollPane { public static void main(String args[]) { JFrame frame = new JFrame("Tabbed Pane Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Label"); label.setPreferredSize(new Dimension(1000, 1000)); JScrollPane

Change side of a jScrollPane & change size

丶灬走出姿态 提交于 2019-12-10 13:25:59
问题 I want to change the side of my JScrollPane from the right (default) to the left side. How do I do this? AND: I want to change the size of JScrollBar because it's a touch-display (22") so that it can be scrolled easily. Thanks a lot! 回答1: Following @camickr suggestion for the placement, here is a complete example import java.awt.*; import javax.swing.*; public class Test { public static void main(String[] args) { JFrame jf = new JFrame("Scorllbar test"); JPanel jp = new JPanel() {{ add(new

Changing the thumb color and background color of a JScrollPane?

浪子不回头ぞ 提交于 2019-12-10 13:08:14
问题 I am having trouble styling a JScrollPane. I just want to be able to change the color of both the thumb and the background (and also remove the increase/decrease buttons). So far I have tried the following: this.setBackground(new Color(0,0,0)); this.viewport.setBackground(new Color(0,0,0)); this.getViewport().setBackground(Color.BLACK); this.setOpaque(false); this.getVerticalScrollBar().setUI(new BasicScrollBarUI() { @Override protected JButton createDecreaseButton(int orientation) { return

How to make a JFrame scrollable in Java?

拟墨画扇 提交于 2019-12-10 12:43:05
问题 I have this code in which I am trying to fit a scrollable Panel (JPanel) but I don't get it. Here is my code: public class Sniffer_GUI extends JFrame { Canvas c = new Canvas(); ConnectorPropertiesPanel props; public Sniffer_GUI() { super("JConnector demo"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setLayout(new GridBagLayout()); init(); getContentPane().add(new JLabel("Connectors example. You can drag the connected component to see how the line will be changed"), new

jQuery jScrollPane Synchronize Scroll

∥☆過路亽.° 提交于 2019-12-10 12:17:53
问题 Is it possible to synchronize two scrolls? 回答1: Add this function to your code: jQuery.fn.synchronizeScroll = function() { var elements = this; if (elements.length <= 1) return; elements.scroll( function() { var left = $(this).scrollLeft(); var top = $(this).scrollTop(); elements.each( function() { if ($(this).scrollLeft() != left) $(this).scrollLeft(left); if ($(this).scrollTop() != top) $(this).scrollTop(top); } ); }); } Then, you can just synchronize all the scrollbars within an element

JScrollPane setViewPosition After “Zoom”

给你一囗甜甜゛ 提交于 2019-12-10 11:28:56
问题 The code that I have here is using a MouseAdapter to listen for the user to "draw" a box around the area of an image that they would like to zoom in on and calculate the ratio of the box to the image. It then resizes the image to the calculated ratio. This part works. The issue that I am having is making the JScrollPane view appear as if it is still at the same top left position after the image has been resized. I have tried several methods that seem to have gotten close to the result I want

How to make scrollable to jPanel

笑着哭i 提交于 2019-12-10 11:27:33
问题 I am making swing application. And there is too much height of my jPanel. So I want to make this panel as scrollable.: Following is my description of my requirement. I have four jpanel in one jpanel I mean: JPanel p1=new JPanel(); JPanel p2=new JPanel(); JPanel p3=new JPanel(); JPanel p4=new JPanel(); I am adding p2, p3, p4 inside p1 like following output: like above showing panel has more height than computer screen height. So I want to display all content of my panel on computer screen by

How do make an infinite jscrollpane?

我怕爱的太早我们不能终老 提交于 2019-12-10 10:49:36
问题 I've implemented drag scroll before, but what's the best way to go about creating an infinite scroll pane? Of course there won't be any scrollbars and I will implement drag scroll. What I am trying to do is implement dynamic loading on an infinite surface. EDIT Of course it wouldn't actually be infinite. I am asking how to fake it. 回答1: You could use JScrollPane.getViewport() to get the JViewport and add a ChangeListener to it. The JViewport will alert your listener when the size or, more

creating jscrollpane-arrows outsite jspContainer

随声附和 提交于 2019-12-10 10:14:25
问题 Is there an easy way to create the arrows outside the jspcontainter and horizontally arranged for a vertical scroll bar? As the container has overflow:hidden with positioning the arrows cannot be displayed outside. I tried to clone the arrows with jquery clonefunction, but the js hangs up scrolling up again. Is there a way to add default-behavior to custom controls outside the container with the api? 回答1: The best way to do this would be to not show arrows on the jScrollPane itself and then

Irrelevant change of button size in Right to Left orientation

回眸只為那壹抹淺笑 提交于 2019-12-10 08:23:25
问题 I have 9 jbuttons added to jpanel and the panel added to jscrollpane and it added to jframe. http://www.pic1.iran-forum.ir/images/up9/95426323683658592564.jpg when i change frame orientation by: applyComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); the panel move to right and size of buttons got fixed and wouldn`t fill the panel but you see in the image below that scrolbar is fill all width of panel http://www.pic1.iran-forum.ir/images/up9/60975202722295688553.jpg (i used