ScrollPane « JScrollPane « Java Swing Q&A





1. SwingBuilder: scrollPane    stackoverflow.com

What's the proper way to set up a scroll pane using groovy's SwingBuilder? I'm using griffon and I'm having a hard time adding and removing components dynamically... Here's a snippet I've tried ...

2. Java Swing Scrollpane in NetBeans    stackoverflow.com

I have Java application which adds JTextFields @ runtime to JPanel. Basically user clicks a button and new JTextField is added, clicks again added again... Each new JTextField is directly below ...

3. Scrollpane for JPanel?    stackoverflow.com

I want to add Scrollpane to JPanel which is in turn called by another jpanel?

 public class test {

    JFrame jframe;
    JPanel jpanel;
   ...

4. ScrollPane doesn't work    stackoverflow.com

I have a problem with ScrollPane and TextArea I put a scroll there and when I try to type in the TextArea it doesn't scroll it gets wider. Here you got ...

5. Need help with logic of nested scrollpane    stackoverflow.com

I need to make a "nested" scrollpane within another scrollpane and am looking for a bit of logic advice. Here is what I want to do - enter image description here I'm ...

6. Java ScrollPane/JPanel    stackoverflow.com

I have a JPanel with multiple Pentahex(custom class extends Jpanel) objects in it. The JPanel has a grid layout with 7 rows and 1 column. I'm trying to add a JPanel ...

7. Question about scrollpane    coderanch.com

8. Scrollpane    coderanch.com

Make sure you are incrementing your location. If you hardcode the y position to 20 the scrollpane will always go to 0,20 as the upper left hand point in your scrollpane. ( thus will never change!) try getY from the scrollpane and then adding 20 to it. I did the same thing when I added the new scrollbar. This way you ...

9. ScrollPane is always a problem !!!    coderanch.com





10. ScrollPane/ScrollBar    coderanch.com

Hi, Is there any method that gives me the "direction" (Positive /Negative) in which the ScrollBar is moving. I looked into BasicScrollBarUI class, there are two constants POSITIVE_SCROLL and NEGATIVE_SCROLL. But I need to know from an instance of a ScrollPane class, whether user clicked POSITIVE_SCROLL or NEGATIVE_SCROLL. Please help me. Let me explain what I am trying to do. I ...

11. poor ScrollPane!    coderanch.com

I write a component which do drawing work itself ,then i put it in a scrollpane, and the scroll bars do appear when needed. But i think the scrollpane size (100* 100) is too small, so i set the scroll pane's size to 200*200, now the scrollbars never appear! what can i do? i want do more than just curse AWT! ...

12. ScrollPane- Urgent    coderanch.com

Haai, I have a problem in using scrollpane. I have added a scrollpane and a panel into it which is in GridbagLayout.The panel added contains many Labels. When I minimize the size of the panel and scroll using a scrollbar through the panel the labels are not repainted properly. What property should i use for a scrollpane. Expecting ur reply as ...

13. ScrollPane    coderanch.com

Hi Phillip, After looking at your code I figured out the following problems. 1. You must set some size on your 'panel'. Since you have set its layout to null, the scrollPane assumes it is the same size as itself. Therefore you get no scrolling! Replace the line: sp.setBounds( 0, 0, 800, 400 ); with the following: panel.setBounds( 0, 0, 800, ...

14. animation in scrollPane    coderanch.com

Here's some code I have that graphs the used memory of the JVM... it has a graph in a scrollpane that follows the graph. Check out the addData() method. Especially the scrollRectToVisible() call. import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Rectangle; import java.util.Vector; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JScrollPane; public class GraphScroller extends JFrame { private GraphPanel p; private Thread t; ...

15. Scrollpane in JDK 1.0 ??    coderanch.com

16. Reading a file in ScrollPane    coderanch.com

I am using awt to display my files. I need to format the lines i need to display, so I am using ScrollPane to display the lines and not the text area. The code is below. I am setting the dimension of the scrollpane using setDimension, in the PaneWriter class. As I said before, I could display the files only for ...





17. ScrollPane problem    coderanch.com

18. Header in ScrollPane    coderanch.com

private JScrollPane gettestSP() { JScrollPane testSP = new javax.swing.JScrollPane(); testSP.setName("MySP"); testSP.setHorizontalScrollBarPolicy (javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); testSP.setFont(new java.awt.Font("sansserif", 1, 12)); testSP.setBounds(5,20,1090,225); // sizing scrollpane to width = 1090 testSP.setViewportView(gettestTP()); return testSP; } private JTable gettestTP() { JTable testTP = new javax.swing.JTable(); testTP.setName("MyTP"); testSP.setColumnHeaderView(testTP.getTableHeader()); testSP.getViewport().setBackingStoreEnabled(true); testTP.setAutoResizeMode(0); testTP.setBackground(java.awt.Color.white); testTP.setAutoCreateColumnsFromModel(false); testTP.setPreferredSize(new java.awt.Dimension(2200, 200)); testTP.setFont(new java.awt.Font("sansserif", 1, 12)); testTP.setBounds(0, 0, 2200, 220); }

19. AWT List + ScrollPane ???    coderanch.com

Hi, I am trying to write an AWT Table. The table will be placed in a scrolling pane and updated dynamically. I can not figure out how to send updates to the scrolling pane. The only solution I got so far is to validate the pane after each update. I am sure there must be better way. I tried to use ...

20. synchronize two ScrollPane    coderanch.com

import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ScrollPaneTest { public ScrollPaneTest() { JScrollPane scrollPane1 = new JScrollPane(getPanel()); JScrollPane scrollPane2 = new JScrollPane(getPanel()); Synchronizer synchronizer = new Synchronizer(scrollPane1, scrollPane2); scrollPane1.getVerticalScrollBar().addAdjustmentListener(synchronizer); scrollPane1.getHorizontalScrollBar().addAdjustmentListener(synchronizer); scrollPane2.getVerticalScrollBar().addAdjustmentListener(synchronizer); scrollPane2.getHorizontalScrollBar().addAdjustmentListener(synchronizer); JPanel panel = new JPanel(new GridLayout(1,0)); panel.add(scrollPane1); panel.add(scrollPane2); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(panel); f.setSize(500,300); f.setLocation(200,200); f.setVisible(true); } private JPanel getPanel() { JPanel panel = new JPanel() ...

21. scrollPane    coderanch.com

Thanks a lot. Preferred size did it. I have another odd problem though. When I scroll the panel now ,up or down, the panel's graphics get distorted. I have buttons above the panel(#1) in another panel(#2) and it seems the button graphics from #2 are scrolled on #1 like they were part of #1? if that makes sense. Anyway I added ...

22. Scrollpane doubt    coderanch.com

23. Checkboxs in ScrollPane    coderanch.com

25. visible area in scrollPane    coderanch.com

hello friends , I am dynamically adding labels in panel which is in ScrollPane. After adding more labels , vertical scroll bars are visible as usual. But newer labels are hidden behind the scollPane. I want new labels to be displyed on top wherever added. Any Idea ?? import javax.swing.*; import java.awt.event.*; class ScrollablePanel extends JFrame { static int times = ...

26. Scrollpane    coderanch.com

27. Adding ScrollPane to JPanel    coderanch.com

28. scrollpane not scrolling    coderanch.com

my Jtext area does not scroll when overflowing, any ideas? package testers; import javax.swing.*; import graphics_serious.PulseTrainDisplay; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; //import ij.gui.GenericDialog; //import ij.io.OpenDialog; //import ij.io.SaveDialog; import java.awt.*; import javax.swing.JFileChooser; public class Scroller extends JFrame{ private JFileChooser fc; privateJTextArea jTextArea; privateJButton open; privateJTextField risingETV, fallingETV, risingMinV, fallingMinV; private JLabel risingET, fallingET, risingMin, fallingMin, blank; private Container contentPane; private JPanel ...

29. Problem with scrollpane hscroll in windows XP    coderanch.com

Hi, We have a web based application, which has an embedded applet.The applet in turn has a scroll pane. When the vertical scroll bar of the browser(IE 6)touches any point of the scroll pane, the horizontal scroll bar of the scroll pane freezes.The moment the vertical scroll bar is moved beyond the scroll pane, the horizontal scroll bar of the scroll ...

30. setHorizontalScrollBar and setVerticalScrollBar for ScrollPane?    coderanch.com

Is that possible for a layout somewhat like this: ----------------------- | some panel w/data|ve| |------------------|rt| | | | | | | lt | scroll | rt |sc| | | | |ro| | pan| Pane | pan|ll| | el | | el |ba| |w/ | |w/ |r | |data| |data| | |------------------| | | otherpanel w/data| | ----------------------- |horiz scrollbar | | ...

31. two mirror scrollpane    coderanch.com

32. ScrollPane in JApplet    coderanch.com

container.add(scrollpane); (where, presumably, 'container' is Container cont = getContentPane() ;) here the scrollpane will occupy the frame (almost), so, for the scrollpane to work, the panel needs to be a bigger size than that of the frame/scrollpane e.g. if the frame's size is (400,300), include this line and see what happens panel.setPreferredSize(new Dimension(600,400)); if, by some chance, you are using a ...

33. ScrollPane behave differently    coderanch.com

/** * @(#)SampleText.java * * * @author BALASUBRAMANIAN C * @version 1.00 2008/1/18 */ import javax.swing.*; import javax.swing.text.DefaultStyledDocument; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyleConstants; import java.awt.*; import java.awt.event.*; public class SampleText extends JFrame{ static DefaultStyledDocument doc = new DefaultStyledDocument(); static SimpleAttributeSet sat = new SimpleAttributeSet(); static int i=0; public SampleText() { } public static void main(String[] args) { JFrame frame = new JFrame(); ...

35. scrollpane on JPanel    coderanch.com

I want to be able to scroll in my TrainingProgram when the dimension exceed that of the GraphPanel but the scrollpane just wont activate. I take it I need to do something more than just draw a line that is longer than my JPanel size. any help would be appreciated. public class Main { /** * @param args the command line ...

36. ScrollPane trouble    coderanch.com

What isn't? Well ok, the most obvious drawbacks: - you have to position every component yourself (may be what you want) - it will not scale components if your user interfaces resizes - it doesn't calculate the minimum, maximum and preferred sizes of components A null layout is never a good idea. If you really need to manually position your components ...

37. ScrollPane in netbeans GUI    coderanch.com

hi,I'm using netbeans GUI,I am writing a program like paint program(in windows),I have a panel that I can paint on it,and also I can load image into this panel. but the problem is that when I load an image,when it is bigger than my panel I can not see the hole image,I need to have something to let me edit all ...

38. ScrollPane Issues..    java-forums.org

Hi, When i scale the image, the scrollbars dont pop out to cover the whole image. The only time, the scrollbars do work is when I drag the JFrame and even then , it still doesnt show the whole image. It seems like a simple question But I am still unable to solve it. :confused: I know the code seems a ...

39. scrollPane to handle 24 hours time    java-forums.org

You could fill it with either Strings that show your time, or if you want to get just a little fancier, fill it with Date objects, and use a renderer that displays your date objects in a way satisifies your requirements. For instance, I had a JTable recently where I wanted the left column of data to show times, and I ...

40. scrollpane    java-forums.org

private class ExampleMouseAdapter extends MouseAdapter { public void mouseClicked(MouseEvent event) { // Actions taken when click on board button if (SwingUtilities.isLeftMouseButton(event)) { // Show results up to that stage // clicked on text field // want to execute query up to that point // get the array text field is from and the position within array JTextField clicked = (JTextField)event.getSource(); //etc. ...

41. JScrollPane and ScrollPane    forums.oracle.com

hey all!! i had an earlier question http://forum.java.sun.com/thread.jspa?threadID=5207322&tstart=30 regarding J and difference. and here i am with the difference example. i don't seem to be able to solve this if i do JLabel lbl = new JLabel("lable"); ScrollPane sc = new ScrollPane(); sc.add(lbl); sc.validate(); and run this code in my applet everything is fine but when i use JScrollPane this ...