Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Cortado
Commits
51d51399
Commit
51d51399
authored
Mar 16, 2010
by
ogg.k.ogg.k
Browse files
center better the "CC" icon, and make it only use JDK 1.1 compatible APIs
parent
b3897968
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/com/fluendo/player/Status.java
View file @
51d51399
...
...
@@ -21,6 +21,7 @@ package com.fluendo.player;
import
java.awt.*
;
import
java.awt.image.*
;
import
java.awt.event.*
;
import
java.awt.font.*
;
import
java.util.*
;
public
class
Status
extends
Component
implements
MouseListener
,
...
...
@@ -303,21 +304,27 @@ public class Status extends Component implements MouseListener,
private
void
paintSubtitles
(
Graphics
g
)
{
if
(
haveSubtitles
)
{
Rectangle
sb
=
getSubtitlesBounds
();
int
font_height
=
r
.
height
-
2
;
g
.
setColor
(
Color
.
darkGray
);
g
.
drawRect
(
sb
.
x
,
sb
.
y
,
sb
.
width
,
sb
.
height
);
g
.
setColor
(
colors
[
SUBTITLES
]);
g
.
fillRect
(
sb
.
x
+
1
,
sb
.
y
+
1
,
sb
.
width
-
1
,
sb
.
height
-
1
);
if
(
boldFont
==
null
)
boldFont
=
new
Font
(
"SansSerif"
,
Font
.
BOLD
,
r
.
height
-
2
);
if
(
boldFont
==
null
)
boldFont
=
new
Font
(
"SansSerif"
,
Font
.
BOLD
,
font_
height
);
g
.
setColor
(
Color
.
white
);
Font
previousFont
=
g
.
getFont
();
g
.
setFont
(
boldFont
);
java
.
awt
.
geom
.
Rectangle2D
ccbounds
=
g
.
getFontMetrics
().
getStringBounds
(
"CC"
,
g
);
int
midx
=
(
int
)(
ccbounds
.
getCenterX
()+
0.5f
);
int
midy
=
(
int
)(
ccbounds
.
getCenterY
()+
0.5f
);
g
.
drawString
(
"CC"
,
sb
.
x
+
1
+
(
sb
.
width
+
1
)/
2
-
midx
,
sb
.
y
+
1
+
(
sb
.
height
+
1
)/
2
-
midy
);
g
.
setFont
(
font
);
FontMetrics
fm
=
g
.
getFontMetrics
();
LineMetrics
lm
=
fm
.
getLineMetrics
(
"CC"
,
g
);
float
cc_w
=
fm
.
stringWidth
(
"CC"
);
float
cc_h
=
lm
.
getAscent
()-
lm
.
getDescent
();
float
button_midx
=
sb
.
x
+
sb
.
width
/
2.0f
;
float
button_midy
=
sb
.
y
+
sb
.
height
/
2.0f
;
g
.
drawString
(
"CC"
,
(
int
)(
button_midx
-
cc_w
/
2.0f
+
0.5f
),
(
int
)(
button_midy
+
cc_h
/
2.0f
+
0.5f
));
g
.
setFont
(
previousFont
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment