package visao;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import controle.Constantes;
public class TelaInicial extends JFrame {
private JPanel painelTI;
private boolean seJogando;
private JButton btIniciarTI;
private JButton btSobreTI;
private JButton btSairTI;
private JLabel lblImgTelaInicialTI;
private JLabel lblTextNomeDoJogo;
public static int coluna=0;
JPanel p1;
public TelaInicial() {
setFocusable(true);
setUndecorated(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize( Constantes.ALTURA, Constantes.LARGURA);
setLocationRelativeTo(null);
painelTI = new JPanel();
painelTI.setLayout(null);
setContentPane(painelTI);
lblTextNomeDoJogo = new JLabel("");
lblTextNomeDoJogo.setForeground(Color.WHITE);
lblTextNomeDoJogo.setFont(GerenciarFonte.FontePlain(47));
lblTextNomeDoJogo.setBounds(242, 250, 633, 46);
painelTI.add(lblTextNomeDoJogo);
btIniciarTI = new JButton("Iniciar");
btIniciarTI.setFont(GerenciarFonte.FontePlain(44));
btIniciarTI.setForeground(Color.WHITE);
btIniciarTI.setFocusable(false);
btIniciarTI.setContentAreaFilled(false);
btIniciarTI.setFocusPainted(true);
btIniciarTI.setBounds(445, 350, 185, 47);
painelTI.add(btIniciarTI);
btSobreTI = new JButton("Sobre");
btSobreTI.setFont(GerenciarFonte.FontePlain(42));
btSobreTI.setForeground(Color.WHITE);//laranja 255 69 0
btSobreTI.setFocusable(false);
btSobreTI.setBorderPainted(true);
btSobreTI.setContentAreaFilled(false);
btSobreTI.setFocusPainted(true);
btSobreTI.setBounds(461, 414, 156, 41);
painelTI.add(btSobreTI);
btSairTI = new JButton("Sair");
btSairTI.setFont(GerenciarFonte.FontePlain(42));//RockoUltraFLF
btSairTI.setForeground(Color.WHITE);
btSairTI.setFocusable(false);
btSairTI.setBorderPainted(true);
btSairTI.setContentAreaFilled(false);
btSairTI.setFocusPainted(true);
btSairTI.setBounds(471, 472, 131, 37);
painelTI.add(btSairTI);
OrdenadorDeFoco of = new OrdenadorDeFoco(this);
of.configurarOrdem(btIniciarTI, btSobreTI, btSairTI);
lblImgTelaInicialTI = new JLabel();
lblImgTelaInicialTI.setIcon(new ImageIcon(getClass().getResource("/imagem/11.jpg")));
lblImgTelaInicialTI.setBounds(0, 0,Constantes.ALTURA, Constantes.LARGURA);
painelTI.add(lblImgTelaInicialTI);
setResizable(false);
setVisible(true);
}
public void paint(Graphics g){
super.paint(g);
g.setColor(Color.WHITE);
g.drawRect(436, 341, 201, 58);
g.drawRect(436, 408, 201, 47);
g.drawRect(436, 463, 201, 47);
}
public class Panel extends JGradientPanel {
private static final long serialVersionUID = 1L;
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(new Color(255,69,0));
g.draw3DRect( 414, 273, 180, 37, true );
g.draw3DRect( 414, 363, 180, 37, true );
g.draw3DRect( 414, 453, 180, 37, true );
}
public Panel(Color initialColor, Color finalColor) {
super(initialColor, finalColor);
}
}
public JButton getBtIniciarTI() {
return btIniciarTI;
}
public JButton getBtSairTI() {
return btSairTI;
}
public JButton getBtSobreTI() {
return btSobreTI;
}
public boolean isSeJogando() {
return seJogando;
}
public void setSeJogando(boolean seJogando) {
this.seJogando = seJogando;
}
}
}
package visao;
import java.awt.Font;
import java.awt.FontFormatException;
import java.io.IOException;
public class GerenciarFonte {
public Font carregarFonte(String caminho, int tipo, int tamanho) {
Font minhaFonte = null;
try {
minhaFonte = Font.createFont(Font.TRUETYPE_FONT, getClass().getResourceAsStream(caminho)).deriveFont(tipo,
tamanho);
} catch (IOException e) {
// TODO: handle exception
} catch (FontFormatException e) {
// TODO: handle exception
}
return minhaFonte;
}
public static Font FontePlain(int tamanho){
GerenciarFonte f = new GerenciarFonte();
Font cooper = f.carregarFonte("/fonte/cooper-black.ttf", Font.PLAIN, tamanho);
return cooper;
}
public static Font FonteBold(int tamanho){
GerenciarFonte f = new GerenciarFonte();
Font cooper = f.carregarFonte("/fonte/cooper-black.ttf", Font.BOLD, tamanho);
return cooper;
}
public static Font FontePlainListen(int tamanho){
GerenciarFonte f = new GerenciarFonte();
Font cooper = f.carregarFonte("/fonte/TypoSlabserif-Light.ttf", Font.BOLD, tamanho);
return cooper;
}
}
}
package visao;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Point2D;
import javax.swing.JPanel;
public class JGradientPanel extends JPanel {
private Color finalColor;
private Color initialColor;
public JGradientPanel(Color initialColor, Color finalColor) {
if (initialColor == null)
throw new IllegalArgumentException("Invalid initial color!");
if (finalColor == null)
throw new IllegalArgumentException("Invalid final color!");
this.initialColor = initialColor;
this.finalColor = finalColor;
}
public void setInitialColor(Color color) {
this.initialColor = color;
invalidate();
}
public void setFinalColor(Color color) {
this.finalColor = color;
invalidate();
}
public Color getInitialColor() {
return initialColor;
}
public Color getFinalColor() {
return finalColor;
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g.create();
if (!isOpaque()) {
return;
}
GradientPaint paint = new GradientPaint(new Point2D.Float(getWidth() / 2, 0), initialColor,
new Point2D.Float(getWidth() / 2, getHeight()), finalColor);
g2d.setPaint(paint);
g2d.fillRect(0, 0, getWidth(), getHeight());
g2d.dispose();
}
}
}
public abstract class Constantes {
public static final int ALTURA = 1000;
public static final int LARGURA = 700;
}
}