Changeset 368


Ignore:
Timestamp:
10/11/08 16:40:26 (16 years ago)
Author:
bjn8
Message:
 
Location:
trunk/src_apollo/org/apollo
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src_apollo/org/apollo/gui/TimeAxis.java

    r355 r368  
    2525        public static final Font TIME_BAR_FONT = new Font("Arial", Font.PLAIN, 14);
    2626        private static final Stroke TICK_STROKE = Strokes.SOLID_1;
     27       
     28        private static final Color MAJOR_TICK_COLOR = Color.BLACK;
     29        private static final Color MINOR_TICK_COLOR = new Color(0.4f, 0.4f, 0.4f);
    2730       
    2831        private static final int DESIRED_MAJOR_TICK_PIXEL_SPACING = 100;
     
    210213       
    211214                                // Skip major positions
    212                                 if (((tx - majorTickXStart) % majorTickPixelSpacing) == 0)
     215                                if (((tx - majorTickXStart) % majorTickPixelSpacing) <= 4) // could be a pixel out
    213216                                        tx += minorTickPixelSpacing;
    214217                               
     
    311314        public void paint(Graphics g, int x, int y, int height, Color backgroundColor) {
    312315               
    313                 if (majorTickXPositions == null) return;
    314                
    315316                int majorTickHeight = height / 2;
    316317                int minorTickHeight = height / 4;
     
    321322               
    322323                g.setFont(TIME_BAR_FONT);
    323                 g.setColor(Color.BLACK);
    324                 ((Graphics2D)g).setStroke(TICK_STROKE);
    325                
    326                 if (majorTickLabels != null) {
    327        
    328        
     324               
     325                if (majorTickXPositions != null) {
     326
     327                        ((Graphics2D)g).setStroke(TICK_STROKE);
     328                       
     329                        g.setColor(MAJOR_TICK_COLOR);
    329330                        // Draw Major ticks and labels
    330331                        for (int i = 0; i < majorTickLabels.length; i++) {
     
    344345                               
    345346                        }
     347                       
     348                        g.setColor(MINOR_TICK_COLOR);
    346349                       
    347350                        // Draw minor ticks
     
    358361                } else if (alternateLabel != null) {
    359362                       
     363                        g.setColor(Color.BLACK);
     364                       
    360365                        FontMetrics fm   = g.getFontMetrics(TIME_BAR_FONT);
    361366                        Rectangle2D rect = fm.getStringBounds(alternateLabel, g);
Note: See TracChangeset for help on using the changeset viewer.