rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
int endOffset = offset + length;
int endMark = offset + length;
private void adjustPositionsInRange(int offset, int length, int incr) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index...
int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 < 0) index1 = -(index1 + 1);
synchronized (this) { int startIndex = binarySearch(positionMarks, offset, numMarks); if (startIndex < 0) startIndex = - startIndex - 1; int endIndex = binarySearch(positionMarks, endMark, numMarks); if (endIndex < 0) endIndex = - endIndex - 2;
private void adjustPositionsInRange(int offset, int length, int incr) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index...
while (index1 > 0) { WeakReference r = (WeakReference) positions.get(index1 - 1); GapContentPosition p = (GapContentPosition) r.get(); if (p != null && p.mark == offset || p == null) index1--; else break;
assert (startIndex <= 0 || positionMarks[startIndex - 1] <= positionMarks [startIndex] + incr) && (endIndex >= numMarks - 1 || positionMarks[endIndex + 1] >= positionMarks[endIndex] + incr) : "Adjusting the marks must not change their order"; if (startIndex > 0 && positionMarks[startIndex - 1] == positionMarks[start...
private void adjustPositionsInRange(int offset, int length, int incr) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index...
for (ListIterator i = positions.listIterator(index1); i.hasNext();) { WeakReference r = (WeakReference) i.next(); GapContentPosition p = (GapContentPosition) r.get(); if (p == null) continue; if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark += incr; }
private void adjustPositionsInRange(int offset, int length, int incr) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index...
if (offset < 0 || offset > length()) throw new BadLocationException("The offset was out of the bounds of this" + " buffer", offset);
GapContentPosition pos = null; Set positionSet = positions.keySet(); for (Iterator i = positionSet.iterator(); i.hasNext();) { GapContentPosition p = (GapContentPosition) i.next(); if (p.getOffset() == offset) { pos = p; break; } }
public Position createPosition(final int offset) throws BadLocationException { if (offset < 0 || offset > length()) throw new BadLocationException("The offset was out of the bounds of this" + " buffer", offset); clearPositionReferences(); // We store the actual array index in the GapContentPos...
clearPositionReferences();
if (pos == null) { int mark = offset; if (mark >= gapStart) mark += (gapEnd - gapStart); pos = new GapContentPosition(mark); positions.put(pos, null); }
public Position createPosition(final int offset) throws BadLocationException { if (offset < 0 || offset > length()) throw new BadLocationException("The offset was out of the bounds of this" + " buffer", offset); clearPositionReferences(); // We store the actual array index in the GapContentPos...
int mark = offset; if (offset >= gapStart) mark += gapEnd - gapStart; GapContentPosition pos = new GapContentPosition(mark); WeakReference r = new WeakReference(pos); int index = Collections.binarySearch(positions, r, new WeakPositionComparator()); if (index < 0) index = -(index + 1); positions.add(index, r);
public Position createPosition(final int offset) throws BadLocationException { if (offset < 0 || offset > length()) throw new BadLocationException("The offset was out of the bounds of this" + " buffer", offset); clearPositionReferences(); // We store the actual array index in the GapContentPos...
int endOffset = offset + length;
int endOffs = offset + length;
protected Vector getPositionsInRange(Vector v, int offset, int length) { Vector res = v; if (res == null) res = new Vector(); else res.clear(); int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(of...
int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 < 0) index1 = -(index1 + 1); while (index1 > 0)
Set positionSet = positions.keySet(); for (Iterator i = positionSet.iterator(); i.hasNext();)
protected Vector getPositionsInRange(Vector v, int offset, int length) { Vector res = v; if (res == null) res = new Vector(); else res.clear(); int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(of...
WeakReference r = (WeakReference) positions.get(index1 - 1); GapContentPosition p = (GapContentPosition) r.get(); if (p != null && p.mark == offset || p == null) index1--; else break;
GapContentPosition p = (GapContentPosition) i.next(); int offs = p.getOffset(); if (offs >= offset && offs < endOffs) res.add(p);
protected Vector getPositionsInRange(Vector v, int offset, int length) { Vector res = v; if (res == null) res = new Vector(); else res.clear(); int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(of...
for (ListIterator i = positions.listIterator(index1); i.hasNext();) { WeakReference r = (WeakReference) i.next(); GapContentPosition p = (GapContentPosition) r.get(); if (p == null) continue; if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) res.add(p); }
protected Vector getPositionsInRange(Vector v, int offset, int length) { Vector res = v; if (res == null) res = new Vector(); else res.clear(); int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(of...
setPositionsInRange(gapEnd, 0, 0);
positionMarks[0] = 0;
protected void resetMarksAtZero() { if (gapStart != 0) return; setPositionsInRange(gapEnd, 0, 0); }
private void setPositionsInRange(int offset, int length, int value)
private void setPositionsInRange(int start, int end, boolean toStart)
private void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 ...
int endOffset = offset + length;
private void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 ...
int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 < 0) index1 = -(index1 + 1);
synchronized (this) { int startIndex = binarySearch(positionMarks, start, numMarks); if (startIndex < 0) startIndex = - startIndex - 1; int endIndex = binarySearch(positionMarks, end, numMarks); if (endIndex < 0) endIndex = - endIndex - 2;
private void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 ...
while (index1 > 0) { WeakReference r = (WeakReference) positions.get(index1 - 1); GapContentPosition p = (GapContentPosition) r.get(); if (p != null && p.mark == offset || p == null) index1--;
int removed = endIndex - startIndex; if (removed <= 0) return; System.arraycopy(positionMarks, endIndex + 1, positionMarks, startIndex + 1, positionMarks.length - endIndex - 1); numMarks -= removed; if (toStart) { positionMarks[startIndex] = start; }
private void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 ...
break;
{ positionMarks[startIndex] = end;
private void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 ...
for (ListIterator i = positions.listIterator(index1); i.hasNext();)
Set positionSet = positions.keySet(); for (Iterator i = positionSet.iterator(); i.hasNext();)
private void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 ...
WeakReference r = (WeakReference) i.next(); GapContentPosition p = (GapContentPosition) r.get(); if (p == null) continue; if (p.mark > endOffset) break; if (p.mark >= offset && p.mark <= endOffset) p.mark = value;
GapContentPosition p = (GapContentPosition) i.next(); if (p.index > start || p.index <= end) p.index = start; else if (p.index > end) p.index -= removed; }
private void setPositionsInRange(int offset, int length, int value) { int endOffset = offset + length; int index1 = Collections.binarySearch(positions, new GapContentPosition(offset), new WeakPositionComparator()); if (index1 ...
setPositionsInRange(gapEnd, newGapEnd - gapEnd, newGapEnd);
setPositionsInRange(gapEnd, newGapEnd, false);
protected void shiftGapEndUp(int newGapEnd) { if (newGapEnd == gapEnd) return; assert newGapEnd > gapEnd : "The new gap end must be greater than the " + "old gap end."; setPositionsInRange(gapEnd, newGapEnd - gapEnd, newGapEnd); gapEnd = newGapEnd; }
setPositionsInRange(newGapStart, gapStart - newGapStart, gapStart);
setPositionsInRange(newGapStart, gapStart, false);
protected void shiftGapStartDown(int newGapStart) { if (newGapStart == gapStart) return; assert newGapStart < gapStart : "The new gap start must be less than the " + "old gap start."; setPositionsInRange(newGapStart, gapStart - newGapStart, gapStart); gapStart = ne...
} else if(s.length == 1) { _port = Integer.parseInt(s[0]);
public void configure (HashMap properties) throws TransportException { // Get address [form: "hostname:port"] String p = (String) properties.get (_PROPERTY_ADDRESS); if (p != null) { String[] s = p.split (":"); if (s.length == 2) { _host = s[0]; _port = Integer.parseInt (s[1]); } } ...
if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme && enabled) { String gradient; if (focus) gradient = "Slider.focusGradient"; else gradient = "Slider.gradient"; MetalUtils.paintGradient(g, x + 1, y + 2, 12, 13, SwingConstants.VERTICAL, gradient, gradientMask); } else {
public void paintIcon(Component c, Graphics g, int x, int y) { boolean enabled = false; boolean focus = false; if (c != null) { enabled = c.isEnabled(); focus = c.hasFocus(); } // draw the outline if (enabled) g.setColor(MetalLookAndFeel...
if (c.isEnabled())
if (c.isEnabled() && !(MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme))
public void paintIcon(Component c, Graphics g, int x, int y) { boolean enabled = false; boolean focus = false; if (c != null) { enabled = c.isEnabled(); focus = c.hasFocus(); } // draw the outline if (enabled) g.setColor(MetalLookAndFeel...
MetalUtils.paintGradient(g, x, y, getIconWidth(), getIconHeight(), SwingConstants.VERTICAL, "RadioButton.gradient");
MetalUtils.paintGradient(g, x + 2, y + 2, 8, 8, SwingConstants.VERTICAL, "RadioButton.gradient", gradientMask);
public void paintIcon(Component c, Graphics g, int x, int y) { if (UIManager.get("RadioButton.gradient") != null) MetalUtils.paintGradient(g, x, y, getIconWidth(), getIconHeight(), SwingConstants.VERTICAL, "RadioButton.gradient"); Color savedColor = g.getColor(); ...
if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme && enabled) { String gradient; if (focus) gradient = "Slider.focusGradient"; else gradient = "Slider.gradient"; MetalUtils.paintGradient(g, x + 2, y + 1, 13, 12, SwingConstants.HORIZONTAL, gradient, gradientMask); } else {
public void paintIcon(Component c, Graphics g, int x, int y) { boolean enabled = false; boolean focus = false; if (c != null) { enabled = c.isEnabled(); focus = c.hasFocus(); } // draw the outline if (enabled) g.setColor(MetalLookAndFeel...
if (enabled)
if (enabled && ! (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme))
public void paintIcon(Component c, Graphics g, int x, int y) { boolean enabled = false; boolean focus = false; if (c != null) { enabled = c.isEnabled(); focus = c.hasFocus(); } // draw the outline if (enabled) g.setColor(MetalLookAndFeel...
public void activate (Applet applet);
void activate (Applet applet);
public void activate (Applet applet);
public void initialize (Applet applet, BeanContext context);
void initialize (Applet applet, BeanContext context);
public void initialize (Applet applet, BeanContext context);
throw new HeadlessException ();
{ ds = null; throw new HeadlessException(); }
public DragSource() { if (GraphicsEnvironment.isHeadless()) throw new HeadlessException (); }
createDefaultDragGestureRecognizer(Component c, int actions,
public DragGestureRecognizer createDefaultDragGestureRecognizer(Component c, int actions,
createDefaultDragGestureRecognizer(Component c, int actions, DragGestureListener dgl) { return createDragGestureRecognizer (MouseDragGestureRecognizer.class, c, actions, dgl); }
createDragGestureRecognizer(Class recognizer, Component c, int actions,
public DragGestureRecognizer createDragGestureRecognizer(Class recognizer, Component c, int actions,
createDragGestureRecognizer(Class recognizer, Component c, int actions, DragGestureListener dgl) { DragGestureRecognizer dgr; dgr = Toolkit.getDefaultToolkit () .createDragGestureRecognizer (recognizer, this, c, actions, ...
DragGestureRecognizer dgr; dgr = Toolkit.getDefaultToolkit () .createDragGestureRecognizer (recognizer, this, c, actions, dgl); if (dgr == null) dgr = new NoDragGestureRecognizer(this, c, actions, dgl); return dgr;
return Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizer, this, c, actions, dgl);
createDragGestureRecognizer(Class recognizer, Component c, int actions, DragGestureListener dgl) { DragGestureRecognizer dgr; dgr = Toolkit.getDefaultToolkit () .createDragGestureRecognizer (recognizer, this, c, actions, ...
return null;
return new DragSourceContext(peer, dge, cursor, image, offset, t, dsl);
createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge, Cursor cursor, Image image, Point offset, Transferable t, DragSourceListener dsl) { return null; }
return new DragSource();
if (GraphicsEnvironment.isHeadless()) { ds = null; throw new HeadlessException(); } if (ds == null) ds = new DragSource(); return ds;
public static DragSource getDefaultDragSource() { return new DragSource(); }
try { flavorMap = map; if (peer == null) peer = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger); if (context == null) context = createDragSourceContext(peer, trigger, dragCursor, dragImage, imageOffset, trans, dsl); if (peer == null) throw new InvalidDnDOperationException(); peer.startDrag(context,...
public void startDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable trans, DragSourceListener dsl, FlavorMap map) { }
else {
else
public void setup(Map attributes) { // find out which hash to use String underlyingMD = (String) attributes.get(MD_NAME); if (underlyingMD == null) { if (md == null) { // happy birthday // ensure we have a reliable implementation of this hash md = HashFactory.getIn...
} else {
else
public void setup(Map attributes) { // find out which hash to use String underlyingMD = (String) attributes.get(MD_NAME); if (underlyingMD == null) { if (md == null) { // happy birthday // ensure we have a reliable implementation of this hash md = HashFactory.getIn...
}
public void setup(Map attributes) { // find out which hash to use String underlyingMD = (String) attributes.get(MD_NAME); if (underlyingMD == null) { if (md == null) { // happy birthday // ensure we have a reliable implementation of this hash md = HashFactory.getIn...
{
public void setup(Map attributes) { // find out which hash to use String underlyingMD = (String) attributes.get(MD_NAME); if (underlyingMD == null) { if (md == null) { // happy birthday // ensure we have a reliable implementation of this hash md = HashFactory.getIn...
return (EnumSyntax[])null;
return enumValueTable;
protected EnumSyntax[] getEnumValueTable() { // FIXME return (EnumSyntax[])null; }
return (String[])null;
return stringTable;
protected String[] getStringTable() { // FIXME return (String[])null; }
public void drawText(Graphics2D g, String text, Font font, int x, int y) {
public void drawText(Surface g, AffineTransform tx, String text, Font font, int x, int y, Color color) {
public void drawText(Graphics2D g, String text, Font font, int x, int y) { FontProvider prv = getProvider(font); Font txFont = font; if (prv == null) { txFont = getTranslatedFont(font); prv = getProvider(txFont); } if (prv != null) { final TextRenderer r...
renderer.render(g, text, x, y);
renderer.render(g, tx, text, x, y, color);
public void drawText(Graphics2D g, String text, Font font, int x, int y) { FontProvider prv = getProvider(font); Font txFont = font; if (prv == null) { txFont = getTranslatedFont(font); prv = getProvider(txFont); } if (prv != null) { final TextRenderer r...
static BeanInfo reallyFindExplicitBeanInfo(Class beanClass) { try { try { return (BeanInfo) Class.forName(beanClass.getName() + "BeanInfo").newInstance(); } catch (ClassNotFoundException E) { } String newName = ClassHelper.getTruncatedClassName(beanClass) + "BeanInfo"; for (int i = 0; i < Introspector.beanInfoSearchPat...
static BeanInfo reallyFindExplicitBeanInfo(Class beanClass) { ClassLoader beanClassLoader = beanClass.getClassLoader(); BeanInfo beanInfo; beanInfo = getBeanInfo(beanClassLoader, beanClass.getName() + "BeanInfo"); if (beanInfo == null) { String newName; newName = ClassHelper.getTruncatedClassName(beanClass) + "BeanInf...
static BeanInfo reallyFindExplicitBeanInfo(Class beanClass) { try { try { return (BeanInfo) Class.forName(beanClass.getName() + "BeanInfo").newInstance(); } catch (ClassNotFoundException E) { } String newName = ClassHelper.getTruncatedClassName(beanClass) + "BeanInfo"; for (int i = 0; i < Introspector.be...
public static String decapitalize(String name) { try { if (!Character.isUpperCase(name.charAt(0))) { return name; } else { try { if (Character.isUpperCase(name.charAt(1))) { return name; } else { char[] c = name.toCharArray(); c[0] = Character.toLowerCase(c[0]); return new String(c); } } catch (StringIndexOutOfBoundsEx...
public static String decapitalize(String name) { try { if(!Character.isUpperCase(name.charAt(0))) { return name; } else { try { if(Character.isUpperCase(name.charAt(1))) { return name; } else { char[] c = name.toCharArray(); c[0] = Character.toLowerCase(c[0]); return new String(c); } } catch(StringIndexOutOfBoundsExcep...
public static String decapitalize(String name) { try { if (!Character.isUpperCase(name.charAt(0))) { return name; } else { try { if (Character.isUpperCase(name.charAt(1))) { return name; } else { char[] c = name.toCharArray(); c[0] = Character.toLowerCase(c[0]); return new String...
} catch(StringIndexOutOfBoundsException E) { return name; } catch(NullPointerException E) { return null; } }
public static String decapitalize(String name) { try { if (!Character.isUpperCase(name.charAt(0))) { return name; } else { try { if (Character.isUpperCase(name.charAt(1))) { return name; } else { char[] c = name.toCharArray(); c[0] = Character.toLowerCase(c[0]); return new String...
Template.DEFAULT_PRIORITY,
null,
void doParse(Node node, boolean root) throws TransformerConfigurationException { try { String namespaceUri = node.getNamespaceURI(); if (XSL_NS.equals(namespaceUri) && node.getNodeType() == Node.ELEMENT_NODE) { String name = node.getLocalName(); Name...
double priority = (p == null) ? Template.DEFAULT_PRIORITY : Double.parseDouble(p);
final Template parseTemplate(Node node, NamedNodeMap attrs) throws TransformerConfigurationException, XPathExpressionException { String n = getAttribute(attrs, "name"); QName name = (n == null) ? null : getQName(n); String m = getAttribute(attrs, "match"); Pattern match = null; if (m != null) ...
precedence, priority, mode);
precedence, p, mode);
final Template parseTemplate(Node node, NamedNodeMap attrs) throws TransformerConfigurationException, XPathExpressionException { String n = getAttribute(attrs, "name"); QName name = (n == null) ? null : getQName(n); String m = getAttribute(attrs, "match"); Pattern match = null; if (m != null) ...
System.out.println("Key: " + key + " Value: " + value);
private void readEntries(Preferences node) throws InvalidPreferencesFormatException, IOException { while ("entry".equals(nextTag())) { skipTill("<entry"); skipTill("key=\""); String key = readTill("\""); skipTill("value=\""); String...
System.out.println("Found subnode: " + subnode.absolutePath());
private void readNodes(Preferences node) throws InvalidPreferencesFormatException, IOException { while ("node".equals(nextTag())) { skipTill("<node"); skipTill("name=\""); String name = readTill("\""); Preferences subnode = node.node(name); ...
static RawData adjustAddress(RawData address, int offset) {
static Pointer adjustAddress(Pointer address, int offset) {
static RawData adjustAddress(RawData address, int offset) { final MemoryResource res = ((MemoryRawData)address).resource; final Extent size = res.getSize().sub(offset); try { return new MemoryRawData(res.claimChildResource(Offset.fromIntZeroExtend(offset), size, true)); } catch (ResourceNotFreeException ex) { ...
static RawData allocate(int capacity) {
static Pointer allocate(int capacity) {
static RawData allocate(int capacity) { return new MemoryRawData(capacity); }
static void free(RawData address) {
static void free(Pointer address) {
static void free(RawData address) { ((MemoryRawData)address).resource.release(); }
static byte get(RawData address, int index) {
static byte get(Pointer address, int index) {
static byte get(RawData address, int index) { final MemoryRawData mrd = (MemoryRawData)address; final byte value = mrd.address.loadByte(Offset.fromIntZeroExtend(index)); return value; }
static void put(RawData address, int index, byte value) {
static void put(Pointer address, int index, byte value) {
static void put(RawData address, int index, byte value) { ((MemoryRawData)address).resource.setByte(index, value); }
static void shiftDown(RawData address, int dst_offset, int src_offset,
static void shiftDown(Pointer address, int dst_offset, int src_offset,
static void shiftDown(RawData address, int dst_offset, int src_offset, int count) { ((MemoryRawData)address).resource.copy(src_offset, dst_offset, count); }
final RawData address = new MemoryRawData(resource);
final Pointer address = new MemoryRawData(resource);
public static ByteBuffer wrap(MemoryResource resource) { final Object owner = resource.getOwner(); final RawData address = new MemoryRawData(resource); final int size = resource.getSize().toInt(); final ByteBuffer result = new DirectByteBufferImpl.ReadWrite(owner, address, size, size, 0)...
final VmClassLoader loader = new VmClassLoader(new File(".").toURL(), new VmX86Architecture());
final VmSystemClassLoader loader = new VmSystemClassLoader(new File(".").toURL(), new VmX86Architecture());
public static void main(String[] args) throws Exception { final String className = (args.length > 0) ? args[0] : "java.lang.Object"; final VmClassLoader loader = new VmClassLoader(new File(".").toURL(), new VmX86Architecture()); final VmType vmClass = loader.loadClass(className, true); for (int i = 0; i < vmCla...
model = new DefaultButtonModel();
protected void init(String text, Icon icon) { this.text = text; default_icon = icon; model = new DefaultButtonModel(); actionListener = createActionListener(); changeListener = createChangeListener(); itemListener = createItemListener(); model.addActionListener(actionListener); model.addChange...
model.addActionListener(actionListener); model.addChangeListener(changeListener); model.addItemListener(itemListener);
protected void init(String text, Icon icon) { this.text = text; default_icon = icon; model = new DefaultButtonModel(); actionListener = createActionListener(); changeListener = createChangeListener(); itemListener = createItemListener(); model.addActionListener(actionListener); model.addChange...
renderingHints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_DEFAULT);
HashMap hints = new HashMap(); hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_DEFAULT); renderingHints = new RenderingHints(hints);
protected AbstractGraphics2D() { transform = new AffineTransform(); background = Color.WHITE; composite = AlphaComposite.SrcOver; stroke = new BasicStroke(); renderingHints = new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_DEFAULT); ...
setClip(clip);
public void clip(Shape s) { // Initialize clip if not already present. if (clip == null) clip = s; // This is so common, let's optimize this. else if (clip instanceof Rectangle && s instanceof Rectangle) { Rectangle clipRect = (Rectangle) clip; Rectangle r = (Rectangle) s; ...
Shape clipped = clipShape(shape); if (clipped != null) {
public void draw(Shape shape) { // Clip the shape. Shape clipped = clipShape(shape); if (clipped != null) { // Stroke the shape. Shape strokedShape = stroke.createStrokedShape(clipped); // Fill the shape. fillShape(strokedShape); } }
Shape strokedShape = stroke.createStrokedShape(clipped); fillShape(strokedShape); }
Shape strokedShape = stroke.createStrokedShape(shape); fillShape(strokedShape, false);
public void draw(Shape shape) { // Clip the shape. Shape clipped = clipShape(shape); if (clipped != null) { // Stroke the shape. Shape strokedShape = stroke.createStrokedShape(clipped); // Fill the shape. fillShape(strokedShape); } }
fill(p);
fillShape(p, true);
public void drawGlyphVector(GlyphVector gv, float x, float y) { int numGlyphs = gv.getNumGlyphs(); AffineTransform t = new AffineTransform(); t.translate(x, y); // TODO: We could use fill(gv.getOutline()), but that doesn't seem // to work yet with the font infrastructure I use. for (int i = 0; i < ...
rawDrawLine(x1, y1, x2, y2);
{ int tx = (int) transform.getTranslateX(); int ty = (int) transform.getTranslateY(); rawDrawLine(x1 + tx, y1 + ty, x2 + tx, y2 + ty); }
public void drawLine(int x1, int y1, int x2, int y2) { if (isOptimized) rawDrawLine(x1, y1, x2, y2); else { Line2D line = new Line2D.Double(x1, y1, x2, y2); draw(line); } }
Shape clipped = clipShape(shape); if (clipped != null) fillShape(shape);
fillShape(shape, false);
public void fill(Shape shape) { Shape clipped = clipShape(shape); if (clipped != null) fillShape(shape); }
rawFillRect(x, y, width, height);
{ int tx = (int) transform.getTranslateX(); int ty = (int) transform.getTranslateY(); rawFillRect(x + tx, y + ty, width, height); }
public void fillRect(int x, int y, int width, int height) { if (isOptimized) rawFillRect(x, y, width, height); else { fill(new Rectangle(x, y, width, height)); } }
protected void fillScanline(int x0, int x1, int y)
protected void fillScanline(PaintContext pCtx, int x0, int x1, int y)
protected void fillScanline(int x0, int x1, int y) { for (int x = x0; x < x1; x++) drawPixel(x, y); }
for (int x = x0; x < x1; x++) drawPixel(x, y);
Raster paintRaster = pCtx.getRaster(x0, y, x1 - x0, 1); ColorModel paintColorModel = pCtx.getColorModel(); CompositeContext cCtx = composite.createContext(paintColorModel, getColorModel(), renderingHints); cCtx.compose(paintRaster, destinationRaster, destinationRaster); updateRaster(destinationRaster, x0, y, x1 - x0, 1...
protected void fillScanline(int x0, int x1, int y) { for (int x = x0; x < x1; x++) drawPixel(x, y); }
protected void fillShape(Shape s)
protected void fillShape(Shape s, boolean isFont)
protected void fillShape(Shape s) { PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillPolygon() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; ...
rawFillShape(segs, minX, minY, maxX, maxY);
{ if (antialias) fillShapeAntialias(segs, minX, minY, maxX, maxY, userBounds); else rawFillShape(segs, minX, minY, maxX, maxY, userBounds); }
protected void fillShape(Shape s) { PathIterator path = s.getPathIterator(getTransform(), 1.0); // Build up polygons and let the native backend render this using // rawFillPolygon() which would provide a default implementation for // drawPixel using a PolyScan algorithm. double[] seg = new double[6]; ...
return clip.getBounds();
Rectangle b = null; if (clip != null) b = clip.getBounds(); return b;
public Rectangle getClipBounds() { return clip.getBounds(); }
protected abstract Rectangle getDeviceBounds();
protected Rectangle getDeviceBounds() { return destinationRaster.getBounds(); }
protected abstract Rectangle getDeviceBounds();
clip = getDeviceBounds(); destinationRaster = getDestinationRaster();
protected void init() { setPaint(Color.BLACK); setFont(new Font("SansSerif", Font.PLAIN, 12)); isOptimized = true; }
double maxX, double maxY)
double maxX, double maxY, Rectangle2D userBounds)
protected void rawFillShape(ArrayList segs, double minX, double minY, double maxX, double maxY) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // Create table of a...
if (Math.ceil(edge.y0) == Math.ceil(edge.y1)) continue;
protected void rawFillShape(ArrayList segs, double minX, double minY, double maxX, double maxY) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // Create table of a...
if (y >= edge.y0 && y >= edge.y1)
if (y > edge.y1)
protected void rawFillShape(ArrayList segs, double minX, double minY, double maxX, double maxY) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // Create table of a...
int x0 = 0;
PolyEdge previous = null;
protected void rawFillShape(ArrayList segs, double minX, double minY, double maxX, double maxY) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // Create table of a...
int x = (int) edge.xIntersection;
protected void rawFillShape(ArrayList segs, double minX, double minY, double maxX, double maxY) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // Create table of a...
fillScanline(x0, x, y);
if (edge.y1 > y) { int x0 = (int) previous.xIntersection; int x1 = (int) edge.xIntersection; fillScanline(pCtx, x0, x1, y); previous = edge;
protected void rawFillShape(ArrayList segs, double minX, double minY, double maxX, double maxY) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // Create table of a...
x0 = x;
if (edge.y1 > y) { previous = edge;
protected void rawFillShape(ArrayList segs, double minX, double minY, double maxX, double maxY) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // Create table of a...
pCtx.dispose(); }
protected void rawFillShape(ArrayList segs, double minX, double minY, double maxX, double maxY) { // This is an implementation of a polygon scanline conversion algorithm // described here: // http://www.cs.berkeley.edu/~ug/slide/pipeline/assignments/scan/ // Create table of a...
protected abstract void rawSetForeground(Color c);
protected void rawSetForeground(Color c) { }
protected abstract void rawSetForeground(Color c);
protected abstract void rawSetPixel(int x, int y);
protected void rawSetPixel(int x, int y) { }
protected abstract void rawSetPixel(int x, int y);
compositeContext = composite.createContext(getColorModel(), getDestinationColorModel(), renderingHints);
public void setComposite(Composite comp) { composite = comp; compositeContext = composite.createContext(getColorModel(), getDestinationColorModel(), renderingHints); if (! (comp.equals(AlphaComposite.SrcOver))) ...
if (paint != null && ! (paint instanceof Color))
if (! (paint instanceof Color))
public void setPaint(Paint p) { paint = p; if (paint != null && ! (paint instanceof Color)) isOptimized = false; else { updateOptimization(); rawSetForeground((Color) paint); } }
}
public void setPaint(Paint p) { paint = p; if (paint != null && ! (paint instanceof Color)) isOptimized = false; else { updateOptimization(); rawSetForeground((Color) paint); } }
setClip(r);
public void translate(int x, int y) { transform.translate(x, y); // Update the clip. We special-case rectangular clips here, because they // are so common (e.g. in Swing). if (clip != null) { if (clip instanceof Rectangle) { Rectangle r = (Rectangle) clip; r.x -...
boolean optimizedTransform = (transformType & (AffineTransform.TYPE_TRANSLATION | AffineTransform.TYPE_IDENTITY)) != 0;
boolean optimizedTransform = false; if (transformType == AffineTransform.TYPE_IDENTITY || transformType == AffineTransform.TYPE_TRANSLATION) optimizedTransform = true;
private void updateOptimization() { int transformType = transform.getType(); boolean optimizedTransform = (transformType & (AffineTransform.TYPE_TRANSLATION | AffineTransform.TYPE_IDENTITY)) != 0; isOptimized = clip instanceof Rectangle && optimizedTransform && paint instanceof Co...
isOptimized = clip instanceof Rectangle
boolean optimizedClip = (clip == null || clip instanceof Rectangle); isOptimized = optimizedClip
private void updateOptimization() { int transformType = transform.getType(); boolean optimizedTransform = (transformType & (AffineTransform.TYPE_TRANSLATION | AffineTransform.TYPE_IDENTITY)) != 0; isOptimized = clip instanceof Rectangle && optimizedTransform && paint instanceof Co...
if (instance == null)
if (instances == null) instances = new HashMap(); Object o = instances.get(component); MetalSliderUI instance; if (o == null) {
public static ComponentUI createUI(JComponent component) { if (instance == null) instance = new MetalSliderUI(); return instance; }
instances.put(component, instance); } else instance = (MetalSliderUI) o;
public static ComponentUI createUI(JComponent component) { if (instance == null) instance = new MetalSliderUI(); return instance; }
public void addColumn(Object columnName) { addColumn(columnName, new Vector(dataVector.size())); }
public void addColumn(Object columnName) { addColumn(columnName, (Object[]) null); }
public void addColumn(Object columnName) { addColumn(columnName, new Vector(dataVector.size())); } // addColumn()
}
dataVector.add(rowData); fireTableDataChanged(); }
public void addRow(Vector rowData) { // TODO } // addRow()
int index; Vector vector; if (data == null) {
if (data == null)
protected static Vector convertToVector(Object[] data) { // Variables int index; Vector vector; // Check for null if (data == null) { return null; } // if // Process vector = new Vector(); for (index = 0; index < data.length; index++) { vector.add(data[index]); } // for: index // Return new Vector retu...
} vector = new Vector(); for (index = 0; index < data.length; index++) { vector.add(data[index]); }
Vector vector = new Vector(data.length); for (int i = 0; i < data.length; i++) vector.add(data[i]);
protected static Vector convertToVector(Object[] data) { // Variables int index; Vector vector; // Check for null if (data == null) { return null; } // if // Process vector = new Vector(); for (index = 0; index < data.length; index++) { vector.add(data[index]); } // for: index // Return new Vector retu...
Vector rowVector; rowVector = (Vector) dataVector.get(row); return rowVector.get(column); }
return ((Vector) dataVector.get(row)).get(column); }
public Object getValueAt(int row, int column) { // Variables Vector rowVector; // Get Row Vector rowVector = (Vector) dataVector.get(row); // Get Data return rowVector.get(column); } // getValueAt()