-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Animaciones para combobox y scrollbar, borde para sombra
- Loading branch information
1 parent
35d489b
commit e8b4aa3
Showing
11 changed files
with
364 additions
and
89 deletions.
There are no files selected for viewing
Binary file modified
BIN
+262 Bytes
(110%)
build/classes/icm/sphynx/ui/components/metro/UIButton.class
Binary file not shown.
Binary file modified
BIN
+1.78 KB
(140%)
build/classes/icm/sphynx/ui/components/metro/UIComboBox.class
Binary file not shown.
Binary file modified
BIN
+579 Bytes
(110%)
build/classes/icm/sphynx/ui/components/metro/UIScrollBar.class
Binary file not shown.
Binary file modified
BIN
+363 Bytes
(110%)
build/classes/icm/sphynx/ui/components/metro/UITools.class
Binary file not shown.
57 changes: 57 additions & 0 deletions
57
src/icm/sphynx/ui/components/metro/MetroUIBorderShadow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package icm.sphynx.ui.components.metro; | ||
|
||
import java.awt.AlphaComposite; | ||
import java.awt.BasicStroke; | ||
import java.awt.Color; | ||
import java.awt.Component; | ||
import java.awt.Graphics; | ||
import java.awt.Graphics2D; | ||
import java.awt.Insets; | ||
import java.awt.RenderingHints; | ||
import javax.swing.border.LineBorder; | ||
import javax.swing.border.MatteBorder; | ||
|
||
/** | ||
* | ||
* @author israel-icm | ||
*/ | ||
public class MetroUIBorderShadow extends LineBorder { | ||
public MetroUIBorderShadow(Color color, int thickness) { | ||
super(color, thickness); | ||
} | ||
|
||
|
||
@Override | ||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { | ||
Graphics2D g2d = (Graphics2D)g; | ||
|
||
Insets insets = getBorderInsets(c); | ||
g2d.setColor(lineColor); | ||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); | ||
|
||
float transparencia = 1; | ||
float div = (1.0f / insets.top); | ||
|
||
int bajarSombra = 4; // Establece si se bajará la sombra y cuantos puntos se bajará para hacer el cálculo y no dejar espacios en blanco | ||
|
||
int top = insets.top; | ||
int bottom = height - (insets.bottom + insets.top) - bajarSombra; | ||
int left = insets.left; | ||
int right = width - (insets.left + insets.right); | ||
for (int i = insets.left; i > 0; i--) { | ||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, transparencia)); | ||
g2d.drawRect(left, top + bajarSombra, right, bottom); | ||
top--; | ||
left--; | ||
right+=2; | ||
bottom+=2; | ||
transparencia = transparencia - div; | ||
} | ||
|
||
// Agregamos un borde complementario para el componente | ||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1)); | ||
g2d.setStroke(new BasicStroke(2)); | ||
g2d.setColor(Color.decode("#CCCCCC")); | ||
g2d.drawRect(insets.left - 1, insets.top - 1, (width - (insets.left * 2)) + 1, (height - (insets.top * 2)) + 1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.