Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将用一个例子来解释我的问题:
buttons[0][0].addActionListener(new ActionListener() {
在上面的代码中,我在左上角的按钮上添加了一个监听器。现在我想知道是否有一个选项,所以我可以调用整个行[0][0-3],比如)。0-3-3
[0][0-3]
0-3
-3
我知道我可以通过一个一个地为按钮添加一个监听器来做到这一点,但我必须if声明当所有按钮都被按下时,它会返回一些东西。
if
你不能在一次调用中做到这一点,最简单的方法是遍历它们:
ActionListener toAddToThoseButtons = new ActionListener() { /*...*/ }; for (int i=0; buttons[0].length; i++) { buttons[0][i].addActionListener(toAddToThoseButtons); }
我有两个带有路径的文件:
/reader.php /ebook/titlepage.xhtml
我计划让读者最终阅读电子书 toc.ncx 并能够将其显示在左侧窗格中以便于导航。但是现在,我要做的就是解决显示 xhtml 文件的问题。
电子书标题页的开头如下