JScrollPane 1 « JScrollPane « Java Swing Q&A





1. JScrollPane problem    stackoverflow.com

The JScrollpane is not visible at the JTextArea... Can anybody find out what is wrong in my code?
And how to fix it?

import java.awt.*; 
import java.awt.event.*; 
import javax.swing.*; 
import java.util.*; 
import ...

2. How do make an infinite jscrollpane?    stackoverflow.com

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 ...

3. Javascript problem with iframe that's hidden before loaded    stackoverflow.com

I have a page that contains an iframe that gets loaded using Javascript: index.html

<iframe id="myFrame" width="800" height="600" style="display: none;"></iframe>
<div id="loader"><!-- some loading indicator --></div>

<script type="text/javascript">
function someFunction() {
  var myFrame = document.getElementById('myFrame');
 ...

4. how to add an attribute from an object to a JScrollPane in java    stackoverflow.com

I have declared an ArrayList and DefaultListModel

DefaultListModel model;

List<AddFlight> Flights = new ArrayList<AddFlight>();
To this list I add an object as an element
Flights.add(new AddFlight(txtFlightNo.getText(),
          ...

5. Java: Multiple JScrollPanes show view on 1 common component    stackoverflow.com

how (if at all) can I make multiple JScrollPanes have different views on 1 common component (a JTable in this case). Every time I set the viewport of a scrollpane, the ...

6. JScrollPane not showing up?    stackoverflow.com

I have some JScrollPanes on my hex editor and they're not showing up. Any idea why?

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;
import java.util.Vector;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

public class HexEditor extends JFrame{
    JScrollPane ...

7. Jscroll is not working in chrome and safari    stackoverflow.com

I tried teh jScroll plugin by Kelvin Luck. First of all its a wonderful script. Its working fine with text, ie text as contents, in all browesers. But when we insert ...

8. DnD JPane (or JScrollPane)    stackoverflow.com

I am trying to implement dnd on a jpanel so that I can drag content(another Jpanel that has some drawing on it) to another jpanel in the same jframe. I've reviewed ...

9. problem with jscrollpane in java    stackoverflow.com

I add a jtextarea to my jscrollpane but I dont know why it's not working! would u please help me? problem is my text go down, but scroll not working in GUI. I upload ...





10. Issue with JScrollPane    stackoverflow.com

I've written a code which displays search results which are images in JTable.. The main problem is that even after adding JScrollbar, the scorll bar does not appear even when its needed... Here ...

11. Applying jscrollpane to pre-existing page    stackoverflow.com

I have a Dojo Contentpane and I want to apply jscrollpane to it. I have added all the CSS and JS files to the page and they are being downloaded by ...

12. media in div disappears after loading in internet explorer    stackoverflow.com

when i load the follow page in internet explorer: http://www.brittdanielle.com/videos.php I see the content load and then disappear. The content is within a and it is using jscrollpane (if that ...

13. How to hide the JScrollBars in a JScrollPane    stackoverflow.com

I can't seem to find an answer to this on stackoverflow or at the javadoc site. It's probably very trivial. Could someone help?

14. Get component from a JScrollPane (Java)    stackoverflow.com

If there is a JEditorPane in a JScrollPane, how can you get the editor from the scollpane? I tried scrollPane.getComponents() but the editor wasn't in the list.

15. Java JScrollPane- Multiple components    stackoverflow.com

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 ...

16. jScrollPane flicker issue safari    stackoverflow.com

i'm using a jScrollPane for dynamic content. http://dev.harvest.sugarshaker.com/#interview20 ...click on 'open transcript' it works fine on mac firefox, but mac safari flickers when scrolled. i've not even checked on ...





17. I'm trying to use the JScrollPane component in Java    stackoverflow.com

Hi guys i would like you to help me display parallel arrays on a JScrollPane. The arrays are of String and double data types. Here is my sample code: String[] items ...

18. jscrollpane interfering with a booking script    stackoverflow.com

I have a website that uses jscrollpane by kelvinluck. The page is W3C validated, but the jsrollpane is interfering with a bookingscript provided by a company. The provides script works fine in ...

19. Jscrollpane pagination    stackoverflow.com

Well im new to jscrollpane but ive been doing well so far until i placed multiple Mysql Results within a small div and a pagination class. The scrollbar apears the first time, ...

20. JScrollPane not loading initially in Firefox    stackoverflow.com

Here is the page I am having trouble with: http://www.kempsigmonconstruction.com/gallery.html. I am a Java beginner so I don't really know the language. What I know is, that the scrollbar ...

21. Java JScrollPane    stackoverflow.com

I'm trying to add a Vertical scrolling my java programs textarea. I am using this code to create my JScrollPane: console = my textarea. I am also Declaring JScrollPane vertical;

   ...

22. Javascript function for both instead of each one separately    stackoverflow.com

I have this piece of code for a jScrollPane that changes the top arrow's class when it's at the top of the page (since it can't scroll any higher) and the ...

23. JScrollPane problem    forums.netbeans.org

Hello, Forum I am working with Swing in NetBeans IDE 6.7.1 GUI, but sometimes I have big problems, because Java Tutorial differs from NetBeans GUI generated code. The most terrible problem ...

24. JScrollpane - add ColumnHeader    forums.netbeans.org

JList in Jscrollpane. I want to have a column header in this list. In JScrollpane I have a CoolumnHeader. And I need in JscrollPane.setColumnHeader add JViewport()/ But it not enouth. But I have the only one line for code. Please help me what to do

25. JScrollPane does not work as I expected    forums.netbeans.org

I used NetBeans 7.0 to create a Java application GUI. My top leve is a JFRAME, then a JScrollPane and a JPanel (A) in the JScrollPane. Then multiple JPanel's in the JPanel (A) to layout multiple areas for groups of JTextfield's and JButton's (like a Form). However, when I ran it and resized it, the scrollbar did not work as the ...

26. serializing subclass of JScrollPane    coderanch.com

Hi there, Please help me to properly set up serialization/deserialization of a subclass of JScrollPane. I called the class Listbox. It extends JScrollPane implements Serializable and contains a JList object. I have a start on this but I'm not getting the results I need. Without implementing readObject(...) and writeObject(...) methods, I keep losing the text inside the JList. It's still there, ...

27. Using JScrollPane    coderanch.com

28. JScrollPane    coderanch.com

29. JScrollpane    coderanch.com

30. Problem with JscrollPane    coderanch.com

Hi, My application must support jdk1.2.2 and jdk1.3 versions of java. When i run the application in jdk1.2.2 no problem, when i run the same application in jdk1.3 it's running, the problem is: Jscrollpane is giving problem. I added two tabbed panes to JscrollPane, one is on top and another is on bottom. In jdk1.2.2 the Jscrollpane is perfectly displaying the ...

31. JscrollPane(To support methods jdk1.3 --->jdk 1.2.2)    coderanch.com

Hi, My application must support jdk1.2.2 and jdk1.3 versions of java. When i run the application in jdk1.2.2 no problem, when i run the same application in jdk1.3 it's running, the problem is: Jscrollpane is giving problem. I added two tabbed panes to JscrollPane, one is on top and another is on bottom. In jdk1.2.2 the Jscrollpane is perfectly displaying the ...

32. Very Different Problem with JScrollPane    coderanch.com

33. JScroll Pane    coderanch.com

34. JScrollPane    coderanch.com

Hi Remi / Vandana I took a look at your code fragments, but it is a little unclear. I would just point out a few gui design tips and hopefully these should solve your problem: 1. if your main panel has a border layout, the preferrd size of any component might not be set/taken into consideration. for eg. if you add ...

35. Probs with JScrollPane    coderanch.com

36. Which JScrollPane ?    coderanch.com

Hello, I have a problem with scroll panes. In my app I have a JFrame that is split vertically into 2 panels using JSplitPane. The two panels added to either side of the split pane are JScrollPanes, because when the split pane bar is moved, or the frame is re-sized, i need both panels to scroll so the user can see ...

37. JScrollPane    coderanch.com

38. Find Center with JScrollPane    coderanch.com

39. Problem with JScrollPane    coderanch.com

40. JScrollPane Problem    coderanch.com

42. JScrollPane - More than One Component    coderanch.com

43. Is this possible in JScrollPane?    coderanch.com

Color and appearance of UI items are controlled by the UI Delegate of the object, which is installed by a particular Look&Feel. So, the answer to your question is yes in the abstract. More specifically, how you do it really depends on the Look&Feel you have installed. If you are using Metal, it supports the concept of "themes". You can probably ...

46. JscrollPane    coderanch.com

47. Misbehaving JScrollPane    coderanch.com

48. JScrollPane problem    coderanch.com

Hello I have a funny situation. I have a panel onto which I am putting a JScrollPanel. The JScrollPanel occupies about 70% of the total parent panel and is positioned in the middle of the parent panel. into the scroll panel i add some light weight components. so basically i have a scrollable control ui. now when the light weight components ...

49. JScrollPane    coderanch.com

Hi Manoj, I have seen ur request to get the ans. to this ques. in another thread. It's my sincere request that please keep different threads totally isolated if they r not related. Please follow the same thread. Also bear in mind that people here r taking extra pains to reply/help others. If different threads get mixed up then it will ...

50. JScrollPane    coderanch.com

51. JScrollpane problem    coderanch.com

Hi, I have a problem with the scrolling and a flowlayout. If i reduce the size of my frame the jscrollpane doesnt scroll...? can you help please. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ICQTest extends JFrame { private GridBagLayout gbl = new GridBagLayout(); private GridBagConstraints gbc = new GridBagConstraints(); private JPanel centerPanel = new JPanel(); private JLabel label1 = ...

52. JScrollPane    coderanch.com

54. HELP !!!!!!!!!!!!!!!!!!!!! JSCROLLPANE    coderanch.com

Hi How to restrict a canvas within a jScrollPane? I mean, I am adding a canvas to a JscrollPane.I keep on increasing the size of the canvas, during runtime but the canvas overlaps the scrollPane and goes beyond that, which i dont want to happen. All i need is how to make the canvas browseable, no matter how big it is, ...

55. JScrollPane doesn't work?    coderanch.com

56. How to change JScrollPane class    coderanch.com

57. [B]JScrollPane.... Help me....[/B]    coderanch.com

58. JScrollPane:    coderanch.com

59. JScrollPane    coderanch.com

Why won't the JScrollPane work. I know I am missing something but just keep overlooking it. import java.awt.*; import javax.swing.*; import java.awt.event.*; import javax.swing.event.*; import java.util.Random; public class Assignment2 extends JFrame implements ActionListener { private JTextArea display_area; private JButton run, mode, mean, max, min, display; private JScrollPane scroller; int[] random_number_array = new int[10000]; int[] reverse_array = new int [10000]; Random generator ...

60. JScrollPane problem    coderanch.com

61. Help with JScrollPane    coderanch.com

Hello everyone ! I've developed an application to draw workflows (basically just boxes connected with arrows but hey ! it's a workflow !). These drawings are placed onto a panel which is placed on a JScrollPane. To enable scrolling when a box is dragged outside the visible area I use the following code: Dimension drawingArea = new Dimension(0, 0); // x ...

62. Jscrollpane    coderanch.com

63. JScrollPane impossible to add....    coderanch.com

hi ranchers! i'm having difficulty (again) in adding a JScrollPane in my program. In my controller class, i have a frame that has a container, that contains a panel from another class (class a) with all that its contents shown in the screen. when i click a button in class a, in my controller class, it changes the current panel and ...

65. JScrollPane Settings    coderanch.com

import java.awt.*; import javax.swing.*; import javax.swing.table.*; public class ScrollingAndSize { public static void main(String[] args) { String[] headers = { "column 1", "column 2", "column 3", "column 4", "column 5" }; String[][] data = new String[10][5]; for(int i = 0; i < 50; i++) { int row = i / 5; int col = i % 5; data[row][col] = "item " ...

66. Controlling Where a JScrollPane Opens    coderanch.com

67. JScrollpane problem    coderanch.com

68. Problem with JScrollPane    coderanch.com

import java.awt.*; import java.awt.event.*; import java.util.Random; import javax.swing.*; public class ScrollViewTest { static Random seed = new Random(); static JPanel panel; public static void main(String[] args) { panel = new JPanel(new GridLayout(0,1)); JPanel hi = getPanel("hi"), mid = getPanel("mid"), lo = getPanel("lo"); panel.add(hi); panel.add(mid); panel.add(lo); final JButton up = new JButton("up"), down = new JButton("down"); ActionListener l = new ActionListener() { ...

69. JScrollPane: Unnecessary Full Repaints    coderanch.com

I've got a large scrollable view tied to a minature view, where if you drag the mouse around the minature view, the large view scrolls as well to match it. If anybody has Paint Shop Pro 8, it's much like the Preview pane. For maximum rendering speed when scrolling, I call the scroll pane viewport's scrollRectToVisible() method when adjusting the viewport ...

70. JScrollPane not working    coderanch.com

My Code import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.JTextArea.*; public class practice { JButton btnEast = new JButton("East"); JButton btnSouth = new JButton("South"); JButton btnWest = new JButton("West"); JButton btnNorth = new JButton("North"); JButton btnAction = new JButton("Action"); JTextField text = new JTextField (10); JTextArea area = new JTextArea(15, 30); JScrollPane scrollPane = new JScrollPane(area, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED ); public void ...

71. JScrollPane problem    coderanch.com

72. JScrollPane problem    coderanch.com

The following code works fine for me. I am not sure why yours doesn't. It might have something to do with the fact that you are using LayeredPane's and/or that custom class you didn't show us. public class CheckScroll extends JFrame { public CheckScroll() { super("Check Scroll Test"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setLayout(new GridLayout(15, 2)); for (int ...

73. JScrollPane    coderanch.com

/****************************************************************/ /* controlGUI */ /* */ /****************************************************************/ import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * Summary description for controlGUI * */ public class controlGUI extends JFrame { // Label declaration private JLabel jLabel1; private JLabel jLabel2; private JLabel jLabel3; private JLabel jLabel4; private JLabel jLabel5; private JLabel jLabel6; // Button declaration private JButton custFirstB; private JButton custNextB; private JButton custPrevB; private ...

74. JScrollPane    coderanch.com

75. Combo drop down won't cross JScrollPane    coderanch.com

76. Help with JScrollPane    coderanch.com

77. JScrollPanes sync in development but not in live environment    coderanch.com

Hi there I have two JScrollPanes that I keep in sync with one another. When the one JScrollPane is scrolled, the second one programatically scrolls to the same point. This works while the mouse is busy moving the bar. This works fine in our development environment, but as soon as we run the application from the installed version, the JScrollPanes don't ...

78. Browse picture in JScrollpane !!!    coderanch.com

80. about JScrollPane component    coderanch.com

try this import java.awt.*; import java.awt.event.KeyEvent; import javax.swing.*; class Testing extends JFrame { public Testing() { setLocation(400,300); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel jp = new JPanel(new GridLayout(50,1)); for(int x = 0; x < 50; x++) { jp.add(new JLabel("Label "+x+" with longggggggggggggg line")); jp.setFocusable(true);//labels need this, otherwise arrow keys will work } JScrollPane sp = new JScrollPane(jp); sp.setPreferredSize(new Dimension(100,150)); InputMap im = sp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); im.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), ...

81. JScrollPane performance problem    coderanch.com

82. JScrollPane    coderanch.com

83. JScrollPane with multiple JEditorPanes    coderanch.com

Hi guys, I have a scroll pane with a number of editor panes. The trouble is, the scroll pane always scrolls to the last editor pane - despite my best efforts. So, the net result is that the scrollpane always ends up and the bottom, not at the top. If I replace the editor panes with JTextFields of similar size, the ...

84. relayouting after setViewportView for JScrollPane    coderanch.com

public class LabelTest { private static final String TEXT = "a big text here...."; public static void main(String args[]) { JFrame frame = new JFrame("Tree Lines"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Box box = Box.createVerticalBox(); addTextArea(box); addTextArea(box); addTextArea(box); JScrollPane sp = new JScrollPane(); frame.getContentPane().add(sp, BorderLayout.CENTER); sp.setViewportView(box); frame.pack(); frame.setVisible(true); } private static void addTextArea(Box box) { box.add(new JLabel("comment:")); box.add(generateTextArea()); } private static JTextArea generateTextArea() { JTextArea ...

85. JScrollPane that resizes itself    coderanch.com

//file ResizableJScrollPane.java import java.awt.*; import javax.swing.*; public class ResizableJScrollPane extends JScrollPane { JComponent jComponent = null; public ResizableJScrollPane(JComponent jComponent){ super(jComponent); setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); this.jComponent = jComponent; } public Dimension getPreferredSize(){ Dimension dimension = jComponent.getPreferredSize(); int w = dimension.width; int h = dimension.height; return new Dimension(w+3,h+3); } public void validate(){ Dimension dimension = jComponent.getPreferredSize(); int w = dimension.width; int h = dimension.height; setPreferredSize(dimension); ...

86. Problem adjusting JScrollPane programatically    coderanch.com

I have a JScrollPane with a JTextArea. The JTextArea is loaded with 10 lines of data. I have two JCheckBox's. The first check box sets the scroll to 10. sp.getVerticalScrollBar().setValue(10); The second check box reloads (ta.setText(text)) the text and then sets the scroll to 10. Why does the second one not work? I have attached a simple program. It is probably ...

87. JScrollPane    coderanch.com

88. Problem in Using JScrollPane    coderanch.com

89. JScrollPane doesn't work.    coderanch.com

import java.awt.*; import javax.swing.*; class Main extends JFrame { //Drawer drawer; JPanel drawer; JPanel panel; JScrollPane jsp; public Main() { //drawer=new Drawer(); drawer=new JPanel(); drawer.setBorder(new javax.swing.border.LineBorder(Color.BLACK,1)); //drawer.setSize(800,800); drawer.setPreferredSize(new Dimension(800,800)); jsp=new JScrollPane(drawer,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jsp.setSize(400,400); //jsp.setPreferredSize(new Dimension(400,400)); jsp.setLocation(0,0); panel=new JPanel(); //panel.setSize(400,400); panel.setPreferredSize(new Dimension(400,400)); panel.setLayout(null); panel.add(jsp); this.setSize(500,500); this.getContentPane().add(panel,BorderLayout.CENTER); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true); } public static void main(String[] args) { new Main(); } }

90. Add Components in JScrollPane    coderanch.com

91. Artifacts appearing outside of JScrollPane    coderanch.com

When you do drawing in an overridden painting method inside a lightweight, opaque component you need to clear the background before each trip through the painting method unless you fill in all the background yourself, eg, drawing an offscreen image that fills the component. An easy way to do this is to call super which directs the parent component (enclosing class ...

92. JScrollPane not working    coderanch.com

93. Problem with the JScrollPane    coderanch.com

94. JScrollPane problem    coderanch.com

Hi all, I am having a bit of trouble making a window that will provide scroll capabilities and contain a JPanel. My code works fine for creating a window to provide scroll capabilities for a JLabel that is too big for the window (Just not for a panel, and I cant figure out why!!!) Heres what Ive got: import ...all the ...

95. JScrollPane placement question    coderanch.com

Hi, I'm making a list of JPanels that can be dynamically added or removed. I have *most* of the code worked out, but when one needs more of these JPanels than space allows for in my "holder" panel, I obviously need a JScrollPane. But the implementation of it is a problem, due to stacked JPanels, etc. Here is the code: class ...

96. JScrollPane Frustrations    coderanch.com

Ok, I'm trying to create a JScrollPane that will hold custom visual classes. The way I'm currently doing it is /** * This method initializes changesScrollPane * * @return javax.swing.JScrollPane */ private JScrollPane getChangesScrollPane() { if (changesScrollPane == null) { changesScrollPane = new JScrollPane(); changesScrollPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); changesScrollPane.setViewportView(getChangesPanel()); } return changesScrollPane; } /** * This method initializes changesPanel * * @return javax.swing.JPanel */ ...

97. JScrollPane    coderanch.com

> i am adding components to Jpanel but all components are not showing in screen generally indicates you have set the frame's visibility to true, before adding the components to the frame. > can you please give me sample program for this much better for you to post your (errant) sample program

98. Problem with JScrollPane    coderanch.com

99. JScrollpane Action Listener    coderanch.com

Originally posted by Ajay Singh: Hi all I am having two horizontal scollpanes in a frame.One on the left side and one on the right side.My requirement is that when i scroll the left hand side scrollpane ,the right hand side scrollpane should also scroll.Can someone tell me how to proceed.Thanks in advance Regards Ajay

100. Cannot access JScrollPane, bad class file !!!!    coderanch.com

Hi everybody. I have got a big big problem. I can not compile my code because this message alwayes is displayed: C:\Java\hosseindab\Dabb.java:8: cannot access JScrollPane bad class file: .\JScrollPane.class class file contains wrong class: javax.swing.JScrollPane Please remove or make sure it appears in the correct subdirectory of the classpath. private JScrollPane skrollytan; I tried to uninstall and reinstall SDK och Textpad, ...