java panel layout dock - java

I'm having problem with the "dock" in java panel. I have UI like
the panel has a slide bar, a button and a scroll view, i.e. the while area above, with GirdBagLayout, (I also tried BorderLayout but won't work either). below it is another panel, both panel are placed in a parent panel with GridBagLayout.
When I click the "more" button, I want to extend the height of the panel to 3*original height to let the scrollview show more stuff vertically. and of course I want the slide bar and button still at the bottom of the panel. I call resize on the panel but I got this:
it shows that the scrollview is longer than before but was cut, and the bar and button remain at the same place. and my question is how I can put the slide bar and button always at the botton of the panel and show the scrollview correctly.

well, answer to my own question:
have to set up the layout again and call revalidate() and repaint().

Related

JProgressBar positioning to bottom of the window

I was trying to position a JProgressBar to the bottom of the window's screen. I have tried using setVerticalAlignment and setHorizontalAlignment. When doing so a syntax error appears.
To make it clear my goal is to put a progress bar at the bottom of the window.
An easy way is to set the parent container to have a BorderLayout, then panel.add(progressBar, BorderLayout.PAGE_END); will make the progress bar appear at the bottom.

JScrollPane scroll on the top page when the submit button click

Is it possible in Java Netbeans for the jScrollPanel to scroll automatically return to te top when a submit button click? Any idea?
You can use the JScrollPane's JViewport's setViewPosition to change the position of the top/left corner of the view.
See How to Use Scroll Panes for more details

Scrollable windows

I want scrollable panes.
Please, have a look at the picture
As you can see at the Navigator, I used Tabbed Pane, then placed Scroll Panes on it. Then placed Panel on it. And then added Lables. Looks like I'm trying to reach my left ear with my right foot. But without the jPanel1 my lable occupied the whole panel size.
Well now my scrollable panel doesn't work well.
It is visible at this .
Well, I made the window narrow. But the scroll bar at the bottom doesn't allow me to reach what is behind the border further on the right. And this scrollbar seems strange. It has only t left arrow. No right one. And no vertical scroll bar if I make the window less high.
Could you give me a hint how to make scrollable windows?
I'm not sure what you're doing wrong this is the results I get when I do only this and nothing more.
Drag and drop a tabbed pane to the frame
Drag and drop a scroll pane to the tabbed pane
Drag and drop a panel to the scroll pane
Drag and drop a label to the panel, and another label to the bottom.
Resize to smaller frame and scroll bars appear
Navigator Window

GWT: Draggable Popup with Scrollpanel

Designed a popup which is draggable, works as designed. Now Popup panel contains the ScrollPanel it is having vertical scroll bars, but while trying to scroll with dragging is not working
The following link gives u a window box implementation which is draggable. You can add scroll panel to it. I have tried it. It works. Have a look at it.
http://svn.clazzes.org/svn/gwt/branches/gwt-extras-0.1-branch/src/main/java/org/clazzes/gwt/extras/dialog/WindowBox.java

Problem in Java GUI

Before reading about my problem, first look at this GUI Diagram.
There are three bars at the top as follows:
one having buttons "pictorial view", "textual view" etc.
second having buttons "processes", "organisation" etc.
third having buttons "application to processes" etc.
After that two information bars are there.
After that a canvas window displaying the diagram.
Now, I want a GUI similar to this with the following features (relative to the above diagram):
At first, only first bar appears and below it a white blank canvas having no diagram appears spreading all over the GUI.
When the user clicks on the "pictorial view" button the second bar appears below the first bar and after that the same canvas without diagram spreading over the remaining space
When the user clicks on the "application" button on the second bar, the third bar appears below the second bar, and after that the same empty canvas spreading over the remaing space in the GUI.
I had tried to implement it by first having a "main panel" with BorderLayout. After that as showing in the following figure:
mainPanel(Border Layout)
|
|--topPanel (at NORTH of the mainPanel's Border Layout)
|
|
|--centerPanel (at CENTER of the mainPanel's Border Layout)
topPanel - to contain all the bars (bars should be added dynamically when a user clicks on a button)
centerPanel - to contain the canvas and adjust its size automatically when new bars are added in the topPanel
I would use a BorderLayout for the app, with the toolbars in a northerly pane.
That north pane I'd give a vertical BoxLayout and put the 3 toolbars into 3 successive boxes. That should take care of the geometry.
I'm not sure if making a toolbar invisible will cause it not to occupy space, but that would be the simplest. Alternatively, you could dynamically add()/remove() toolbars from the north pane.
The other alternative is to go with MigLayout where you can add as many components as you need to the "top". By setting "hidemode" parameter you can specify how space will occupied by invisible components.
In general MigLayout is much more flexible for almost any task and can be used instead of any standard layout or combination of layouts

Categories