GridLayout.java (layoutContainer): Use tree lock.
* java/awt/GridLayout.java (layoutContainer): Use tree lock. (getSize): Likewise. * java/awt/FlowLayout.java (layoutContainer): Use tree lock. (getSize): Likewise. * java/awt/BorderLayout.java (layoutContainer): Use tree lock. (calcSize): Likewise. * java/awt/CardLayout.java (getSize): Use tree lock. (gotoComponent): Likewise. (layoutContainer): Likewise. From-SVN: r58998
This commit is contained in:
parent
a6b5bd3b6b
commit
924af605fe
@ -1,5 +1,15 @@
|
||||
2002-11-10 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* java/awt/GridLayout.java (layoutContainer): Use tree lock.
|
||||
(getSize): Likewise.
|
||||
* java/awt/FlowLayout.java (layoutContainer): Use tree lock.
|
||||
(getSize): Likewise.
|
||||
* java/awt/BorderLayout.java (layoutContainer): Use tree lock.
|
||||
(calcSize): Likewise.
|
||||
* java/awt/CardLayout.java (getSize): Use tree lock.
|
||||
(gotoComponent): Likewise.
|
||||
(layoutContainer): Likewise.
|
||||
|
||||
* java/io/natFileDescriptorWin32.cc (read): Handle case where
|
||||
count is 0.
|
||||
* java/io/natFileDescriptorPosix.cc (read): Handle case where
|
||||
|
@ -528,6 +528,8 @@ invalidateLayout(Container parent)
|
||||
*/
|
||||
public void
|
||||
layoutContainer(Container target)
|
||||
{
|
||||
synchronized (target.getTreeLock ())
|
||||
{
|
||||
Insets i = target.getInsets();
|
||||
|
||||
@ -604,6 +606,7 @@ layoutContainer(Container target)
|
||||
setBounds(my_west, x1, y2, w.width, hh);
|
||||
setBounds(my_east, x3, y2, e.width, hh);
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
@ -647,6 +650,8 @@ calcCompSize(Component comp, int what)
|
||||
// this layout.
|
||||
private Dimension
|
||||
calcSize(Container target, int what)
|
||||
{
|
||||
synchronized (target.getTreeLock ())
|
||||
{
|
||||
Insets ins = target.getInsets();
|
||||
|
||||
@ -703,4 +708,5 @@ calcSize(Container target, int what)
|
||||
|
||||
return(new Dimension(width, height));
|
||||
}
|
||||
}
|
||||
} // class BorderLayout
|
||||
|
@ -164,6 +164,8 @@ public class CardLayout implements LayoutManager2, Serializable
|
||||
* @param parent The parent container.
|
||||
*/
|
||||
public void layoutContainer (Container parent)
|
||||
{
|
||||
synchronized (parent.getTreeLock ())
|
||||
{
|
||||
int width = parent.width;
|
||||
int height = parent.height;
|
||||
@ -181,6 +183,7 @@ public class CardLayout implements LayoutManager2, Serializable
|
||||
for (int i = 0; i < num; ++i)
|
||||
comps[i].setBounds (x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the maximum layout size of the container.
|
||||
* @param target The parent container
|
||||
@ -286,6 +289,8 @@ public class CardLayout implements LayoutManager2, Serializable
|
||||
// This implements first(), last(), next(), and previous().
|
||||
private void gotoComponent (Container parent, int what,
|
||||
Component target)
|
||||
{
|
||||
synchronized (parent.getTreeLock ())
|
||||
{
|
||||
int num = parent.ncomponents;
|
||||
// This is more efficient than calling getComponents().
|
||||
@ -339,9 +344,12 @@ public class CardLayout implements LayoutManager2, Serializable
|
||||
if (choice >= 0 && choice < num)
|
||||
comps[choice].setVisible (true);
|
||||
}
|
||||
}
|
||||
|
||||
// Compute the size according to WHAT.
|
||||
private Dimension getSize (Container parent, int what)
|
||||
{
|
||||
synchronized (parent.getTreeLock ())
|
||||
{
|
||||
int w = 0, h = 0, num = parent.ncomponents;
|
||||
Component[] comps = parent.component;
|
||||
@ -373,6 +381,7 @@ public class CardLayout implements LayoutManager2, Serializable
|
||||
|
||||
return new Dimension (w, h);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @serial Horizontal gap value.
|
||||
|
@ -149,6 +149,8 @@ public class FlowLayout implements LayoutManager, Serializable
|
||||
* @param parent The parent container
|
||||
*/
|
||||
public void layoutContainer (Container parent)
|
||||
{
|
||||
synchronized (parent.getTreeLock ())
|
||||
{
|
||||
int num = parent.getComponentCount ();
|
||||
// This is more efficient than calling getComponents().
|
||||
@ -222,6 +224,7 @@ public class FlowLayout implements LayoutManager, Serializable
|
||||
y += new_h + vgap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum layout size for the specified container using
|
||||
@ -303,6 +306,8 @@ public class FlowLayout implements LayoutManager, Serializable
|
||||
|
||||
// This method is used to compute the various sizes.
|
||||
private Dimension getSize (Container parent, boolean is_min)
|
||||
{
|
||||
synchronized (parent.getTreeLock ())
|
||||
{
|
||||
int w, h, num = parent.getComponentCount ();
|
||||
// This is more efficient than calling getComponents().
|
||||
@ -335,6 +340,7 @@ public class FlowLayout implements LayoutManager, Serializable
|
||||
|
||||
return new Dimension (w, h);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @serial The justification alignment of the lines of components, which
|
||||
|
@ -152,6 +152,8 @@ public class GridLayout implements LayoutManager, Serializable
|
||||
* @param parent The container to lay out
|
||||
*/
|
||||
public void layoutContainer (Container parent)
|
||||
{
|
||||
synchronized (parent.getTreeLock ())
|
||||
{
|
||||
int num = parent.ncomponents;
|
||||
|
||||
@ -211,6 +213,7 @@ public class GridLayout implements LayoutManager, Serializable
|
||||
x += hgap + tw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the minimum layout size of the container.
|
||||
* @param cont The parent container
|
||||
@ -300,6 +303,8 @@ public class GridLayout implements LayoutManager, Serializable
|
||||
|
||||
// This method is used to compute the various sizes.
|
||||
private Dimension getSize (Container parent, boolean is_min)
|
||||
{
|
||||
synchronized (parent.getTreeLock ())
|
||||
{
|
||||
int w = 0, h = 0, num = parent.ncomponents;
|
||||
// This is more efficient than calling getComponents().
|
||||
@ -332,6 +337,7 @@ public class GridLayout implements LayoutManager, Serializable
|
||||
h = ins.top + ins.bottom + real_rows * (h + vgap) - vgap;
|
||||
return new Dimension (w, h);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @serial The number of columns in the grid.
|
||||
|
Loading…
Reference in New Issue
Block a user