bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
public void update() { stop(); Caret c = caret; if (c != null) { setDelay(c.getBlinkRate()); if (editable) start(); else c.setVisible(false); } }
public void update() { stop(); Caret c = caret; if (c != null) { setDelay(c.getBlinkRate()); if (editable) start(); else c.setVisible(false); } }
406
public void update() { stop(); Caret c = caret; if (c != null) { setDelay(c.getBlinkRate()); if (editable) start(); else c.setVisible(false); } }
public void update() { stop(); Caret c = caret; if (c != null) { setDelay(c.getBlinkRate()); if (editable) start(); else c.setVisible(false); } }
407
public JTextComponent() { Keymap defkeymap = getKeymap(DEFAULT_KEYMAP); boolean creatingKeymap = false; if (defkeymap == null) { defkeymap = addKeymap(DEFAULT_KEYMAP, null); defkeymap.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction()); creatingKeymap = true; } caretBlinkTimer = new CaretBlinkTimer(); setFocusable(true); setEditable(true); enableEvents(AWTEvent.KEY_EVENT_MASK); updateUI(); // need to do this after updateUI() if (creatingKeymap) loadKeymap(defkeymap, new KeyBinding[] { new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), DefaultEditorKit.backwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), DefaultEditorKit.forwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \b"), DefaultEditorKit.deletePrevCharAction), new KeyBinding(KeyStroke.getKeyStroke("typed \u007f"), DefaultEditorKit.deleteNextCharAction) }, getActions()); }
public JTextComponent() { Keymap defkeymap = getKeymap(DEFAULT_KEYMAP); boolean creatingKeymap = false; if (defkeymap == null) { defkeymap = addKeymap(DEFAULT_KEYMAP, null); defkeymap.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction()); creatingKeymap = true; } caretBlinkTimer = new CaretBlinkTimer(); setFocusable(true); setEditable(true); enableEvents(AWTEvent.KEY_EVENT_MASK); updateUI(); // need to do this after updateUI() if (creatingKeymap) loadKeymap(defkeymap, new KeyBinding[] { new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), DefaultEditorKit.backwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), DefaultEditorKit.forwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \b"), DefaultEditorKit.deletePrevCharAction), new KeyBinding(KeyStroke.getKeyStroke("typed \u007f"), DefaultEditorKit.deleteNextCharAction) }, getActions()); }
408
public JTextComponent() { Keymap defkeymap = getKeymap(DEFAULT_KEYMAP); boolean creatingKeymap = false; if (defkeymap == null) { defkeymap = addKeymap(DEFAULT_KEYMAP, null); defkeymap.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction()); creatingKeymap = true; } caretBlinkTimer = new CaretBlinkTimer(); setFocusable(true); setEditable(true); enableEvents(AWTEvent.KEY_EVENT_MASK); updateUI(); // need to do this after updateUI() if (creatingKeymap) loadKeymap(defkeymap, new KeyBinding[] { new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), DefaultEditorKit.backwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), DefaultEditorKit.forwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \b"), DefaultEditorKit.deletePrevCharAction), new KeyBinding(KeyStroke.getKeyStroke("typed \u007f"), DefaultEditorKit.deleteNextCharAction) }, getActions()); }
public JTextComponent() { Keymap defkeymap = getKeymap(DEFAULT_KEYMAP); boolean creatingKeymap = false; if (defkeymap == null) { defkeymap = addKeymap(DEFAULT_KEYMAP, null); defkeymap.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction()); creatingKeymap = true; } caretBlinkTimer = new CaretBlinkTimer(); setFocusable(true); setEditable(true); enableEvents(AWTEvent.KEY_EVENT_MASK); updateUI(); // need to do this after updateUI() if (creatingKeymap) loadKeymap(defkeymap, new KeyBinding[] { new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), DefaultEditorKit.backwardAction), new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), DefaultEditorKit.forwardAction), new KeyBinding(KeyStroke.getKeyStroke("typed \b"), DefaultEditorKit.deletePrevCharAction), new KeyBinding(KeyStroke.getKeyStroke("typed \u007f"), DefaultEditorKit.deleteNextCharAction) }, getActions()); }
409
public AccessibleContext getAccessibleContext() { return null; }
public AccessibleContext getAccessibleContext() { return null; }
410
public int getCaretPosition() { return caret.getDot(); }
public int getCaretPosition() { return caret.getDot(); }
411
public int getCaretPosition() { return caret.getDot(); }
public int getCaretPosition() { return caret.getDot(); }
412
public Document getDocument() { return doc; }
public Document getDocument() { return doc; }
413
public Insets getMargin() { return margin; }
public Insets getMargin() { return margin; }
414
public Insets getMargin() { return margin; }
public Insets getMargin() { return margin; }
415
public Dimension getPreferredScrollableViewportSize() { return getPreferredSize(); }
public Dimension getPreferredScrollableViewportSize() { return getPreferredSize(); }
416
public Dimension getPreferredScrollableViewportSize() { return getPreferredSize(); }
public Dimension getPreferredScrollableViewportSize() { return getPreferredSize(); }
417
public int getScrollableBlockIncrement(Rectangle visible, int orientation, int direction) { // We return the whole visible area as documented in Sun's API docs. if (orientation == SwingConstants.HORIZONTAL) return visible.width; else if (orientation == SwingConstants.VERTICAL) return visible.height; else throw new IllegalArgumentException("orientation must be either " + "javax.swing.SwingConstants.VERTICAL " + "or " + "javax.swing.SwingConstants.HORIZONTAL" ); }
public int getScrollableBlockIncrement(Rectangle visible, int orientation, int direction) { // We return the whole visible area as documented in Sun's API docs. if (orientation == SwingConstants.HORIZONTAL) return visible.width; else if (orientation == SwingConstants.VERTICAL) return visible.height; else throw new IllegalArgumentException("orientation must be either " + "javax.swing.SwingConstants.VERTICAL " + "or " + "javax.swing.SwingConstants.HORIZONTAL" ); }
418
public int getScrollableBlockIncrement(Rectangle visible, int orientation, int direction) { // We return the whole visible area as documented in Sun's API docs. if (orientation == SwingConstants.HORIZONTAL) return visible.width; else if (orientation == SwingConstants.VERTICAL) return visible.height; else throw new IllegalArgumentException("orientation must be either " + "javax.swing.SwingConstants.VERTICAL " + "or " + "javax.swing.SwingConstants.HORIZONTAL" ); }
public int getScrollableBlockIncrement(Rectangle visible, int orientation, int direction) { // We return the whole visible area as documented in Sun's API docs. if (orientation == SwingConstants.HORIZONTAL) return visible.width; else if (orientation == SwingConstants.VERTICAL) return visible.height; else throw new IllegalArgumentException("orientation must be either " + "javax.swing.SwingConstants.VERTICAL " + "or " + "javax.swing.SwingConstants.HORIZONTAL" ); }
419
public boolean getScrollableTracksViewportHeight() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getHeight() > getPreferredSize().height; return false; }
public boolean getScrollableTracksViewportHeight() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getHeight() > getPreferredSize().height; return false; }
420
public boolean getScrollableTracksViewportWidth() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getWidth() > getPreferredSize().width; return false; }
public boolean getScrollableTracksViewportWidth() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getWidth() > getPreferredSize().width; return false; }
421
public boolean getScrollableTracksViewportWidth() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getWidth() > getPreferredSize().width; return false; }
public boolean getScrollableTracksViewportWidth() { if (getParent() instanceof JViewport) return ((JViewport) getParent()).getWidth() > getPreferredSize().width; return false; }
422
public int getScrollableUnitIncrement(Rectangle visible, int orientation, int direction) { // We return 1/10 of the visible area as documented in Sun's API docs. if (orientation == SwingConstants.HORIZONTAL) return visible.width / 10; else if (orientation == SwingConstants.VERTICAL) return visible.height / 10; else throw new IllegalArgumentException("orientation must be either " + "javax.swing.SwingConstants.VERTICAL " + "or " + "javax.swing.SwingConstants.HORIZONTAL" ); }
public int getScrollableUnitIncrement(Rectangle visible, int orientation, int direction) { // We return 1/10 of the visible area as documented in Sun's API docs. if (orientation == SwingConstants.HORIZONTAL) return visible.width / 10; else if (orientation == SwingConstants.VERTICAL) return visible.height / 10; else throw new IllegalArgumentException("orientation must be either " + "javax.swing.SwingConstants.VERTICAL " + "or " + "javax.swing.SwingConstants.HORIZONTAL" ); }
423
public int getScrollableUnitIncrement(Rectangle visible, int orientation, int direction) { // We return 1/10 of the visible area as documented in Sun's API docs. if (orientation == SwingConstants.HORIZONTAL) return visible.width / 10; else if (orientation == SwingConstants.VERTICAL) return visible.height / 10; else throw new IllegalArgumentException("orientation must be either " + "javax.swing.SwingConstants.VERTICAL " + "or " + "javax.swing.SwingConstants.HORIZONTAL" ); }
public int getScrollableUnitIncrement(Rectangle visible, int orientation, int direction) { // We return 1/10 of the visible area as documented in Sun's API docs. if (orientation == SwingConstants.HORIZONTAL) return visible.width / 10; else if (orientation == SwingConstants.VERTICAL) return visible.height / 10; else throw new IllegalArgumentException("orientation must be either " + "javax.swing.SwingConstants.VERTICAL " + "or " + "javax.swing.SwingConstants.HORIZONTAL" ); }
424
public int getSelectionEnd() { return Math.max(caret.getDot(), caret.getMark()); }
public int getSelectionEnd() { return Math.max(caret.getDot(), caret.getMark()); }
425
public int getSelectionEnd() { return Math.max(caret.getDot(), caret.getMark()); }
public int getSelectionEnd() { return Math.max(caret.getDot(), caret.getMark()); }
426
public int getSelectionStart() { return Math.min(caret.getDot(), caret.getMark()); }
public int getSelectionStart() { return Math.min(caret.getDot(), caret.getMark()); }
427
public int getSelectionStart() { return Math.min(caret.getDot(), caret.getMark()); }
public int getSelectionStart() { return Math.min(caret.getDot(), caret.getMark()); }
428
public TextUI getUI() { return (TextUI) ui; }
public TextUI getUI() { return (TextUI) ui; }
429
public String getUIClassID() { return "TextComponentUI"; }
public String getUIClassID() { return "TextComponentUI"; }
430
public String getUIClassID() { return "TextComponentUI"; }
public String getUIClassID() { return "TextComponentUI"; }
431
public void moveCaretPosition(int position) { if (doc == null) return; if (position < 0 || position > doc.getLength()) throw new IllegalArgumentException(); caret.moveDot(position); }
public void moveCaretPosition(int position) { if (doc == null) return; if (position < 0 || position > doc.getLength()) throw new IllegalArgumentException(); caret.moveDot(position); }
432
public void moveCaretPosition(int position) { if (doc == null) return; if (position < 0 || position > doc.getLength()) throw new IllegalArgumentException(); caret.moveDot(position); }
public void moveCaretPosition(int position) { if (doc == null) return; if (position < 0 || position > doc.getLength()) throw new IllegalArgumentException(); caret.moveDot(position); }
433
protected String paramString() { return "JTextComponent"; }
protected String paramString() { return "JTextComponent"; }
434
public void select(int start, int end) { int length = doc.getLength(); start = Math.max(start, 0); start = Math.min(start, length); end = Math.max(end, 0); end = Math.min(end, length); setCaretPosition(start); moveCaretPosition(end); }
public void select(int start, int end) { int length = doc.getLength(); start = Math.max(start, 0); start = Math.min(start, length); end = Math.max(end, 0); end = Math.min(end, length); setCaretPosition(start); moveCaretPosition(end); }
435
public void select(int start, int end) { int length = doc.getLength(); start = Math.max(start, 0); start = Math.min(start, length); end = Math.max(end, 0); end = Math.min(end, length); setCaretPosition(start); moveCaretPosition(end); }
public void select(int start, int end) { int length = doc.getLength(); start = Math.max(start, 0); start = Math.min(start, length); end = Math.max(end, 0); end = Math.min(end, length); setCaretPosition(start); moveCaretPosition(end); }
436
public void selectAll() { select(0, doc.getLength()); }
public void selectAll() { select(0, doc.getLength()); }
437
public void selectAll() { select(0, doc.getLength()); }
public void selectAll() { select(0, doc.getLength()); }
438
public void setCaretPosition(int position) { if (doc == null) return; if (position < 0 || position > doc.getLength()) throw new IllegalArgumentException(); caret.setDot(position); }
public void setCaretPosition(int position) { if (doc == null) return; if (position < 0 || position > doc.getLength()) throw new IllegalArgumentException(); caret.setDot(position); }
439
public void setCaretPosition(int position) { if (doc == null) return; if (position < 0 || position > doc.getLength()) throw new IllegalArgumentException(); caret.setDot(position); }
public void setCaretPosition(int position) { if (doc == null) return; if (position < 0 || position > doc.getLength()) throw new IllegalArgumentException(); caret.setDot(position); }
440
public void setDocument(Document newDoc) { Document oldDoc = doc; doc = newDoc; firePropertyChange("document", oldDoc, newDoc); revalidate(); repaint(); }
public void setDocument(Document newDoc) { Document oldDoc = doc; doc = newDoc; firePropertyChange("document", oldDoc, newDoc); revalidate(); repaint(); }
441
public void setEditable(boolean newValue) { if (editable == newValue) return; if (newValue == true) caretBlinkTimer.start(); else { caretBlinkTimer.stop(); caret.setVisible(false); } boolean oldValue = editable; editable = newValue; firePropertyChange("editable", oldValue, newValue); }
public void setEditable(boolean newValue) { if (editable == newValue) return; if (newValue == true) caretBlinkTimer.start(); else { caretBlinkTimer.stop(); caret.setVisible(false); } boolean oldValue = editable; editable = newValue; firePropertyChange("editable", oldValue, newValue); }
442
public void setEditable(boolean newValue) { if (editable == newValue) return; if (newValue == true) caretBlinkTimer.start(); else { caretBlinkTimer.stop(); caret.setVisible(false); } boolean oldValue = editable; editable = newValue; firePropertyChange("editable", oldValue, newValue); }
public void setEditable(boolean newValue) { if (editable == newValue) return; if (newValue == true) caretBlinkTimer.start(); else { caretBlinkTimer.stop(); caret.setVisible(false); } boolean oldValue = editable; editable = newValue; firePropertyChange("editable", oldValue, newValue); }
443
public void setSelectionEnd(int end) { select(getSelectionStart(), end); }
public void setSelectionEnd(int end) { select(getSelectionStart(), end); }
444
public void setSelectionEnd(int end) { select(getSelectionStart(), end); }
public void setSelectionEnd(int end) { select(getSelectionStart(), end); }
445
public void setSelectionStart(int start) { select(start, getSelectionEnd()); }
public void setSelectionStart(int start) { select(start, getSelectionEnd()); }
446
public void setSelectionStart(int start) { select(start, getSelectionEnd()); }
public void setSelectionStart(int start) { select(start, getSelectionEnd()); }
447
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
448
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
449
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
450
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
451
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
public void setText(String text) { try { doc.remove(0, doc.getLength()); doc.insertString(0, text, null); } catch (BadLocationException e) { // This can never happen. } }
452
public void setUI(TextUI newUI) { super.setUI(newUI); }
public void setUI(TextUI newUI) { super.setUI(newUI); }
453
public void updateUI() { setUI((TextUI) UIManager.getUI(this)); }
public void updateUI() { setUI((TextUI) UIManager.getUI(this)); }
454
public void updateUI() { setUI((TextUI) UIManager.getUI(this)); }
public void updateUI() { setUI((TextUI) UIManager.getUI(this)); }
455
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { if (this.owner != owner) if (this.owner != null) this.owner.lostOwnership(this, contents); this.owner = owner; this.contents = contents; }
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { if (this.owner != owner) if (this.owner != null) this.owner.lostOwnership(this, contents); this.owner = owner; this.contents = contents; }
456
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { if (this.owner != owner) if (this.owner != null) this.owner.lostOwnership(this, contents); this.owner = owner; this.contents = contents; }
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { if (this.owner != owner) if (this.owner != null) this.owner.lostOwnership(this, contents); this.owner = owner; this.contents = contents; }
457
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { if (this.owner != owner) if (this.owner != null) this.owner.lostOwnership(this, contents); this.owner = owner; this.contents = contents; }
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { if (this.owner != owner) if (this.owner != null) this.owner.lostOwnership(this, contents); this.owner = owner; if (oldOwner != null) oldOwner.lostOwnership(this, oldContents); } FlavorListener[] fs = getFlavorListeners(); if (fs.length > 0) { boolean newFlavors = ((contents != null && oldContents == null) || (contents == null && oldContents != null)); if (!newFlavors && contents != null && oldContents != null) { DataFlavor[] df1 = contents.getTransferDataFlavors(); DataFlavor[] df2 = oldContents.getTransferDataFlavors(); newFlavors = df1.length != df2.length; for (int i = 0; !newFlavors && i < df1.length; i++) newFlavors = !df1[i].equals(df2[i]); } if (newFlavors) { FlavorEvent e = new FlavorEvent(this); for (int i = 0; i < fs.length; i++) fs[i].flavorsChanged(e); } } }
458
public static KeyStroke getKeyStroke(int keyCode, int modifiers) { return (KeyStroke) getAWTKeyStroke(keyCode, modifiers); }
public static KeyStroke getKeyStroke(char keyChar) { return (KeyStroke) getAWTKeyStroke(keyCode, modifiers); }
460
public static KeyStroke getKeyStroke(int keyCode, int modifiers) { return (KeyStroke) getAWTKeyStroke(keyCode, modifiers); }
public static KeyStroke getKeyStroke(int keyCode, int modifiers) { return (KeyStroke) getAWTKeyStroke(keyChar); }
461
public Dimension getPreferredSize() { if (preferredSize != null) return preferredSize; if (ui != null) { Dimension s = ui.getPreferredSize(this); if (s != null) return s; } Dimension p = super.getPreferredSize(); return p; }
public Dimension getPreferredSize() { if (preferredSize != null) return preferredSize; if (ui != null) { Dimension s = ui.getPreferredSize(this); if (s != null) return s; } Dimension p = super.getPreferredSize(); return p; }
462
public Dimension getPreferredSize() { if (preferredSize != null) return preferredSize; if (ui != null) { Dimension s = ui.getPreferredSize(this); if (s != null) return s; } Dimension p = super.getPreferredSize(); return p; }
public Dimension getPreferredSize() { if (preferredSize != null) return preferredSize; if (ui != null) { Dimension s = ui.getPreferredSize(this); if (s != null) return s; } Dimension p = super.getPreferredSize(); return p; }
463
public Dimension getPreferredSize() { if (preferredSize != null) return preferredSize; if (ui != null) { Dimension s = ui.getPreferredSize(this); if (s != null) return s; } Dimension p = super.getPreferredSize(); return p; }
public Dimension getPreferredSize() { if (preferredSize != null) return preferredSize; if (ui != null) { Dimension s = ui.getPreferredSize(this); if (s != null) return s; } Dimension p = super.getPreferredSize(); return p; }
464
int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction);
int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction);
465
int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction);
int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction);
466
public static int min(int a, int b) { return (a < b) ? a : b; }
public static int min(int a, int b) { return (a < b) ? a : b; }
467
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (changeSupport != null) changeSupport.firePropertyChange(propertyName, oldValue, newValue); }
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (changeSupport != null) changeSupport.firePropertyChange(propertyName, oldValue, newValue); }
468
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (changeSupport != null) changeSupport.firePropertyChange(propertyName, oldValue, newValue); }
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (changeSupport != null) changeSupport.firePropertyChange(propertyName, oldValue, newValue); }
469
public InheritableThreadLocal() { Thread currentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. List heritage = (List)threadMap.get(currentThread); if (heritage == null) { heritage = new ArrayList(); threadMap.put(currentThread, heritage); } heritage.add(this); }
public InheritableThreadLocal() { Thread currentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. List heritage = (List)threadMap.get(currentThread); if (heritage == null) { heritage = new ArrayList(); threadMap.put(currentThread, heritage); } heritage.add(this); }
470
public InheritableThreadLocal() { Thread currentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. List heritage = (List)threadMap.get(currentThread); if (heritage == null) { heritage = new ArrayList(); threadMap.put(currentThread, heritage); } heritage.add(this); }
public InheritableThreadLocal() { Thread currentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. List heritage = (List)threadMap.get(currentThread); if (heritage == null) { heritage = new ArrayList(); threadMap.put(currentThread, heritage); } heritage.add(this); }
471
protected Object childValue(Object parentValue) { return parentValue; }
protected Object childValue(Object parentValue) { return parentValue; }
472
static void newChildThread(Thread childThread) { // The currentThread is the parent of the new thread. Thread parentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. ArrayList heritage = (ArrayList)threadMap.get(parentThread); if (heritage != null) { threadMap.put(childThread, heritage.clone()); // Perform the inheritance. Iterator it = heritage.iterator(); int i = heritage.size(); while (--i >= 0) { InheritableThreadLocal local = (InheritableThreadLocal)it.next(); Object parentValue = local.valueMap.get(parentThread); if (parentValue != null) { Object childValue = local.childValue(parentValue == NULL ? null : parentValue); local.valueMap.put(childThread, (childValue == null ? NULL : parentValue)); } } } }
static void newChildThread(Thread childThread) { // The currentThread is the parent of the new thread. Thread parentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. ArrayList heritage = (ArrayList)threadMap.get(parentThread); if (heritage != null) { threadMap.put(childThread, heritage.clone()); // Perform the inheritance. Iterator it = heritage.iterator(); int i = heritage.size(); while (--i >= 0) { InheritableThreadLocal local = (InheritableThreadLocal)it.next(); Object parentValue = local.valueMap.get(parentThread); if (parentValue != null) { Object childValue = local.childValue(parentValue == NULL ? null : parentValue); local.valueMap.put(childThread, (childValue == null ? NULL : parentValue)); } } } }
473
static void newChildThread(Thread childThread) { // The currentThread is the parent of the new thread. Thread parentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. ArrayList heritage = (ArrayList)threadMap.get(parentThread); if (heritage != null) { threadMap.put(childThread, heritage.clone()); // Perform the inheritance. Iterator it = heritage.iterator(); int i = heritage.size(); while (--i >= 0) { InheritableThreadLocal local = (InheritableThreadLocal)it.next(); Object parentValue = local.valueMap.get(parentThread); if (parentValue != null) { Object childValue = local.childValue(parentValue == NULL ? null : parentValue); local.valueMap.put(childThread, (childValue == null ? NULL : parentValue)); } } } }
static void newChildThread(Thread childThread) { // The currentThread is the parent of the new thread. Thread parentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. ArrayList heritage = (ArrayList)threadMap.get(parentThread); if (heritage != null) { threadMap.put(childThread, heritage.clone()); // Perform the inheritance. Iterator it = heritage.iterator(); int i = heritage.size(); while (--i >= 0) { InheritableThreadLocal local = (InheritableThreadLocal)it.next(); Object parentValue = local.valueMap.get(parentThread); if (parentValue != null) { Object childValue = local.childValue(parentValue == NULL ? null : parentValue); local.valueMap.put(childThread, (childValue == null ? NULL : parentValue)); } } } }
474
static void newChildThread(Thread childThread) { // The currentThread is the parent of the new thread. Thread parentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. ArrayList heritage = (ArrayList)threadMap.get(parentThread); if (heritage != null) { threadMap.put(childThread, heritage.clone()); // Perform the inheritance. Iterator it = heritage.iterator(); int i = heritage.size(); while (--i >= 0) { InheritableThreadLocal local = (InheritableThreadLocal)it.next(); Object parentValue = local.valueMap.get(parentThread); if (parentValue != null) { Object childValue = local.childValue(parentValue == NULL ? null : parentValue); local.valueMap.put(childThread, (childValue == null ? NULL : parentValue)); } } } }
static void newChildThread(Thread childThread) { // The currentThread is the parent of the new thread. Thread parentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. ArrayList heritage = (ArrayList)threadMap.get(parentThread); if (heritage != null) { threadMap.put(childThread, heritage.clone()); // Perform the inheritance. Iterator it = heritage.iterator(); int i = heritage.size(); while (--i >= 0) { InheritableThreadLocal local = (InheritableThreadLocal)it.next(); Object parentValue = local.valueMap.get(parentThread); if (parentValue != null) { Object childValue = local.childValue(parentValue == NULL ? null : parentValue); local.valueMap.put(childThread, (childValue == null ? NULL : parentValue)); } } } }
475
static void newChildThread(Thread childThread) { // The currentThread is the parent of the new thread. Thread parentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. ArrayList heritage = (ArrayList)threadMap.get(parentThread); if (heritage != null) { threadMap.put(childThread, heritage.clone()); // Perform the inheritance. Iterator it = heritage.iterator(); int i = heritage.size(); while (--i >= 0) { InheritableThreadLocal local = (InheritableThreadLocal)it.next(); Object parentValue = local.valueMap.get(parentThread); if (parentValue != null) { Object childValue = local.childValue(parentValue == NULL ? null : parentValue); local.valueMap.put(childThread, (childValue == null ? NULL : parentValue)); } } } }
static void newChildThread(Thread childThread) { // The currentThread is the parent of the new thread. Thread parentThread = Thread.currentThread(); // Note that we don't have to synchronize, as only this thread will // ever modify the returned heritage. ArrayList heritage = (ArrayList)threadMap.get(parentThread); if (heritage != null) { threadMap.put(childThread, heritage.clone()); // Perform the inheritance. Iterator it = heritage.iterator(); int i = heritage.size(); while (--i >= 0) { InheritableThreadLocal local = (InheritableThreadLocal)it.next(); Object parentValue = local.valueMap.get(parentThread); if (parentValue != null) { Object childValue = local.childValue(parentValue == NULL ? null : parentValue); local.valueMap.put(childThread, (childValue == null ? NULL : parentValue)); } } } }
476
public void mousePressed(MouseEvent e) { if (! toolBar.isFloatable()) return; Point ssd = e.getPoint(); Insets insets = toolBar.getInsets(); // Verify that this click occurs in the top inset. if (toolBar.getOrientation() == SwingConstants.HORIZONTAL) { if (e.getX() > insets.left) return; } else { if (e.getY() > insets.top) return; } origin = new Point(0, 0); SwingUtilities.convertPointToScreen(ssd, toolBar); if (! (SwingUtilities.getAncestorOfClass(Window.class, toolBar) instanceof UIResource)) // Need to know who keeps the toolBar if it gets dragged back into it. origParent = toolBar.getParent(); SwingUtilities.convertPointToScreen(origin, toolBar); isDragging = true; if (dragWindow != null) dragWindow.setOffset(new Point(e.getX(), e.getY())); dragTo(e.getPoint(), origin); }
public void mousePressed(MouseEvent e) { if (! toolBar.isFloatable()) return; Point ssd = e.getPoint(); Insets insets = toolBar.getInsets(); // Verify that this click occurs in the top inset. if (toolBar.getOrientation() == SwingConstants.HORIZONTAL) { if (e.getX() > insets.left) return; } else { if (e.getY() > insets.top) return; } origin = new Point(0, 0); SwingUtilities.convertPointToScreen(ssd, toolBar); if (! (SwingUtilities.getAncestorOfClass(Window.class, toolBar) instanceof UIResource)) // Need to know who keeps the toolBar if it gets dragged back into it. origParent = toolBar.getParent(); SwingUtilities.convertPointToScreen(origin, toolBar); isDragging = true; if (dragWindow != null) dragWindow.setOffset(new Point(e.getX(), e.getY())); dragTo(e.getPoint(), origin); }
477
public void mousePressed(MouseEvent e) { if (! toolBar.isFloatable()) return; Point ssd = e.getPoint(); Insets insets = toolBar.getInsets(); // Verify that this click occurs in the top inset. if (toolBar.getOrientation() == SwingConstants.HORIZONTAL) { if (e.getX() > insets.left) return; } else { if (e.getY() > insets.top) return; } origin = new Point(0, 0); SwingUtilities.convertPointToScreen(ssd, toolBar); if (! (SwingUtilities.getAncestorOfClass(Window.class, toolBar) instanceof UIResource)) // Need to know who keeps the toolBar if it gets dragged back into it. origParent = toolBar.getParent(); SwingUtilities.convertPointToScreen(origin, toolBar); isDragging = true; if (dragWindow != null) dragWindow.setOffset(new Point(e.getX(), e.getY())); dragTo(e.getPoint(), origin); }
public void mousePressed(MouseEvent e) { if (! toolBar.isFloatable()) return; Point ssd = e.getPoint(); Insets insets = toolBar.getInsets(); // Verify that this click occurs in the top inset. if (toolBar.getOrientation() == SwingConstants.HORIZONTAL) { if (e.getX() > insets.left) return; } else { if (e.getY() > insets.top) return; } origin = new Point(0, 0); if (toolBar.isShowing()) SwingUtilities.convertPointToScreen(ssd, toolBar); if (! (SwingUtilities.getAncestorOfClass(Window.class, toolBar) instanceof UIResource)) // Need to know who keeps the toolBar if it gets dragged back into it. origParent = toolBar.getParent(); SwingUtilities.convertPointToScreen(origin, toolBar); isDragging = true; if (dragWindow != null) dragWindow.setOffset(new Point(e.getX(), e.getY())); dragTo(e.getPoint(), origin); }
478
public void mousePressed(MouseEvent e) { if (! toolBar.isFloatable()) return; Point ssd = e.getPoint(); Insets insets = toolBar.getInsets(); // Verify that this click occurs in the top inset. if (toolBar.getOrientation() == SwingConstants.HORIZONTAL) { if (e.getX() > insets.left) return; } else { if (e.getY() > insets.top) return; } origin = new Point(0, 0); SwingUtilities.convertPointToScreen(ssd, toolBar); if (! (SwingUtilities.getAncestorOfClass(Window.class, toolBar) instanceof UIResource)) // Need to know who keeps the toolBar if it gets dragged back into it. origParent = toolBar.getParent(); SwingUtilities.convertPointToScreen(origin, toolBar); isDragging = true; if (dragWindow != null) dragWindow.setOffset(new Point(e.getX(), e.getY())); dragTo(e.getPoint(), origin); }
public void mousePressed(MouseEvent e) { if (! toolBar.isFloatable()) return; Point ssd = e.getPoint(); Insets insets = toolBar.getInsets(); // Verify that this click occurs in the top inset. if (toolBar.getOrientation() == SwingConstants.HORIZONTAL) { if (e.getX() > insets.left) return; } else { if (e.getY() > insets.top) return; } origin = new Point(0, 0); SwingUtilities.convertPointToScreen(ssd, toolBar); if (! (SwingUtilities.getAncestorOfClass(Window.class, toolBar) instanceof UIResource)) // Need to know who keeps the toolBar if it gets dragged back into it. origParent = toolBar.getParent(); if (toolBar.isShowing()) SwingUtilities.convertPointToScreen(origin, toolBar); isDragging = true; if (dragWindow != null) dragWindow.setOffset(new Point(e.getX(), e.getY())); dragTo(e.getPoint(), origin); }
479
public BasicToolBarUI() { // Do nothing here. }
public BasicToolBarUI() { // Do nothing here. }
480
public BasicToolBarUI() { // Do nothing here. }
public BasicToolBarUI() { // Do nothing here. }
481
public boolean canDock(Component c, Point p) { return areaOfClick(c, p) != -1; }
public boolean canDock(Component c, Point p) { return areaOfClick(c, p) != -1; }
482
public boolean canDock(Component c, Point p) { return areaOfClick(c, p) != -1; }
public boolean canDock(Component c, Point p) { return areaOfClick(c, p) != -1; }
483
protected MouseInputListener createDockingListener() { return new DockingListener(toolBar); }
protected MouseInputListener createDockingListener() { return new DockingListener(toolBar); }
484
protected MouseInputListener createDockingListener() { return new DockingListener(toolBar); }
protected MouseInputListener createDockingListener() { return new DockingListener(toolBar); }
485
protected BasicToolBarUI.DragWindow createDragWindow(JToolBar toolbar) { return new DragWindow(); }
protected BasicToolBarUI.DragWindow createDragWindow(JToolBar toolbar) { return new DragWindow(); }
486
protected BasicToolBarUI.DragWindow createDragWindow(JToolBar toolbar) { return new DragWindow(); }
protected BasicToolBarUI.DragWindow createDragWindow(JToolBar toolbar) { return new DragWindow(); }
487
protected JFrame createFloatingFrame(JToolBar toolbar) { // FIXME: Though deprecated, this should still work. return null; }
protected JFrame createFloatingFrame(JToolBar toolbar) { // FIXME: Though deprecated, this should still work. return null; }
488
protected JFrame createFloatingFrame(JToolBar toolbar) { // FIXME: Though deprecated, this should still work. return null; }
protected JFrame createFloatingFrame(JToolBar toolbar) { // FIXME: Though deprecated, this should still work. return null; }
489
protected RootPaneContainer createFloatingWindow(JToolBar toolbar) { // This one is used by default though. return new ToolBarDialog(); }
protected RootPaneContainer createFloatingWindow(JToolBar toolbar) { // This one is used by default though. return new ToolBarDialog(); }
490
protected RootPaneContainer createFloatingWindow(JToolBar toolbar) { // This one is used by default though. return new ToolBarDialog(); }
protected RootPaneContainer createFloatingWindow(JToolBar toolbar) { // This one is used by default though. return new ToolBarDialog(); }
491
protected WindowListener createFrameListener() { return new FrameListener(); }
protected WindowListener createFrameListener() { return new FrameListener(); }
492
protected WindowListener createFrameListener() { return new FrameListener(); }
protected WindowListener createFrameListener() { return new FrameListener(); }
493
protected Border createNonRolloverBorder() { return new EtchedBorderUIResource(); }
protected Border createNonRolloverBorder() { return new EtchedBorderUIResource(); }
494
protected Border createNonRolloverBorder() { return new EtchedBorderUIResource(); }
protected Border createNonRolloverBorder() { return new EtchedBorderUIResource(); }
495
protected PropertyChangeListener createPropertyListener() { return new PropertyListener(); }
protected PropertyChangeListener createPropertyListener() { return new PropertyListener(); }
496
protected PropertyChangeListener createPropertyListener() { return new PropertyListener(); }
protected PropertyChangeListener createPropertyListener() { return new PropertyListener(); }
497
protected Border createRolloverBorder() { return new EtchedBorderUIResource() { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (c instanceof JButton) { if (((JButton) c).getModel().isRollover()) super.paintBorder(c, g, x, y, width, height); } } }; }
protected Border createRolloverBorder() { return new EtchedBorderUIResource() { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (c instanceof JButton) { if (((JButton) c).getModel().isRollover()) super.paintBorder(c, g, x, y, width, height); } } }; }
498
protected Border createRolloverBorder() { return new EtchedBorderUIResource() { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (c instanceof JButton) { if (((JButton) c).getModel().isRollover()) super.paintBorder(c, g, x, y, width, height); } } }; }
protected Border createRolloverBorder() { return new EtchedBorderUIResource() { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { if (c instanceof JButton) { if (((JButton) c).getModel().isRollover()) super.paintBorder(c, g, x, y, width, height); } } }; }
499
protected ContainerListener createToolBarContListener() { return new ToolBarContListener(); }
protected ContainerListener createToolBarContListener() { return new ToolBarContListener(); }
500
protected ContainerListener createToolBarContListener() { return new ToolBarContListener(); }
protected ContainerListener createToolBarContListener() { return new ToolBarContListener(); }
501
protected FocusListener createToolBarFocusListener() { return new ToolBarFocusListener(); }
protected FocusListener createToolBarFocusListener() { return new ToolBarFocusListener(); }
502
protected FocusListener createToolBarFocusListener() { return new ToolBarFocusListener(); }
protected FocusListener createToolBarFocusListener() { return new ToolBarFocusListener(); }
503
public static ComponentUI createUI(JComponent c) { return new BasicToolBarUI(); }
public static ComponentUI createUI(JComponent c) { return new BasicToolBarUI(); }
504
public static ComponentUI createUI(JComponent c) { return new BasicToolBarUI(); }
public static ComponentUI createUI(JComponent c) { return new BasicToolBarUI(); }
505
protected void dragTo(Point position, Point origin) { int loc = areaOfClick(origParent, SwingUtilities.convertPoint(toolBar, position, origParent)); if (loc != -1) { dragWindow.setBorderColor(dockingBorderColor); dragWindow.setBackground(dockingColor); } else { dragWindow.setBorderColor(floatingBorderColor); dragWindow.setBackground(floatingColor); } int w = 0; int h = 0; boolean tmp = ((loc == SwingConstants.NORTH) || (loc == SwingConstants.SOUTH) || (loc == -1)); if (((cachedOrientation == SwingConstants.HORIZONTAL) && tmp) || ((cachedOrientation == VERTICAL) && ! tmp)) { w = cachedBounds.width; h = cachedBounds.height; } else { w = cachedBounds.height; h = cachedBounds.width; } Point p = dragWindow.getOffset(); Insets insets = toolBar.getInsets(); dragWindow.setBounds((origin.x + position.x) - p.x - ((insets.left + insets.right) / 2), (origin.y + position.y) - p.y - ((insets.top + insets.bottom) / 2), w, h); if (! dragWindow.isVisible()) dragWindow.show(); }
protected void dragTo(Point position, Point origin) { int loc = areaOfClick(origParent, SwingUtilities.convertPoint(toolBar, position, origParent)); if (loc != -1) { dragWindow.setBorderColor(dockingBorderColor); dragWindow.setBackground(dockingColor); } else { dragWindow.setBorderColor(floatingBorderColor); dragWindow.setBackground(floatingColor); } int w = 0; int h = 0; boolean tmp = ((loc == SwingConstants.NORTH) || (loc == SwingConstants.SOUTH) || (loc == -1)); if (((cachedOrientation == SwingConstants.HORIZONTAL) && tmp) || ((cachedOrientation == VERTICAL) && ! tmp)) { w = cachedBounds.width; h = cachedBounds.height; } else { w = cachedBounds.height; h = cachedBounds.width; } Point p = dragWindow.getOffset(); Insets insets = toolBar.getInsets(); dragWindow.setBounds((origin.x + position.x) - p.x - ((insets.left + insets.right) / 2), (origin.y + position.y) - p.y - ((insets.top + insets.bottom) / 2), w, h); if (! dragWindow.isVisible()) dragWindow.show(); }
506