Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

[Java] Best container to use?

  • 01-03-2006 8:28pm
    #1
    Registered Users, Registered Users 2 Posts: 383 ✭✭


    OK, need advice on the best Swing container to use. Basically I have JPanels appearing on "the container", this container has to be able to scroll.

    Its for an application similar to Rational Rose. Any suggestions?


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Put your JPanels inside a JScrollPane. Voila, scrolling.


  • Registered Users, Registered Users 2 Posts: 383 ✭✭cherrio


    thanks for the quick reply :)

    Trying that at the moment, but its refusing to scroll. Even setting the setHorizontalScrollBarPolicy() the scroll bar remain inactive. Any suggestions?

    	private JScrollPane getScrPnl() {
    		if (scrPnl == null) {
    			scrPnl = new JScrollPane();
    			scrPnl.setViewportView(getPnlXMLScreen());
    			scrPnl.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    			scrPnl.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    		}
    		return scrPnl;
    	}
    


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Are you making sure to make the JPanel larger that the size of the container window?


  • Registered Users, Registered Users 2 Posts: 383 ✭✭cherrio


    setting pnlXMLScreen.setPreferredSize(new Dimension(1000, 1000));

    Gets the scroll bars to appear and function. But the elements cannot be put outside that area. Is dynamically changing the PreferredSize as I add componets the way to do it?


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Yep.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 383 ✭✭cherrio


    Sweet :) Thx for the help.


Advertisement