193 lines
4.9 KiB
Plaintext
193 lines
4.9 KiB
Plaintext
<%@ page import="java.util.Calendar" %>
|
|
<%@ page import="java.util.Date" %>
|
|
<%@ page import="java.util.Vector" %>
|
|
|
|
<%@ page import="java.awt.Button" %>
|
|
<%@ page import="java.awt.Color" %>
|
|
<%@ page import="java.awt.Font" %>
|
|
<%@ page import="java.awt.Frame" %>
|
|
<%@ page import="java.awt.GraphicsEnvironment" %>
|
|
<%@ page import="java.awt.GraphicsConfiguration" %>
|
|
<%@ page import="java.awt.GraphicsDevice" %>
|
|
<%@ page import="java.awt.GraphicsConfigTemplate" %>
|
|
<%@ page import="java.awt.TextField" %>
|
|
|
|
<%@ page import="javax.swing.JFrame" %>
|
|
<%@ page import="java.awt.Canvas" %>
|
|
<%@ page import="java.awt.Rectangle" %>
|
|
|
|
|
|
|
|
<html>
|
|
<head>
|
|
<title>Entorno gráfico</title>
|
|
</head>
|
|
<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="ffffff">
|
|
|
|
<%
|
|
Date fecha = new Date();
|
|
Calendar calendario = Calendar.getInstance();
|
|
calendario.setTime(fecha);
|
|
|
|
String dia = String.valueOf(calendario.get(Calendar.DATE));
|
|
if(dia.length() == 1)
|
|
{
|
|
dia = "0" + dia;
|
|
}
|
|
String mes = String.valueOf(calendario.get(Calendar.MONTH) + 1);
|
|
if(mes.length() == 1)
|
|
{
|
|
mes = "0" + mes;
|
|
}
|
|
String ano = String.valueOf(calendario.get(Calendar.YEAR));
|
|
String hora = String.valueOf(calendario.get(Calendar.HOUR_OF_DAY));
|
|
if(hora.length() == 1)
|
|
{
|
|
hora = "0" + hora;
|
|
}
|
|
String minutos = String.valueOf(calendario.get(Calendar.MINUTE));
|
|
if(minutos.length() == 1)
|
|
{
|
|
minutos = "0" + minutos;
|
|
}
|
|
String segundos = String.valueOf(calendario.get(Calendar.SECOND));
|
|
if(segundos.length() == 1)
|
|
{
|
|
segundos = "0" + segundos;
|
|
}
|
|
|
|
out.print("<hr>");
|
|
out.print("Fecha = " + dia + "/" + mes + "/" + ano);
|
|
out.print(" ");
|
|
out.print("Hora = " + hora + ":" + minutos + ":" + segundos);
|
|
out.print("<hr>");
|
|
%>
|
|
|
|
|
|
<b><i><font size="+1">Entorno gráfico</font></i></b>
|
|
<hr>
|
|
|
|
<%
|
|
|
|
out.println("<font size=\"-1\"><ul>");
|
|
out.println("<li><b>awt.toolkit: </b>" + System.getProperties().get("awt.toolkit"));
|
|
out.println("<li><b>java.awt.graphicsenv: </b>" + System.getProperties().get("java.awt.graphicsenv"));
|
|
|
|
out.println("</ul></font>");
|
|
|
|
|
|
try
|
|
{
|
|
out.println("<font size=\"-1\"><ul>");
|
|
|
|
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
|
out.println("<li><b>GraphicsEnvironment </b>--> " + ge);
|
|
out.println("</ul></font>");
|
|
|
|
GraphicsDevice gd = ge.getDefaultScreenDevice();
|
|
out.println("<font size=\"-1\"><ul>");
|
|
out.println("<li><b>GraphicsDevice default</b>--> " + gd);
|
|
out.println("</ul></font>");
|
|
|
|
GraphicsDevice[] gds = ge.getScreenDevices();
|
|
GraphicsConfiguration[] gc = null;
|
|
GraphicsConfiguration bestGc = null;
|
|
out.println("<font size=\"-1\"><ul>");
|
|
for(int i = 0; i < gds.length; i++)
|
|
{
|
|
out.println("<li><b>GraphicsDevice[" + i + "] </b>--> " + gds[i] + "; getType()=" + gds[i].getType() + "; getIDstring()=" + gds[i].getIDstring());
|
|
gc = gds[i].getConfigurations();
|
|
out.println("<font size=\"-1\"><ul>");
|
|
for(int j = 0; j < gc.length; j++)
|
|
{
|
|
out.println("<li><b>GraphicsConfiguration[" + j + "] </b>--> " + gc[j] + "; getColorModel()=" + gc[j].getColorModel() + "; getDevice()=" + gc[j].getDevice());
|
|
}
|
|
out.println("<li><b>GraphicsConfiguration default </b>--> " + gds[i].getDefaultConfiguration());
|
|
out.println("</ul></font>");
|
|
}
|
|
out.println("</ul></font>");
|
|
|
|
Font[] fuentes = ge.getAllFonts();
|
|
out.println("<font size=\"-1\"><ul>");
|
|
for(int i = 0; i < fuentes.length; i++)
|
|
{
|
|
out.println("<li><b>Fuente[" + i + "] </b>--> nombre:" + fuentes[i].getFontName() + ", familia " + fuentes[i].getFamily());
|
|
}
|
|
out.println("</ul></font>");
|
|
|
|
String[] familias = ge.getAvailableFontFamilyNames();
|
|
out.println("<font size=\"-1\"><ul>");
|
|
for(int i = 0; i < familias.length; i++)
|
|
{
|
|
out.println("<li><b>Familia[" + i + "] </b>--> " + familias[i]);
|
|
}
|
|
out.println("</ul></font>");
|
|
}
|
|
catch(Throwable ex)
|
|
{
|
|
out.println("<li><b>Excepción en manejo de entorno gráfico:</b> " + ex);
|
|
}
|
|
|
|
|
|
|
|
out.println("<hr>");
|
|
out.println("</b>Prueba de clases de java.awt</b>");
|
|
out.println("<font size=\"-1\"><ul>");
|
|
|
|
try
|
|
{
|
|
Color color = new Color(100, 125, 12);
|
|
out.println("<li>Color --> " + color);
|
|
}
|
|
catch(Throwable ex)
|
|
{
|
|
out.println("<li>Excepción en Color --> " + ex);
|
|
}
|
|
|
|
try
|
|
{
|
|
Frame ventana = new Frame("ventana de prueba");
|
|
out.println("<li>Frame --> " + ventana);
|
|
}
|
|
catch(Throwable ex)
|
|
{
|
|
out.println("<li>Excepción en Frame --> " + ex);
|
|
}
|
|
|
|
try
|
|
{
|
|
Button boton = new Button("botón de prueba");
|
|
out.println("<li>Button --> " + boton);
|
|
}
|
|
catch(Throwable ex)
|
|
{
|
|
out.println("<li>Excepción en Button --> " + ex);
|
|
}
|
|
|
|
try
|
|
{
|
|
Font fuente = new Font("LucidaSansRegular", Font.PLAIN, 12);
|
|
out.println("<li>Fuente --> " + fuente);
|
|
}
|
|
catch(Throwable ex)
|
|
{
|
|
out.println("<li>Excepción en Font --> " + ex);
|
|
}
|
|
|
|
try
|
|
{
|
|
TextField campo = new TextField("campo de texto");
|
|
out.println("<li>TextField --> " + campo);
|
|
}
|
|
catch(Throwable ex)
|
|
{
|
|
out.println("<li>Excepción en TextField --> " + ex);
|
|
}
|
|
|
|
out.println("</ul></font>");
|
|
|
|
%>
|
|
|
|
<hr>
|
|
</body>
|
|
</html> |