Invisible JScrollPane?

I have a JList matched up with a JTextArea. Inside the JList I want it to list numbers corresponding to the line in the JTextArea. I have the JList's and JTextArea's JScrollPanes synched up. But, I only want the JTextArea's JScrollPane to show up. Is it possible to have the JList's JScrollPane be invisible but because it is synched up with the JTextArea's JScrollPane still scroll through the JList? If you do not know what I mean or want more of my code, let me know.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
public class cfmCodeCounter1_1 extends JFrame
     private JLabel lblEnter;
     private JTextArea input, output;
     private JList row;
     private JButton parse, clear, exit;
     private JScrollPane scroller, scroller2, scroller3;
     private Container c;
     private Vector <String> rowVec;
     private boolean threadflag = false; // Used so only one thread for the CaretListener runs at one time
     private cfmCodeCounter1_1()
          try
               this.setTitle("ColdFusion Parser - NGIT");
               // Vector
               rowVec = new Vector<String>();
               // Display Label
               lblEnter = new JLabel("Enter Code Below: ");
               lblEnter.setVisible(true);
               // JTextAreas
               input = new JTextArea(10, 30); // (rows, columns)
               input.setEditable(true);
               scroller = new JScrollPane(input);
               input.requestFocus();
               output = new JTextArea(5, 19); // (rows, columns)
               output.setEditable(false);
               scroller2 = new JScrollPane(output);
               output.requestFocus();
               // Selectable List
               row = new JList(rowVec);
               row.setVisibleRowCount(10);
               row.setFixedCellWidth(50);
               row.setFixedCellHeight((input.getPreferredSize().height/10));
               scroller3 = new JScrollPane(row);
               // Set up scroller and scroller3
               scroller.getVerticalScrollBar().setModel(scroller3.getVerticalScrollBar().getModel());
               // Set up listener for input and row
               TextHandler txthandle = new TextHandler();
               input.addCaretListener(txthandle);
               // Button
               parse = new JButton("Parse Code");
               clear = new JButton("Clear");
               exit = new JButton("Exit");
               // Set Layout
               c = getContentPane();
               SpringLayout layout = new SpringLayout();
               c.setLayout(layout);
               c.add(lblEnter);
               c.add(scroller3);
               c.add(scroller);
               c.add(scroller2);
               c.add(parse);
               c.add(clear);
               c.add(exit);
               // Place lblEnter
               layout.putConstraint(SpringLayout.WEST, lblEnter,
                             10,
                             SpringLayout.WEST, c);
             layout.putConstraint(SpringLayout.NORTH, lblEnter,
                             10,
                             SpringLayout.NORTH, c);
            // Place scroller3 aka row
               layout.putConstraint(SpringLayout.WEST, scroller3,
                             10,
                             SpringLayout.WEST, c);
             layout.putConstraint(SpringLayout.NORTH, scroller3,
                             5,
                             SpringLayout.SOUTH, lblEnter);
               // Place scroller aka input
               layout.putConstraint(SpringLayout.WEST, scroller,
                             -1,
                             SpringLayout.EAST, scroller3);
             layout.putConstraint(SpringLayout.NORTH, scroller,
                             0,
                             SpringLayout.NORTH, scroller3);
                // Place scroller2 aka output
               layout.putConstraint(SpringLayout.WEST, scroller2,
                             5,
                             SpringLayout.EAST, scroller);
             layout.putConstraint(SpringLayout.NORTH, scroller2,
                             0,
                             SpringLayout.NORTH, scroller);
            // Place parse
               layout.putConstraint(SpringLayout.WEST, parse,
                             10,
                             SpringLayout.WEST, c);
             layout.putConstraint(SpringLayout.NORTH, parse,
                             5,
                             SpringLayout.SOUTH, scroller);
            // Place clear
               layout.putConstraint(SpringLayout.WEST, clear,
                             5,
                             SpringLayout.EAST, parse);
             layout.putConstraint(SpringLayout.NORTH, clear,
                             0,
                             SpringLayout.NORTH, parse);
            // Place exit
               layout.putConstraint(SpringLayout.WEST, exit,
                             5,
                             SpringLayout.EAST, clear);
             layout.putConstraint(SpringLayout.NORTH, exit,
                             0,
                             SpringLayout.NORTH, clear);
               // Button Event Handler
               ButtonHandler handler = new ButtonHandler();
               parse.addActionListener(handler);
               clear.addActionListener(handler);
               exit.addActionListener(handler);
               this.addWindowListener(new WindowAdapter()
                         public void windowClosing(WindowEvent e)
                              System.exit(0);
               setSize(650, 300);
               setVisible(true);
          catch(Exception e)
               e.printStackTrace();
               JOptionPane.showMessageDialog(null, "General Error: See Command Line.", "ERROR - NGIT", JOptionPane.ERROR_MESSAGE);
               System.exit(0);
     private class TextHandler implements Runnable, CaretListener
          public void caretUpdate(CaretEvent e)
               if (!threadflag)
                    threadflag = true;
                    Thread txtThread = new Thread(this);
                    txtThread.start();
          public void run()
               rowVec.removeAllElements();
               for (int i = 1; i <= input.getLineCount(); i++)
                    rowVec.add("" + i);          
               row.setListData(rowVec);
               threadflag = false;
               // Find current row of cursor
               int numrows = 1;
               char[] chararr = input.getText().toCharArray();
               int caretPos = input.getCaretPosition();
               for (int i = (caretPos-1); i >= 0; i--)
                    if (chararr[i] == '\n')
                         numrows++;
               row.setSelectedIndex((numrows-1));
               row.ensureIndexIsVisible((numrows-1));
//Code Continues

Thank you, you did catch an error that I had. I did not want output to have requestFocus(), as you can see just above it I actually wanted input to have it. Also, I put "input.requestFocus()" after I set the visible to true and it works. Thank you for that.
But, I have two main questions. One is, can you do what I described above and have one jscrollpane be invisible, yet still work since it is synched up with another jscrollpane that is visible?
The other question goes with this code below. I do not necessarily want it to scroll to the bottom of the page, just to where the cursor ends. Let's say I already have code in the input JTextArea, and I paste more code above it, I do not want it to scroll to the bottom of the JTextArea, just to where the cursor ends up. I cannot figure out why it is not autoscrolling.
private class TextHandler implements Runnable, CaretListener
          public void caretUpdate(CaretEvent e)
               if (!threadflag)
                    threadflag = true;
                    Thread txtThread = new Thread(this);
                    txtThread.start();
          public void run()
               rowVec.removeAllElements();
               for (int i = 1; i <= input.getLineCount(); i++)
                    rowVec.add("" + i);          
               row.setListData(rowVec);
               // Find current row of cursor
               int numrows = 1;
               char[] chararr = input.getText().toCharArray();
               int caretPos = input.getCaretPosition();
               for (int i = (caretPos-1); i >= 0; i--)
                    if (chararr[i] == '\n')
                         numrows++;
               row.setSelectedIndex(numrows-1);
               row.ensureIndexIsVisible(numrows-1);
               System.out.println("ACTUAL: " + row.getSelectedIndex());
               threadflag = false;
     }

Similar Messages

  • Invisible JTextArea in a JScrollPane

    I want to have an invisible JTextArea in a JScrollPane (i only want a thin border either vieport border or JTextArea border). i tried setOpaque(false) for JTextArea, JScrollPane and both, and it wont work, i dont know why. Could anyone help me?

    This poster is 0 for 3 in responding to previous postings he has made.I did notice - that's why I didn't post the link.
    he/she might now learn how to do a search (for when future questions are ignored)
    What do you think the chances are he'll bother to thank anyone for the help
    he received on this posting?Nil
    a 'thank you' does go a long way to getting the next query answered, but I'd prefer just
    an acknowledement of "it works/doesn't work" - makes it so much easier, when
    searching the forums, when you spot a "yes, that works" at the end.

  • LayeredPane, validation Icons, JScrollPane should become invisible

    For development of an application we have customized textfields, comboxes etc. The are able to show validation icons, these icons are centered in the down/left corner. Thus a little bit in and outside of the components bounds.
    To add validation icons, I add them (JLabel, with icon) tothe layeredPane of the getRootpane(). Using swingutilitities.getLocationOnScreen I calculate the location where to put the icons.
    However if a textfield is inside a scrollpane, and the textfield is scrolled outside of the visible viewport the icon is still being painted, somewhere outside the scrollpane.
    (I had the same problems with JTabbedPane, buth by check isShowing this was solved, however when component is inside viewPort, the "isShowing" still return "true" ). How can I check, or should I use other way of displaying validation icons.
    Our components need to extend from components and need to be using by visual designer tool.

    //Sorry, went something wrong during previous post
    This is my "special panel":
    @Override
    AddImple(Component comp, Object c, int index){
    if(x instanceof y){   
         //layerUI created somewhere else(examples on your site)
        JxLayer<JComponent>  wrapper = new JXLayer<JComponent>(comp, layerUI);
        super.addImpl(wrapper, c, index)
    }This only goes fine using layoutmanagers which not using the setBounds methods. If using nullLayout, grouplayout etc etc, if have to override setBounds, find out who is invoking, "parent" panel or the JXJayer. Depending on that, in the setbounds if have to invoke setBounds from super or setBounds from layer&super.
    I'm not happy with my implementation yet because: Using special panel(addImpl) and overriding setbounds in component. Further not every visual designer (jFormDesigner, netbeans) deals nice with it.
    I tried creating custom borderUIResource. Overriding getInsets and paintComponent works quite well, however because of custom insets(extra left&down) it's not lined-out perfectly with other default components.Further visual designers paint insets white at design time, not biggest issue yet....
    There are really several ways for painting icons outside bounds, however perfect isn't found yet....
    Maybe using rootpane's layeredpane with custom code for jScrollPane etc isn't so bad at all.
    Edited by: heicovdkamp on Oct 8, 2008 5:15 AM

  • How do I make a JTextArea invisible to the mouse?

    Consider the applet below. There is a small JTextArea sitting in the glass pane. There are 3 JButtons sitting in a JPanel that is sitting in the content pane. One is completely under the JTextArea, one is half in and half out, & the last is completely outside it (at least I hope thats what it looks like on your machine.) The idea is when you click the disable button the JTextArea is disabled and you can click on the button that's underneath it.
    But it doesn't work that way. even when the JTextArea is disabled the mouse still cant click through it.
    Is there some way to make the JTextArea completely invisible to the mouse so I can click through it? I know setVisible(false) on the glass panel will work but I only want it to be invisible to the mouse, not my eyes.
    Thanks.
    /*  <applet code="MyTest14" width="400" height="100"></applet>  */
    // testing glass panes
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import javax.swing.*;
    public class MyTest14 extends JApplet implements MouseListener
    TextPanel textPanel;
    JPanel buttonPanel;
    JButton underButton, enableButton, disableButton;
    JTextArea jta;
    public void init()
      Container contentPane = getContentPane();
      contentPane.setLayout(new FlowLayout());
      contentPane.setBackground(Color.WHITE);
      underButton = new JButton("Under textarea");
      underButton.addMouseListener(this);
      enableButton = new JButton("Enable textarea");
      enableButton.addMouseListener(this);
      disableButton  = new JButton("Disable textarea");
      disableButton.addMouseListener(this);
      buttonPanel = new JPanel(new BorderLayout());
      buttonPanel.add(underButton, "West");
      buttonPanel.add(enableButton, "Center");
      buttonPanel.add(disableButton, "East");
      jta = new JTextArea();
      jta.setPreferredSize(new Dimension(200,80));
      jta.setOpaque(false);
      jta.setLineWrap(true);
      jta.setWrapStyleWord(true);
      textPanel = new TextPanel();
      textPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
      textPanel.add(jta);
      jta.setBorder(BorderFactory.createLineBorder(Color.black));
      contentPane.add(buttonPanel);
      setGlassPane(textPanel);
      textPanel.setVisible(true);
    public void mouseClicked(MouseEvent e)
      if (e.getSource() == enableButton) { jta.setEnabled(true); }
      else if (e.getSource() == disableButton) { jta.setEnabled(false); }
      else if (e.getSource() == underButton) { System.out.println("You reached the under button!"); }
    public void mouseExited(MouseEvent e) {}
    public void mouseEntered(MouseEvent e) {}
    public void mouseReleased(MouseEvent e) {}
    public void mousePressed(MouseEvent e) {}
    class TextPanel extends JPanel
      public TextPanel()
       super();
       setOpaque(false);
      public void paintComponent(Graphics g) { super.paintComponent(g); }
    }

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test extends JFrame {
      Container content = getContentPane();
      JButton jb = new JButton("Press"), disenable = new JButton("Enable");
      JTextArea jta = new JTextArea("Now is the time for all google men to come to the aid of their browser");
      public Test() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        JPanel jp = new JPanel();
        content.add(jp, BorderLayout.CENTER);
        jp.add(jb);
        jb.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) { System.out.println("Click!"); }
        jta.setLineWrap(true);
        jta.setWrapStyleWord(true);
        jta.setOpaque(false);
        jta.setEnabled(false);
        JScrollPane jsp = new JScrollPane(jta);
        jsp.setOpaque(false);
        jsp.getViewport().setOpaque(false);
        jsp.setPreferredSize(new Dimension(130,130));
        JPanel glass = (JPanel)getGlassPane();
        glass.add(jsp);
        glass.setVisible(true);
        jta.addMouseListener(new MouseListener() {
          public void mouseReleased(MouseEvent me) { mousy(me); }
          public void mouseClicked(MouseEvent me) { mousy(me); }
          public void mouseEntered(MouseEvent me) { mousy(me); }
          public void mouseExited(MouseEvent me) { mousy(me); }
          public void mousePressed(MouseEvent me) { mousy(me); }
        content.add(disenable, BorderLayout.SOUTH);
        disenable.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            jta.setEnabled(!jta.isEnabled());
            disenable.setText(jta.isEnabled()?"Disable":"Enable");
        setSize(200,200);
        setVisible(true);
      void mousy(MouseEvent me) {
        if (jta.isEnabled()) return;
        Point p = SwingUtilities.convertPoint((Component)me.getSource(), me.getPoint(), content);
        Component c = content.findComponentAt(p);
        if (p!=null) c.dispatchEvent(SwingUtilities.convertMouseEvent((Component)me.getSource(), me, c));
      public static void main(String[] args) { new Test(); }
    }

  • Help with JScrollPane

    I have a JScrollPane that I need to add multiple components to. That includes 5 JButtons, and 5 Jtree's.
    I need to add all of the components at once, making the JTree's visible and invisible by clicking the JButton's. My first problem is when I try to add multiple objects to the JScrollPane using the default layout manager. The last object added is always stretched to fill the entire viewport. This makes the objects first added un-viewable. So I decided to first add all of the objects to a Box then add the Box to the scrollpane.
    My second problem occurs when I make a JTree visible, aftering adding it to the Box. It draws the tree completely from top to bottom as it should, but clips the right end of titles on the nodes. The horizontal scroll adjusts enought so that you can scroll far enough to the right, but the titles are cut off.
    If I add one of the JTree's directly to the JScrollPane it behaves as it should, showing the complete node titles.
    I've tried revalidating, updating, and repainting without success.
    So, first question is can multiple objects be added to a JScrollPane using the default layout manager, without having the last object hide the previously added objects?
    Secondly, does anyone know why nodes in a JTree would be clipped when added to a Box then added the Box added to a JScrollPane. And more importantly how to fix it.
    Any help would be appreciated,
    Thanks,
    Jim

    Hi there
    Im not sure on exactly what you are trying to do.
    But if you want multiple components in one JScrollPane
    I would use a JPanel that I would add to the JScrollPane
    On that JPanel I would then add my components.
    I would also use GridBagLayout instead of any other layout manager. Thats because it is the most complex
    layout manager and it will arrange the components as I whant.
    If you whant to be able to remove a component from the view by making them invisible. I think I would consider
    JLayeredPane.
    on a JLayeredPane you add components on different layers. Each component is positionend exactly with setLocation or setBounds. This is the most exact thing to use. The JLayeredPane uses exact positioning of its components. which can be usefull when you use
    several components that will be visible at different times
    /Markus

  • JScrollPane Visibility

    Hey,
    I'm having some issues with setVisible on JScrollPanes.
    Basically I'm writing a little class that's storing settings using java.util.Properties.
    These settings are checked on load to see if it should display some certain buttons, and a JScrollPane.
    I've also included a JMenu with checkbox items to toggle visibility of these buttons/JScrollPane during runtime.
    Now to the problem, when I launch the class with the JScrollPane disabled in configuration I can't seem to make it visible again.
    The setVisible(true); line is being run, as I've printlned the object on change. But it's just not appearing on screen.
    When the class is run with the JScrollPane enabled in configuration it runs fine, and changes visibility on demand.
    Heres a small example snippet:
    Properties config = new Properties();
    config.load(new FileInputStream("configfile.cfg));
    if (config.get("showScroll")!=null) {
        if (config.get("showScroll").equals("0") {
            scrollPane.setVisible(false);
        } else {
            scrollPane.setVisible(true);
    } else {
        config.setProperty("showScroll","1");
        scrollPane.setVisible(true);
    }Then the toggle button changes setVisible(); between true/false and config.setProperty("showScroll","1/0");.
    So basically if at runtime "showScroll" = "0" the scrollPane won't be visible, and the toggle button won't make it visible even though it is changing the state.
    If "showScroll" = "1" the scrollPane will be visible, and the toggle button will toggle it between visible and invisible without any hassles.
    Sorry if this post is mumbled, 3am here and I'm a bit tired.
    Thanks in advance.

    Ahh great, thanks heaps.
    I came so close as well, I had actually tried repaint() with no luck.
    validate(); worked a treat :)

  • JOptionPane setMaximumSize with a JScrollPane as the object doesn't work

    I am trying to use a JOptionPane for error messages. I'm trying to make the JOptionPane dialog be a minimum of 500x100 and a maximum size of 500x450 depending on the amount of text in the JTextArea inside the JScrollPane that's being passed into JOptionPane. I've tried both JOptionPane.showMessagePane(), and instantiating a JOptionPane and then setting its maximumSize, neither of which work as expected. Here is the relevant code:
    public static void doCommonMessagePane( Component parent, String optMsg,
                                             String title, int msgType )
        JTextArea msg = new JTextArea( optMsg );
        JScrollPane jsp = new JScrollPane( msg );
        initOptionPaneComponents( msg, jsp );
        Dimension maxSize =new Dimension(500, 450) ;
        JOptionPane op = new JOptionPane(jsp, msgType);
        op.setMaximumSize(maxSize);
        op.revalidate();
        op.setVisible(true);
    //here is me also trying showMessageDialog
    //    JOptionPane.showMessageDialog(parent, jsp, title, msgType);
      private static void initOptionPaneComponents( JTextArea ta, JScrollPane sp )
              Color bg = UIManager.getColor( "Panel.background" );
              Dimension jspSz = new Dimension( 500, 75 );
              Dimension max = new Dimension( 500, 450 );
              ta.setMargin( new Insets( 5, 10, 10, 5 ) );
              ta.setColumns( 50 );
              ta.setLineWrap( true );
              ta.setWrapStyleWord( true );
              ta.setEditable( false );
              ta.setEnabled( false );
              ta.setBackground( bg );
              ta.setDisabledTextColor( Color.black );
              ta.setFont( UIManager.getLookAndFeelDefaults().getFont( "Dialog" ) );
              ta.setMaximumSize(max);
              ta.setMinimumSize(jspSz);
              sp.getViewport().add( ta );
         //sp.setPreferredSize( jspSz );
              sp.getViewport().setMaximumSize(max);
              sp.getViewport().setMinimumSize(jspSz);
              sp.setBorder( BorderFactory.createLoweredBevelBorder() );
              sp.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED );
         //     sp.setPreferredSize( jspSz );
           sp.setMinimumSize(jspSz);
              sp.setMaximumSize( max );
         }

    When the JScrollPane is placed into the CENTER position the JOptionPane ignores the maxSize of both the JScrollPane and the JTextArea and stretches both of these out to 500x700 so that all text is visible. You still miss the basic concept.
    The answer is it depends! First the size of the dialog needs to be determined.
    If you use dialog.pack() then the preferred size of all components is used to determine the size of the dialog and the scrollpane will be whatever preferred size you gave it. If you leave the preferred size at (0, 0) then the scrollpane and text area will be invisible.
    If you use dialog.setSize(???, ???), then the size of the scrollpane will be adjusted to fit the available space.
    The amount of text in the text area is irrelevant in determining the size of the scrollpane. It is relevant in determining whether scrollbars will appear or not once the scrollpane is displayed.
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.
    Don't forget to use the [Code Formatting Tags|http://forum.java.sun.com/help.jspa?sec=formatting], so the posted code retains its original formatting.

  • Make a JScrollBar only update its JScrollPane when the user releases it?

    Hi
    I have a JTable inside a JScrollpane. The JTable gets its data from my TableModel using the getValueAt method in the normal way. It is almost working fine. The one thing left to improve is that I don�t want the JTable to keep trying to get its data while the scrollbar is still being dragged. This is primarily because the latency in fetching the data makes the UI unresponsive - the table model does not keep all rows in memory at one time, but keeps a page of data in memory.
    So, just to clarify, I want the behaviour to be that when the user is still adjusting the value of the scroll bar, the thumb position of the scroll bar moves, but the rows displayed in the JTable do not update. When the user releases the scrollbar, the rows should then update.
    I have almost acheived this by having a second, independent scroll bar on the frame, and an adjustment listener listening for events, like this
    public void adjustmentValueChanged(AdjustmentEvent e){
    if (e.getSource() == scrManual){
    if (!scrManual.getValueIsAdjusting()){
      JScrollBar scrTable = scrPaneResults.getVerticalScrollBar();
    int iManValue = scrManual.getValue();
    int iManMax = scrManual.getMaximum();
    float fManWhere = (float)iManValue / (float)iManMax;
    int iTblMax = scrTable.getMaximum();
    int iTblNewValue = (int)(iTblMax * fManWhere);
      scrTable.setValue(iTblNewValue);
    else
    throw new IllegalArgumentException("I don't know how to handle the adjustment event for " + e.getSource());
    }This is actually working fine, except that I don't want there to be two scrollbars - one in the scroll pane and one extra one. But when I try to make the scrollpane's scrollbar invisible, it remains visible.
    Can anyone tell me either
    (a) how to just have a normal JScrollPane scrollbar, but have it only update its viewport when the value is no longer adjusting (ie scrollbar has been released)
    (b) how to make the JScrollPane's scrollbar still effective, but invisible.
    (c) if the JScrollPane has a no scrollbars policy, how to instead in the code I posted above, set the ScrollPane's position directly.
    Whichever is easiest.
    Thanks for your help
    Mark

    Oh how embarassing! I already asked this question before, and answered it myself! Sorry - I think I am losing the plot
    I�ve hacked it. Turns out that the jScrollPane has a getXXXScrollBar method, which even when you�ve hidden the scrollbars, still works. You just use another scroll bar, register a listener for the mouse released event, and update the jScrollPane�s scroll bar to match the value.

  • JLayeredPane in JScrollPane!

    here I am again, I thought I had solved it but apparently not so I'm trying some other way. Now what I have is the JLayeredPane inside the JScrollPane but the problem is that if I don't do this:
    layeredPane.setPreferredSize(new Dimension(1500, 1500));this is okay but when I want to insert info beyond this dimension it gets invisible. so what I wanted is the layeredPane' size to be dynamic..can anyone help me please?
    thanx a lot really
    iland

    Constructor
    // JLayeredPane   
        jlayeredPane = new JLayeredPane();
        jspLayered = new JScrollPane(jlayeredPane);
        jlayeredPane.addComponentListener(this);
        add(jspLayered, BorderLayout.CENTER);
        jlayeredPane.setPreferredSize(new Dimension(1000, 1000));
        jlayeredPane.add(graph, JLayeredPane.DEFAULT_LAYER);
    public void componentResized(ComponentEvent e) {
        Component c = e.getComponent();
        graph.setSize(c.getSize());
        graph.validate();
        c.repaint();
      }can u tell me pleasewhere do i revalidate the scrollpane and how , i really don't know
    thanx iland

  • Problem: invisible a JTable

    I have a JTable created in a JScrollPane in a frame. Initialy, the table is empty, after I pressed on a create_table button on my GUI, the TableModel will be create and the data will show up on the table.
    I want to disappear my table by pressing on another button. I simply use "table.setVisible(false)" in my actionPerformed method, and it doesnt work. However, When I scroll down the Panel, part of the table, that initially hidden down the screen, is scrolled up.
    What i mean is: Lets say the scrollPane can see the first 10 rows, you need to scroll down to see the rest of the table, after i pressed on the disappear button, the table disapper, but when i scroll down, i can still see the 11th row coming up from the bottom. So in fact only the first 10 rows are disappeared. However if i move the frame a bit , then the 11th row disappear. I scroll down a bit more, the 12th row comes up, and I move again the frame, then it disappear..........
    I think its the problem from scroll bar, it sholdnt be there, but i did try to set the scoll bar to invisible, but it just doesnt disappear.
    How should I fix this problem?

    Hi,
    two possibilities for hiding the table:
    1. if you want to hide table, header and scrollbars, you can call serVisible(false) on the JScrollPane. But be aware that this will perhaps change your layout.
    2. If you only want to hide the table's content but not the header and scrollbars, you can call setVisible(false) on the JScrollPane's JViewport. It's your table's parent and could be done like
    table.getParent().setVisible(false);where table is a reference to your JTable.
    BTW, you can disable the mouse wheel by calling setWheelScrollingEnabled(false) on the JScrollPane.
    Andr�

  • Invisible icons on DESKTOP

    although i know for a fact that a certain file is on my desktop, since its listed in my Finder, i cannot drag/drop/copy/erase ANYTHING onto/from my desktop because it either goes back to its original folder or ends up in smoke "the poof cloud"... even a simple "screen capture" image which always go to the Desktop by default is INVISIBLE to the naked eye but exists on the Finder!
    i think i made a keyboard shortcut action while trying to remember the screen capture and maybe ended up activating "invisibility" to my desktop, or something! its frustrating because i use a lot of my desktop area to copy/paste files, or eject a dvd, or install DMG programs so i googled and read a lot about possible "invisibility" function within a TERMINAL command but all i can manage to do is list my HD directories with the command "ls -a ~/Desktop" but i wont adventure further because a n00b like me is to afraid of recking my new mac!
    HELP!!!

    Maybe I can clarify since im having the same issue. Whe I save a pdf or any other file to my desktop from safari the file does not show up visible on the desktop...... the file is there in the desktop folder but cant be seen. I can do a search for it in spotlight and it is there I can even drag it from the spotlight window to the desktop and it shows up. Have you tried a spotlight search. I would like to know if there is a fix for this as it becomes very tiresome to save the file somewhere else and then move it

  • Invisible page or something like this?

    Hi,
    do we have something like invisible page? For example, i have
    a class with many many children, and the drawing of this class take
    a time. I thought that i can draw my class (and all the children)
    somewhere on invisible page, and that if it ready transform this
    "ready" page to the visible page, so the user can see this control
    and work this it.
    Is it possible?

    You could use the viewstack container to accomplish what you
    need. you can layout a viewstack with two children, the first one a
    canvas and a label maybe that gives your users some feedback, and
    another children containig your whole class, so if you have a
    function or your class dispatches an event when it creation its
    completed you can the change the viewstack selectedchildren to
    reveal your class.

  • What is the difference between "Invisible" (11g) and "virtual" index?

    Hi
    What is the difference between the "Invisible" index and "virtual" index?
    Thanks
    Balaji

    Indexes can be visible or invisible. An invisible index is maintained by DML operations and cannot be used by the optimizer. Actually takes space, but is not to be used as part of a potential access path.
    AFAIK, a virtual index is created by the tools used in SQL statement access path tuning to provide an alternative for the optimizer to test. It does not take any real space as it is a pure in memory definition.

  • Invisible files which can't be deleted

    There is a single folder in my trash, and nothing else. When I try to empty the trash, there is a series of popups saying "the operation cannot be completed because the file 2010.psf is locked", etc, for 60 or so different files. These files are from some calendar function of Photo Impression. The funny thing is, if I open the folder which is in the trash to unlock the files, they aren't there, or at least they are invisible. If I open the Info dialog for the folder it shows 5.9M of contents, and it shows read and write permissions for owner, group and others, and it says it's unlocked, but I can't figure out how to get rid of it. Any suggestions? It's very annoying. Thanks.

    Oh! I just had the VERY same problem last night with a rogue AppleWorks folder..
    Do you have the ability to boot to OS9?
    If so, put the offending folder into your hard drive (at the 'root' level, not in a folder anywhere - makes it easier to find in OS9), reboot to 9, then holmes it out and throw it in the trash.
    To delete locked files in OS9 simply hold down the option key when you choose 'Empty Trash'.
    Gone, gone, gone!!
    Deb.

  • How to add a JScrollPane in a JPanel

    I have a JPanel (layout = null, size = 200*400).
    I would like to add a JScrollPane, that sizes 100*100 and that contains an other JPanel, at the location 0,200 in the first JPanel. I would like too that the JScrollBar is always visible.
    How is it possible ?

    The scrollbars will appear automatically when the preferred size of the panel is greater than the size of the scroll pane. So you probably need to add:
    panel.setPreferredSize(...);
    Of course if you use LayoutManagers, instead of a null layout, then this is done automatically for you.
    If you want the scroll bars to appear all the time then read the JScrollPane API.

Maybe you are looking for

  • Voice Memos missing in iTunes

    I have an ipod touch 4g. I have about 10 voice memos on my itouch, some important that I don't want to loose. They are all visible and playable on the itouch. However, with the device connected to itunes, under my device there are only 3 voice memos

  • How to display an error message in maintenace view

    Hi, I have following requirement. I have a table. In the table, there is a field named REPORT which keeps an executable report name. When adding an entry i need to fill the field with an report name, which should exist in the system. The report name

  • PDF Booklet Printing

    In PDF Booklet printing how do I ensure that center column (for binding) is properly aligned?

  • How do mathematical functions in a table invoked in jsf page

    hi i need detail about how can i do mathematical functions for data in table in jsf page using adf bc. for example in my table(sales) i give product id,name,unit price, quantity then i want to calculate product of quantity and unit price in a table a

  • Inserting an Image in Excel with POI HSSF

    Has anyone been successful creating an Excel document with an embedded image using POI HSSF? Create a nicely formatted Excel is no, problem - but I can't seem to figure the image part out. I am not calling the loadPicture correctly, which is confusin