8025603: Unused methods in the awt text peers should be removed
Reviewed-by: art, anthony
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -123,7 +123,7 @@
}
@Override
- public final void setText(final String l) {
+ public final void setText(final String text) {
synchronized (getDelegateLock()) {
// JTextArea.setText() posts two different events (remove & insert).
// Since we make no differences between text events,
@@ -131,7 +131,7 @@
// JTextArea.setText() is called.
final Document document = getTextComponent().getDocument();
document.removeDocumentListener(this);
- getTextComponent().setText(l);
+ getTextComponent().setText(text);
revalidate();
if (firstChangeSkipped) {
postEvent(new TextEvent(getTarget(),
--- a/jdk/src/share/classes/java/awt/TextComponent.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/share/classes/java/awt/TextComponent.java Tue Oct 08 23:34:20 2013 +0400
@@ -822,37 +822,6 @@
// Accessibility support
////////////////
-
- /**
- *
- */
- int getIndexAtPoint(Point p) {
- return -1;
-/* To be fully implemented in a future release
- if (peer == null) {
- return -1;
- }
- TextComponentPeer peer = (TextComponentPeer)this.peer;
- return peer.getIndexAtPoint(p.x, p.y);
-*/
- }
-
-
- /**
- *
- */
- Rectangle getCharacterBounds(int i) {
- return null;
-/* To be fully implemented in a future release
- if (peer == null) {
- return null;
- }
- TextComponentPeer peer = (TextComponentPeer)this.peer;
- return peer.getCharacterBounds(i);
-*/
- }
-
-
/**
* Gets the AccessibleContext associated with this TextComponent.
* For text components, the AccessibleContext takes the form of an
@@ -963,7 +932,7 @@
* @return the zero-based index of the character under Point p.
*/
public int getIndexAtPoint(Point p) {
- return TextComponent.this.getIndexAtPoint(p);
+ return -1;
}
/**
@@ -976,7 +945,7 @@
* @return the screen coordinates of the character's bounding box
*/
public Rectangle getCharacterBounds(int i) {
- return TextComponent.this.getCharacterBounds(i);
+ return null;
}
/**
--- a/jdk/src/share/classes/java/awt/peer/TextComponentPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/share/classes/java/awt/peer/TextComponentPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -60,11 +60,11 @@
/**
* Sets the content for the text component.
*
- * @param l the content to set
+ * @param text the content to set
*
* @see TextComponent#setText(String)
*/
- void setText(String l);
+ void setText(String text);
/**
* Returns the start index of the current selection.
--- a/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -73,25 +73,6 @@
private final JavaMouseEventHandler javaMouseEventHandler =
new JavaMouseEventHandler(this);
- /* FIXME */
-
- public long filterEvents(long mask) {
- Thread.dumpStack();
- return 0;
- }
-
- /* FIXME */
- public Rectangle getCharacterBounds(int i) {
- Thread.dumpStack();
- return null;
- }
-
- public int getIndexAtPoint(int x, int y) {
- Thread.dumpStack();
- return 0;
- }
-
-
/**
* Create a Text area.
*/
@@ -160,6 +141,7 @@
firstChangeSkipped = true;
}
+ @Override
public void dispose() {
XToolkit.specialPeerMap.remove(jtext);
// visible caret has a timer thread which must be stopped
@@ -169,7 +151,6 @@
super.dispose();
}
-
/*
* The method overrides one from XComponentPeer
* If ignoreSubComponents=={@code true} it calls super.
@@ -195,7 +176,7 @@
javaMouseEventHandler.setCursor();
}
- void setScrollBarVisibility() {
+ private void setScrollBarVisibility() {
int visibility = ((TextArea)target).getScrollbarVisibility();
jtext.setLineWrap(false);
@@ -223,10 +204,12 @@
/**
* Compute minimum size.
*/
+ @Override
public Dimension getMinimumSize() {
return getMinimumSize(10, 60);
}
+ @Override
public Dimension getPreferredSize(int rows, int cols) {
return getMinimumSize(rows, cols);
}
@@ -234,7 +217,7 @@
/**
* @see java.awt.peer.TextAreaPeer
*/
-
+ @Override
public Dimension getMinimumSize(int rows, int cols) {
/* Dimension d = null;
if (jtext != null) {
@@ -263,10 +246,12 @@
fm.getHeight() * rows + /*2*YMARGIN +*/ hsbheight);
}
+ @Override
public boolean isFocusable() {
return true;
}
+ @Override
public void setVisible(boolean b) {
super.setVisible(b);
if (textPane != null)
@@ -277,27 +262,30 @@
jtext.repaintNow();
}
+ @Override
public void focusGained(FocusEvent e) {
super.focusGained(e);
jtext.forwardFocusGained(e);
}
+ @Override
public void focusLost(FocusEvent e) {
super.focusLost(e);
jtext.forwardFocusLost(e);
}
-
/**
* Paint the component
* this method is called when the repaint instruction has been used
*/
+ @Override
public void repaint() {
if (textPane != null) {
//textPane.validate();
textPane.repaint();
}
}
+
@Override
void paintPeer(final Graphics g) {
if (textPane != null) {
@@ -305,6 +293,7 @@
}
}
+ @Override
public void setBounds(int x, int y, int width, int height, int op) {
super.setBounds(x, y, width, height, op);
if (textPane != null) {
@@ -331,21 +320,26 @@
}
}
+ @Override
void handleJavaKeyEvent(KeyEvent e) {
AWTAccessor.getComponentAccessor().processEvent(jtext,e);
}
+ @Override
public boolean handlesWheelScrolling() { return true; }
+ @Override
void handleJavaMouseWheelEvent(MouseWheelEvent e) {
- AWTAccessor.getComponentAccessor().processEvent(textPane,e);
+ AWTAccessor.getComponentAccessor().processEvent(textPane, e);
}
+ @Override
public void handleJavaMouseEvent( MouseEvent e ) {
super.handleJavaMouseEvent( e );
javaMouseEventHandler.handle( e );
}
+ @Override
void handleJavaInputMethodEvent(InputMethodEvent e) {
if (jtext != null)
jtext.processInputMethodEventPublic((InputMethodEvent)e);
@@ -354,13 +348,15 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public void select(int s, int e) {
- jtext.select(s,e);
+ jtext.select(s, e);
// Fixed 5100806
// We must take care that Swing components repainted correctly
jtext.repaint();
}
+ @Override
public void setBackground(Color c) {
super.setBackground(c);
// synchronized (getStateLock()) {
@@ -373,6 +369,7 @@
// repaintText();
}
+ @Override
public void setForeground(Color c) {
super.setForeground(c);
// synchronized (getStateLock()) {
@@ -386,6 +383,7 @@
// repaintText();
}
+ @Override
public void setFont(Font f) {
super.setFont(f);
// synchronized (getStateLock()) {
@@ -397,10 +395,10 @@
textPane.validate();
}
-
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public void setEditable(boolean editable) {
if (jtext != null) jtext.setEditable(editable);
repaintText();
@@ -409,6 +407,7 @@
/**
* @see java.awt.peer.ComponentPeer
*/
+ @Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (jtext != null) {
@@ -420,6 +419,7 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public InputMethodRequests getInputMethodRequests() {
if (jtext != null) return jtext.getInputMethodRequests();
else return null;
@@ -428,6 +428,7 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public int getSelectionStart() {
return jtext.getSelectionStart();
}
@@ -435,6 +436,7 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public int getSelectionEnd() {
return jtext.getSelectionEnd();
}
@@ -442,6 +444,7 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public String getText() {
return jtext.getText();
}
@@ -449,8 +452,9 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
- public void setText(String txt) {
- setTextImpl(txt);
+ @Override
+ public void setText(String text) {
+ setTextImpl(text);
repaintText();
}
@@ -473,6 +477,7 @@
* insert the text "txt on position "pos" in the array lines
* @see java.awt.peer.TextAreaPeer
*/
+ @Override
public void insert(String txt, int p) {
if (jtext != null) {
boolean doScroll = (p >= jtext.getDocument().getLength() && jtext.getDocument().getLength() != 0);
@@ -491,6 +496,7 @@
* replace the text between the position "s" and "e" with "txt"
* @see java.awt.peer.TextAreaPeer
*/
+ @Override
public void replaceRange(String txt, int s, int e) {
if (jtext != null) {
// JTextArea.replaceRange() posts two different events.
@@ -508,6 +514,7 @@
* to be implemented.
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public void setCaretPosition(int position) {
jtext.setCaretPosition(position);
}
@@ -516,54 +523,19 @@
* to be implemented.
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public int getCaretPosition() {
return jtext.getCaretPosition();
}
- /**
- * DEPRECATED
- * @see java.awt.peer.TextAreaPeer
- */
- public void insertText(String txt, int pos) {
- insert(txt, pos);
- }
-
- /**
- * DEPRECATED
- * @see java.awt.peer.TextAreaPeer
- */
- public void replaceText(String txt, int start, int end) {
- replaceRange(txt, start, end);
- }
+ final class AWTTextAreaUI extends MotifTextAreaUI {
- /**
- * DEPRECATED
- * @see java.awt.peer.TextAreaPeer
- */
- public Dimension minimumSize(int rows, int cols) {
- return getMinimumSize(rows, cols);
- }
+ private JTextArea jta;
- /**
- * DEPRECATED
- * @see java.awt.peer.TextAreaPeer
- */
- public Dimension preferredSize(int rows, int cols) {
- return getPreferredSize(rows, cols);
- }
-
-
- class AWTTextAreaUI extends MotifTextAreaUI {
- /**
- * Creates a UI for a JTextArea.
- *
- * @param c the text field
- * @return the UI
- */
- JTextArea jta;
-
+ @Override
protected String getPropertyPrefix() { return "TextArea"; }
+ @Override
public void installUI(JComponent c) {
super.installUI(c);
@@ -619,6 +591,7 @@
}
}
+ @Override
protected void installKeyboardActions() {
super.installKeyboardActions();
@@ -636,13 +609,15 @@
}
}
+ @Override
protected Caret createCaret() {
return new XAWTCaret();
}
}
- static class XAWTCaret extends DefaultCaret {
+ static final class XAWTCaret extends DefaultCaret {
+ @Override
public void focusGained(FocusEvent e) {
super.focusGained(e);
if (getComponent().isEnabled()){
@@ -652,6 +627,7 @@
getComponent().repaint();
}
+ @Override
public void focusLost(FocusEvent e) {
super.focusLost(e);
getComponent().repaint();
@@ -660,6 +636,7 @@
// Fix for 5100950: textarea.getSelectedText() returns the de-selected text, on XToolkit
// Restoring Motif behaviour
// If the text is unhighlighted then we should sets the selection range to zero
+ @Override
public void setSelectionVisible(boolean vis) {
if (vis){
super.setSelectionVisible(vis);
@@ -670,16 +647,14 @@
}
}
+ final class XAWTScrollBarButton extends BasicArrowButton {
- class XAWTScrollBarButton extends BasicArrowButton
- {
- UIDefaults uidefaults = XToolkit.getUIDefaults();
+ private UIDefaults uidefaults = XToolkit.getUIDefaults();
private Color darkShadow = SystemColor.controlShadow;
private Color lightShadow = SystemColor.controlLtHighlight;
private Color buttonBack = uidefaults.getColor("ScrollBar.track");
- public XAWTScrollBarButton(int direction)
- {
+ XAWTScrollBarButton(int direction) {
super(direction);
switch (direction) {
@@ -699,6 +674,7 @@
setForeground(uidefaults.getColor("ScrollBar.foreground"));
}
+ @Override
public Dimension getPreferredSize() {
switch (direction) {
case NORTH:
@@ -711,18 +687,22 @@
}
}
+ @Override
public Dimension getMinimumSize() {
return getPreferredSize();
}
+ @Override
public Dimension getMaximumSize() {
return getPreferredSize();
}
+ @Override
public boolean isFocusTraversable() {
return false;
}
+ @Override
public void paint(Graphics g)
{
int w = getWidth();
@@ -838,19 +818,16 @@
}
}
+ final class XAWTScrollBarUI extends BasicScrollBarUI {
- class XAWTScrollBarUI extends BasicScrollBarUI
- {
- public XAWTScrollBarUI() {
- super();
- }
-
+ @Override
protected void installDefaults()
{
super.installDefaults();
scrollbar.setBorder(new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight) );
}
+ @Override
protected void configureScrollBarColors() {
UIDefaults uidefaults = XToolkit.getUIDefaults();
Color bg = scrollbar.getBackground();
@@ -873,12 +850,14 @@
}
+ @Override
protected JButton createDecreaseButton(int orientation) {
JButton b = new XAWTScrollBarButton(orientation);
return b;
}
+ @Override
protected JButton createIncreaseButton(int orientation) {
JButton b = new XAWTScrollBarButton(orientation);
return b;
@@ -892,12 +871,14 @@
return incrButton;
}
+ @Override
public void paint(Graphics g, JComponent c) {
paintTrack(g, c, getTrackBounds());
Rectangle thumbBounds = getThumbBounds();
paintThumb(g, c, thumbBounds);
}
+ @Override
public void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
{
if(!scrollbar.isEnabled()) {
@@ -926,17 +907,18 @@
}
}
+ final class AWTTextArea extends JTextArea implements DocumentListener {
- class AWTTextArea extends JTextArea implements DocumentListener {
- boolean isFocused = false;
- XTextAreaPeer peer;
+ private boolean isFocused = false;
+ private final XTextAreaPeer peer;
- public AWTTextArea(String text, XTextAreaPeer peer) {
+ AWTTextArea(String text, XTextAreaPeer peer) {
super(text);
setFocusable(false);
this.peer = peer;
}
+ @Override
public void insertUpdate(DocumentEvent e) {
if (peer != null) {
peer.postEvent(new TextEvent(peer.target,
@@ -944,6 +926,7 @@
}
}
+ @Override
public void removeUpdate(DocumentEvent e) {
if (peer != null) {
peer.postEvent(new TextEvent(peer.target,
@@ -951,6 +934,7 @@
}
}
+ @Override
public void changedUpdate(DocumentEvent e) {
if (peer != null) {
peer.postEvent(new TextEvent(peer.target,
@@ -971,6 +955,7 @@
super.processFocusEvent(fe);
}
+ @Override
public boolean hasFocus() {
return isFocused;
}
@@ -991,6 +976,7 @@
processInputMethodEvent(e);
}
+ @Override
public void updateUI() {
ComponentUI ui = new AWTTextAreaUI();
setUI(ui);
@@ -998,6 +984,7 @@
// Fix for 4915454 - override the default implementation to avoid
// loading SystemFlavorMap and associated classes.
+ @Override
public void setTransferHandler(TransferHandler newHandler) {
TransferHandler oldHandler = (TransferHandler)
getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
@@ -1010,9 +997,8 @@
}
}
+ final class XAWTScrollPaneUI extends BasicScrollPaneUI {
- class XAWTScrollPaneUI extends BasicScrollPaneUI
- {
private final Border vsbMarginBorderR = new EmptyBorder(0, 2, 0, 0);
private final Border vsbMarginBorderL = new EmptyBorder(0, 0, 0, 2);
private final Border hsbMarginBorder = new EmptyBorder(2, 0, 0, 0);
@@ -1022,12 +1008,14 @@
private PropertyChangeListener propertyChangeHandler;
+ @Override
protected void installListeners(JScrollPane scrollPane) {
super.installListeners(scrollPane);
propertyChangeHandler = createPropertyChangeHandler();
scrollPane.addPropertyChangeListener(propertyChangeHandler);
}
+ @Override
public void paint(Graphics g, JComponent c) {
Border vpBorder = scrollpane.getViewportBorder();
if (vpBorder != null) {
@@ -1043,6 +1031,7 @@
private PropertyChangeListener createPropertyChangeHandler() {
return new PropertyChangeListener() {
+ @Override
public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
@@ -1067,7 +1056,7 @@
return c.getComponentOrientation().isLeftToRight();
}
-
+ @Override
protected void installDefaults(JScrollPane scrollpane) {
Border b = scrollpane.getBorder();
UIDefaults uidefaults = XToolkit.getUIDefaults();
@@ -1094,6 +1083,7 @@
}
}
+ @Override
protected void uninstallDefaults(JScrollPane c) {
super.uninstallDefaults(c);
@@ -1115,15 +1105,15 @@
}
}
+ private class AWTTextPane extends JScrollPane implements FocusListener {
- private class AWTTextPane extends JScrollPane implements FocusListener {
- JTextArea jtext;
- XWindow xwin;
+ private final JTextArea jtext;
+ private final XWindow xwin;
- Color control = SystemColor.control;
- Color focus = SystemColor.activeCaptionBorder;
+ private final Color control = SystemColor.control;
+ private final Color focus = SystemColor.activeCaptionBorder;
- public AWTTextPane(JTextArea jt, XWindow xwin, Container parent) {
+ AWTTextPane(JTextArea jt, XWindow xwin, Container parent) {
super(jt);
this.xwin = xwin;
setDoubleBuffered(true);
@@ -1148,6 +1138,7 @@
}
}
+ @Override
public void focusGained(FocusEvent e) {
Graphics g = getGraphics();
Rectangle r = getViewportBorderBounds();
@@ -1156,6 +1147,7 @@
g.dispose();
}
+ @Override
public void focusLost(FocusEvent e) {
Graphics g = getGraphics();
Rectangle r = getViewportBorderBounds();
@@ -1168,19 +1160,23 @@
return (Window) xwin.target;
}
+ @Override
public ComponentPeer getPeer() {
return (ComponentPeer) (xwin);
}
+ @Override
public void updateUI() {
ComponentUI ui = new XAWTScrollPaneUI();
setUI(ui);
}
+ @Override
public JScrollBar createVerticalScrollBar() {
return new XAWTScrollBar(JScrollBar.VERTICAL);
}
+ @Override
public JScrollBar createHorizontalScrollBar() {
return new XAWTScrollBar(JScrollBar.HORIZONTAL);
}
@@ -1189,18 +1185,19 @@
return this.jtext;
}
+ @Override
public Graphics getGraphics() {
return xwin.getGraphics();
}
+ final class XAWTScrollBar extends ScrollBar {
- class XAWTScrollBar extends ScrollBar {
-
- public XAWTScrollBar(int i) {
+ XAWTScrollBar(int i) {
super(i);
setFocusable(false);
}
+ @Override
public void updateUI() {
ComponentUI ui = new XAWTScrollBarUI();
setUI(ui);
@@ -1214,12 +1211,13 @@
private Color control = SystemColor.controlShadow;
private boolean isRaised;
- public BevelBorder(boolean isRaised, Color darkShadow, Color lightShadow) {
+ BevelBorder(boolean isRaised, Color darkShadow, Color lightShadow) {
this.isRaised = isRaised;
this.darkShadow = darkShadow;
this.lightShadow = lightShadow;
}
+ @Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
g.setColor((isRaised) ? lightShadow : darkShadow);
g.drawLine(x, y, x+w-1, y); // top
@@ -1238,10 +1236,12 @@
g.drawLine(x+w-2, y+h-2, x+w-2, y+1); // right
}
+ @Override
public Insets getBorderInsets(Component c) {
return getBorderInsets(c, new Insets(0,0,0,0));
}
+ @Override
public Insets getBorderInsets(Component c, Insets insets) {
insets.top = insets.left = insets.bottom = insets.right = 2;
return insets;
--- a/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -97,6 +97,7 @@
firstChangeSkipped = true;
}
+ @Override
public void dispose() {
XToolkit.specialPeerMap.remove(xtext);
// visible caret has a timer thread which must be stopped
@@ -136,10 +137,10 @@
setFont(font);
}
-
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public void setEditable(boolean editable) {
if (xtext != null) {
xtext.setEditable(editable);
@@ -150,6 +151,7 @@
/**
* @see java.awt.peer.ComponentPeer
*/
+ @Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (xtext != null) {
@@ -161,22 +163,23 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
-
+ @Override
public InputMethodRequests getInputMethodRequests() {
if (xtext != null) return xtext.getInputMethodRequests();
else return null;
}
+ @Override
void handleJavaInputMethodEvent(InputMethodEvent e) {
if (xtext != null)
xtext.processInputMethodEventImpl(e);
}
-
/**
* @see java.awt.peer.TextFieldPeer
*/
+ @Override
public void setEchoChar(char c) {
if (xtext != null) {
xtext.setEchoChar(c);
@@ -188,6 +191,7 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public int getSelectionStart() {
return xtext.getSelectionStart();
}
@@ -195,6 +199,7 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public int getSelectionEnd() {
return xtext.getSelectionEnd();
}
@@ -202,6 +207,7 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public String getText() {
return xtext.getText();
}
@@ -209,12 +215,13 @@
/**
* @see java.awt.peer.TextComponentPeer
*/
- public void setText(String txt) {
- setXAWTTextField(txt);
+ @Override
+ public void setText(String text) {
+ setXAWTTextField(text);
repaint();
}
- private boolean setXAWTTextField(String txt) {
+ private void setXAWTTextField(String txt) {
text = txt;
if (xtext != null) {
// JTextField.setText() posts two different events (remove & insert).
@@ -229,29 +236,22 @@
xtext.getDocument().addDocumentListener(xtext);
xtext.setCaretPosition(0);
}
- return true;
}
/**
* to be implemented.
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public void setCaretPosition(int position) {
if (xtext != null) xtext.setCaretPosition(position);
}
- /**
- * DEPRECATED
- * @see java.awt.peer.TextFieldPeer
- */
- public void setEchoCharacter(char c) {
- setEchoChar(c);
- }
-
void repaintText() {
xtext.repaintNow();
}
+ @Override
public void setBackground(Color c) {
if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("target="+ target + ", old=" + background + ", new=" + c);
@@ -264,6 +264,7 @@
repaintText();
}
+ @Override
public void setForeground(Color c) {
foreground = c;
if (xtext != null) {
@@ -274,6 +275,7 @@
repaintText();
}
+ @Override
public void setFont(Font f) {
synchronized (getStateLock()) {
font = f;
@@ -285,14 +287,6 @@
}
/**
- * DEPRECATED
- * @see java.awt.peer.TextFieldPeer
- */
- public Dimension preferredSize(int cols) {
- return getPreferredSize(cols);
- }
-
- /**
* Deselects the the highlighted text.
*/
public void deselect() {
@@ -303,20 +297,19 @@
}
}
-
/**
* to be implemented.
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public int getCaretPosition() {
return xtext.getCaretPosition();
}
-
-
/**
* @see java.awt.peer.TextComponentPeer
*/
+ @Override
public void select(int s, int e) {
xtext.select(s,e);
// Fixed 5100806
@@ -324,29 +317,32 @@
xtext.repaint();
}
-
+ @Override
public Dimension getMinimumSize() {
return xtext.getMinimumSize();
}
+ @Override
public Dimension getPreferredSize() {
return xtext.getPreferredSize();
}
+ @Override
public Dimension getPreferredSize(int cols) {
return getMinimumSize(cols);
}
private static final int PADDING = 16;
+ @Override
public Dimension getMinimumSize(int cols) {
Font f = xtext.getFont();
FontMetrics fm = xtext.getFontMetrics(f);
return new Dimension(fm.charWidth('0') * cols + 10,
fm.getMaxDescent() + fm.getMaxAscent() + PADDING);
-
}
+ @Override
public boolean isFocusable() {
return true;
}
@@ -359,11 +355,10 @@
modifiers));
}
-
protected void disposeImpl() {
}
-
+ @Override
public void repaint() {
if (xtext != null) xtext.repaint();
}
@@ -372,27 +367,32 @@
if (xtext != null) xtext.paint(g);
}
+ @Override
public void print(Graphics g) {
if (xtext != null) {
xtext.print(g);
}
}
+ @Override
public void focusLost(FocusEvent e) {
super.focusLost(e);
xtext.forwardFocusLost(e);
}
+ @Override
public void focusGained(FocusEvent e) {
super.focusGained(e);
xtext.forwardFocusGained(e);
}
+ @Override
void handleJavaKeyEvent(KeyEvent e) {
AWTAccessor.getComponentAccessor().processEvent(xtext,e);
}
+ @Override
public void handleJavaMouseEvent( MouseEvent mouseEvent ) {
super.handleJavaMouseEvent(mouseEvent);
if (xtext != null) {
@@ -405,26 +405,21 @@
}
}
-
/**
* DEPRECATED
*/
+ @Override
public Dimension minimumSize() {
return getMinimumSize();
}
- /**
- * DEPRECATED
- */
- public Dimension minimumSize(int cols) {
- return getMinimumSize(cols);
- }
-
+ @Override
public void setVisible(boolean b) {
super.setVisible(b);
if (xtext != null) xtext.setVisible(b);
}
+ @Override
public void setBounds(int x, int y, int width, int height, int op) {
super.setBounds(x, y, width, height, op);
if (xtext != null) {
@@ -451,47 +446,11 @@
}
}
-
- //
- // Accessibility support
- //
-
- // stub functions: to be fully implemented in a future release
- public int getIndexAtPoint(int x, int y) { return -1; }
- public Rectangle getCharacterBounds(int i) { return null; }
- public long filterEvents(long mask) { return 0; }
-
-
- /* To be fully implemented in a future release
-
- int oldSelectionStart;
- int oldSelectionEnd;
-
- public native int getIndexAtPoint(int x, int y);
- public native Rectangle getCharacterBounds(int i);
- public native long filterEvents(long mask);
+ final class AWTTextFieldUI extends MotifPasswordFieldUI {
- /**
- * Handle a change in the text selection endpoints
- * (Note: could be simply a change in the caret location)
- *
- public void selectionValuesChanged(int start, int end) {
- return; // Need to write implemetation of this.
- }
- */
-
+ private JTextField jtf;
- class AWTTextFieldUI extends MotifPasswordFieldUI {
-
- /**
- * Creates a UI for a JTextField.
- *
- * @param c the text field
- * @return the UI
- */
- JTextField jtf;
-
-
+ @Override
protected String getPropertyPrefix() {
JTextComponent comp = getComponent();
if (comp instanceof JPasswordField && ((JPasswordField)comp).echoCharIsSet()) {
@@ -501,6 +460,7 @@
}
}
+ @Override
public void installUI(JComponent c) {
super.installUI(c);
@@ -557,6 +517,7 @@
}
}
+ @Override
protected void installKeyboardActions() {
super.installKeyboardActions();
@@ -574,21 +535,19 @@
}
}
+ @Override
protected Caret createCaret() {
return new XTextAreaPeer.XAWTCaret();
}
}
- class XAWTTextField extends JPasswordField
- implements ActionListener,
- DocumentListener
- {
+ final class XAWTTextField extends JPasswordField
+ implements ActionListener, DocumentListener {
- boolean isFocused = false;
+ private boolean isFocused = false;
+ private final XComponentPeer peer;
- XComponentPeer peer;
-
- public XAWTTextField(String text, XComponentPeer peer, Container parent) {
+ XAWTTextField(String text, XComponentPeer peer, Container parent) {
super(text);
this.peer = peer;
setDoubleBuffered(true);
@@ -603,6 +562,7 @@
}
+ @Override
public void actionPerformed( ActionEvent actionEvent ) {
peer.postEvent(new ActionEvent(peer.target,
ActionEvent.ACTION_PERFORMED,
@@ -612,6 +572,7 @@
}
+ @Override
public void insertUpdate(DocumentEvent e) {
if (peer != null) {
peer.postEvent(new TextEvent(peer.target,
@@ -619,6 +580,7 @@
}
}
+ @Override
public void removeUpdate(DocumentEvent e) {
if (peer != null) {
peer.postEvent(new TextEvent(peer.target,
@@ -626,6 +588,7 @@
}
}
+ @Override
public void changedUpdate(DocumentEvent e) {
if (peer != null) {
peer.postEvent(new TextEvent(peer.target,
@@ -633,33 +596,32 @@
}
}
+ @Override
public ComponentPeer getPeer() {
return (ComponentPeer) peer;
}
-
public void repaintNow() {
paintImmediately(getBounds());
}
+ @Override
public Graphics getGraphics() {
return peer.getGraphics();
}
+ @Override
public void updateUI() {
ComponentUI ui = new AWTTextFieldUI();
setUI(ui);
}
-
void forwardFocusGained( FocusEvent e) {
isFocused = true;
FocusEvent fe = CausedFocusEvent.retarget(e, this);
super.processFocusEvent(fe);
-
}
-
void forwardFocusLost( FocusEvent e) {
isFocused = false;
FocusEvent fe = CausedFocusEvent.retarget(e, this);
@@ -667,11 +629,11 @@
}
+ @Override
public boolean hasFocus() {
return isFocused;
}
-
public void processInputMethodEventImpl(InputMethodEvent e) {
processInputMethodEvent(e);
}
@@ -686,6 +648,7 @@
// Fix for 4915454 - override the default implementation to avoid
// loading SystemFlavorMap and associated classes.
+ @Override
public void setTransferHandler(TransferHandler newHandler) {
TransferHandler oldHandler = (TransferHandler)
getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
@@ -697,6 +660,7 @@
firePropertyChange("transferHandler", oldHandler, newHandler);
}
+ @Override
public void setEchoChar(char c) {
super.setEchoChar(c);
((AWTTextFieldUI)ui).installKeyboardActions();
--- a/jdk/src/windows/classes/sun/awt/windows/WButtonPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WButtonPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
-class WButtonPeer extends WComponentPeer implements ButtonPeer {
+final class WButtonPeer extends WComponentPeer implements ButtonPeer {
static {
initIDs();
@@ -84,13 +84,6 @@
}
/**
- * DEPRECATED
- */
- public Dimension minimumSize() {
- return getMinimumSize();
- }
-
- /**
* Initialize JNI field and method IDs
*/
private static native void initIDs();
--- a/jdk/src/windows/classes/sun/awt/windows/WCheckboxPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WCheckboxPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
import java.awt.peer.*;
import java.awt.event.ItemEvent;
-public class WCheckboxPeer extends WComponentPeer implements CheckboxPeer {
+final class WCheckboxPeer extends WComponentPeer implements CheckboxPeer {
// CheckboxPeer implementation
@@ -100,12 +100,4 @@
}
});
}
-
- /**
- * DEPRECATED
- */
- public Dimension minimumSize() {
- return getMinimumSize();
- }
-
}
--- a/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
import java.awt.event.WindowAdapter;
import sun.awt.SunToolkit;
-class WChoicePeer extends WComponentPeer implements ChoicePeer {
+final class WChoicePeer extends WComponentPeer implements ChoicePeer {
// WComponentPeer overrides
@@ -151,12 +151,5 @@
return fm.getHeight() * maxItems;
}
- /**
- * DEPRECATED
- */
- public Dimension minimumSize() {
- return getMinimumSize();
- }
-
native void closeList();
}
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,6 @@
import sun.java2d.d3d.D3DSurfaceData;
import sun.java2d.opengl.OGLSurfaceData;
import sun.java2d.pipe.Region;
-import sun.awt.DisplayChangedListener;
import sun.awt.PaintEventDispatcher;
import sun.awt.SunToolkit;
import sun.awt.event.IgnorePaintEvent;
@@ -884,13 +883,6 @@
/**
* DEPRECATED
*/
- public Dimension minimumSize() {
- return getMinimumSize();
- }
-
- /**
- * DEPRECATED
- */
public Dimension preferredSize() {
return getPreferredSize();
}
--- a/jdk/src/windows/classes/sun/awt/windows/WLabelPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WLabelPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
import java.awt.*;
import java.awt.peer.*;
-class WLabelPeer extends WComponentPeer implements LabelPeer {
+final class WLabelPeer extends WComponentPeer implements LabelPeer {
// ComponentPeer overrides
@@ -82,12 +82,4 @@
super.initialize();
}
-
- /**
- * DEPRECATED
- */
- public Dimension minimumSize() {
- return getMinimumSize();
- }
-
}
--- a/jdk/src/windows/classes/sun/awt/windows/WListPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WListPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,13 +29,8 @@
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
-class WListPeer extends WComponentPeer implements ListPeer {
-
- // ComponentPeer overrides
+final class WListPeer extends WComponentPeer implements ListPeer {
- public Dimension minimumSize() {
- return minimumSize(4);
- }
public boolean isFocusable() {
return true;
}
--- a/jdk/src/windows/classes/sun/awt/windows/WScrollbarPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WScrollbarPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,7 @@
import java.awt.peer.*;
import java.awt.event.AdjustmentEvent;
-class WScrollbarPeer extends WComponentPeer implements ScrollbarPeer {
-
+final class WScrollbarPeer extends WComponentPeer implements ScrollbarPeer {
// Returns width for vertial scrollbar as SM_CXHSCROLL,
// height for horizontal scrollbar as SM_CYVSCROLL
@@ -140,12 +139,4 @@
public boolean shouldClearRectBeforePaint() {
return false;
}
-
- /**
- * DEPRECATED
- */
- public Dimension minimumSize() {
- return getMinimumSize();
- }
-
}
--- a/jdk/src/windows/classes/sun/awt/windows/WTextAreaPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WTextAreaPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,34 +30,36 @@
import java.awt.im.InputMethodRequests;
-class WTextAreaPeer extends WTextComponentPeer implements TextAreaPeer {
+final class WTextAreaPeer extends WTextComponentPeer implements TextAreaPeer {
// WComponentPeer overrides
+ @Override
public Dimension getMinimumSize() {
return getMinimumSize(10, 60);
}
// TextAreaPeer implementation
- /* This should eventually be a direct native method. */
- public void insert(String txt, int pos) {
- insertText(txt, pos);
+ @Override
+ public void insert(String text, int pos) {
+ replaceRange(text, pos, pos);
}
- /* This should eventually be a direct native method. */
- public void replaceRange(String txt, int start, int end) {
- replaceText(txt, start, end);
- }
+ @Override
+ public native void replaceRange(String text, int start, int end);
+ @Override
public Dimension getPreferredSize(int rows, int cols) {
return getMinimumSize(rows, cols);
}
+ @Override
public Dimension getMinimumSize(int rows, int cols) {
FontMetrics fm = getFontMetrics(((TextArea)target).getFont());
return new Dimension(fm.charWidth('0') * cols + 20, fm.getHeight() * rows + 20);
}
+ @Override
public InputMethodRequests getInputMethodRequests() {
return null;
}
@@ -68,42 +70,6 @@
super(target);
}
+ @Override
native void create(WComponentPeer parent);
-
- // native callbacks
-
-
- // deprecated methods
-
- /**
- * DEPRECATED but, for now, still called by insert(String, int).
- */
- public native void insertText(String txt, int pos);
-
- /**
- * DEPRECATED but, for now, still called by replaceRange(String, int, int).
- */
- public native void replaceText(String txt, int start, int end);
-
- /**
- * DEPRECATED
- */
- public Dimension minimumSize() {
- return getMinimumSize();
- }
-
- /**
- * DEPRECATED
- */
- public Dimension minimumSize(int rows, int cols) {
- return getMinimumSize(rows, cols);
- }
-
- /**
- * DEPRECATED
- */
- public Dimension preferredSize(int rows, int cols) {
- return getPreferredSize(rows, cols);
- }
-
}
--- a/jdk/src/windows/classes/sun/awt/windows/WTextComponentPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WTextComponentPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,14 +38,20 @@
// TextComponentPeer implementation
+ @Override
public void setEditable(boolean editable) {
enableEditing(editable);
setBackground(((TextComponent)target).getBackground());
}
+ @Override
public native String getText();
- public native void setText(String txt);
+ @Override
+ public native void setText(String text);
+ @Override
public native int getSelectionStart();
+ @Override
public native int getSelectionEnd();
+ @Override
public native void select(int selStart, int selEnd);
// Toolkit & peer internals
@@ -54,6 +60,7 @@
super(target);
}
+ @Override
void initialize() {
TextComponent tc = (TextComponent)target;
String text = tc.getText();
@@ -64,14 +71,12 @@
select(tc.getSelectionStart(), tc.getSelectionEnd());
setEditable(tc.isEditable());
-// oldSelectionStart = -1; // accessibility support
-// oldSelectionEnd = -1; // accessibility support
-
super.initialize();
}
native void enableEditing(boolean e);
+ @Override
public boolean isFocusable() {
return true;
}
@@ -81,6 +86,7 @@
* unfortunately resets the selection, but seems to be the
* only way to get this to work.
*/
+ @Override
public void setCaretPosition(int pos) {
select(pos,pos);
}
@@ -89,6 +95,7 @@
* Get the caret position by looking up the end of the current
* selection.
*/
+ @Override
public int getCaretPosition() {
return getSelectionStart();
}
@@ -105,34 +112,8 @@
*/
private static native void initIDs();
- // stub functions: to be fully implemented in a future release
- public int getIndexAtPoint(int x, int y) { return -1; }
- public Rectangle getCharacterBounds(int i) { return null; }
- public long filterEvents(long mask) { return 0; }
-
+ @Override
public boolean shouldClearRectBeforePaint() {
return false;
}
-
-//
-// Accessibility support
-//
-
-/* To be fully implemented in a future release
-
- int oldSelectionStart;
- int oldSelectionEnd;
-
- public native int getIndexAtPoint(int x, int y);
- public native Rectangle getCharacterBounds(int i);
- public native long filterEvents(long mask);
-
- /**
- * Handle a change in the text selection endpoints
- * (Note: could be simply a change in the caret location)
- *
- public void selectionValuesChanged(int start, int end) {
- return; // Need to write implementation of this.
- }
-*/
}
--- a/jdk/src/windows/classes/sun/awt/windows/WTextFieldPeer.java Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WTextFieldPeer.java Tue Oct 08 23:34:20 2013 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -31,16 +31,18 @@
import java.awt.event.KeyEvent;
import java.awt.im.InputMethodRequests;
-class WTextFieldPeer extends WTextComponentPeer implements TextFieldPeer {
+final class WTextFieldPeer extends WTextComponentPeer implements TextFieldPeer {
// WComponentPeer overrides
+ @Override
public Dimension getMinimumSize() {
FontMetrics fm = getFontMetrics(((TextField)target).getFont());
return new Dimension(fm.stringWidth(getText()) + 24,
fm.getHeight() + 8);
}
+ @Override
public boolean handleJavaKeyEvent(KeyEvent e) {
switch (e.getID()) {
case KeyEvent.KEY_TYPED:
@@ -56,35 +58,35 @@
// TextFieldPeer implementation
+ @Override
+ public native void setEchoChar(char echoChar);
- /* This should eventually be a direct native method. */
- public void setEchoChar(char c) {
- setEchoCharacter(c);
- }
-
+ @Override
public Dimension getPreferredSize(int cols) {
return getMinimumSize(cols);
}
+ @Override
public Dimension getMinimumSize(int cols) {
FontMetrics fm = getFontMetrics(((TextField)target).getFont());
return new Dimension(fm.charWidth('0') * cols + 24, fm.getHeight() + 8);
}
+ @Override
public InputMethodRequests getInputMethodRequests() {
- return null;
+ return null;
}
-
-
// Toolkit & peer internals
WTextFieldPeer(TextField target) {
super(target);
}
+ @Override
native void create(WComponentPeer parent);
+ @Override
void initialize() {
TextField tf = (TextField)target;
if (tf.echoCharIsSet()) {
@@ -92,33 +94,4 @@
}
super.initialize();
}
-
- // deprecated methods
-
- /**
- * DEPRECATED but, for now, called by setEchoChar(char).
- */
- public native void setEchoCharacter(char c);
-
- /**
- * DEPRECATED
- */
- public Dimension minimumSize() {
- return getMinimumSize();
- }
-
- /**
- * DEPRECATED
- */
- public Dimension minimumSize(int cols) {
- return getMinimumSize(cols);
- }
-
- /**
- * DEPRECATED
- */
- public Dimension preferredSize(int cols) {
- return getPreferredSize(cols);
- }
-
}
--- a/jdk/src/windows/native/sun/windows/awt_TextArea.cpp Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_TextArea.cpp Tue Oct 08 23:34:20 2013 +0400
@@ -767,11 +767,11 @@
/*
* Class: sun_awt_windows_WTextAreaPeer
- * Method: replaceText
+ * Method: replaceRange
* Signature: (Ljava/lang/String;II)V
*/
JNIEXPORT void JNICALL
-Java_sun_awt_windows_WTextAreaPeer_replaceText(JNIEnv *env, jobject self,
+Java_sun_awt_windows_WTextAreaPeer_replaceRange(JNIEnv *env, jobject self,
jstring text,
jint start, jint end)
{
@@ -791,19 +791,4 @@
CATCH_BAD_ALLOC;
}
-
-/*
- * Class: sun_awt_windows_WTextAreaPeer
- * Method: insertText
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_windows_WTextAreaPeer_insertText(JNIEnv *env, jobject self,
- jstring text, jint pos)
-{
- Java_sun_awt_windows_WTextAreaPeer_replaceText(env, self, text, pos, pos);
-}
-
} /* extern "C" */
-
-
--- a/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp Tue Oct 08 23:34:20 2013 +0400
@@ -987,30 +987,6 @@
// Accessibility support
//
-/* To be fully implemented in a future release
- *
- * Class: sun_awt_windows_WTextComponentPeer
- * Method: getIndexAtPoint
- * Signature: (II)I
- *
-JNIEXPORT jlong JNICALL
-Java_sun_awt_windows_WTextComponentPeer_filterEvents(JNIEnv *env, jobject self, jlong mask)
-{
- TRY;
-
- PDATA pData;
- JNI_CHECK_PEER_RETURN_NULL(self);
- AwtTextComponent* c = (AwtTextComponent*)pData;
-
- jlong oldMask = c->javaEventsMask;
- c->javaEventsMask = mask;
-
- return oldMask;
-
- CATCH_BAD_ALLOC_RET(0);
-}
-*/
-
// [[[FIXME]]] need to switch to rich edit field; look for EN_SELCHANGE event instead
/*
* Handle WmKeyDown to catch keystrokes which may move the caret,
@@ -1051,112 +1027,4 @@
return AwtComponent::WmKeyDown(wkey, repCnt, flags, system);
}
*/
-
-/* To be fully implemented in a future release
- *
- * Class: sun_awt_windows_WTextComponentPeer
- * Method: getIndexAtPoint
- * Signature: (II)I
- *
-JNIEXPORT jint JNICALL
-Java_sun_awt_windows_WTextComponentPeer_getIndexAtPoint(JNIEnv *env, jobject self, jint x, jint y)
-{
- TRY;
-
- PDATA pData;
-// JNI_CHECK_PEER_RETURN_VAL(self, -1); [[[FIXME]]] Peter Korn -> should return -1 here
- JNI_CHECK_PEER_RETURN_NULL(self);
- AwtTextComponent* c = (AwtTextComponent*)pData;
- int indicies = c->SendMessage(EM_CHARFROMPOS, (WPARAM) 0, (LPARAM) MAKELPARAM(x, y));
- int index = LOWORD(indicies); // index into the line the (x,y) coord is on
- int lineIndex = c->SendMessage(EM_LINEINDEX, HIWORD(indicies)); // index of start of line
- return (index + lineIndex);
-
- CATCH_BAD_ALLOC_RET(-1);
-}
-*/
-
-/* To be fully implemented in a future release
- *
- * Class: sun_awt_windows_WTextComponentPeer
- * Method: getCharacterBounds
- * Signature: (I)Ljava/awt/Rectangle;
- *
-JNIEXPORT jobject JNICALL
-Java_sun_awt_windows_WTextComponentPeer_getCharacterBounds(JNIEnv *env, jobject self, jint i)
-{
-
- // loop through lines with EM_LINELENGTH? e.g.:
- // line = 0; ttl = 0; // index is passed in as 'i' above
- // while (ttl < index) {
- // ttl += SendMessage(EM_LINELENGTH, line++);
- // }
- // line-- (decrement back again)
- // alternately, we could use EM_LINEINDEX to the same effect; perhaps slightly cleaner:
- // computedIndex = 0; line = 0;
- // while (computedIndex < index) {
- // computedIndex = SendMessage(EM_LINEINDEX, 1 + line++);
- // }
- // line--;
-
- // EM_POSFROMCHAR - convert char index into a Point
- // wParam = (LPPOINT) lpPoint; // address of structure
- // receiving character position
- // lParam = (LPARAM) wCharIndex; // zero-based index of character
- //
- // still need to turn the above into a Rect somehow...
- // (use font metrics on font info for letter to get height? use
- // getLineHeight type of message?).
-
- // WM_GETFONT - get the font struct for the window control
- // wParam = lParam = 0
- // returns an HFONT
- // -or-
- // GetTextMetrics(hDC) to get the text info for the font selected
- // into the hDC of the control (tmHeight is what we want in the
- // TEXTMETRIC struct).
- // also GetCharWidth32() with the char at the index in question to get
- // the width of that char
- // *** Can't use GetTextMetrics/GetCharWidth32, as we don't have an hDC!! ***
-
- TRY;
-
- PDATA pData;
- JNI_CHECK_PEER_RETURN_NULL(self);
- AwtComponent* c = (AwtComponent*)pData;
-/*
- int line = 0;
- int lineIndex = 0;
- while (lineIndex < i) {
- lineIndex = c->SendMessage(EM_LINEINDEX, 1 + line++);
- }
- line--; // line is now the line which contains our character at position 'i'
- int offsetIndex = i - lineIndex; // offsetIndex is now distance in on the line
-* /
- POINT p;
-
- c->SendMessage(EM_POSFROMCHAR, (WPARAM) &p, (LPARAM) i); // x coord is meaningful; y may not be
-
- // need to calculate charWidth, charHeight, and set p.y to something meangful
-
- jint charWidth;
- jint charHeight;
-
-/*
- HFONT font = c->SendMessage(WM_GETFONT);
- if (GetCharWidth32(c->hdc, i, i, &charWidth) != 0) { // [[[FIXME]]] need to get hDC!
-
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject rect = JNU_NewObjectByName(env, "java/awt/Rectangle", "(IIII)V",
- (jint) p.x, (jint) p.y, charWidth, charHeight);
-
- return rect;
- }
-* /
- return (jobject) 0;
-
- CATCH_BAD_ALLOC_RET(0);
-}
-*/
-
} /* extern "C" */
--- a/jdk/src/windows/native/sun/windows/awt_TextField.cpp Tue Oct 08 21:24:49 2013 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_TextField.cpp Tue Oct 08 23:34:20 2013 +0400
@@ -316,12 +316,12 @@
/*
* Class: sun_awt_windows_WTextFieldPeer
- * Method: setEchoCharacter
+ * Method: setEchoChar
* Signature: (C)V
*/
JNIEXPORT void JNICALL
-Java_sun_awt_windows_WTextFieldPeer_setEchoCharacter(JNIEnv *env, jobject self,
- jchar ch)
+Java_sun_awt_windows_WTextFieldPeer_setEchoChar(JNIEnv *env, jobject self,
+ jchar ch)
{
TRY;