Aluno1 - 3,0
Aluno2 - 4,5
Aluno3 - 10,0
Aluno4 - 10,0
Aluno5 - 0,5
para quem não lembra o número de sua prova, me enviei um e-mail
Tuesday, November 30, 2010
Tuesday, November 16, 2010
enviando parâmetro do HTML para a Applet
void setup() {
size(100, 100);
// Read the value "51" from the following text embedded in an HTML page:
// <applet code="param_example" archive="param_example.jar" width=100 height=100>
// <param name="back" VALUE="51">
// </applet>
String bgcolorStr = param("back");
int bgcolor = int(bgcolorStr);
//int bgcolor = 51;
background(bgcolor);
}
size(100, 100);
// Read the value "51" from the following text embedded in an HTML page:
// <applet code="param_example" archive="param_example.jar" width=100 height=100>
// <param name="back" VALUE="51">
// </applet>
String bgcolorStr = param("back");
int bgcolor = int(bgcolorStr);
//int bgcolor = 51;
background(bgcolor);
}
Message Dialog
import javax.swing.JOptionPane;
String firstNumber;
firstNumber = JOptionPane.showInputDialog( "Enter first integer" );
JOptionPane.showMessageDialog(null, "The sum is " + firstNumber, "Results",JOptionPane.PLAIN_MESSAGE );
String firstNumber;
firstNumber = JOptionPane.showInputDialog( "Enter first integer" );
JOptionPane.showMessageDialog(null, "The sum is " + firstNumber, "Results",JOptionPane.PLAIN_MESSAGE );
Interface AWT no processing
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class exemplo_awt extends PApplet implements ActionListener{
float r, ang;
// tipos do AWT
Button okButton;
Button wrongButton;
TextField nameField;
public void setup()
{
size(400, 400); // define o tamnho da tela
background(255); // define a cor de fundo como branco
r = min(width,height) / 2 * 0.9f;
ang = 0;
//
setLayout(new FlowLayout());
okButton = new Button("Action!");
wrongButton = new Button("Don't click!");
nameField = new TextField("Type here Something",35);
//
add(okButton);
add(wrongButton);
add(nameField);
//
// Attach actions to the components
okButton.addActionListener(this);
wrongButton.addActionListener(this);
}
public void draw()
{
background(255);
star(r, 5, 3, ang);
ang += 0.01f;
}
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == okButton){
nameField.setText("OK button!");
repaint();
}
if (evt.getSource() == wrongButton){
nameField.setText("Wrong button!");
repaint();
}
}
public void star(float raio, float lado, float divisor, float angulo)
{
float next, k, i,inc,y0,x0,y1,x1,pi=3.141596f;
float pi2 = 2*pi;
inc = pi2/lado;
k = divisor;
next = inc * k;
for(i=angulo;i<=pi2+angulo;i+=inc)
{
x0 = sin(i)*raio;
y0 = -cos(i)*raio;
x1 = sin(i+next)*raio;
y1 = -cos(i+next)*raio;
line(width/2+round(x0),height/2+round(y0),width/2+round(x1),height/2+round(y1));
}
}
}
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class exemplo_awt extends PApplet implements ActionListener{
float r, ang;
// tipos do AWT
Button okButton;
Button wrongButton;
TextField nameField;
public void setup()
{
size(400, 400); // define o tamnho da tela
background(255); // define a cor de fundo como branco
r = min(width,height) / 2 * 0.9f;
ang = 0;
//
setLayout(new FlowLayout());
okButton = new Button("Action!");
wrongButton = new Button("Don't click!");
nameField = new TextField("Type here Something",35);
//
add(okButton);
add(wrongButton);
add(nameField);
//
// Attach actions to the components
okButton.addActionListener(this);
wrongButton.addActionListener(this);
}
public void draw()
{
background(255);
star(r, 5, 3, ang);
ang += 0.01f;
}
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == okButton){
nameField.setText("OK button!");
repaint();
}
if (evt.getSource() == wrongButton){
nameField.setText("Wrong button!");
repaint();
}
}
public void star(float raio, float lado, float divisor, float angulo)
{
float next, k, i,inc,y0,x0,y1,x1,pi=3.141596f;
float pi2 = 2*pi;
inc = pi2/lado;
k = divisor;
next = inc * k;
for(i=angulo;i<=pi2+angulo;i+=inc)
{
x0 = sin(i)*raio;
y0 = -cos(i)*raio;
x1 = sin(i+next)*raio;
y1 = -cos(i+next)*raio;
line(width/2+round(x0),height/2+round(y0),width/2+round(x1),height/2+round(y1));
}
}
}
Subscribe to:
Comments (Atom)