Skip to content

Tag: netbeans

1º Java Day em Juazeiro do Norte

Esse fim de semana o CEJUG vai colocar o pé na estrada e partir rumo a Juazeiro do Norte para realizar, no dia 31 de Maio, um JavaDay, ciclo de palestras sobre tecnologia Java.

Essa é a grade de palestras:

Horário Palestra Palestrante
08:30 Certificação Java. A palestra tem o intuito de apresentar as Certificações da Tecnologia Java, os programas de estudos para obtenção destas certificações, como o mercado de trabalho local avalia os profissionais certificados e as estatísticas referentes a remuneração dos profissionais certificados. Rafael Carneiro é JUG Leader do CEJUG (Ceará Java Users Group) e também coordenador do
PortalJava. Trabalha na IVIA, gosta de ler diversos blogs sobre Java e possui algumas certificações da Sun.
Mantém um blog sobre desenvolvimento de software no endereço www.rafaelcarneiro.org.
09:30 Utilizando o Spring Framework em Aplicações JEE. Desenvolver aplicações na plataforma JEE pode tornar-se difícil dependendo das tecnologias escolhidas. Esta palestra tem o objetivo de mostrar como o Spring Framework pode simplificar o desenvolvimento de software nessa plataforma, mantendo a solução leve e com serviços avançados, tais como gerenciamento de transações, acesso remoto a Web-Services ou RMI, e transparência no uso de AOP. Tarso Bessa é um entusiasta Java e atua no desenvolvimento na plataforma há 5 anos. Possui foco em tecnologias Web e gosta de ler bastante sobre novas tecnologias, tendências de mercado e computação distribuída. Atualmente trabalha na IVIA como Arquiteto Java, é formado em Informática pela UNIFOR e possui
algumas certificações da Sun, entre elas a SCEA.
10:30 Conhecendo o NetBeans 6. O NetBeans é uma plataforma de desenvolvimento gratuita, livre, multiplataforma e multilinguagem. A palestra apresenta os recursos básicos do NetBeans 6, focando a facilidade de seu aprendizado, seus recursos de produtividade e usabilidade, além da inclusão de linguagens como Ruby, JavaScript e PHP. Silveira Neto é estudante de Computação na Universidade Federal do Ceará, Embaixador de
Campus da Sun Microsystems, participa do grupo de pesquisa ParGO (Paralelismo, Grafos e Otimização combinatória) e é membro do CEJUG (Ceará Java Users Group). Tem como hobbies os blogs (silveiraento.net e eupodiatamatando.com), o desenho e o desenvolvimento de Softwares Livres.
11:30 JavaServer Faces, desenvolvendo aplicações web com produtividade. JSF é um framework que auxilia o desenvolvimento de sistemas para a Web, fornecendo recursos avançados e dinâmicos. A palestra aborda os principais conceitos da tecnologia, como ciclo de vida, características, mercado de trabalho e integração com outros frameworks do mercado. Rafael Ponte atua com desenvolvimento de software há mais de 3 anos, atualmente é analista
pogramador na IVIA, com foco no desenvolvimento de aplicações web, entusiasta Java, JSF e Domain Driven
Design, moderador da lista de discussão JavaServer Faces International Group e sócio fundador da empresa
de consultoria Triadworks. Mantém um blog no endereço www.rponte.com.br.

Vai acontecer na Faculdade de Juazeiro do Norte (Rua São Francisco 1224 A São Miguel, Juazeiro do Norte, Ceará), no dia 31 de Maio a partir das 8:30. Além das palestras também vão haver sorteios de vários brindes.

O evento é uma promoção do CEJUG e da Coordenação do Curso de Sistemas de Informação da Faculdade de Juazeiro do Norte.

Java key listening example

This post continues a serie of posts I’m writing about 2D game development in Java.
A simple example of an JPanel that implements KeyListener (and a little trick) to handle KeyEvents to move a white square.

Java KeyListening Example

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class KeyPanel extends JPanel implements KeyListener{
    private int x=50,y=50;
    public KeyPanel() {
        JTextField textfield = new JTextField();
        textfield.addKeyListener(this);
        add(textfield);
        textfield.setPreferredSize(new Dimension(0,0));
    }

    public void keyTyped(KeyEvent e) {}

    public void keyReleased(KeyEvent e) {}

    public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_LEFT)
            x-=5;
        if (e.getKeyCode() == KeyEvent.VK_RIGHT)
            x+=5;
        if (e.getKeyCode() == KeyEvent.VK_DOWN)
            y+=5;
        if (e.getKeyCode() == KeyEvent.VK_UP)
            y-=5;
        this.repaint();
    }

    @Override
    public void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.setColor(Color.black);
        g.fillRect(0, 0, 500, 500);
        g.setColor(Color.white);
        g.fillRect(x, y, 50, 50);
    }
}

Download the complete NetBeans source project files: KeyTest.tar.bz2.

Simple Java Tileset Example

Tilesets are a common technique in game development to create all kinds of tile-based games (from strategy to RPG games).

Here’s a example of simple 2D isometric square tilesets. I decided to use 32×32 pixels tiles and store 10 tiles per row in a single image:

I created a class called public class JGameCanvas that extends from JPanel from swing:

package game;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JPanel;

enum Tile {
GRASS, GRASS_STONE, GRASS_BAGS, T3, T4, T5, T6, T7, T8, T9,
TREE, TREE_CHOMP, TREE_DEAD, T13, T14, T15, T16, T17, T18, T19,
ROAD_H, ROAD_V, ROAD_HV_DOWN, ROAD_HV_UP, ROAD_VH_RIGHT, ROAD_VH_LEFT, ROAD_CROSS, T27, T28, T29,
WALL, WALL_POSTER, WALL_END_RIGHT, WALL_END_LEFT, T34, T35, T36, T37, T38, T39,
T40, T41, T42, T43, T44, T45, T46, T47, T48, T49,
NEWS, T51,      RES_1, RES_2, BUSS_1, BUSS_2, HOSP_1, HOSP_2, MARK_1, MARK_2,
PIZZ_1, PIZZ_2, RES_3, RES_4, BUSS_3, BUSS_4, HOSP_3, HOSP_4, MARK_3, MARK_4,
PIZZ_3, PIZZ_4, RES_5, RES_6, BUSS_5, BUSS_6, HOSP_5, HOSP_6, MARK_5, MARK_6
}

public class JGameCanvas extends JPanel{
    private static final int tW = 32; // tile width
    private static final int tH = 32; // tile height
    private static final Tile map[][] =
    {{Tile.TREE,Tile.TREE, Tile.TREE, Tile.ROAD_V, Tile.GRASS, Tile.TREE, Tile.TREE_DEAD, Tile.GRASS_STONE, Tile.TREE, Tile.TREE},
     {Tile.WALL, Tile.WALL_POSTER, Tile.WALL_END_RIGHT , Tile.ROAD_V, Tile.WALL_END_LEFT, Tile.WALL, Tile.WALL_END_RIGHT, Tile.TREE_CHOMP, Tile.GRASS_STONE, Tile.GRASS_STONE},
     {Tile.GRASS,Tile.GRASS, Tile.GRASS_STONE, Tile.ROAD_V, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS},
     {Tile.PIZZ_1,Tile.PIZZ_2, Tile.GRASS, Tile.ROAD_V, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS},
     {Tile.PIZZ_3,Tile.PIZZ_4, Tile.GRASS, Tile.ROAD_V, Tile.GRASS, Tile.GRASS, Tile.MARK_1, Tile.MARK_2, Tile.HOSP_1, Tile.HOSP_2},
     {Tile.ROAD_H,Tile.ROAD_H, Tile.ROAD_H, Tile.ROAD_VH_LEFT, Tile.TREE, Tile.TREE_DEAD, Tile.MARK_3, Tile.MARK_4, Tile.HOSP_3, Tile.HOSP_4},
     {Tile.GRASS,Tile.BUSS_1, Tile.BUSS_2, Tile.ROAD_V, Tile.TREE, Tile.NEWS, Tile.MARK_5, Tile.MARK_6, Tile.HOSP_5, Tile.HOSP_6},
     {Tile.GRASS,Tile.BUSS_3, Tile.BUSS_4, Tile.ROAD_VH_RIGHT, Tile.ROAD_H, Tile.ROAD_H, Tile.ROAD_H, Tile.ROAD_H, Tile.ROAD_H, Tile.ROAD_H},
     {Tile.GRASS,Tile.BUSS_5, Tile.BUSS_6, Tile.ROAD_V, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS},
     {Tile.GRASS,Tile.GRASS, Tile.GRASS, Tile.ROAD_V, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS, Tile.GRASS}
    };

    private Image tileset;

    public JGameCanvas() {
        tileset = Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("resources/tileset.png"));
    }

    @Override
    protected void paintComponent(Graphics g) {
        g.setColor(Color.black);
        g.fillRect(0, 0, getWidth(), getHeight());

        for(int i=0;i<10;i++)
            for(int j=0;j<10;j++)
                drawTile(g, map[j][i], i*tW,j*tH);
    }

    protected void drawTile(Graphics g, Tile t, int x, int y){
        // map Tile from the tileset
        int mx = t.ordinal()%10;
        int my = t.ordinal()/10;
        g.drawImage(tileset, x, y, x+tW, y+tH,
                mx*tW, my*tH,  mx*tW+tW, my*tH+tH, this);
    }
}

Program running:

Those graphics I created for the game Batalhão and are under Creative Commons Attribution Share Alike 3.0 license. The source code is under GPL license, download the NetBeans project with sources: tileset.tar.bz2.

NetBeans Day Fortaleza with Gregg Sporar

Gregg Sporar and CEJUG

Those days Gregg Sporar, NetBeans enthusiast working at Sun Microsystems was here in Brazil and went to our city Fortaleza to speak in our NetBeans Day Fortaleza. We had only a couple of days to prepare everything but is always good work under such pressure. 🙂

Me at the airport

Me and my friend (Cassiano Carvalho) could toke care of him. First we got Gregg at our international airport, Pinto Martins from a flight from Recife. After that we went to a typical food dinner at Coco Bambu where’s Gregg could taste our tapioca and figure why our local JUG (CEJUG) event is called Tapioca with Coffee.

Gregg tasting Tapioca

After that we went to the hotel but we did not have realized that that day was the birthday of our city Fortaleza and the birthday party was a public concert at beach of one of most famous artist in Brazil, Roberto Carlos.

Roberto Carlos in the early years
Roberto Carlos in the early years… 😛

For those who are not Brazilians, To have an idea what Roberto Carlos is, just imagine (in a smaller proportion of course) some kind of Brazilian Elvis Presley. When we quited the restaurant the show was just finished, we had a huge crowd walking back for everywhere, streets blocked, mess and traffic extremely slow. We spend about two hour on this. We decided to park the car, get Gregg’s luggage and go walking the hotel. Luckily the rain don’t caught us.

Rainy Day

In the morning was raining cats and dogs at Fortaleza, what is very uncommon.

Gregg cheking out

I picked Gregg at the hotel to the campus so we can meet the NPD (acronym in Portuguese for Data Processing Core) building, the Internet backbone of the entire state and where some projects are using NetBeans. Gregg also met our CS department, our labs and our cluster.

While that we prepared the auditorium and some last details, test microphones and projector.

P4140007 P4140006

People started to get and we got their names and mails for event certifications. I opened the event talking about NetBeans, CEJUG projects and opportunities for the students.

P4140019

P4140024

People from TV Software Livre (Free Software Television) was there too to record and transmit the event.

P4140017 P4140025

The first Gregg’s talk was about NetBeans and some new features from the last version of NetBeans and some new features for the version 6.1.

P4140045

The second was about Memory Leaks in Java and a method for detecting those. Very interesting.

Gregg Sporar

NetBeans Day Fortaleza

NetBeans Day Fortaleza

NetBeans Day NetBeans Day Fortaleza

Gregg Sporar

After Gregg quited to fly to Brasilia I did a presentation on NetBeans 6 and 6.1 Beta news features. You can download Gregg’s slides here and here, my slides here.The recorded video is hosted at Google Video. You can see more photos in this album:

Gregg Sporar

Gregg, thank you very much and hope you liked your quick visit to Fortaleza. 😉 Thanks also CEJUG and all guys that made this event possible.

Netbeans Day Fortaleza

Netbeans Day Fortaleza

Gregg Sporar, Sun MicrosystemsGregg Sporar, evangelista do Netbeans pela Sun Microsystems, estará essa segunda-feira (14/Abril/2008) em Fortaleza para participar do NetBeans Day Fortaleza.

O evento será essa segunda-feira a partir das 13 horas no auditório da Pró-Reitoria de Graduação, no prédio da Biblioteca Central no Campus do Pici. Dê uma olhada no mapa. Os assentos são limitados, chegue cedo e garanta seu lugar.

No NetBeans Day eu também vou fazer uma apresentação mostrando a palestra que eu vou apresentar no FISL, Netbeans 6: indo além do Java na trilha de Ruby.

Em seguida ele partirá para Brasília e depois para Porto Alegre onde ele apresentará sua palestra no FISL intitulada Memory Leaks in Java Applications – Different Tools for Different Types of Leaks.

Espero vocês lá!

E esse sábado tem o nosso tradicional Café com Tapioca, não esqueçam de ir!

Concurso de Blogagem NetBeans IDE 6.1 Beta

Typewriter
Creative Commons Image
Está cada vez mais fácil colaborar com projetos livres.Quem diria que você poderia blogar sobre um projeto livre e ainda ganhar dinheiro e brindes? Esse é o Concurso de Blogagem do Netbeans IDE 6.1 Beta. Blogando você disputa:

  • 10 chances de ganhar um vale-compras American Express no valor de U$ 500,00.
  • 100 chances de ganhar camisetas do Netbeans.

Tudo que você tem que fazer é:

  1. Baixar o Netbeans 6.1 Beta (ou o último release) e experimentar.
  2. Blogue sobre isso.
  3. Envie a URL do seu blog e post.
  4. Faça isso antes de 18 de Abril de 2008!

Os posts enviados seram julgados e serão escolhidos 10 vencedores para ganhar os vale-compras. Os 100 melhores posts ganham camisetas do Netbeans.

Basicamente é isso mas há informações mais detalhadas na página de regras do concurso. Se você estiver com preguiça de ler eu fiz esse perguntas e respostas.

Perguntas e Respostas

O que é esse Netbeans 6.1 Beta?

Netbeans é uma IDE (ambiente de desenvolvimento integrado), um programa que lhe ajuda a construir programas. É multiplataforma (você pode usar no Linux, Windows, Opensolaris, etc), tem suporte há várias linguagens (Java, C/C++, Ruby, PHP etc), disponível em diversos idiomas (a comunidade de tradução para português é uma das mais ativas) e livre (disponível em licenças GPL e CDDL). Para saber mais dê uma olhada na página de características do Netbeans.

Eu posso fazer um post em português?

Sim. Você também pode postar em inglês, espanhol, russo, francês, chinês simplificado, japonês e polonês.

É sorteio?

Não. Os melhores posts serão julgados e classificados. Se seu post estiver entre os 100 melhores você ganha uma camiseta do Netbeans, se estiver entre os 10 melhores, quinhentas doletas. 😉

E eu vou falar do que nesse post?

Teste o Netbeans 6.1 Beta, procure as novidades em relação ao Netbeans 6.0.1, mostre como fazer certas coisas, tire screenshots. Enfim, seja criativo!

Você pode dar uma olhada na lista de características e novidades no Netbeans e se inspirar.

Mas eu não tenho um blog?

Já pensou em criar seu próprio blog? Eu sugiro que dê uma olhada no wordpress.com onde você pode hospedar seu blog de graça usando um ótimo motor de blogs.

Eu posso pegar o post bacana de alguém e submeter dizendo que é meu?

O que é que você acha? ¬_¬
Não, não pode.

E se eu pegar um post bacana de alguém, em outra lingua e submeter dizendo que é um post original meu? Pode?

Não. Claro que não. Você vai ser desclassificado se fizer isso.

Boa blogagem pra você.

Tech Demo February

Today I did one more Tech Demo about Netbeans and also Sun Academmic Initiative and Community Innovation Awards Program.

Below are the slides (in Portuguese). They are an continuation from those from the last demo. You can also download them in ODP or PDF.

I have really little time to prepare this presentation (one day) but everything goes right. I prepared the slides during the night, took some food, soft drinks and gifts, called the students using our mail list. We had few people but was a good audience for the first weak of the university calendar.

People
Some guys at the beginning of the demo.

We talked two hours about stuff like:

  • Netbeans: Netbeans history, architecture and available modules. We did a demo showing some functionalities and I showed how use Issuezilla to report an bug.
  • Sun Academmic Initiative: how can we benefit from the program using Sun Learning Connection and 60% discount for Sun Certifications.
  • Community Innovation Awards Program: Sun Microsystems is giving one million dollars for innovations in Open and Free Software. I showed to the students details of the program and how to participate.

Hora do almoço
Lunch: Sfiha and soda.

Sorteio de Brindes
We used the JavaFX Wheel of Fortune for give prizes.

The next tech demo will be about one of those themes: JavaFX, Opensolaris or How to develop a module for Netbeans. I’m open for suggestions.

More photos at Flickr.

JavaFX: Color picker

An simple color picker that can be also used as a gadget.

import javafx.ui.*;
import javafx.ui.canvas.*;

var colors = [red:Color, orange:Color, yellow:Color, green:Color,
     cyan:Color,blue:Color, magenta:Color, gray:Color];

var chosenColor: Paint;
chosenColor = black:Color;

var x = 120;
var y = 70;

Canvas{
    content: Group{
        transform: bind translate(x,y)
        content: [Star{
            points: sizeof colors
            rin: 30
            rout: 50
            fill: bind chosenColor
            onMouseDragged: operation(e) {
                x += e.localDragTranslation.x;
                y += e.localDragTranslation.y;
            }
        },
        foreach (i in [1..sizeof colors]) Circle {
            var: self
            transform: [rotate(i*360/sizeof colors,0,0), translate(50,0)]
            radius: 10
            fill: colors[i%sizeof colors]
            onMouseClicked: operation (e){
                chosenColor = self.fill;
            }
        }]
    }
}

Gato em JavaFX, versão 2

Lembra daquele nosso gato em Java FX? Agora ele move os olhos com cliques em botões.



Código fonte:

import javafx.ui.canvas.*;
import javafx.ui.*;

class Cat extends CompositeNode{
    attribute look: Number; // -1.0 to 1.0
    operation lookLeft();
    operation lookCenter();
    operation lookRight();
}

attribute Cat.look = 0; // 0 = middle

operation Cat.lookLeft(){
    look = [look, look - 0.1 .. -1.0] dur 1000;
}

operation Cat.lookCenter(){
    var step = if look < 0 then 0.1 else -0.1;
    look = [look, look+step .. 0.0] dur 1000;
}

operation Cat.lookRight(){
    look = [look, look + 0.1 .. 1.0] dur 1000;
}

function Cat.composeNode(){
    var head =  Ellipse {cx:100, cy:100, radiusX:100, radiusY:50, fill:black };
    var rightEar =  Arc {x:100, y:10, height:150, width:100,
                       startAngle:-20, length:90, closure:PIE, fill:black};
    var leftEar = Arc {x:000, y:10, height:150, width:100,
                     startAngle:110, length:90, closure:PIE, fill:black};
    var leftEye = Ellipse { cx:60, cy:100, radiusX:30, radiusY:15, fill:white};
    var rightEye = Ellipse { cx:140, cy:100, radiusX:30, radiusY:15, fill:white};
    var nose = Arc { x:85, y:110, height:20, width:30,
                     startAngle:45, length:90, closure:PIE, fill:white};
    
    var rightIris = Ellipse { cx: bind 140+look*20, cy:100,
                     radiusX:5, radiusY:15, fill:black};
    var leftIris = Ellipse { cx: bind 60+look*20, cy:100,
                     radiusX:5, radiusY:15, fill:black};    
    
    return Group{content: [head, rightEar, leftEar, leftEye,
                     leftIris, rightEye, rightIris, nose]};
}

var myCat = Cat{};

var myCatControl = View {
            transform: [translate(0, 150)]
            content: GroupPanel {
                cursor: DEFAULT
                var row = Row {alignment: BASELINE}
                var column1 = Column { }
                var column2 = Column { }
                var column3 = Column { }
                var column4 = Column { }
                var column5 = Column { }
                rows: [row]
                columns: [column1, column2, column3, column4]
                content:
                [SimpleLabel {
                    row: row
                    column: column1
                    text: "Look:"
                },
                Button {
                    row: row
                    column: column2
                    mnemonic: L
                    text: "Left"
                    action: operation() {
                        myCat.lookLeft();
                    }
                },
                Button {
                    row: row
                    column: column3
                    mnemonic: C
                    text: "Center"
                    action: operation() {
                        myCat.lookCenter();
                    }
                },
                Button {
                    row: row
                    column: column4
                    mnemonic: R
                    text: "Right"
                    action: operation() {
                        myCat.lookRight();
                    }
                }]
                }
            };

Canvas {
    content: [myCatControl, myCat]
}

Downloads: