JavaBeans : How to implement a Java Bean Pls Help! thanks ^-^
Hello everyone thats my first post because I need to know how java beans works in Intellyj IDEA 8.1
I come from netbeans , in the school I am working with Jdeveloper and in this latest one I created a Javabean
package jtextfieldrestringido;
import java.awt.Toolkit;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JTextField;
public class JTextFieldRestringido extends JTextField {
int longitud;
String caracteresPermitidos;
public JTextFieldRestringido() {
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
}
private void jbInit() throws Exception {
this.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
this_keyTyped(e);
}
});
}
private boolean comprobarCaracter(char c){
boolean existe=false;
System.out.println(this.getText().length());
for (int i=0; i<caracteresPermitidos.length();i++){
if(caracteresPermitidos.charAt(i)==c && existe==false){
existe=true;
}
}
return existe;
}
private void this_keyTyped(KeyEvent e) {
for (int i = 0; i < this.getText().length(); i++) {
if(comprobarCaracter(this.getText().charAt(i))&& this.getText().length()<= this.getLongitud()){
}else {
Toolkit.getDefaultToolkit().beep();
this.setText("");
}
}
}
public void setCaracteresPermitidos(String caracteresPermitidos) {
this.caracteresPermitidos = caracteresPermitidos;
}
public String getCaracteresPermitidos() {
return caracteresPermitidos;
}
public void setLongitud(int longitud) {
this.longitud = longitud;
}
public int getLongitud() {
return longitud;
}
}
Well on JDeveloper it appear like swing components but on Intellij Idea I really dont know how to start for install it , maybe it is already in front of my eyes but i cant see it
I am really a newbye with Intellyj Idea so please understand it and if you know the solution please do it Step by Step to make one like mine.
The following images show my javabean in JDeveloper , I just like the same for intelliJ Idea
请先登录再写评论。
So, your question is "How to add a custom Swing Component to the UI designer", right?
I am not using the designer, but this may be helpful:
http://www.jetbrains.com/idea/webhelp/adding-gui-components-and-forms-to-the-palette.html