Friday, December 4, 2009

notas da prova 2

Bruno - aluno1 - 1,7
Camila - aluno2 - 7,0
Carlos Augusto - aluno3 - 6,0
Jose Ricardo - aluno4 - 4,5
Juliana - aluno5 - 5,0
Krissia - aluno6 - 3,75
Luisa - aluno7 - 5,0
Marcelo - aluno8 - 2,0
Mario - aluno9 - 0
Vinicius - aluno10 - 3,0
Elder - aluno11 - 1,5

Wednesday, November 25, 2009

parametros no processing

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);
background(bgcolor);
}

parametros de html para applet

Here is the code for the Java Program :
import java.applet.*;
import java.awt.*;

public class appletParameter extends Applet {
private String strDefault = "Hello! Java Applet.";
public void paint(Graphics g) {
String strParameter = this.getParameter("Message");
if (strParameter == null)
strParameter = strDefault;
g.drawString(strParameter, 50, 25);
}
}

Here is the code for the html program :
<HTML>
<HEAD>
<TITLE>Passing Parameter in Java Applet</TITLE>
</HEAD>
<BODY>
This is the applet:<P>
<APPLET code="appletParameter.class" width="800" height="100">
<PARAM name="message" value="Welcome in Passing parameter in java applet example.">
</APPLET>
</BODY>
</HTML>

There is the advantage that if need to change the output then you will have to change only the value of the param tag in html file not in java code.

Friday, November 20, 2009

Notas da primeira prova

5881890 - 7,0
6511182 - 8,5
3141959 - 8,5
6511216 - 0
6511202 - 0
6416664 - 5,5
5881886 - 5,75
5633753 - 8,0
6418897 - 8,0
6418862 - 1,0
6511108 - 8,5
6418900 - 0
6418622 - 9,0

Thursday, November 19, 2009

interface AWT evento

package processing1;

import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import processing.core.PApplet;



public class estrela2 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();
}
}

inteface AWT para Applet

package processing1;

import java.awt.*;
import processing.core.PApplet;



public class estrela1 extends PApplet {

float r, ang;
// A Button to click
Button okButton;
// A textField to get text input
TextField nameField;
// A group of radio buttons
// necessary to only allow one radio button to be selected at the same time.
CheckboxGroup radioGroup;
// The radio buttons to be selected
Checkbox radio1;
Checkbox radio2;
// An independant selection box
Checkbox option;

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;
//
// Tell the applet not to use a layout manager.
setLayout(null);
// initialze the button and give it a text.
okButton = new Button("A button");
// text and length of the field
nameField = new TextField("A TextField",100);
// initialize the radio buttons group
radioGroup = new CheckboxGroup();
// first radio button. Gives the label text, tells to which
// group it belongs and sets the default state (unselected)
radio1 = new Checkbox("Radio1", radioGroup,false);
// same but selected
radio2 = new Checkbox("Radio2", radioGroup,true);
// Label and state of the checkbox
option = new Checkbox("Option",false);

// now we will specify the positions of the GUI components.
// this is done by specifying the x and y coordinate and
//the width and height.
okButton.setBounds(20,20,100,30);
nameField.setBounds(20,70,100,40);
radio1.setBounds(20,120,100,30);
radio2.setBounds(140,120,100,30);
option.setBounds(20,170,100,30);

// now that all is set we can add these components to the applet
add(okButton);
add(nameField);
add(radio1);
add(radio2);
add(option);
//
}

Saturday, September 19, 2009

exercício formulários

Montar uma fomulários complexo
que tenha radiobutton, checkbox e várias entradas de texto.
organizar as variávies dos formulários por vetores

a) verificar se os campos foram selecionados

b) verificar os estados do radiobutton e do checkbox

o código fonte para os formulários está em http://mandelbrot.ifsc.usp.br/form.zip