@@ -17,54 +17,69 @@ import javax.swing.JSplitPane
1717import  scala .collection .immutable 
1818import  scala .swing .Swing .nullPeer 
1919
20- /** 
21-  * A container with exactly two children. Arranges them side by side, either 
22-  * horizontally or vertically. Displays a draggable divider component between 
23-  * them that lets the user adjust the size ratio of the children. 
24-  * 
25-  * @see  javax.swing.JSplitPane 
26-  */  
27- class  SplitPane (o : Orientation .Value , left : Component , right : Component ) extends  Component  with  Container  with  Orientable .Wrapper  {
28-   override  lazy  val  peer :  JSplitPane  = 
29-     new  javax.swing.JSplitPane (o.id, left.peer, right.peer) with  SuperMixin 
20+ /**  A container with exactly two children. Arranges them side by side, either
21+   * horizontally or vertically. Displays a draggable divider component between 
22+   * them that lets the user adjust the size ratio of the children. 
23+   * 
24+   * @param   o  the orientation of the divider. Note that we are using 
25+   *           `Orientation.Horizontal` and `Orientation.Vertical`, which are 
26+   *           different from the underlying `JSplitPane` values. 
27+   *           `Orientation.Horizontal` corresponds with `VERTICAL_SPLIT`, thus 
28+   *           producing a left and right component and a "vertical divider", 
29+   *           and `Orientation.Vertical` corresponds with `HORIZONTAL_SPLIT`, thus 
30+   *           producing a top and bottom component and a "horizontal divider". 
31+   * 
32+   * @see  javax.swing.JSplitPane 
33+   */  
34+ class  SplitPane (o : Orientation .Value , left : Component , right : Component )
35+   extends  Component  with  Container  with  Orientable .Wrapper  {
36+ 
3037  def  this (o : Orientation .Value ) =  this (o, new  Component  {}, new  Component  {})
3138  def  this () =  this (Orientation .Horizontal )
3239
40+   override  lazy  val  peer :  JSplitPane  = 
41+     new  javax.swing.JSplitPane (o.id, left.peer, right.peer) with  SuperMixin 
42+ 
3343  def  contents :  immutable.Seq [Component ] =  List (leftComponent, rightComponent)
44+ 
3445  def  contents_= (left : Component , right : Component ):  Unit  =  {
35-     peer.setLeftComponent(nullPeer(left))
46+     peer.setLeftComponent  (nullPeer(left))
3647    peer.setRightComponent(nullPeer(right))
3748  }
3849
3950  def  topComponent :  Component  = 
4051    UIElement .cachedWrapper[Component ](peer.getTopComponent.asInstanceOf [javax.swing.JComponent ])
4152  def  topComponent_= (c : Component ):  Unit  =  peer.setTopComponent(nullPeer(c))
53+ 
4254  def  bottomComponent :  Component  = 
4355    UIElement .cachedWrapper[Component ](peer.getBottomComponent.asInstanceOf [javax.swing.JComponent ])
4456  def  bottomComponent_= (c : Component ):  Unit  =  peer.setBottomComponent(nullPeer(c))
4557
46-   def  leftComponent :  Component  =  topComponent
47-   def  leftComponent_= (c : Component ):  Unit  =  { topComponent =  c }
48-   def  rightComponent :  Component  =  bottomComponent
49-   def  rightComponent_= (c : Component ):  Unit  =  { bottomComponent =  c }
58+   def  leftComponent      :  Component          =    topComponent
59+   def  leftComponent_=  (c : Component ):  Unit   =  { topComponent =  c }
5060
51-   def  dividerLocation :  Int  =  peer.getDividerLocation
52-   def  dividerLocation_= (n : Int ):  Unit  =  peer.setDividerLocation(n)
61+   def  rightComponent     :  Component          =    bottomComponent
62+   def  rightComponent_= (c : Component ):  Unit   =  { bottomComponent =  c }
63+ 
64+   def  dividerLocation        :  Int              =  peer.getDividerLocation
65+   def  dividerLocation_=    (n : Int ):  Unit       =  peer.setDividerLocation(n)
5366
5467  /* def proportionalDividerLocation: Double =
5568    if (orientation == Orientation.Vertical) dividerLocation / (size.height - dividerSize) 
5669    else dividerLocation / (size.width - dividerSize)*/  
5770  def  dividerLocation_= (f : Double ):  Unit  =  peer.setDividerLocation(f)
5871
59-   def  dividerSize :  Int  =  peer.getDividerSize
60-   def  dividerSize_= (n : Int ):  Unit  =  peer.setDividerSize(n)
61-   def  resizeWeight :  Double  =  peer.getResizeWeight
62-   def  resizeWeight_= (n : Double ):  Unit  =  peer.setResizeWeight(n)
72+   def  dividerSize            :  Int              =  peer.getDividerSize
73+   def  dividerSize_=        (n : Int ):  Unit       =  peer.setDividerSize(n)
74+ 
75+   def  resizeWeight           :  Double           =  peer.getResizeWeight
76+   def  resizeWeight_=       (n : Double ):  Unit    =  peer.setResizeWeight(n)
6377
6478  def  resetToPreferredSizes ():  Unit  =  peer.resetToPreferredSizes()
6579
66-   def  oneTouchExpandable :  Boolean  =  peer.isOneTouchExpandable
67-   def  oneTouchExpandable_= (b : Boolean ):  Unit  =  peer.setOneTouchExpandable(b)
68-   def  continuousLayout :  Boolean  =  peer.isContinuousLayout
69-   def  continuousLayout_= (b : Boolean ):  Unit  =  peer.setContinuousLayout(b)
80+   def  oneTouchExpandable     :  Boolean          =  peer.isOneTouchExpandable
81+   def  oneTouchExpandable_= (b : Boolean ):  Unit   =  peer.setOneTouchExpandable(b)
82+ 
83+   def  continuousLayout       :  Boolean          =  peer.isContinuousLayout
84+   def  continuousLayout_=   (b : Boolean ):  Unit   =  peer.setContinuousLayout(b)
7085}
0 commit comments