tach zusammen,
hab da ein problem. ich hab da eine kleine applikation,mit buttons, textFiels und einer textArea. Die TextArea soll scrollable sein. dafür benutze ich eine JScrollPane und enau das funktioniert nicht. hier der code
vielleicht kann mir ja jemand helfen. thx
greetz wicky
hab da ein problem. ich hab da eine kleine applikation,mit buttons, textFiels und einer textArea. Die TextArea soll scrollable sein. dafür benutze ich eine JScrollPane und enau das funktioniert nicht. hier der code
Code:
public GuiArchiv() {
super("Keyword disposer");
Container content = getContentPane();
content.setLayout(new GridLayout(4, 1));
Container contentPaneLabel = new Container();
contentPaneLabel.setLayout(new GridLayout(1, 1));
Container contentPaneText = new Container();
contentPaneText.setLayout(new GridLayout(3, 1));
Container contentPaneButtons = new Container();
contentPaneButtons.setLayout(new GridLayout(3, 3));
Container contentPaneIndexFrame = new Container();
contentPaneIndexFrame.setLayout(new BorderLayout(1, 1));
content.add(contentPaneLabel);
content.add(contentPaneText);
content.add(contentPaneButtons);
content.add(contentPaneIndexFrame);
/**
* Textfields initialisiert
*/
textfield1 = new JTextField();
textfield1.setFont( new Font("Verdana", Font.ROMAN_BASELINE, 10) );
textfield1.setForeground( Color.DARK_GRAY );
textfield2 = new JTextField();
textfield2.setFont( new Font("Verdana", Font.ROMAN_BASELINE, 10) );
textfield2.setForeground( Color.DARK_GRAY );
textfield3 = new JTextField();
textfield3.setFont( new Font("Verdana", Font.ROMAN_BASELINE, 10) );
textfield3.setForeground( Color.red );
contentPaneText.add(textfield1);
contentPaneText.add(textfield2);
contentPaneText.add(textfield3);
/**
* Label initialisiert
*/
label = new JLabel("Magazin Archiv",JLabel.CENTER);
label.setFont( new Font("Verdana", Font.ROMAN_BASELINE, 20) );
label.setForeground( Color.DARK_GRAY );
contentPaneLabel.add(label);
/**
* Textarea initialisiert
* JTextArea textArea = new JTextArea(); wird oben mit allen anderen Variablen definiert
*/
textArea.setFont( new Font("Verdana", Font.ROMAN_BASELINE, 10) );
textArea.setForeground( Color.DARK_GRAY );
contentPaneIndexFrame.add(textArea);
/**
* ScrollBar initialisiert
*/
JScrollPane scrollBar = new JScrollPane();
// scrollBar.setFont( new Font("Verdana", Font.ROMAN_BASELINE, 10) );
// scrollBar.setForeground( Color.DARK_GRAY );
textArea.add(scrollBar);
/**
* Buttons initialisiert
*/
JButton goButton = new JButton("search");
goButton.setFont( new Font("Verdana", Font.ROMAN_BASELINE,12) );
goButton.setForeground( Color.black );
goButton.setActionCommand("search");
goButton.addActionListener(this);
JButton addButton = new JButton("add");
addButton.setFont( new Font("Verdana", Font.ROMAN_BASELINE,12) );
addButton.setForeground( Color.black );
addButton.setActionCommand("add");
addButton.addActionListener(this);
JButton saveButton = new JButton("save");
saveButton.setFont( new Font("Verdana", Font.ROMAN_BASELINE,12) );
saveButton.setForeground( Color.black );
saveButton.setActionCommand("save");
saveButton.addActionListener(this);
JButton removeButton = new JButton("remove");
removeButton.setFont( new Font("Verdana", Font.ROMAN_BASELINE,12) );
removeButton.setForeground( Color.black );
removeButton.setActionCommand("remove");
removeButton.addActionListener(this);
JButton clearButton = new JButton("clear");
clearButton.setFont( new Font("Verdana", Font.ROMAN_BASELINE,12) );
clearButton.setForeground( Color.black );
clearButton.setActionCommand("clear");
clearButton.addActionListener(this);
JButton indexButton = new JButton("index");
indexButton.setFont( new Font("Verdana", Font.ROMAN_BASELINE,12) );
indexButton.setForeground( Color.black );
indexButton.setActionCommand("index");
indexButton.addActionListener(this);
JButton endButton = new JButton("end");
endButton.setFont( new Font("Verdana", Font.ROMAN_BASELINE,12) );
endButton.setForeground( Color.black );
endButton.setActionCommand("end");
endButton.addActionListener(this);
contentPaneButtons.add(goButton);
contentPaneButtons.add(addButton);
contentPaneButtons.add(saveButton);
contentPaneButtons.add(removeButton);
contentPaneButtons.add(clearButton);
contentPaneButtons.add(indexButton);
contentPaneButtons.add(endButton);
/**
* try catch Block zum laden der TreeMap
*/
try {
herstellerTreeMap = speichern.deserialize(filename);
textfield3.setText("Es sind " + herstellerTreeMap.size() + " Themen vorhanden");
} catch (Exception e) {
herstellerTreeMap = new TreeMap();
textfield3.setText("Keine Liste zum laden vorhanden!");
}
}
greetz wicky