As the earlies versions of OpenSolaris, my terminal is without colors. That’s a little annoying. As the default user uses Bash you can configure your Bash options in the file ~/.bashrc. Insert in the last lines of your .bashrc file:
alias ls=’ls –color=auto’
Save, close and open your terminal (or just type source ~/.bashrc).
Two simple JavaFX code handling onMouseDragged event.
import javafx.ui.*;
import javafx.ui.canvas.*;
Canvas {
content: Circle {
var x = 50
var y = 50
transform: bind translate(x, y)
radius: 30
fill: red
onMouseDragged: operation(e) {
x += e.localDragTranslation.x;
y += e.localDragTranslation.y;
}
}
}
import javafx.ui.*;
import javafx.ui.canvas.*;
Canvas {
content: Circle {
var x = 50
var y = 50
var radius = 30
transform: bind translate(x, y)
radius: bind radius
fill: red
onMouseDragged: operation(e) {
if (e.button == 1){
x += e.localDragTranslation.x;
y += e.localDragTranslation.y;
}
if (e.button == 3) {
radius += e.localDragTranslation.x;
}
}
}
}
import javafx.ui.*;
import javafx.ui.canvas.*;
Canvas {
content: [
Rect {x: 50, y: 50, width: 50, height: 50, fill: orange },
Circle {
var x = 50
var y = 50
var radius = 30
var color = red:Color
transform: bind translate(x, y)
radius: bind radius
fill: bind color
onMouseDragged: operation(e) {
if (e.button == 1){
x += e.localDragTranslation.x;
y += e.localDragTranslation.y;
}
if (e.button == 3) {
radius += e.localDragTranslation.x;
}
}
onMousePressed: operation(e){
color = Color {blue: 0.0, green: 0.0, red: 1.0, opacity: 0.5};
}
onMouseReleased: operation(e){
color = red:Color;
}
}]
}
function proximo_segundo(){
var hoje = new Date
var hora = hoje.getHours()
var minutos = hoje.getMinutes()
var segundos = hoje.getSeconds()
relogio = document.getElementById('relogio')
relogio.value = hora +":"+minutos+":"+segundos
setTimeout('proximo_segundo()',1000)
}
proximo_segundo()
Ele cria um objeto Date, encontro o elemento com id ‘relogio’ e coloca no valor dele as informações extraÃdas do objeto Date. Em seguida ele agenda para daqui a um segundo chamar a si próprio, recursivamente.