jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifSliderUI.java
changeset 24163 d56df89854c4
parent 5506 202f599c92aa
equal deleted inserted replaced
24162:0fe6fb6759ab 24163:d56df89854c4
     1 /*
     1 /*
     2  * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package com.sun.java.swing.plaf.motif;
    26 package com.sun.java.swing.plaf.motif;
    27 
    27 
    28 import java.awt.*;
    28 import java.awt.Dimension;
    29 import java.awt.event.*;
    29 import java.awt.Graphics;
       
    30 import java.awt.Rectangle;
    30 
    31 
    31 import javax.swing.*;
    32 import javax.swing.JComponent;
    32 import javax.swing.event.*;
    33 import javax.swing.JSlider;
    33 import javax.swing.plaf.*;
    34 import javax.swing.plaf.ComponentUI;
       
    35 import javax.swing.plaf.basic.BasicSliderUI;
    34 
    36 
    35 import javax.swing.plaf.basic.BasicSliderUI;
    37 import static sun.swing.SwingUtilities2.drawHLine;
       
    38 import static sun.swing.SwingUtilities2.drawVLine;
    36 
    39 
    37 /**
    40 /**
    38  * Motif Slider
    41  * Motif Slider
    39  * <p>
    42  * <p>
    40  * <strong>Warning:</strong>
    43  * <strong>Warning:</strong>
   121             // fill
   124             // fill
   122             g.fillRect(0, 1, w, h - 1);
   125             g.fillRect(0, 1, w, h - 1);
   123 
   126 
   124             // highlight
   127             // highlight
   125             g.setColor(getHighlightColor());
   128             g.setColor(getHighlightColor());
   126             g.drawLine(0, 1, w - 1, 1);             // top
   129             drawHLine(g, 0, w - 1, 1);      // top
   127             g.drawLine(0, 1, 0, h);                     // left
   130             drawVLine(g, 0, 1, h);          // left
   128             g.drawLine(w/2, 2, w/2, h-1);       // center
   131             drawVLine(g, w / 2, 2, h - 1);  // center
   129 
   132 
   130             // shadow
   133             // shadow
   131             g.setColor(getShadowColor());
   134             g.setColor(getShadowColor());
   132             g.drawLine(0, h, w - 1, h);         // bottom
   135             drawHLine(g, 0, w - 1, h);      // bottom
   133             g.drawLine(w - 1, 1, w - 1, h);     // right
   136             drawVLine(g, w - 1, 1, h);      // right
   134             g.drawLine(w/2 - 1, 2, w/2 - 1, h); // center
   137             drawVLine(g, w / 2 - 1, 2, h);  // center
   135 
   138 
   136             g.translate(-x, -(knobBounds.y-1));
   139             g.translate(-x, -(knobBounds.y-1));
   137         }
   140         }
   138         else {
   141         else {
   139             g.translate(knobBounds.x-1, 0);
   142             g.translate(knobBounds.x-1, 0);
   141             // fill
   144             // fill
   142             g.fillRect(1, y, w - 1, h);
   145             g.fillRect(1, y, w - 1, h);
   143 
   146 
   144             // highlight
   147             // highlight
   145             g.setColor(getHighlightColor());
   148             g.setColor(getHighlightColor());
   146             g.drawLine(1, y, w, y);                     // top
   149             drawHLine(g, 1, w, y);             // top
   147             g.drawLine(1, y+1, 1, y+h-1);               // left
   150             drawVLine(g, 1, y + 1, y + h - 1); // left
   148             g.drawLine(2, y+h/2, w-1, y+h/2);           // center
   151             drawHLine(g, 2, w - 1, y + h / 2); // center
   149 
   152 
   150             // shadow
   153             // shadow
   151             g.setColor(getShadowColor());
   154             g.setColor(getShadowColor());
   152             g.drawLine(2, y+h-1, w, y+h-1);             // bottom
   155             drawHLine(g, 2, w, y + h - 1);        // bottom
   153             g.drawLine(w, y+h-1, w, y);                 // right
   156             drawVLine(g, w, y + h - 1, y);        // right
   154             g.drawLine(2, y+h/2-1, w-1, y+h/2-1);       // center
   157             drawHLine(g, 2, w - 1, y + h / 2 - 1);// center
   155 
   158 
   156             g.translate(-(knobBounds.x-1), 0);
   159             g.translate(-(knobBounds.x-1), 0);
   157         }
   160         }
   158     }
   161     }
   159 }
   162 }