我正在使用JScrollPane来保存大面积文本的JTextArea.我将TextArea直接添加到JFrame,它工作正常.但我将它添加到滚动窗格并添加滚动窗格,我没有看到textarea.这是我的SSCCE:
public class foo extends JFrame{
//gui elements
JTextArea chatMonitor = new JTextArea();
JScrollPane textPane = new JScrollPane();
ChatFrame(final String nickname, final String login, final String server, final String channel){
setSize(500,500);
chatMonitor.setEditable(false);
chatMonitor.setVisible(true);
textPane.add(chatMonitor);
textPane.setAutoscrolls(true);
textPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
textPane.setVisible(true);
add(textPane);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个函数,将对象的颜色淡化为Javascript中的另一种颜色作为链接,但是当我使用Firebug的JavaScript控制台时,控制台会给我一个SyntaxError:
SyntaxError: syntax error
[Break On This Error] if (document.getElementById(fadeID).style.color = "#E6E6E6")){
Run Code Online (Sandbox Code Playgroud)
Javascript(我正在使用警报来测试它是否正常工作.如果我将它放在if l之外:
<script>
function toggleColor(fadeID){
if (document.getElementById(fadeID).style.color = "#E6E6E6")){
alert("hi");
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
HTML:
<body>
<div id = "content">
<div id = "header">
<a onmouseover = "javascript:toggleColor('home')" id = "home" href = "#" title = "Home">Home</a> |
<a onmouseover = "javascript:toggleColor('music')" id = "music" href = "#" title = "Music">Music</a>
</h1>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)