ComponentFactory

来源:互联网 发布:firefox安装java插件 编辑:程序博客网 时间:2024/06/06 09:09
public class ComponentFactory {
public LineBorder jtextBorder = new LineBorder(new Color(190, 190, 190));


public JTextField getJTextField(){
return getJTextField("",SwingConstants.LEFT);
}
public JTextField getJTextField(int align){
return getJTextField("",align);
}
public JTextField getJTextField(String content){
return getJTextField(content,SwingConstants.LEFT);
}
public JTextField getJTextField(String content,int align){
JTextField textField = new JTextField(content);
textField.setHorizontalAlignment(align);
textField.setBorder(jtextBorder);
return textField;
}


public WordInputJTextPane getWordInputTextPane(){
WordInputJTextPane textField = new WordInputJTextPane();
textField.setBorder(jtextBorder);
return textField;
}

public JTextArea getJTextArea() {
JTextArea textField = new JTextArea(3, 10);
return textField;
}

public JScrollPane getScrollableJTextArea(Component compontent , int horizontalScrollbarAsNeeded, int verticalScrollbarAsNeeded){
JScrollPane scroll = new JScrollPane(compontent);
scroll.setBorder(jtextBorder);
scroll.setHorizontalScrollBarPolicy(horizontalScrollbarAsNeeded);
scroll.setVerticalScrollBarPolicy(verticalScrollbarAsNeeded);
return scroll;
}
}
0 0
原创粉丝点击