Javadoc/Nitpick のバックアップの現在との差分(No.18)
- title: 翻訳元から title: 翻訳元からの誤記 author: aterai pubdate: 2010-10-05 description: Java クラスドキュメントで翻訳元の英語版から修正した方が良さそうな誤字など。 pubdate: 2010-10-05getAccessibleIndexInParent description: Java クラスドキュメントで、オリジナルの英語版から修正した方が良さそうな誤字など。
概要
Java
(Swing
)のクラスドキュメントで、オリジナルの英語版から修正した方が良さそうな箇所をメモしています。
- 概要
- 未修正
- 未修正
- BasicTreeUI#getPathBounds(...)
- TreePathのサンプルコードに非互換タイプエラー
- UIManager.getString("Table.foreground")
- UIManager
- avadoc
- translateMouseEvent()
- SwingConstants#VERTICAL
- getAlignmentY()
- setAsksAllowsChildren
- TableModelevent
- HTML.Attribute.id
- Typo: any of of them
- JMX Specification.,
- TableModel#isCellEditable(...)
- Htmlの表がずれている
- サンプルコードが一行になっている
- JSpinnerサンプルコード
- 文字化け?
- dataModelとnewModel
- Dimension オブジェクト、寸法オブジェクト
- Component.AccessibleAWTComponent.getAccessibleIndexInParent()
- getAccessibleIndexInParent()
- 1.8.0 で修正済み
- コメント
- Java 9 で修正済み
- コメント
未修正
未修正
BasicTreeUI#getPathBounds(...)
- 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.
- 意味が逆になっている
- [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.
TreePathのサンプルコードに非互換タイプエラー
- https://docs.oracle.com/javase/8/docs/api/javax/swing/tree/TreePath.html
#spanend #spanadd DefaultMutableTreeNode selectedNode = #spanend ((DefaultMutableTreeNode) selectedPath.getLastPathComponent()) .getUserObject(); #spanadd
- [JDK-8054449] Incompatible type in example code in TreePath - Java Bug Systemで以下のように修正される
#spanend #spanadd DefaultMutableTreeNode selectedNode = #spanend (DefaultMutableTreeNode) selectedPath.getLastPathComponent(); #spanadd Object myObject= selectedNode.getUserObject(); #spanend #spanadd
UIManager.getString("Table.foreground")
- 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
- 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
- Javadoc Command
- 最下部の例で、
javadoc
コマンドがavadoc
になっている
- 最下部の例で、
Example 1 Oracle Solaris, Linux, and macOS: avadoc -d /home/html -sourcepath /home/src java.awt \
translateMouseEvent()
- 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()
というメソッドはどこにも存在しない?
-
- 参考
- JDK-8049533 SwingUtilities.convertMouseEvent misses MouseWheelEvent.preciseWheelRotation - Java Bug System
-
Java 9
でMouseWheelEvent
がコピーされない件は修正されているが、同時に指摘されているtranslateMouseEvent()
などは未修正
SwingConstants#VERTICAL
- 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()
- http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html
- 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
- http://docs.oracle.com/javase/8/docs/api/javax/swing/tree/DefaultTreeModel.html#setAsksAllowsChildren-boolean-
- https://docs.oracle.com/javase/8/docs/api/javax/swing/tree/DefaultTreeModel.html#setAsksAllowsChildren-boolean-
- If newvalue is true,
- 修正案
- If newValue is true,
- メモ
TableModelevent
- http://docs.oracle.com/javase/8/docs/api/javax/swing/event/TableModelEvent.html
- 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
- http://docs.oracle.com/javase/8/docs/api/javax/swing/text/html/HTMLDocument.html#getElement-java.lang.String-
- 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).
Typo: any of of them
- http://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,
JMX Specification.,
- http://docs.oracle.com/javase/8/docs/api/java/lang/management/MemoryPoolMXBean.html
- https://docs.oracle.com/javase/8/docs/api/java/lang/management/MemoryPoolMXBean.html
- JMX Specification.,
- ピリオドとカンマが並んでいる
TableModel#isCellEditable(...)
- http://docs.oracle.com/javase/8/docs/api/javax/swing/table/TableModel.html#isCellEditable-int-int-
- 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.
- Bug ID: 4292804 DefaultTableModel doc confusion between isCellEditable and setValueAt
- Bug ID: 4292804 DefaultTableModel doc confusion between isCellEditable and setValueAt
- DefaultTableModel は修正されている?、TableModel は関係ない?
Htmlの表がずれている
- http://docs.oracle.com/javase/8/docs/api/java/awt/Container.html#setFocusTraversalKeys-int-java.util.Set-
- KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, 1 つ下のフォーカストラバーサルサイクルに移動 none
- Bug ID: 4470006 Table shown for Traversal Keys in setDefaultFocusTraversalKeys() not proper
- Submit Date 14-JUN-2001
サンプルコードが一行になっている
- http://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サンプルコード
- 余計な
{
がある。-
catch (ParseException pe) {{
-
-
;
が抜けている。-
JComponent editor = spinner.getEditor()
-
-
)
が足りない。-
((DefaultEditor)editor).getTextField().setValue(spinner.getValue();
-
文字化け?
- http://docs.oracle.com/javase/8/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 は、「ウィンドウのフォントカラー」と同じ値になっている
本来は、"win.messagebox.textColor" とか、全然別の値なのか、あるいは、この ページの先頭付近に載っているサンプルコード
#spandel
String propnames[] = (String[])Toolkit.getDefaultToolkit().getDesktopProperty("win.propNames");
#spanend
#spanadd
String propnames[] = (String[]) Toolkit.getDefaultToolkit()
#spanend
.getDesktopProperty("win.propNames");
で、プロパティー一覧を取得しても、"win.messagebox.textColor" は存在しないので、 「メッセージボックスのフォントカラー」自体が設定できないのかもしれない。
他にも同様に、?がついて重複するプロパティー名が存在する。
「アイコンのサイズ」 "win.icon.hspacing" "win.icon.vspacing"???
「アイコンの横の間隔」 "win.icon.hspacing"
「アイコンの縦の間隔」 "win.icon.vspacing"
dataModelとnewModel
- http://docs.oracle.com/javase/8/docs/api/javax/swing/JTable.html#setModel-javax.swing.table.TableModel-
- 引数のdataModelとnewModelが混ざっている?
#spanend
#spandel
public void setModel(TableModel dataModel)
#spanend
#spandel
このテーブルのデータモデルを newModel に設定し、それに新しいデータモデルからのリスナー通知を登録します。
#spanend
#spandel
パラメータ:
#spanend
#spandel
dataModel - このテーブルの新しいデータソース
#spanend
#spandel
例外:
#spanend
#spandel
IllegalArgumentException - newModel が null の場合
#spanend
#spandel
Dimension オブジェクト、寸法オブジェクト
- http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#getSize--
- https://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#getSize--
- a Dimension object
- http://docs.oracle.com/javase/jp/8/api/docs/java/awt/Component.html#getSize--
- https://docs.oracle.com/javase/jp/8/docs/api/java/awt/Component.html#getSize--
- Dimension オブジェクト
- http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#getPreferredSize--
- https://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#getPreferredSize--
- a dimension object
- http://docs.oracle.com/javase/jp/8/api/docs/java/awt/Component.html#getPreferredSize--
- https://docs.oracle.com/javase/jp/8/docs/api/java/awt/Component.html#getPreferredSize--
- 寸法オブジェクト
Component.AccessibleAWTComponent.getAccessibleIndexInParent()
getAccessibleIndexInParent()
- 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 で修正済み
Typo: agressively
- http://docs.oracle.com/javase/7/docs/api/javax/swing/UIManager.html
- https://docs.oracle.com/javase/7/docs/api/javax/swing/UIManager.html
- agressively
- 変更案
- aggressively
- メモ1
- Some look and feels may agressively 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.
- メモ2
- UIManager.getString("Table.foreground")
class MyApp java.io.Serializable
- http://docs.oracle.com/javase/7/docs/api/java/awt/Component.html
- 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 で修正済み
Typo: any of of them
- 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,
サンプルコードが一行になっている
- 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サンプルコード
- 余計な
{
がある。-
catch (ParseException pe) {{
-
-
;
が抜けている。-
JComponent editor = spinner.getEditor()
-
-
)
が足りない。-
((DefaultEditor)editor).getTextField().setValue(spinner.getValue();
-
dataModelとnewModel
- https://docs.oracle.com/javase/8/docs/api/javax/swing/JTable.html#setModel-javax.swing.table.TableModel-
- 引数のdataModelとnewModelが混ざっている?
#spanend
#spanadd
public void setModel(TableModel dataModel)
#spanend
#spanadd
このテーブルのデータモデルを newModel に設定し、それに新しいデータモデルからのリスナー通知を登録します。
#spanend
#spanadd
パラメータ:
#spanend
#spanadd
dataModel - このテーブルの新しいデータソース
#spanend
#spanadd
例外:
#spanend
#spanadd
IllegalArgumentException - newModel が null の場合
#spanend
#spanadd
Htmlの表がずれている
- https://docs.oracle.com/javase/8/docs/api/java/awt/Container.html#setFocusTraversalKeys-int-java.util.Set-
- KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS, 1 つ下のフォーカストラバーサルサイクルに移動 none
- Bug ID: 4470006 Table shown for Traversal Keys in setDefaultFocusTraversalKeys() not proper
- Submit Date 14-JUN-2001
- Container#setFocusTraversalKeys(...) (Java SE 9 & JDK 9)
setAlignmentX, setAlignmentY, getAlignmentX, getAlignmentY javadoc of JComponent
水平と垂直が実際の動作と入れ替わっている。DateTimeFormatter week-of-month
- JDK-8169482 java.time.DateTimeFormatter javadoc: F is not week-of-month - Java Bug System
- time - Java 8 DateFormatter week of month and year key symbols difference - Stack Overflow
- DateTimeFormatter (Java Platform SE 8)
- パターン文字の
W
とF
が両方week-of-month
になっている - 実際は
F
がday-of-week-in-month
- DateTimeFormatter (Java SE 9 & JDK 9)
JEditorPane#scrollToReference(...)
- 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 theURL
being displayed -
UL.getRef
はURL#getRef()のtypo -
Java 9
、Java 10
で修正済み [JDK-8182350] Spelling mistake in javadoc: javax.swing.JEditorPane.scrollToReference(String) - Java Bug System
- that is, the value returned by the