~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to javax/swing/plaf/basic/BasicToolBarUI.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
package javax.swing.plaf.basic;
40
40
 
 
41
import gnu.classpath.NotImplementedException;
 
42
 
41
43
import java.awt.BorderLayout;
42
44
import java.awt.Color;
43
45
import java.awt.Component;
60
62
import java.beans.PropertyChangeListener;
61
63
import java.util.Hashtable;
62
64
 
 
65
import javax.swing.AbstractButton;
63
66
import javax.swing.JButton;
64
67
import javax.swing.JComponent;
65
68
import javax.swing.JDialog;
72
75
import javax.swing.SwingUtilities;
73
76
import javax.swing.UIManager;
74
77
import javax.swing.border.Border;
 
78
import javax.swing.border.EtchedBorder;
75
79
import javax.swing.event.MouseInputListener;
76
 
import javax.swing.plaf.BorderUIResource.EtchedBorderUIResource;
77
80
import javax.swing.plaf.ComponentUI;
78
81
import javax.swing.plaf.ToolBarUI;
79
82
import javax.swing.plaf.UIResource;
307
310
   */
308
311
  protected Border createNonRolloverBorder()
309
312
  {
310
 
    return new EtchedBorderUIResource();
 
313
    return new EtchedBorder();
311
314
  }
312
315
 
313
316
  /**
328
331
   */
329
332
  protected Border createRolloverBorder()
330
333
  {
331
 
    return new EtchedBorderUIResource()
 
334
    return new EtchedBorder()
332
335
      {
333
336
        public void paintBorder(Component c, Graphics g, int x, int y,
334
337
                                int width, int height)
404
407
    boolean tmp = ((loc == SwingConstants.NORTH)
405
408
                  || (loc == SwingConstants.SOUTH) || (loc == -1));
406
409
 
 
410
    cachedOrientation = toolBar.getOrientation();
 
411
    cachedBounds = toolBar.getSize();
407
412
    if (((cachedOrientation == SwingConstants.HORIZONTAL) && tmp)
408
413
        || ((cachedOrientation == VERTICAL) && ! tmp))
409
414
      {
571
576
 
572
577
    dragWindow = createDragWindow(toolBar);
573
578
 
574
 
    cachedBounds = toolBar.getPreferredSize();
575
 
    cachedOrientation = toolBar.getOrientation();
576
 
 
577
579
    nonRolloverBorder = createNonRolloverBorder();
578
580
    rolloverBorder = createRolloverBorder();
579
581
 
580
582
    borders = new Hashtable();
 
583
    setRolloverBorders(toolBar.isRollover());
581
584
 
582
585
    fillHashtable();
583
586
  }
596
599
 
597
600
    floatingBorderColor = UIManager.getColor("ToolBar.floatingForeground");
598
601
    floatingColor = UIManager.getColor("ToolBar.floatingBackground");
599
 
    setRolloverBorders(toolBar.isRollover());
600
602
  }
601
603
 
602
604
  /**
604
606
   * by the look and feel.
605
607
   */
606
608
  protected void installKeyboardActions()
 
609
    throws NotImplementedException
607
610
  {
608
611
    // FIXME: implement.
609
612
  }
708
711
    if (c instanceof JToolBar)
709
712
      {
710
713
        toolBar = (JToolBar) c;
711
 
        toolBar.setOpaque(true);
712
 
        installDefaults();
713
 
        installComponents();
 
714
    installDefaults();
 
715
    installComponents();
714
716
        installListeners();
715
717
        installKeyboardActions();
716
718
      }
755
757
   */
756
758
  protected void setBorderToNonRollover(Component c)
757
759
  {
758
 
    if (c instanceof JButton)
 
760
    if (c instanceof AbstractButton)
759
761
      {
760
 
        JButton b = (JButton) c;
 
762
        AbstractButton b = (AbstractButton) c;
761
763
        b.setRolloverEnabled(false);
762
764
        b.setBorder(nonRolloverBorder);
763
765
      }
876
878
  {
877
879
    installNormalBorders(toolBar);
878
880
    borders = null;
879
 
    rolloverBorder = null;
880
 
    nonRolloverBorder = null;
881
881
    cachedBounds = null;
882
882
 
883
883
    floatFrame = null;
903
903
   * This method uninstalls keyboard actions installed by the UI.
904
904
   */
905
905
  protected void uninstallKeyboardActions()
 
906
    throws NotImplementedException
906
907
  {
907
908
    // FIXME: implement.
908
909
  }
1061
1062
      isDragging = true;
1062
1063
 
1063
1064
      if (dragWindow != null)
1064
 
        dragWindow.setOffset(new Point(e.getX(), e.getY()));
 
1065
        dragWindow.setOffset(new Point(cachedBounds.width/2, cachedBounds.height/2));
1065
1066
 
1066
1067
      dragTo(e.getPoint(), origin);
1067
1068
    }
1232
1233
    public void propertyChange(PropertyChangeEvent e)
1233
1234
    {
1234
1235
      // FIXME: need name properties so can change floatFrame title.
1235
 
      if (e.getPropertyName().equals("rollover"))
1236
 
        setRolloverBorders(toolBar.isRollover());
 
1236
      if (e.getPropertyName().equals("rollover") && toolBar != null)
 
1237
        setRolloverBorders(toolBar.isRollover());
1237
1238
    }
1238
1239
  }
1239
1240