equal
deleted
inserted
replaced
872 progressBar.getFont()); |
872 progressBar.getFont()); |
873 int stringWidth = SwingUtilities2.stringWidth(progressBar, fontSizer, |
873 int stringWidth = SwingUtilities2.stringWidth(progressBar, fontSizer, |
874 progressString); |
874 progressString); |
875 |
875 |
876 if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) { |
876 if (progressBar.getOrientation() == JProgressBar.HORIZONTAL) { |
877 return new Point(x + Math.round(width/2 - stringWidth/2), |
877 return new Point(x + (int)Math.round(width/2.0 - stringWidth/2.0), |
878 y + ((height + |
878 y + ((height + |
879 fontSizer.getAscent() - |
879 fontSizer.getAscent() - |
880 fontSizer.getLeading() - |
880 fontSizer.getLeading() - |
881 fontSizer.getDescent()) / 2)); |
881 fontSizer.getDescent()) / 2)); |
882 } else { // VERTICAL |
882 } else { // VERTICAL |
883 return new Point(x + ((width - fontSizer.getAscent() + |
883 return new Point(x + ((width - fontSizer.getAscent() + |
884 fontSizer.getLeading() + fontSizer.getDescent()) / 2), |
884 fontSizer.getLeading() + fontSizer.getDescent()) / 2), |
885 y + Math.round(height/2 - stringWidth/2)); |
885 y + (int)Math.round(height/2.0 - stringWidth/2.0)); |
886 } |
886 } |
887 } |
887 } |
888 |
888 |
889 |
889 |
890 public Dimension getPreferredSize(JComponent c) { |
890 public Dimension getPreferredSize(JComponent c) { |