The TetrisIDE is made for programmers were able to develop applications without manual coding.
But, this not means you can't type your codes inside the tool.
Below we will se a little bit of Java behind this powerful IDE and how use this.
Everything on TetrisIDE comes from Java (it is made in Java and for Java). This means that every single action made from TetrisIDE to you comes from some Java class.
Below we have a window with a button. Note the code generated by TetrisIDE:
Source code:
package tetris.javacommands.visao;
import javax.swing.JFrame;
import componentes.visao.*;
public class JFrameMain extends JFrame{
private JTetrisButton jButton1;
private String retorno;
public JFrameMain getJFrameMain(){
return this;
}
public JFrameMain(){
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
addWindowListener( new java.awt.event.WindowAdapter(){
public void windowClosing(java.awt.event.WindowEvent arg0){
fecharJanela();
}
});
setContentPane(new JTetrisPanel(null));
setTitle("Java Commands");
setResizable(true);
setBounds(0, 0, 200, 200);
jButton1 = new JTetrisButton("");
jButton1.setText("Java");
jButton1.setBounds(40, 62, 100, 25);
getContentPane().add(jButton1);
}
public void init(){
setVisible(true);
}
public String init(String retorno){
setRetorno(retorno);
this.init();
return getReturn();
}
public void fecharJanela(){
System.exit(0);
}
public String getReturn(){
return retorno;
}
public void setReturn(String retorno){
this.retorno=retorno;
}
}
Note that every window is a Java class extended from JFrame, JDialog or JInternalFrame.
Create a project and add a button.
Search for the Import property in the Object Inspector and perform double click.
That field contains the imports of libraries and Java classes for your window.
We will import the class JOptionPane from package javax.swing. For that, write in the property Import:
javax.swing.JOptionPane
Click in OK and select the jButton1.
Perform double clique in the OnClick event from Object Inspector and add a function javaCommand with the parameter:
JOptionPane.showMessageDialog(null, "Hello World!");
Save and Run your application, clicking on the buttons in the Toolbar or typing CTRL + S and F9.
Note: We were able to work with Java code and library importations on our applications. This is very important, because this is the true freedom on development.