For Programmers: Free Programming Magazines  


Home > Archive > Java Help > July 2006 > Scroll bar not showing up









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Scroll bar not showing up
fiziwig

2006-07-19, 7:02 pm

Jave newbie problem:

My scroll bar is not showing up at all. What an I doing wrong?
The menu and toolbar are working fine.

public class Example extends JPanel
implements ActionListener, MouseListener, MouseMotionListener,
AdjustmentListener {

...<snip>...

public Example() {
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

buildMenu();
add(buildToolbar());

//Create and set up the layered pane.
layeredPane = new JLayeredPane();
layeredPane.setPreferredSize(new Dimension(640, 500));
layeredPane.setBackground(Color.white);
layeredPane.setOpaque(true);
layeredPane.addMouseMotionListener(this);
layeredPane.addMouseListener(this);

vScrollBar = new JScrollBar(JScrollBar.VERTICAL, 10, 30, 0,
100);
layeredPane.add(vScrollBar, BorderLayout.EAST);
vScrollBar.addAdjustmentListener(this);

add(layeredPane);
...<snip>...

Thanks,

--gary

Steve W. Jackson

2006-07-19, 7:02 pm

In article <1153339953.360940.237130@75g2000cwc.googlegroups.com>,
"fiziwig" <fiziwig@yahoo.com> wrote:

> Jave newbie problem:
>
> My scroll bar is not showing up at all. What an I doing wrong?
> The menu and toolbar are working fine.
>
> public class Example extends JPanel
> implements ActionListener, MouseListener, MouseMotionListener,
> AdjustmentListener {
>
> ...<snip>...
>
> public Example() {
> setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
>
> buildMenu();
> add(buildToolbar());
>
> //Create and set up the layered pane.
> layeredPane = new JLayeredPane();
> layeredPane.setPreferredSize(new Dimension(640, 500));
> layeredPane.setBackground(Color.white);
> layeredPane.setOpaque(true);
> layeredPane.addMouseMotionListener(this);
> layeredPane.addMouseListener(this);
>
> vScrollBar = new JScrollBar(JScrollBar.VERTICAL, 10, 30, 0,
> 100);
> layeredPane.add(vScrollBar, BorderLayout.EAST);
> vScrollBar.addAdjustmentListener(this);
>
> add(layeredPane);
> ...<snip>...
>
> Thanks,
>
> --gary


Honestly, I can't think of any reason to *ever* put a scrollbar on a
panel all by its lonesome...or a menu, either, as is suggested by your
call to the (invisible) buildMenu method. Instead, the usual practice
is to put a panel inside a JScrollPane and let it do the hard parts.
That panel can still have the layered pane you seem to be trying to get
(our app uses one for drawing "animation" over a second display).

Maybe you should spend some quality time with Sun's Swing tutorial to
get more familiar with scroll panes and such. And when that's done, if
you still have troubles, perhaps you could be more clear about what it
is you're actually trying to accomplish. Many here will grumble at you
for not providing short compilable examples demonstrating some problem
or failure you're trying to overcome.

= Steve =
--
Steve W. Jackson
Montgomery, Alabama
fiziwig

2006-07-19, 7:02 pm


Steve W. Jackson wrote:
> In article <1153339953.360940.237130@75g2000cwc.googlegroups.com>,
> "fiziwig" <fiziwig@yahoo.com> wrote:
>
[color=darkred]
>
> Honestly, I can't think of any reason to *ever* put a scrollbar on a
> panel all by its lonesome...or a menu, either, as is suggested by your
> call to the (invisible) buildMenu method. Instead, the usual practice
> is to put a panel inside a JScrollPane and let it do the hard parts.
> That panel can still have the layered pane you seem to be trying to get
> (our app uses one for drawing "animation" over a second display).
>
> Maybe you should spend some quality time with Sun's Swing tutorial to
> get more familiar with scroll panes and such. And when that's done, if
> you still have troubles, perhaps you could be more clear about what it
> is you're actually trying to accomplish. Many here will grumble at you
> for not providing short compilable examples demonstrating some problem
> or failure you're trying to overcome.
>
> = Steve =
> --
> Steve W. Jackson
> Montgomery, Alabama


The scrollbar approach seemed simpler than the JScrollPane for this
application since I'm creating content dynamically and all I need to do
is add an offset to the locations of the pieces to implement scrolling.

Besides which, I'd like to know that I can get JScrollBars to work the
way the documentation says it works, regardless of whether there is
another, or better way to do it. It's just frustrating when I do what
the docs say to do and it doesn't work at all. Something I encounter a
LOT in Java. It seems that if you already know how to do something then
the docs are helpful but if you haven't done it before the docs leave
out some critical info that you have to search, or beg for.

As for a short compilable example, I'd have to do a lot of cut ans
pasting to get rid of the extraneous stuff. The class in question is
about 1600 lines of code.

I took my scrollbar code from
http://www.java2s.com/Code/Java/Swi...dhorizontal.htm
which supposedly works.

--gary

Andrew Thompson

2006-07-19, 7:02 pm

fiziwig wrote:
> Steve W. Jackson wrote:

...

At least that is better than ignoring the post entirely,
which is also a distinct possibility..
[color=darkred]
> As for a short compilable example, I'd have to do a lot of cut ans
> pasting to get rid of the extraneous stuff. The class in question is
> about 1600 lines of code.


By the time you've removed 1540 lines of that code, you will
either have a working example, or a broken example that
others might be willing to look at..

Andrew T.

Oliver Wong

2006-07-19, 7:02 pm


"fiziwig" <fiziwig@yahoo.com> wrote in message
news:1153343452.259032.40430@i42g2000cwa.googlegroups.com...
>
>


> As for a short compilable example, I'd have to do a lot of cut ans
> pasting to get rid of the extraneous stuff. The class in question is
> about 1600 lines of code.


Maybe this will get you started:

> public class Example extends JPanel

[...]
> {

[...]
>
> public Example() {
> setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

[...]
> layeredPane = new JLayeredPane();

[...]
> vScrollBar = new JScrollBar(JScrollBar.VERTICAL, 10, 30, 0,
> 100);
> layeredPane.add(vScrollBar, BorderLayout.EAST);

[...]
> add(layeredPane);


I went a bit further. Changed JPanel to JFrame, added a static void
main, but then got some weird error about BoxLayout not being shareable at
which point I gave up. Anyway, tinker around with this until one of the
following is true:

(A) It compiles and does what you want (problem solved!)
(B) It compiles and doesn't do what you want (now you have an SSCCE
which you can post).

- Oliver

fiziwig

2006-07-19, 7:02 pm


Andrew Thompson wrote:
> fiziwig wrote:
> ..


>
> By the time you've removed 1540 lines of that code, you will
> either have a working example, or a broken example that
> others might be willing to look at..
>
> Andrew T.


Good advice. I gutted the code, removing all but one menu and toolbar
item and removing all the program logic. It still doesn't show the
scroll bar, so here's the remaining few lines of compilable code:

import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.MouseListener;
import java.awt.*;
import java.io.*;
import java.awt.image.*;

import javax.accessibility.*;

import java.awt.event.*;


public class Example extends JPanel
implements AdjustmentListener {
private int mOffsetX = 0;
private int mOffsetY = 0;
private boolean gridShowing = false;
private boolean marginShowing = false;
private boolean snapToGrid = false;
private boolean hasChanged = false;
private int newRegionNumber = 1;
private String knownFilename = "";

static private JFrame parentFrame;
public JLayeredPane layeredPane;
private JMenuBar theMenuBar;
private JToolBar toolBar;
private JMenu fileMenu;
private JMenuItem newDocMenuItem;
private SpinnerNumberModel sizeSpinnerModel;
private JSpinner sizeSpinner;
private JScrollBar vScrollBar;

public Example() {
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

buildMenu();
add(buildToolbar());

//Create and set up the layered pane.
layeredPane = new JLayeredPane();
layeredPane.setPreferredSize(new Dimension(640, 500));
layeredPane.setBackground(Color.white);
layeredPane.setOpaque(true);

vScrollBar = new JScrollBar(JScrollBar.VERTICAL, 10, 30, 0,
100);
layeredPane.add(vScrollBar, BorderLayout.EAST);
vScrollBar.setEnabled(false);
vScrollBar.addAdjustmentListener(this);

add(layeredPane);
}

// Scroll bar event handlers

public void adjustmentValueChanged(AdjustmentEvent e) {
System.out.println("New value="+e.getValue());
}


/**
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
*/
private static void createAndShowGUI() {
//Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);

//Create and set up the window.
parentFrame = new JFrame("Example");
parentFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

//Create and set up the content pane.
JComponent newContentPane = new Example();
newContentPane.setOpaque(true); //content panes must be opaque
parentFrame.setContentPane(newContentPane);

//Display the window.
parentFrame.pack();
parentFrame.setVisible(true);
}


// ========================================
===================================
// build menu

public void buildMenu() {
theMenuBar = new JMenuBar();
theMenuBar.setLayout(new BoxLayout(theMenuBar,
BoxLayout.X_AXIS));

// File menu

fileMenu = new JMenu("File");
fileMenu.setMnemonic(KeyEvent.VK_F);
fileMenu.getAccessibleContext().setAccessibleDescription("File
menu");
ActionListener importActions = new ActionListener() {
public void actionPerformed( ActionEvent e )
{
Object source = e.getSource();

}
};

newDocMenuItem = new JMenuItem("New");

newDocMenuItem.getAccessibleContext().setAccessibleDescription("Create
a new file or template");
fileMenu.add(newDocMenuItem);
newDocMenuItem.addActionListener(importActions);


// add Menus and menu bar

theMenuBar.add(fileMenu);
parentFrame.setJMenuBar(theMenuBar);

}

public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}

private JToolBar buildToolbar() {

toolBar = new JToolBar();
toolBar.setRollover( true );
toolBar.setFloatable( false );



// font sizes
sizeSpinner = new JSpinner();
Dimension d = new Dimension( 40, 25 );
sizeSpinner.setMinimumSize( d );
sizeSpinner.setPreferredSize( d );
sizeSpinner.setMaximumSize( d );
sizeSpinnerModel = new SpinnerNumberModel( /* init value */ 18,
/* min*/ 8,
/* max */ 72,
/* step */ 1 );
sizeSpinner.setModel( sizeSpinnerModel );

sizeSpinner.addChangeListener( new ChangeListener() {
/**
* Invoked when the sizeSpinner changes
*
* @param e a ChangeEvent object
*/
public void stateChanged( ChangeEvent e )
{
}
} );
toolBar.add( sizeSpinner );

return toolBar;
}
}

Andrew Thompson

2006-07-19, 7:02 pm

fiziwig wrote:
....
> As for a short compilable example, I'd have to do a lot of cut ans
> pasting to get rid of the extraneous stuff. The class in question is
> about 1600 lines of code.


After looking at your 205 lines of trimmed code, and taking another
40 lines from it that were redundant to the immediate problem, I still
had little idea of what you are trying to achieve, or why you are using
a JLayeredPane.

In any case, that prompted me to look at the example you pointed to..

> I took my scrollbar code from
> http://www.java2s.com/Code/Java/Swi...dhorizontal.htm
> which supposedly works.


Supposedly? Didn't you try it? It works as advertised for me.

But then, there are no mention of JLayeredPane's in that example.
In the end I changed your JLayeredPane for a JPanel and the
JScrollBar appeared.

I doubt that answers your initial technical question, but then,
none of us yet seem clear on what you are trying to achieve.

And as an aside.. did you note how that example you linked to
contained just 58 lines of code? With the top 9 lines (comments)
removed, it comes to 49 lines - 11 shorter than the 60 I estimated
needed to display JScrollBars, and over 150 lines shorter than your
example.

Andrew T.

fiziwig

2006-07-19, 7:02 pm


Andrew Thompson wrote:
> fiziwig wrote:
> ...
>
> After looking at your 205 lines of trimmed code, and taking another
> 40 lines from it that were redundant to the immediate problem, I still
> had little idea of what you are trying to achieve, or why you are using
> a JLayeredPane.
>
> In any case, that prompted me to look at the example you pointed to..
>
>
> Supposedly? Didn't you try it? It works as advertised for me.
>
> But then, there are no mention of JLayeredPane's in that example.
> In the end I changed your JLayeredPane for a JPanel and the
> JScrollBar appeared.
>
> I doubt that answers your initial technical question, but then,
> none of us yet seem clear on what you are trying to achieve.
>
> And as an aside.. did you note how that example you linked to
> contained just 58 lines of code? With the top 9 lines (comments)
> removed, it comes to 49 lines - 11 shorter than the 60 I estimated
> needed to display JScrollBars, and over 150 lines shorter than your
> example.
>
> Andrew T.


fiziwig

2006-07-19, 7:02 pm


Andrew Thompson wrote:
> fiziwig wrote:
> ...
>
> After looking at your 205 lines of trimmed code, and taking another
> 40 lines from it that were redundant to the immediate problem, I still
> had little idea of what you are trying to achieve,


What I'm trying to achieve right now is a visible scroll bar.

> or why you are using
> a JLayeredPane.
>


I am using a JLayeredPane because I have many items within the main
window which need be capable of being moved around by the user by
dragging them with the mouse, and also need to be able to be given
z-depths so that certain items overlap other items in a particular
z-order. That's a requirement of the application, and it all works very
nicely, so that's not the problem. That's what the other 1540 lines of
code are there for.

> In any case, that prompted me to look at the example you pointed to..
>
>
> Supposedly? Didn't you try it? It works as advertised for me.


Yes, it works for me too.

>
> But then, there are no mention of JLayeredPane's in that example.
> In the end I changed your JLayeredPane for a JPanel and the
> JScrollBar appeared.


Then I guess my question boils down to how do I make a scrollbar appear
in a JLayered Pane?

>
> I doubt that answers your initial technical question, but then,
> none of us yet seem clear on what you are trying to achieve.


What I'm trying to achieve is to add a scroll bar to an already working
JLayeredPane application.


> And as an aside.. did you note how that example you linked to
> contained just 58 lines of code? With the top 9 lines (comments)
> removed, it comes to 49 lines - 11 shorter than the 60 I estimated
> needed to display JScrollBars, and over 150 lines shorter than your
> example.


My example included the toolbar and menu code because some here
complained that I left that code out of my first snipet.

--gary

>
> Andrew T.


Andrew Thompson

2006-07-19, 7:02 pm

fiziwig wrote:
> Andrew Thompson wrote:

....
....[color=darkred]
>
> Then I guess my question boils down to how do I make a scrollbar appear
> in a JLayered Pane?


Aha! (I suspect) you are getting closer to the actual problem.
( I've never needed to use JLayeredPane's, so I'm bowing
out of this thread.. )
....
....[color=darkred]
> My example included the toolbar and menu code because some here
> complained that I left that code out of my first snipet.


Got it.

But it might have been better to remove the call to the menu
completely. The basic idea of posting a short example is to
remove *everything* that is not needed to display the problem.
That hones it down to the simplest possible demonstration,
and saves us all bandwidth, and for those investigating the
problem, time. Sometimes, in the process of code trimming,
the solution is discovered by the coder.

Hope you get it sorted..
Andrew T.

fiziwig

2006-07-19, 7:02 pm

Andrew Thompson wrote:
> fiziwig wrote:
> ...

<snip>
>
> But it might have been better to remove the call to the menu
> completely. The basic idea of posting a short example is to
> remove *everything* that is not needed to display the problem.
> That hones it down to the simplest possible demonstration,
> and saves us all bandwidth, and for those investigating the
> problem, time. Sometimes, in the process of code trimming,
> the solution is discovered by the coder.
>
> Hope you get it sorted..
> Andrew T.


Thanks. I'll keep poking around to see if I can figure it out. Maybe
scroll bars just don't work with layered panes. :(

--gary

fiziwig

2006-07-19, 7:02 pm


Andrew Thompson wrote:[color=darkred]
> fiziwig wrote:
> ...
> ...

FWIW: I changed my JLayeredPane to a JPanel and the scroll bars did
show up, BUT the rest of the application is totally broken by that
change. :-(

--gary

Ralf Seitner

2006-07-20, 4:04 am

fiziwig schrieb:
> Andrew Thompson wrote:
>
> FWIW: I changed my JLayeredPane to a JPanel and the scroll bars did
> show up, BUT the rest of the application is totally broken by that
> change. :-(
>
> --gary
>

Hi!
Perhaps that little example can help you. I think your problem is, that
you cannot show ANY components on the JLayeredPane, you even were not
able to show a JButton...
I can imagine, the problem is the LayoutManager. Perhaps JLayeredPane is
not compatible with all LayoutManagers. I don't know - sorry.
But in fact, it does work with FlowLayout. In my diploma-thesis I have
to use it with a null-Layout and that works fine, too.


import javax.swing.*;
import java.awt.*;
public class JLayeredPaneTest extends JFrame {

JLayeredPane layeredPane;

public JLayeredPaneTest() {
super("Example");
setDefaultCloseOperation(EXIT_ON_CLOSE);

layeredPane = new JLayeredPane();
layeredPane.setLayout(new FlowLayout());
JScrollBar vScrollBar = new JScrollBar(JScrollBar.VERTICAL);
JButton button = new JButton("Button");
layeredPane.add(vScrollBar);
layeredPane.add(button);
layeredPane.setPreferredSize(new Dimension(200,200));
setContentPane(layeredPane);
}

public static void main(String[] args) {
JLayeredPaneTest test = new JLayeredPaneTest();
test.pack();
test.setVisible(true);
}
}

Hope that helps!
bye, Ralf
Ralf Seitner

2006-07-20, 8:01 am

Hi!
Just had a look to JLayeredPane. The default Layout for JLayeredPane is
the null-Layout. If you want to add JComponents (or subclasses of it),
you have to set their position (setLocation) and their size(setSize) or
their bounds (position+size) (setBounds).

You added the JScrollPane without setting its bounds. So add
vScrollPane.setBounds(x,y,width,height); to your code and it should work.

In the previous post I added a FlowLayout to the JLayeredPane, but I
think, that doesnt really make sense, as I think about it ;-)

bye, Ralf
Oliver Wong

2006-07-21, 4:01 am


"fiziwig" <fiziwig@yahoo.com> wrote in message
news:1153346451.377395.9760@p79g2000cwp.googlegroups.com...
>
> Andrew Thompson wrote:
>
>
> Good advice. I gutted the code, removing all but one menu and toolbar
> item and removing all the program logic. It still doesn't show the
> scroll bar, so here's the remaining few lines of compilable code:


[snip]

Thanks for the SSCCE. A few extra tips: Remove any fields that aren't being
used by your example (e.g. "String knownFileName" wasn't being used). In
some cases, this will allow you to remove a few more imports.

Anyway, now that I saw what you were trying to do, I could fix it: Add the
JScrollBar to the JPanel instead of the JLayeredPane.

<SSCCE>
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;

import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JScrollBar;

public class Example extends JPanel implements AdjustmentListener {

static private JFrame parentFrame;

public JLayeredPane layeredPane;

private JScrollBar vScrollBar;

public Example() {
setLayout(new BorderLayout());

// Create and set up the layered pane.
layeredPane = new JLayeredPane();
layeredPane.setPreferredSize(new Dimension(640, 500));
layeredPane.setBackground(Color.white);
layeredPane.setOpaque(true);

vScrollBar = new JScrollBar(JScrollBar.VERTICAL, 10, 30, 0, 100);
add(vScrollBar, BorderLayout.EAST);
vScrollBar.setEnabled(false);
vScrollBar.addAdjustmentListener(this);

add(layeredPane, BorderLayout.CENTER);
}

// Scroll bar event handlers

public void adjustmentValueChanged(AdjustmentEvent e) {
System.out.println("New value=" + e.getValue());
}

/**
* Create the GUI and show it. For thread safety, this method should be
invoked from the event-dispatching
* thread.
*/
private static void createAndShowGUI() {
// Make sure we have nice window decorations.
JFrame.setDefaultLookAndFeelDecorated(true);

// Create and set up the window.
parentFrame = new JFrame("Example");
parentFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// Create and set up the content pane.
JComponent newContentPane = new Example();
newContentPane.setOpaque(true); // content panes must be opaque
parentFrame.setContentPane(newContentPane);

// Display the window.
parentFrame.pack();
parentFrame.setVisible(true);
}

public static void main(String[] args) {
// Schedule a job for the event-dispatching thread:
// creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
</SSCCE>

- Oliver

fiziwig

2006-07-21, 4:01 am


Ralf Seitner wrote:
> Hi!
> Just had a look to JLayeredPane. The default Layout for JLayeredPane is
> the null-Layout. If you want to add JComponents (or subclasses of it),
> you have to set their position (setLocation) and their size(setSize) or
> their bounds (position+size) (setBounds).
>
> You added the JScrollPane without setting its bounds. So add
> vScrollPane.setBounds(x,y,width,height); to your code and it should work.
>
> In the previous post I added a FlowLayout to the JLayeredPane, but I
> think, that doesnt really make sense, as I think about it ;-)
>
> bye, Ralf


Thanks, setBounds() did the trick, BUT I had to override
paintComponnent and do the setBounds() in there because before the
layered pane is painted for the first time it's size is (0,0). Also
that way I catch any the resizing of the window. It works like a charm.

Thanks again.

--gary

fiziwig

2006-07-21, 4:01 am


Oliver Wong wrote:
> "fiziwig" <fiziwig@yahoo.com> wrote in message


> [snip]
>
> Thanks for the SSCCE. A few extra tips: Remove any fields that aren't being
> used by your example (e.g. "String knownFileName" wasn't being used). In
> some cases, this will allow you to remove a few more imports.
>
> Anyway, now that I saw what you were trying to do, I could fix it: Add the
> JScrollBar to the JPanel instead of the JLayeredPane.
>


Thanks. I tried that but the layout manager put it at the top of the
screen, toolBar style instead of at the edge of the window.

What DID work, finally, was to add setBounds() to the scroll bar. Seems
the default for LayeredPane is to make everything size zero if you
don't specify setBounds();

--gary

Oliver Wong

2006-07-21, 4:01 am


"fiziwig" <fiziwig@yahoo.com> wrote in message
news:1153415495.643116.234170@i42g2000cwa.googlegroups.com...
>
> Oliver Wong wrote:
>
>
> Thanks. I tried that but the layout manager put it at the top of the
> screen, toolBar style instead of at the edge of the window.
>
> What DID work, finally, was to add setBounds() to the scroll bar. Seems
> the default for LayeredPane is to make everything size zero if you
> don't specify setBounds();


Did you actually try running the code I posted? In my code, the
LayeredPane has no idea of the existence of the scroll bar, and thus cannot
affect it at all.

Oh well, if you fixed it, you fixed it.

- Oliver

Ralf Seitner

2006-07-21, 4:01 am

fiziwig schrieb:
> Ralf Seitner wrote:
>
> Thanks, setBounds() did the trick, BUT I had to override
> paintComponnent and do the setBounds() in there because before the
> layered pane is painted for the first time it's size is (0,0). Also
> that way I catch any the resizing of the window. It works like a charm.
>
> Thanks again.
>
> --gary
>

Hi!
You don't have to set the bounds in paintComponent(). You can do it
anywhere. For example before you add it. That works.
Yes. You are right. null-Layout sets everything to (0,0) and sets sizes
to zero, too. (width, height).

Glad to be able to help you.
bye, Ralf
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com