• 追加された行はこの色です。
  • 削除された行はこの色です。
TITLE:翻訳元から - Javadoc
#navi(../)
RIGHT:Posted by &author(aterai); at 2010-10-05
---
title: 翻訳元からの誤記
author: aterai
pubdate: 2010-10-05getAccessibleIndexInParent
description: Java クラスドキュメントで、オリジナルの英語版から修正した方が良さそうな誤字など。
---
* 概要 [#summary]
`Java`(`Swing`)のクラスドキュメントで、オリジナルの英語版から修正した方が良さそうな箇所をメモしています。

* 翻訳元から? [#f7d3b511]
#contents(big)
#contents

** Htmlの表がずれている [#p5e32821]
- http://java.sun.com/javase/ja/6/docs/ja/api/java/awt/Container.html#setFocusTraversalKeys(int,%20java.util.Set)
- http://download.oracle.com/javase/6/docs/api/java/awt/Container.html#setFocusTraversalKeys(int,%20java.util.Set)
-- KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS,	1 つ下のフォーカストラバーサルサイクルに移動	none
- [http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4470006 Bug ID: 4470006 Table shown for Traversal Keys in setDefaultFocusTraversalKeys() not proper]
-- Submit Date 	14-JUN-2001
* 未修正 [#Unresolved]
** `BasicTreeUI#getPathBounds(...)` [#w4af6eac]
- https://docs.oracle.com/javase/jp/8/docs/api/javax/swing/plaf/basic/BasicTreeUI.html
-- Will return null if any component in path is currently valid.
-- 意味が逆になっている
- [https://bugs.openjdk.org/browse/JDK-8047749 [JDK-8047749] javadoc for getPathBounds() in TreeUI and BasicTreeUI is incorrect - Java Bug System]で以下のように修正される
-- Will return null if any component in path is currently invalid.

** サンプルコードが一行になっている [#p188f78e]
- http://java.sun.com/javase/ja/6/docs/ja/api/java/awt/BasicStroke.html
- http://download.oracle.com/javase/6/docs/api/java/awt/BasicStroke.html
-- // sets the Graphics2D object's Transform attirbute g2d.scale(10, 10); // sets the Graphics2D object's Storoke attribute g2d.setStroke(new BasicStroke(1.5f));
** TreePathのサンプルコードに非互換タイプエラー [#p756b32f]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/tree/TreePath.html
#code{{
DefaultMutableTreeNode selectedNode =
  ((DefaultMutableTreeNode) selectedPath.getLastPathComponent())
  .getUserObject();
}}

- [https://bugs.openjdk.org/browse/JDK-8054449 [JDK-8054449] Incompatible type in example code in TreePath - Java Bug System]で以下のように修正される
#code{{
DefaultMutableTreeNode selectedNode =
  (DefaultMutableTreeNode) selectedPath.getLastPathComponent();
Object myObject= selectedNode.getUserObject();
}}

** UIManager.getString("Table.foreground") [#be02be71]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/UIManager.html
-- `UIManager.getString("Table.foreground")`
-- この例だと、色を`getString`で取得しようとしているので常に`null`
-- `UIManager.get("Table.foreground")`か`UIManager.getColor("Table.foreground")`に変更した方がよさそう

** UIManager [#q4536622]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/UIManager.html
-- Some look and feels may aggressively look up defaults, so that changing a default may not have an effect after installing the look and feel. Other look and feels may lazily access defaults so that a change to the defaults may effect an existing look and feel.
- https://docs.oracle.com/javase/jp/8/docs/api/javax/swing/UIManager.html
-- 積極的にデフォルトを検索するLook & Feelもあれば(この場合、Look & Feelのインストール後にデフォルトに変更を加えても効果はない)、めったにデフォルトにアクセスしないLook & Feelもあります。(この場合、デフォルトの変更が既存のLook & Feelに影響を及ぼす)
- 修正案?
-- 積極的にデフォルトを検索するLookAndFeelなら、インストール後のデフォルト変更は効果があるような気がするのだが…、括弧内の説明が逆になっている?
-- ついでに、日本語訳としては句点は閉じ括弧の後に移動した方が良さそう

** avadoc [#p9af4b61]
- [https://docs.oracle.com/javase/9/javadoc/javadoc-command.htm#JSJAV-GUID-EAAAE17F-E540-42A0-B22B-4D2B2FD3E4D2 Javadoc Command]
-- 最下部の例で、`javadoc`コマンドが`avadoc`になっている

 Example 1   
 Oracle Solaris, Linux, and macOS:
 
 avadoc -d /home/html -sourcepath /home/src java.awt \

** translateMouseEvent() [#r6849aca]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/SwingUtilities.html#convertMouseEvent-java.awt.Component-java.awt.event.MouseEvent-java.awt.Component-
-- the source field of the returned event will be set to destination if destination is non-null use the translateMouseEvent() method to translate a mouse event from one component to another without changing the source.
- 修正案
-- `translateMouseEvent()`というメソッドはどこにも存在しない?
- 参考
-- [https://bugs.openjdk.org/browse/JDK-8049533 JDK-8049533 SwingUtilities.convertMouseEvent misses MouseWheelEvent.preciseWheelRotation - Java Bug System]
-- `Java 9`で`MouseWheelEvent`がコピーされない件は修正されているが、同時に指摘されている`translateMouseEvent()`などは未修正

** SwingConstants#VERTICAL [#i122ead5]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/SwingConstants.html#VERTICAL
-- Vertical orientation. Used for scrollbars and sliders.
- 修正案
-- `JScrollBar`は`SwingConstants`を実装していない(`java.awt.Adjustable`を実装している)ので、`progressbars and sliders`のほうがよさそう
-- `SwingConstants#HORIZONTAL`も同様

** getAlignmentY() [#ec1629bc]
- https://docs.oracle.com/javase/8/docs/api/java/awt/Component.html
-- Ease-of-use constant for getAlignmentX.
-- Ease-of-use constant for getAlignmentY().
- 修正案
-- ()を付ける方に揃える

** setAsksAllowsChildren [#ed45c143]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/tree/DefaultTreeModel.html#setAsksAllowsChildren-boolean-
-- If newvalue is true,
- 修正案
-- If newValue is true,
- メモ
-- [https://bugs.openjdk.org/browse/JDK-8026776 JDK-8026776 Broken API names in API doc - Java Bug System]で既出
--- https://docs.oracle.com/javase/jp/8/docs/api/java/net/URLConnection.html のgetLastModifedなど

** TableModelevent [#e8b81142]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/event/TableModelEvent.html
-- the TableModelevent can be used to specify the following types of changes:
- 修正案
-- the TableModelEvent can be used to specify the following types of changes:

** HTML.Attribute.id [#j0917455]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/text/html/HTMLDocument.html#getElement-java.lang.String-
-- This is a convenience method for getElement(RootElement, HTML.Attribute.id, id). 
- 修正案
-- This is a convenience method for getElement(RootElement, HTML.Attribute.ID, id). 

** JMX Specification., [#xe79f485]
- https://docs.oracle.com/javase/8/docs/api/java/lang/management/MemoryPoolMXBean.html
//- https://docs.oracle.com/javase/8/docs/api/java/lang/management/ManagementFactory.html
-- JMX Specification.,
-- ピリオドとカンマが並んでいる

** TableModel#isCellEditable(...) [#m34adfd8]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/table/TableModel.html#isCellEditable-int-int-
-- Returns true if the cell at rowIndex and columnIndex is editable. Otherwise, setValueAt on the cell will not change the value of that cell.
-- [https://bugs.openjdk.org/browse/JDK-4292804 Bug ID: 4292804 DefaultTableModel doc confusion between isCellEditable and setValueAt]
--- DefaultTableModel は修正されている?、TableModel は関係ない?

** 文字化け? [#j58229fa]
- http://java.sun.com/javase/ja/6/docs/ja/technotes/guides/swing/1.4/w2k_props.html
- http://download.oracle.com/javase/6/docs/technotes/guides/swing/1.4/w2k_props.html
- https://docs.oracle.com/javase/8/docs/technotes/guides/swing/1.4/w2k_props.html
-- "win.frame.textColor?????"
-- 「メッセージボックスのフォントカラー」のプロパティー名が文字化け?
-- http://java.sun.com/j2se/1.5.0/ja/docs/ja/guide/swing/1.4/w2k_props.html
// -- http://java.sun.com/j2se/1.5.0/ja/docs/ja/guide/swing/1.4/w2k_props.html
は、「ウィンドウのフォントカラー」と同じ値になっている

本来は、"win.messagebox.textColor" とか、全然別の値なのか、あるいは、この
ページの先頭付近に載っているサンプルコード

#code{{
String propnames[] = (String[])Toolkit.getDefaultToolkit().getDesktopProperty("win.propNames");
String propnames[] = (String[]) Toolkit.getDefaultToolkit()
    .getDesktopProperty("win.propNames");
}}
で、プロパティー一覧を取得しても、"win.messagebox.textColor" は存在しないので、
「メッセージボックスのフォントカラー」自体が設定できないのかもしれない。

他にも同様に、?がついて重複するプロパティー名が存在する。

#code{{
「アイコンのサイズ」 "win.icon.hspacing" "win.icon.vspacing"???
「アイコンの横の間隔」 "win.icon.hspacing"
「アイコンの縦の間隔」 "win.icon.vspacing"
}}

** Dimension オブジェクト、寸法オブジェクト [#gfb4e02f]
- https://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#getSize--
-- a Dimension object
- https://docs.oracle.com/javase/jp/8/docs/api/java/awt/Component.html#getSize--
-- Dimension オブジェクト

- https://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#getPreferredSize--
-- a dimension object
- https://docs.oracle.com/javase/jp/8/docs/api/java/awt/Component.html#getPreferredSize--
-- 寸法オブジェクト

** getAccessibleIndexInParent() [#n8ee376d]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/SwingUtilities.html
-- Note: as of the Java 2 platform v1.3, it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method.

コピペして、修正し忘れてるようで、注:が全部getAccessibleIndexInParentのものと同じになっている。

* 1.8.0 で修正済み [#m9daeceb]
** Typo: agressively [#d899477e]
- https://docs.oracle.com/javase/7/docs/api/javax/swing/UIManager.html
-- agressively
- 変更案
-- aggressively

** class MyApp java.io.Serializable [#o8876b77]
- https://docs.oracle.com/javase/7/docs/api/java/awt/Component.html
-- class MyApp java.io.Serializable
- 変更案
-- class MyApp implements  java.io.Serializable

サンプルコードで、implements が抜けている。

* Java 9 で修正済み [#ad8c34d4]
** Typo: any of of them [#wedb8a36]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/JLayer.html
-- using any of of them will cause UnsupportedOperationException to be thrown,
- 変更案
-- using any of them will cause UnsupportedOperationException to be thrown,

** サンプルコードが一行になっている [#p188f78e]
- https://docs.oracle.com/javase/8/docs/api/java/awt/BasicStroke.html
-- // sets the Graphics2D object's Transform attirbute g2d.scale(10, 10); // sets the Graphics2D object's Storoke attribute g2d.setStroke(new BasicStroke(1.5f));

** JSpinnerサンプルコード [#nc09884d]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/JSpinner.html
-- [https://bugs.openjdk.org/browse/JDK-5109918 JDK-5109918 Wrong documentation for JSpinner.DateEditor constructor - Java Bug System]

- 余計な`{`がある。
-- `catch (ParseException pe) {{`

- `;`が抜けている。
-- `JComponent editor = spinner.getEditor()`

- `)`が足りない。
-- `((DefaultEditor)editor).getTextField().setValue(spinner.getValue();`

** dataModelとnewModel [#pb842784]
- http://java.sun.com/javase/ja/6/docs/ja/api/javax/swing/JTable.html#setModel(javax.swing.table.TableModel)
- http://download.oracle.com/javase/6/docs/api/javax/swing/JTable.html#setModel(javax.swing.table.TableModel)
- https://docs.oracle.com/javase/8/docs/api/javax/swing/JTable.html#setModel-javax.swing.table.TableModel-
-- 引数のdataModelとnewModelが混ざっている?

#code{{
public void setModel(TableModel dataModel)
このテーブルのデータモデルを newModel に設定し、それに新しいデータモデルからのリスナー通知を登録します。 
このテーブルのデータモデルを newModel に設定し、それに新しいデータモデルからのリスナー通知を登録します。
パラメータ:
dataModel - このテーブルの新しいデータソース 
例外: 
dataModel - このテーブルの新しいデータソース
例外:
IllegalArgumentException - newModel が null の場合
}}

** ピクセルの色調を明るくする場合は true [#s9dab407]
- http://java.sun.com/javase/ja/6/docs/ja/api/javax/swing/GrayFilter.html#GrayFilter(boolean,%20int)
-- b - boolean 型 -- ピクセルの色調を明るくする場合は true
-- p - グレーの割合を指定する 0 ~ 100 の範囲の int。 100 はもっとも暗いグレー、0 はもっとも明るいグレー
- http://download.oracle.com/javase/6/docs/api/javax/swing/GrayFilter.html#GrayFilter(boolean,%20int)
-- b - a boolean -- true if the pixels should be brightened
-- p - an int in the range 0..100 that determines the percentage of gray, where 100 is the darkest gray, and 0 is the lightest
** Htmlの表がずれている [#p5e32821]
- https://docs.oracle.com/javase/8/docs/api/java/awt/Container.html#setFocusTraversalKeys-int-java.util.Set-
-- KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS,	1 つ下のフォーカストラバーサルサイクルに移動	none
- [https://bugs.openjdk.org/browse/JDK-4470006 Bug ID: 4470006 Table shown for Traversal Keys in setDefaultFocusTraversalKeys() not proper]
-- Submit Date 	14-JUN-2001
- [https://docs.oracle.com/javase/9/docs/api/java/awt/Container.html#setFocusTraversalKeys-int-java.util.Set- Container#setFocusTraversalKeys(...) (Java SE 9 & JDK 9)]

#code{{
import java.awt.*;
import java.awt.image.*;
import java.net.*;
import javax.swing.*;
public class GrayFilterTest {
  public JComponent makeUI() {
    URL url = null;
    try {
      url = new URL("http://lh4.ggpht.com/_9Z4BYR88imo/TRD2KGq73BI/AAAAAAAAAwA/N8-6EXongNk/s800/webstart.png");
    } catch (MalformedURLException e) {
      throw new InternalError();
    }
    ImageIcon original = new ImageIcon(url);
    ImageProducer ip = original.getImage().getSource();
    Box box = Box.createVerticalBox();
    box.add(makeLabel("original  ", original));
    box.add(makeLabel("false,   0", makeGrayImageIcon(ip, false, 0)));
    box.add(makeLabel("false,  50", makeGrayImageIcon(ip, false, 50)));
    box.add(makeLabel("false, 100", makeGrayImageIcon(ip, false, 100)));
    box.add(makeLabel("true,    0", makeGrayImageIcon(ip, true,  0)));
    box.add(makeLabel("true,   50", makeGrayImageIcon(ip, true,  50)));
    box.add(makeLabel("true,  100", makeGrayImageIcon(ip, true,  100)));
    return box;
  }
  private JLabel makeLabel(String title, Icon icon) {
    return new JLabel(title, icon, SwingConstants.HORIZONTAL);
  }
  private Icon makeGrayImageIcon(ImageProducer ip, boolean b, int p) {
    return new ImageIcon(Toolkit.getDefaultToolkit().createImage(
        new FilteredImageSource(ip, new GrayFilter(b, p))));
  }
  public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
      public void run() { createAndShowGUI(); }
    });
  }
  public static void createAndShowGUI() {
    JFrame f = new JFrame();
    f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    f.getContentPane().add(new GrayFilterTest().makeUI());
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);
  }
}
}}
** setAlignmentX, setAlignmentY, getAlignmentX, getAlignmentY javadoc of JComponent [#ueae105a]
- [https://bugs.openjdk.org/browse/JDK-8068374 JDK-8068374 setAlignmentX, setAlignmentY, getAlignmentX, getAlignmentY javadoc of JComponent - Java Bug System]

** TableModel#isCellEditable(...) [#m34adfd8]
- https://java.sun.com/javase/ja/6/docs/ja/api/javax/swing/table/TableModel.html#isCellEditable(int,%20int)
- http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableModel.html#isCellEditable(int,%20int)
-- rowIndex および columnIndex に位置するセルが編集可能な場合に true を返します。そうでない場合は、セルの setValueAt はそのセルの値を変更しません。
-- [http://bugs.sun.com/view_bug.do?bug_id=4292804 Bug ID: 4292804 DefaultTableModel doc confusion between isCellEditable and setValueAt]
--- DefaultTableModel は修正されている?、TableModel は関係ない?
水平と垂直が実際の動作と入れ替わっている。

** Component.AccessibleAWTComponent.getAccessibleIndexInParent() [#n8ee376d]
- http://java.sun.com/javase/ja/6/docs/ja/api/javax/swing/SwingUtilities.html
-- 注:Java 2 プラットフォーム v1.3 以降、開発者はこのメソッドを使用する代わりに、Component.AccessibleAWTComponent.getAccessibleIndexInParent() を呼び出すことをお勧めします。
- http://download.oracle.com/javase/6/docs/api/javax/swing/SwingUtilities.html
-- Note: as of the Java 2 platform v1.3, it is recommended that developers call Component.AccessibleAWTComponent.getAccessibleIndexInParent() instead of using this method.
** DateTimeFormatter week-of-month [#yda50306]
- [https://bugs.openjdk.org/browse/JDK-8169482 JDK-8169482 java.time.DateTimeFormatter javadoc: F is not week-of-month - Java Bug System]
- [https://stackoverflow.com/questions/40389916/java-8-dateformatter-week-of-month-and-year-key-symbols-difference time - Java 8 DateFormatter week of month and year key symbols difference - Stack Overflow]
- [https://docs.oracle.com/javase/jp/8/docs/api/java/time/format/DateTimeFormatter.html#patterns DateTimeFormatter (Java Platform SE 8)]
- パターン文字の`W`と`F`が両方`week-of-month`になっている
- 実際は`F`が`day-of-week-in-month`
- [https://docs.oracle.com/javase/jp/9/docs/api/java/time/format/DateTimeFormatter.html#patterns DateTimeFormatter (Java SE 9 & JDK 9)]

コピペして、修正し忘れてるようで、注:が全部getAccessibleIndexInParentのものと同じになっている。
** JEditorPane#scrollToReference(...) [#o697eaf5]
- https://docs.oracle.com/javase/8/docs/api/javax/swing/JEditorPane.html#scrollToReference-java.lang.String-
-- that is, the value returned by the `UL.getRef` method for the `URL` being displayed
-- `UL.getRef`は[https://docs.oracle.com/javase/8/docs/api/java/net/URL.html#getRef-- URL#getRef()]のtypo
-- `Java 9`、`Java 10`で修正済み [https://bugs.openjdk.org/browse/JDK-8182350 [JDK-8182350] Spelling mistake in javadoc: javax.swing.JEditorPane.scrollToReference(String) - Java Bug System]

* コメント [#z1d2c369]
* コメント [#comment]
#comment
#comment