JMenuBar hidden behind a TextArea?

for some reason the drop down menus are hidden behind the textarea is there a way to force it to the top?
[112 byte] By [helen_166a] at [2007-11-26 12:30:12]
# 1
Post an [url= http://mindprod.com/jgloss/sscce.html]SSCCE[/url]
KomodoDavea at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 2
is textarea a TextArea() or a JTextArea()
Michael_Dunna at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 3

i create the menu first but if i switch it round it makes no difference

JMenuBar menuBar = new JMenuBar();

JMenu menu = new JMenu("Options");

menu.add(logOnAction);

menu.add(logOffAction);

menuBar.add(menu);

this.setJMenuBar(menuBar);

lblUserName = new JLabel("User Name: ");

lblUserName.setVisible(true);

c.weightx = 0.5;

c.gridx = 0;

c.gridy = 0;

c.fill = GridBagConstraints.HORIZONTAL;

jPanel.add(lblUserName, c);

txtChat = new TextArea("", 10, 5, TextArea.SCROLLBARS_VERTICAL_ONLY);

txtChat.setVisible(true);

this.add(txtChat);

helen_166a at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 4
changenew TextArea(...tonew JTextArea(...
Michael_Dunna at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 5
> Post an> [url= http://mindprod.com/jgloss/sscce.html]SSCCE[/url]Really no need. This is an easy oneThis happens when you mix heavyweight and lightweight components. To fix, either use jtextarea instead of textarea or MenuBar instead of JMenuBar
tjacobs01a at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 6
jtxtChat = new TextArea("", 10, 5, JTextArea.SCROLLBARS_VERTICAL_ONLY);bad point is i cant add a scroll bar if i do that?
helen_166a at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 7
and if i use menu then i cant use the add action method
helen_166a at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 8
> bad point is i cant add a scroll bar if i do that?jtxtChat = new JTextArea(10,5);JScrollPane sp = new JScrollPane(jtxtChat);[container].add(sp);
Michael_Dunna at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 9
its not visible if you do that?
helen_166a at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 10
my mistake if u fill it it sudenly appears :) thanks
helen_166a at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 11
is there a way to control the jscrollbar so it shows the info from the bottom first
helen_166a at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 12
> is there a way to control the jscrollbar so it shows the info from the bottom firstit should automatically follow the caret, but if not, when adding text, includejtxtChat.setCaretPosition(jtxtChat.getDocument().getLength());
Michael_Dunna at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...
# 13
thanks that solved that!
helen_166a at 2007-7-7 15:40:40 > top of Java-index,Desktop,Core GUI APIs...