rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
throws NotImplementedException | public int getAccessibleActionCount() throws NotImplementedException { return 0; } |
|
return 0; | return 1; | public int getAccessibleActionCount() throws NotImplementedException { return 0; } |
public String getAccessibleActionDescription(int value0) throws NotImplementedException | public String getAccessibleActionDescription(int actionIndex) | public String getAccessibleActionDescription(int value0) throws NotImplementedException { return null; } |
return null; | return UIManager.getString("ComboBox.togglePopupText"); | public String getAccessibleActionDescription(int value0) throws NotImplementedException { return null; } |
public Accessible getAccessibleChild(int value0) throws NotImplementedException | public Accessible getAccessibleChild(int index) | public Accessible getAccessibleChild(int value0) throws NotImplementedException { return null; } |
return null; | ComponentUI ui = getUI(); Accessible child = null; if (ui != null) child = ui.getAccessibleChild(JComboBox.this, index); else child = super.getAccessibleChild(index); return child; | public Accessible getAccessibleChild(int value0) throws NotImplementedException { return null; } |
return 0; | ComponentUI ui = getUI(); int count; if (ui != null) count = ui.getAccessibleChildrenCount(JComboBox.this); else count = super.getAccessibleChildrenCount(); return count; | public int getAccessibleChildrenCount() throws NotImplementedException { return 0; } |
return 0; | Object sel = getSelectedItem(); int count = 0; if (sel != null) count = 1; return count; | public int getAccessibleSelectionCount() throws NotImplementedException { return 0; } |
public boolean isAccessibleChildSelected(int value0) throws NotImplementedException | public boolean isAccessibleChildSelected(int index) | public boolean isAccessibleChildSelected(int value0) throws NotImplementedException { return false; } |
return false; | return getSelectedIndex() == index; | public boolean isAccessibleChildSelected(int value0) throws NotImplementedException { return false; } |
public void removeAccessibleSelection(int value0) throws NotImplementedException | public void removeAccessibleSelection(int index) | public void removeAccessibleSelection(int value0) throws NotImplementedException { // TODO: Implement this properly. } |
if (getSelectedIndex() == index) clearAccessibleSelection(); | public void removeAccessibleSelection(int value0) throws NotImplementedException { // TODO: Implement this properly. } |
|
start(); | EventDispatchThread(EventQueue queue) { super(); setName("AWT-EventQueue-" + ++dispatchThreadNum); this.queue = queue; setPriority(NORM_PRIORITY + 1); start(); } |
|
while (true) { try { AWTEvent evt = queue.getNextEvent(); if (isInterrupted ()) { return; } | System.out.println("run of dispatch thread"); while (true) { try { AWTEvent evt = queue.getNextEvent(); | public void run() { while (true) { try { AWTEvent evt = queue.getNextEvent(); if (isInterrupted ()) { // We are interrupted when we should finish executing return; } KeyboardFocusManager manager; manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); // Try to dispatch this event to the current keyboard focus // manager. It will dispatch all FocusEvents, all // WindowEvents related to focus, and all KeyEvents, // returning true. Otherwise, it returns false and we // dispatch the event normally. if (!manager.dispatchEvent (evt)) queue.dispatchEvent(evt); } catch (ThreadDeath death) { // If someone wants to kill us, let them. return; } catch (InterruptedException ie) { // We are interrupted when we should finish executing return; } catch (Throwable x) { System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } } |
if (!manager.dispatchEvent (evt)) queue.dispatchEvent(evt); } catch (ThreadDeath death) { return; | if (!manager.dispatchEvent(evt)) { queue.dispatchEvent(evt); } } catch (ThreadDeath death) { System.out.println("dispatch thread:threaddeath"); return; } catch (InterruptedException ie) { System.out.println("dispatch thread:interrupted"); return; } catch (Throwable x) { System.out.println("dispatch thread:exception"); x.printStackTrace(); System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } | public void run() { while (true) { try { AWTEvent evt = queue.getNextEvent(); if (isInterrupted ()) { // We are interrupted when we should finish executing return; } KeyboardFocusManager manager; manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); // Try to dispatch this event to the current keyboard focus // manager. It will dispatch all FocusEvents, all // WindowEvents related to focus, and all KeyEvents, // returning true. Otherwise, it returns false and we // dispatch the event normally. if (!manager.dispatchEvent (evt)) queue.dispatchEvent(evt); } catch (ThreadDeath death) { // If someone wants to kill us, let them. return; } catch (InterruptedException ie) { // We are interrupted when we should finish executing return; } catch (Throwable x) { System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } } |
catch (InterruptedException ie) { return; } catch (Throwable x) { System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } } | } | public void run() { while (true) { try { AWTEvent evt = queue.getNextEvent(); if (isInterrupted ()) { // We are interrupted when we should finish executing return; } KeyboardFocusManager manager; manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); // Try to dispatch this event to the current keyboard focus // manager. It will dispatch all FocusEvents, all // WindowEvents related to focus, and all KeyEvents, // returning true. Otherwise, it returns false and we // dispatch the event normally. if (!manager.dispatchEvent (evt)) queue.dispatchEvent(evt); } catch (ThreadDeath death) { // If someone wants to kill us, let them. return; } catch (InterruptedException ie) { // We are interrupted when we should finish executing return; } catch (Throwable x) { System.err.println("Exception during event dispatch:"); x.printStackTrace(System.err); } } } |
VmAbstractHeap heap = heapManager.getFirstHeap(); | VmAbstractHeap heap = heapManager.getHeapList(); | private final void runFinalization() { VmAbstractHeap heap = heapManager.getFirstHeap(); while (heap != null) { visitor.setCurrentHeap(heap); heap.walk(visitor, true, ObjectFlags.GC_COLOUR_MASK, ObjectFlags.GC_YELLOW); heap = heap.getNext(); } } |
responseHeaders.remove("Content-Encoding"); | private InputStream createResponseBodyStream(Headers responseHeaders, int majorVersion, int minorVersion, InputStream in) throws IOException { long contentLength = -1; Headers trailer = null; // Persistent connections are the default in HTTP/1.1 boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) || "close".equalsIgnoreCase(responseHeaders.getValue("Connection")) || (connection.majorVersion == 1 && connection.minorVersion == 0) || (majorVersion == 1 && minorVersion == 0); String transferCoding = responseHeaders.getValue("Transfer-Encoding"); if ("chunked".equalsIgnoreCase(transferCoding)) { in = new LimitedLengthInputStream(in, -1, false, connection, doClose); in = new ChunkedInputStream(in, responseHeaders); } else { contentLength = responseHeaders.getLongValue("Content-Length"); if (contentLength < 0) doClose = true; // No Content-Length, must close. in = new LimitedLengthInputStream(in, contentLength, contentLength >= 0, connection, doClose); } String contentCoding = responseHeaders.getValue("Content-Encoding"); if (contentCoding != null && !"identity".equals(contentCoding)) { if ("gzip".equals(contentCoding)) { in = new GZIPInputStream(in); } else if ("deflate".equals(contentCoding)) { in = new InflaterInputStream(in); } else { throw new ProtocolException("Unsupported Content-Encoding: " + contentCoding); } } return in; } |
|
addLayoutComponent(Component component, Object constraints) { | public void addLayoutComponent(Component component, Object constraints) { | addLayoutComponent(Component component, Object constraints){ if (constraints != null && ! (constraints instanceof String)) throw new IllegalArgumentException("Constraint must be a string"); addLayoutComponent((String) constraints, component);} |
calcCompSize(Component comp, int what) { | private Dimension calcCompSize(Component comp, int what) { | calcCompSize(Component comp, int what){ if (comp == null || !comp.isVisible()) return new Dimension(0, 0); if (what == MIN) return comp.getMinimumSize(); else if (what == MAX) return comp.getMaximumSize(); return comp.getPreferredSize();} |
calcSize(Container target, int what) { | private Dimension calcSize(Container target, int what) { | calcSize(Container target, int what){ synchronized (target.getTreeLock ()) { Insets ins = target.getInsets(); ComponentOrientation orient = target.getComponentOrientation (); boolean left_to_right = orient.isLeftToRight (); Component my_north = north; Component my_east = east; Component my_south = south; Component my_west = west; // Note that we currently don't handle vertical layouts. Neither // does JDK 1.3. if (firstLine != null) my_north = firstLine; if (lastLine != null) my_south = lastLine; if (firstItem != null) { if (left_to_right) my_west = firstItem; else my_east = firstItem; } if (lastItem != null) { if (left_to_right) my_east = lastItem; else my_west = lastItem; } Dimension ndim = calcCompSize(my_north, what); Dimension sdim = calcCompSize(my_south, what); Dimension edim = calcCompSize(my_east, what); Dimension wdim = calcCompSize(my_west, what); Dimension cdim = calcCompSize(center, what); int width = edim.width + cdim.width + wdim.width + (hgap * 2); // check for overflow if (width < edim.width || width < cdim.width || width < cdim.width) width = Integer.MAX_VALUE; if (ndim.width > width) width = ndim.width; if (sdim.width > width) width = sdim.width; width += (ins.left + ins.right); int height = edim.height; if (cdim.height > height) height = cdim.height; if (wdim.height > height) height = wdim.height; int addedHeight = height + (ndim.height + sdim.height + (vgap * 2) + ins.top + ins.bottom); // check for overflow if (addedHeight < height) height = Integer.MAX_VALUE; else height = addedHeight; return(new Dimension(width, height)); }} |
getHgap() { | public int getHgap() { | getHgap(){ return(hgap);} |
getLayoutAlignmentX(Container parent) { | public float getLayoutAlignmentX(Container parent) { | getLayoutAlignmentX(Container parent){ return(parent.getAlignmentX());} |
getLayoutAlignmentY(Container parent) { | public float getLayoutAlignmentY(Container parent) { | getLayoutAlignmentY(Container parent){ return(parent.getAlignmentY());} |
getVgap() { | public int getVgap() { | getVgap(){ return(vgap);} |
invalidateLayout(Container parent) { } | public void invalidateLayout(Container parent) { } | invalidateLayout(Container parent){} |
layoutContainer(Container target) { | public void layoutContainer(Container target) { | layoutContainer(Container target){ synchronized (target.getTreeLock ()) { Insets i = target.getInsets(); ComponentOrientation orient = target.getComponentOrientation (); boolean left_to_right = orient.isLeftToRight (); Component my_north = north; Component my_east = east; Component my_south = south; Component my_west = west; // Note that we currently don't handle vertical layouts. Neither // does JDK 1.3. if (firstLine != null) my_north = firstLine; if (lastLine != null) my_south = lastLine; if (firstItem != null) { if (left_to_right) my_west = firstItem; else my_east = firstItem; } if (lastItem != null) { if (left_to_right) my_east = lastItem; else my_west = lastItem; } Dimension c = calcCompSize(center, PREF); Dimension n = calcCompSize(my_north, PREF); Dimension s = calcCompSize(my_south, PREF); Dimension e = calcCompSize(my_east, PREF); Dimension w = calcCompSize(my_west, PREF); Dimension t = target.getSize(); /* <-> hgap <-> hgap +----------------------------+ } |t | } i.top | +----------------------+ | --- y1 } | |n | | | +----------------------+ | } vgap | +---+ +----------+ +---+ | --- y2 } } | |w | |c | |e | | } hh | +---+ +----------+ +---+ | } vgap } | +----------------------+ | --- y3 } | |s | | | +----------------------+ | } | | } i.bottom +----------------------------+ } |x1 |x2 |x3 <----------------------> <--> ww <--> i.left i.right */ int x1 = i.left; int x2 = x1 + w.width + (w.width == 0 ? 0 : hgap); int x3; if (t.width <= i.right + e.width) x3 = x2 + w.width + (w.width == 0 ? 0 : hgap); else x3 = t.width - i.right - e.width; int ww = t.width - i.right - i.left; int y1 = i.top; int y2 = y1 + n.height + (n.height == 0 ? 0 : vgap); int midh = Math.max(e.height, Math.max(w.height, c.height)); int y3; if (t.height <= i.bottom + s.height) y3 = y2 + midh + vgap; else y3 = t.height - i.bottom - s.height; int hh = y3-y2-(s.height == 0 ? 0 : vgap); setBounds(center, x2, y2, x3-x2-(w.width == 0 ? 0 : hgap), hh); setBounds(my_north, x1, y1, ww, n.height); setBounds(my_south, x1, y3, ww, s.height); setBounds(my_west, x1, y2, w.width, hh); setBounds(my_east, x3, y2, e.width, hh); }} |
Dimension t = target.getSize(); | int targetWidth = target.getWidth(); int targetHeight = target.getHeight(); | layoutContainer(Container target){ synchronized (target.getTreeLock ()) { Insets i = target.getInsets(); ComponentOrientation orient = target.getComponentOrientation (); boolean left_to_right = orient.isLeftToRight (); Component my_north = north; Component my_east = east; Component my_south = south; Component my_west = west; // Note that we currently don't handle vertical layouts. Neither // does JDK 1.3. if (firstLine != null) my_north = firstLine; if (lastLine != null) my_south = lastLine; if (firstItem != null) { if (left_to_right) my_west = firstItem; else my_east = firstItem; } if (lastItem != null) { if (left_to_right) my_east = lastItem; else my_west = lastItem; } Dimension c = calcCompSize(center, PREF); Dimension n = calcCompSize(my_north, PREF); Dimension s = calcCompSize(my_south, PREF); Dimension e = calcCompSize(my_east, PREF); Dimension w = calcCompSize(my_west, PREF); Dimension t = target.getSize(); /* <-> hgap <-> hgap +----------------------------+ } |t | } i.top | +----------------------+ | --- y1 } | |n | | | +----------------------+ | } vgap | +---+ +----------+ +---+ | --- y2 } } | |w | |c | |e | | } hh | +---+ +----------+ +---+ | } vgap } | +----------------------+ | --- y3 } | |s | | | +----------------------+ | } | | } i.bottom +----------------------------+ } |x1 |x2 |x3 <----------------------> <--> ww <--> i.left i.right */ int x1 = i.left; int x2 = x1 + w.width + (w.width == 0 ? 0 : hgap); int x3; if (t.width <= i.right + e.width) x3 = x2 + w.width + (w.width == 0 ? 0 : hgap); else x3 = t.width - i.right - e.width; int ww = t.width - i.right - i.left; int y1 = i.top; int y2 = y1 + n.height + (n.height == 0 ? 0 : vgap); int midh = Math.max(e.height, Math.max(w.height, c.height)); int y3; if (t.height <= i.bottom + s.height) y3 = y2 + midh + vgap; else y3 = t.height - i.bottom - s.height; int hh = y3-y2-(s.height == 0 ? 0 : vgap); setBounds(center, x2, y2, x3-x2-(w.width == 0 ? 0 : hgap), hh); setBounds(my_north, x1, y1, ww, n.height); setBounds(my_south, x1, y3, ww, s.height); setBounds(my_west, x1, y2, w.width, hh); setBounds(my_east, x3, y2, e.width, hh); }} |
if (t.width <= i.right + e.width) | if (targetWidth <= i.right + e.width) | layoutContainer(Container target){ synchronized (target.getTreeLock ()) { Insets i = target.getInsets(); ComponentOrientation orient = target.getComponentOrientation (); boolean left_to_right = orient.isLeftToRight (); Component my_north = north; Component my_east = east; Component my_south = south; Component my_west = west; // Note that we currently don't handle vertical layouts. Neither // does JDK 1.3. if (firstLine != null) my_north = firstLine; if (lastLine != null) my_south = lastLine; if (firstItem != null) { if (left_to_right) my_west = firstItem; else my_east = firstItem; } if (lastItem != null) { if (left_to_right) my_east = lastItem; else my_west = lastItem; } Dimension c = calcCompSize(center, PREF); Dimension n = calcCompSize(my_north, PREF); Dimension s = calcCompSize(my_south, PREF); Dimension e = calcCompSize(my_east, PREF); Dimension w = calcCompSize(my_west, PREF); Dimension t = target.getSize(); /* <-> hgap <-> hgap +----------------------------+ } |t | } i.top | +----------------------+ | --- y1 } | |n | | | +----------------------+ | } vgap | +---+ +----------+ +---+ | --- y2 } } | |w | |c | |e | | } hh | +---+ +----------+ +---+ | } vgap } | +----------------------+ | --- y3 } | |s | | | +----------------------+ | } | | } i.bottom +----------------------------+ } |x1 |x2 |x3 <----------------------> <--> ww <--> i.left i.right */ int x1 = i.left; int x2 = x1 + w.width + (w.width == 0 ? 0 : hgap); int x3; if (t.width <= i.right + e.width) x3 = x2 + w.width + (w.width == 0 ? 0 : hgap); else x3 = t.width - i.right - e.width; int ww = t.width - i.right - i.left; int y1 = i.top; int y2 = y1 + n.height + (n.height == 0 ? 0 : vgap); int midh = Math.max(e.height, Math.max(w.height, c.height)); int y3; if (t.height <= i.bottom + s.height) y3 = y2 + midh + vgap; else y3 = t.height - i.bottom - s.height; int hh = y3-y2-(s.height == 0 ? 0 : vgap); setBounds(center, x2, y2, x3-x2-(w.width == 0 ? 0 : hgap), hh); setBounds(my_north, x1, y1, ww, n.height); setBounds(my_south, x1, y3, ww, s.height); setBounds(my_west, x1, y2, w.width, hh); setBounds(my_east, x3, y2, e.width, hh); }} |
x3 = t.width - i.right - e.width; int ww = t.width - i.right - i.left; | x3 = targetWidth - i.right - e.width; int ww = targetWidth - i.right - i.left; | layoutContainer(Container target){ synchronized (target.getTreeLock ()) { Insets i = target.getInsets(); ComponentOrientation orient = target.getComponentOrientation (); boolean left_to_right = orient.isLeftToRight (); Component my_north = north; Component my_east = east; Component my_south = south; Component my_west = west; // Note that we currently don't handle vertical layouts. Neither // does JDK 1.3. if (firstLine != null) my_north = firstLine; if (lastLine != null) my_south = lastLine; if (firstItem != null) { if (left_to_right) my_west = firstItem; else my_east = firstItem; } if (lastItem != null) { if (left_to_right) my_east = lastItem; else my_west = lastItem; } Dimension c = calcCompSize(center, PREF); Dimension n = calcCompSize(my_north, PREF); Dimension s = calcCompSize(my_south, PREF); Dimension e = calcCompSize(my_east, PREF); Dimension w = calcCompSize(my_west, PREF); Dimension t = target.getSize(); /* <-> hgap <-> hgap +----------------------------+ } |t | } i.top | +----------------------+ | --- y1 } | |n | | | +----------------------+ | } vgap | +---+ +----------+ +---+ | --- y2 } } | |w | |c | |e | | } hh | +---+ +----------+ +---+ | } vgap } | +----------------------+ | --- y3 } | |s | | | +----------------------+ | } | | } i.bottom +----------------------------+ } |x1 |x2 |x3 <----------------------> <--> ww <--> i.left i.right */ int x1 = i.left; int x2 = x1 + w.width + (w.width == 0 ? 0 : hgap); int x3; if (t.width <= i.right + e.width) x3 = x2 + w.width + (w.width == 0 ? 0 : hgap); else x3 = t.width - i.right - e.width; int ww = t.width - i.right - i.left; int y1 = i.top; int y2 = y1 + n.height + (n.height == 0 ? 0 : vgap); int midh = Math.max(e.height, Math.max(w.height, c.height)); int y3; if (t.height <= i.bottom + s.height) y3 = y2 + midh + vgap; else y3 = t.height - i.bottom - s.height; int hh = y3-y2-(s.height == 0 ? 0 : vgap); setBounds(center, x2, y2, x3-x2-(w.width == 0 ? 0 : hgap), hh); setBounds(my_north, x1, y1, ww, n.height); setBounds(my_south, x1, y3, ww, s.height); setBounds(my_west, x1, y2, w.width, hh); setBounds(my_east, x3, y2, e.width, hh); }} |
if (t.height <= i.bottom + s.height) | if (targetHeight <= i.bottom + s.height) | layoutContainer(Container target){ synchronized (target.getTreeLock ()) { Insets i = target.getInsets(); ComponentOrientation orient = target.getComponentOrientation (); boolean left_to_right = orient.isLeftToRight (); Component my_north = north; Component my_east = east; Component my_south = south; Component my_west = west; // Note that we currently don't handle vertical layouts. Neither // does JDK 1.3. if (firstLine != null) my_north = firstLine; if (lastLine != null) my_south = lastLine; if (firstItem != null) { if (left_to_right) my_west = firstItem; else my_east = firstItem; } if (lastItem != null) { if (left_to_right) my_east = lastItem; else my_west = lastItem; } Dimension c = calcCompSize(center, PREF); Dimension n = calcCompSize(my_north, PREF); Dimension s = calcCompSize(my_south, PREF); Dimension e = calcCompSize(my_east, PREF); Dimension w = calcCompSize(my_west, PREF); Dimension t = target.getSize(); /* <-> hgap <-> hgap +----------------------------+ } |t | } i.top | +----------------------+ | --- y1 } | |n | | | +----------------------+ | } vgap | +---+ +----------+ +---+ | --- y2 } } | |w | |c | |e | | } hh | +---+ +----------+ +---+ | } vgap } | +----------------------+ | --- y3 } | |s | | | +----------------------+ | } | | } i.bottom +----------------------------+ } |x1 |x2 |x3 <----------------------> <--> ww <--> i.left i.right */ int x1 = i.left; int x2 = x1 + w.width + (w.width == 0 ? 0 : hgap); int x3; if (t.width <= i.right + e.width) x3 = x2 + w.width + (w.width == 0 ? 0 : hgap); else x3 = t.width - i.right - e.width; int ww = t.width - i.right - i.left; int y1 = i.top; int y2 = y1 + n.height + (n.height == 0 ? 0 : vgap); int midh = Math.max(e.height, Math.max(w.height, c.height)); int y3; if (t.height <= i.bottom + s.height) y3 = y2 + midh + vgap; else y3 = t.height - i.bottom - s.height; int hh = y3-y2-(s.height == 0 ? 0 : vgap); setBounds(center, x2, y2, x3-x2-(w.width == 0 ? 0 : hgap), hh); setBounds(my_north, x1, y1, ww, n.height); setBounds(my_south, x1, y3, ww, s.height); setBounds(my_west, x1, y2, w.width, hh); setBounds(my_east, x3, y2, e.width, hh); }} |
y3 = t.height - i.bottom - s.height; | y3 = targetHeight - i.bottom - s.height; | layoutContainer(Container target){ synchronized (target.getTreeLock ()) { Insets i = target.getInsets(); ComponentOrientation orient = target.getComponentOrientation (); boolean left_to_right = orient.isLeftToRight (); Component my_north = north; Component my_east = east; Component my_south = south; Component my_west = west; // Note that we currently don't handle vertical layouts. Neither // does JDK 1.3. if (firstLine != null) my_north = firstLine; if (lastLine != null) my_south = lastLine; if (firstItem != null) { if (left_to_right) my_west = firstItem; else my_east = firstItem; } if (lastItem != null) { if (left_to_right) my_east = lastItem; else my_west = lastItem; } Dimension c = calcCompSize(center, PREF); Dimension n = calcCompSize(my_north, PREF); Dimension s = calcCompSize(my_south, PREF); Dimension e = calcCompSize(my_east, PREF); Dimension w = calcCompSize(my_west, PREF); Dimension t = target.getSize(); /* <-> hgap <-> hgap +----------------------------+ } |t | } i.top | +----------------------+ | --- y1 } | |n | | | +----------------------+ | } vgap | +---+ +----------+ +---+ | --- y2 } } | |w | |c | |e | | } hh | +---+ +----------+ +---+ | } vgap } | +----------------------+ | --- y3 } | |s | | | +----------------------+ | } | | } i.bottom +----------------------------+ } |x1 |x2 |x3 <----------------------> <--> ww <--> i.left i.right */ int x1 = i.left; int x2 = x1 + w.width + (w.width == 0 ? 0 : hgap); int x3; if (t.width <= i.right + e.width) x3 = x2 + w.width + (w.width == 0 ? 0 : hgap); else x3 = t.width - i.right - e.width; int ww = t.width - i.right - i.left; int y1 = i.top; int y2 = y1 + n.height + (n.height == 0 ? 0 : vgap); int midh = Math.max(e.height, Math.max(w.height, c.height)); int y3; if (t.height <= i.bottom + s.height) y3 = y2 + midh + vgap; else y3 = t.height - i.bottom - s.height; int hh = y3-y2-(s.height == 0 ? 0 : vgap); setBounds(center, x2, y2, x3-x2-(w.width == 0 ? 0 : hgap), hh); setBounds(my_north, x1, y1, ww, n.height); setBounds(my_south, x1, y3, ww, s.height); setBounds(my_west, x1, y2, w.width, hh); setBounds(my_east, x3, y2, e.width, hh); }} |
maximumLayoutSize(Container target) { | public Dimension maximumLayoutSize(Container target) { | maximumLayoutSize(Container target){ return calcSize(target, MAX);} |
minimumLayoutSize(Container target) { | public Dimension minimumLayoutSize(Container target) { | minimumLayoutSize(Container target){ return calcSize(target, MIN);} |
preferredLayoutSize(Container target) { | public Dimension preferredLayoutSize(Container target) { | preferredLayoutSize(Container target){ return calcSize(target, PREF);} |
removeLayoutComponent(Component component) { | public void removeLayoutComponent(Component component) { | removeLayoutComponent(Component component){ if (north == component) north = null; if (south == component) south = null; if (east == component) east = null; if (west == component) west = null; if (center == component) center = null; if (firstItem == component) firstItem = null; if (lastItem == component) lastItem = null; if (firstLine == component) firstLine = null; if (lastLine == component) lastLine = null;} |
setBounds(Component comp, int x, int y, int w, int h) { | private void setBounds(Component comp, int x, int y, int w, int h) { | setBounds(Component comp, int x, int y, int w, int h){ if (comp == null) return; comp.setBounds(x, y, w, h);} |
setHgap(int hgap) { | public void setHgap(int hgap) { | setHgap(int hgap){ this.hgap = hgap;} |
setVgap(int vgap) { | public void setVgap(int vgap) { | setVgap(int vgap){ this.vgap = vgap;} |
toString() { | public String toString() { | toString(){ return getClass().getName() + "[hgap=" + hgap + ",vgap=" + vgap + "]";} |
final int[] table = this.table; if (table != null) { final int length = table.length; int lastPC = 0; for (int i = 0; i < length; i += 2) { final int o = table[i+1]; if (o > offset) { return lastPC; } else { lastPC = table[i+0]; } } } return 0; } | final int[] table = this.table; if (table != null) { final int length = table.length; int lastPC = 0; for (int i = 0; i < length; i += 2) { final int o = table[ i + 1]; if (o > offset) { return lastPC; } else { lastPC = table[ i + 0]; } } return lastPC; } else { return 0; } } | public int findPC(int offset) { final int[] table = this.table; if (table != null) { final int length = table.length; int lastPC = 0; for (int i = 0; i < length; i += 2) { final int o = table[i+1]; if (o > offset) { return lastPC; } else { lastPC = table[i+0]; } } } return 0; } |
registerKeyboardAction(); | registerKeyboardActions(); | protected void installKeyboardActions() { // FIXME: create actions and keystrokes. registerKeyboardAction(); } |
int fs = screenFields.getCurrentFieldShift(); | protected boolean simulateKeyStroke(char c){ if (isStatusErrorCode() && !Character.isISOControl(c) && !keyProcessed) { restoreErrorLine(); setStatus(STATUS_ERROR_CODE,STATUS_VALUE_OFF,null); } boolean updateField = false; boolean numericError = false; boolean updatePos = false; boolean autoEnter = false; if (!Character.isISOControl(c)) { if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { switch (screenFields.getCurrentFieldShift()) { case 0: // Alpha shift case 2: // Numeric Shift updateField = true; break; case 1: // Alpha Only if(Character.isLetter(c) || c == ',' || c == '-' || c == '.' || c == ' ') updateField = true; break; case 3: // Numeric only if(Character.isDigit(c) || c == '+' || c == ',' || c == '-' || c == '.' || c == ' ') updateField = true; else numericError = true; break; case 5: // Digits only if(Character.isDigit(c)) updateField = true; else displayError(ERR_NUMERIC_09); break; case 7: // Signed numeric if(Character.isDigit(c) || c == '+' || c == '-') if (lastPos == screenFields.getCurrentField().endPos() && (c != '+' && c != '-')) displayError(ERR_INVALID_SIGN); else updateField = true; else displayError(ERR_NUMERIC_09); break; } if (updateField) { if (screenFields.isCurrentFieldToUpper()) c = Character.toUpperCase(c); setCursorOff(); updatePos = true; resetDirty(lastPos); if (insertMode) { if (endOfField(false) != screenFields.getCurrentField().endPos()) shiftRight(lastPos); else { displayError(ERR_NO_ROOM_INSERT); updatePos = false; } } if (updatePos) { screenFields.getCurrentField().getKeyPos(getRow(lastPos),getCol(lastPos)); screenFields.getCurrentField().changePos(1); screen[lastPos].setChar(c); screenFields.setCurrentFieldMDT(); // if we have gone passed the end of the field then goto the next field if (!screenFields.withinCurrentField(screenFields.getCurrentFieldPos())) { if (screenFields.isCurrentFieldAutoEnter()) { autoEnter = true; } else if (!screenFields.isCurrentFieldFER()) gotoFieldNext(); } else goto_XY(screenFields.getCurrentField().getCursorRow() + 1,screenFields.getCurrentField().getCursorCol() + 1); } updateImage(dirty); setCursorOn(); if (autoEnter) sendAid(AID_ENTER); } else { if (numericError) { displayError(ERR_NUMERIC_ONLY); } } } else { displayError(ERR_CURSOR_PROTECTED); } } return updatePos; } |
|
case 4: | protected boolean simulateKeyStroke(char c){ if (isStatusErrorCode() && !Character.isISOControl(c) && !keyProcessed) { restoreErrorLine(); setStatus(STATUS_ERROR_CODE,STATUS_VALUE_OFF,null); } boolean updateField = false; boolean numericError = false; boolean updatePos = false; boolean autoEnter = false; if (!Character.isISOControl(c)) { if (screenFields.getCurrentField() != null && screenFields.withinCurrentField(lastPos) && !screenFields.isCurrentFieldBypassField()) { switch (screenFields.getCurrentFieldShift()) { case 0: // Alpha shift case 2: // Numeric Shift updateField = true; break; case 1: // Alpha Only if(Character.isLetter(c) || c == ',' || c == '-' || c == '.' || c == ' ') updateField = true; break; case 3: // Numeric only if(Character.isDigit(c) || c == '+' || c == ',' || c == '-' || c == '.' || c == ' ') updateField = true; else numericError = true; break; case 5: // Digits only if(Character.isDigit(c)) updateField = true; else displayError(ERR_NUMERIC_09); break; case 7: // Signed numeric if(Character.isDigit(c) || c == '+' || c == '-') if (lastPos == screenFields.getCurrentField().endPos() && (c != '+' && c != '-')) displayError(ERR_INVALID_SIGN); else updateField = true; else displayError(ERR_NUMERIC_09); break; } if (updateField) { if (screenFields.isCurrentFieldToUpper()) c = Character.toUpperCase(c); setCursorOff(); updatePos = true; resetDirty(lastPos); if (insertMode) { if (endOfField(false) != screenFields.getCurrentField().endPos()) shiftRight(lastPos); else { displayError(ERR_NO_ROOM_INSERT); updatePos = false; } } if (updatePos) { screenFields.getCurrentField().getKeyPos(getRow(lastPos),getCol(lastPos)); screenFields.getCurrentField().changePos(1); screen[lastPos].setChar(c); screenFields.setCurrentFieldMDT(); // if we have gone passed the end of the field then goto the next field if (!screenFields.withinCurrentField(screenFields.getCurrentFieldPos())) { if (screenFields.isCurrentFieldAutoEnter()) { autoEnter = true; } else if (!screenFields.isCurrentFieldFER()) gotoFieldNext(); } else goto_XY(screenFields.getCurrentField().getCursorRow() + 1,screenFields.getCurrentField().getCursorCol() + 1); } updateImage(dirty); setCursorOn(); if (autoEnter) sendAid(AID_ENTER); } else { if (numericError) { displayError(ERR_NUMERIC_ONLY); } } } else { displayError(ERR_CURSOR_PROTECTED); } } return updatePos; } |
|
if ((obj instanceof MediaName && this instanceof MediaName) || (obj instanceof MediaTray && this instanceof MediaTray) || (obj instanceof MediaSizeName && this instanceof MediaSizeName)) { return ((Media) obj).getValue() == this.getValue(); } | if (obj == null) return false; | public boolean equals(Object obj) { if ((obj instanceof MediaName && this instanceof MediaName) || (obj instanceof MediaTray && this instanceof MediaTray) || (obj instanceof MediaSizeName && this instanceof MediaSizeName)) { return ((Media) obj).getValue() == this.getValue(); } return false; } |
return false; | return (obj.getClass() == this.getClass() && ((Media) obj).getValue() == this.getValue()); | public boolean equals(Object obj) { if ((obj instanceof MediaName && this instanceof MediaName) || (obj instanceof MediaTray && this instanceof MediaTray) || (obj instanceof MediaSizeName && this instanceof MediaSizeName)) { return ((Media) obj).getValue() == this.getValue(); } return false; } |
private final void secureSetAccessible(boolean flag) { if (flag && ((this instanceof Constructor && ((Constructor)this).getDeclaringClass() == Class.class) || ((Member)this).getDeclaringClass() == AccessibleObject.class)) throw new SecurityException( "Cannot make object accessible: " + this); | private final void secureSetAccessible(boolean flag) { if (flag && (this instanceof Constructor && ((Constructor) this).getDeclaringClass() == Class.class)) throw new SecurityException("Cannot make object accessible: " + this); | private final void secureSetAccessible(boolean flag) { if (flag && ((this instanceof Constructor && ((Constructor)this).getDeclaringClass() == Class.class) || ((Member)this).getDeclaringClass() == AccessibleObject.class)) throw new SecurityException( "Cannot make object accessible: " + this); this.flag = flag; } |
Frame frame) { super(); | Frame awtFrame) { this.awtFrame = awtFrame; | public SwingFramePeer(SwingToolkit toolkit, JDesktopPane desktopPane, Frame frame) { super(); this.toolkit = toolkit; desktopPane.add(this); SwingToolkit.copyAwtProperties(frame, this); getContentPane().setLayout(null); setLocation(frame.getLocation()); setSize(frame.getSize()); setResizable(frame.isResizable()); setIconifiable(true); setMaximizable(true); setClosable(true); try { setIcon(frame.getState() == Frame.ICONIFIED); } catch (PropertyVetoException x) { } setState(frame.getState()); setTitle(frame.getTitle()); setIconImage(frame.getIconImage()); setMenuBar(frame.getMenuBar()); } |
desktopPane.add(this); | this.frame = new SwingFrame(awtFrame); desktopPane.add(frame); | public SwingFramePeer(SwingToolkit toolkit, JDesktopPane desktopPane, Frame frame) { super(); this.toolkit = toolkit; desktopPane.add(this); SwingToolkit.copyAwtProperties(frame, this); getContentPane().setLayout(null); setLocation(frame.getLocation()); setSize(frame.getSize()); setResizable(frame.isResizable()); setIconifiable(true); setMaximizable(true); setClosable(true); try { setIcon(frame.getState() == Frame.ICONIFIED); } catch (PropertyVetoException x) { } setState(frame.getState()); setTitle(frame.getTitle()); setIconImage(frame.getIconImage()); setMenuBar(frame.getMenuBar()); } |
SwingToolkit.copyAwtProperties(frame, this); getContentPane().setLayout(null); setLocation(frame.getLocation()); setSize(frame.getSize()); setResizable(frame.isResizable()); setIconifiable(true); setMaximizable(true); setClosable(true); | SwingToolkit.copyAwtProperties(awtFrame, this.frame); frame.getContentPane().setLayout(new SwingFrameLayout(this)); frame.setLocation(awtFrame.getLocation()); frame.setSize(awtFrame.getSize()); setResizable(awtFrame.isResizable()); frame.setIconifiable(true); frame.setMaximizable(true); frame.setClosable(true); | public SwingFramePeer(SwingToolkit toolkit, JDesktopPane desktopPane, Frame frame) { super(); this.toolkit = toolkit; desktopPane.add(this); SwingToolkit.copyAwtProperties(frame, this); getContentPane().setLayout(null); setLocation(frame.getLocation()); setSize(frame.getSize()); setResizable(frame.isResizable()); setIconifiable(true); setMaximizable(true); setClosable(true); try { setIcon(frame.getState() == Frame.ICONIFIED); } catch (PropertyVetoException x) { } setState(frame.getState()); setTitle(frame.getTitle()); setIconImage(frame.getIconImage()); setMenuBar(frame.getMenuBar()); } |
setIcon(frame.getState() == Frame.ICONIFIED); | frame.setIcon(awtFrame.getState() == Frame.ICONIFIED); | public SwingFramePeer(SwingToolkit toolkit, JDesktopPane desktopPane, Frame frame) { super(); this.toolkit = toolkit; desktopPane.add(this); SwingToolkit.copyAwtProperties(frame, this); getContentPane().setLayout(null); setLocation(frame.getLocation()); setSize(frame.getSize()); setResizable(frame.isResizable()); setIconifiable(true); setMaximizable(true); setClosable(true); try { setIcon(frame.getState() == Frame.ICONIFIED); } catch (PropertyVetoException x) { } setState(frame.getState()); setTitle(frame.getTitle()); setIconImage(frame.getIconImage()); setMenuBar(frame.getMenuBar()); } |
setState(frame.getState()); setTitle(frame.getTitle()); setIconImage(frame.getIconImage()); setMenuBar(frame.getMenuBar()); | setState(awtFrame.getState()); frame.setTitle(awtFrame.getTitle()); setMenuBar(awtFrame.getMenuBar()); | public SwingFramePeer(SwingToolkit toolkit, JDesktopPane desktopPane, Frame frame) { super(); this.toolkit = toolkit; desktopPane.add(this); SwingToolkit.copyAwtProperties(frame, this); getContentPane().setLayout(null); setLocation(frame.getLocation()); setSize(frame.getSize()); setResizable(frame.isResizable()); setIconifiable(true); setMaximizable(true); setClosable(true); try { setIcon(frame.getState() == Frame.ICONIFIED); } catch (PropertyVetoException x) { } setState(frame.getState()); setTitle(frame.getTitle()); setIconImage(frame.getIconImage()); setMenuBar(frame.getMenuBar()); } |
getContentPane().add(peer); | frame.getContentPane().add(peer); | public void addAWTComponent(Component awtComponent, JComponent peer) { getContentPane().add(peer); } |
System.err.println(e); | public void coalescePaintEvent(PaintEvent e) { System.err.println(e); } |
|
public void createBuffers(int x, BufferCapabilities bufferCapabilities) { | public void createBuffers(int x, BufferCapabilities capabilities) throws AWTException { | public void createBuffers(int x, BufferCapabilities bufferCapabilities) { } |
public void flip(BufferCapabilities.FlipContents flipContents) { | public void flip(FlipContents contents) { | public void flip(BufferCapabilities.FlipContents flipContents) { } |
public boolean requestFocus(Component lightweightChild, boolean temporary, boolean focusedWindowChangeAllowed, long time) { return true; | public void requestFocus() { frame.requestFocus(); | public boolean requestFocus(Component lightweightChild, boolean temporary, boolean focusedWindowChangeAllowed, long time) { return true; } |
public void setIconImage(Image im) { | public void setIconImage(Image image) { | public void setIconImage(Image im) { } |
public void setMaximizedBounds(java.awt.Rectangle bounds) { | public void setMaximizedBounds(Rectangle r) { | public void setMaximizedBounds(java.awt.Rectangle bounds) { } |
frame.setMenuBar(new SwingMenuBarPeer(mb)); | public void setMenuBar(MenuBar mb) { } |
|
if (state == Frame.ICONIFIED) { } else { } | public void setState(int state) { if (state == Frame.ICONIFIED) { } else // state == Frame.NORMAL { } } |
|
configure(DEFAULT_CONFIG_FILE); | public Log () { configure(DEFAULT_CONFIG_FILE); } |
|
public void configure(String configFileName) { | public static void configure(String configFileName) { | public void configure(String configFileName) { Properties props = new Properties(); //the property hashtable try { FileInputStream istream = new FileInputStream(configFileName); props.load(istream); istream.close(); } catch (IOException e) { System.err.println("Could not read configuration file [" + configFileName+ "]."); // e.printStackTrace(); System.err.println("Ignoring configuration file [" + configFileName+"]."); System.err.println("using default config"); defaultConfig(); return; } // If we reach here, then the config file is alright. System.out.println("Reading configuration."); configure(props); } |
public void debug(String msg) { | public static void debug(String msg) { | public void debug(String msg) { if (priority > Priority.DEBUG) return; try { output.write(msg.getBytes()); output.write(Constants.NEW_LINE.getBytes()); } catch (IOException e) { System.err.println("error in Log.debug()"); e.printStackTrace(); } } |
public void defaultConfig() { | public static void defaultConfig() { | public void defaultConfig() { output = DEFAULT_OUTPUTSTREAM; priority = DEFAULT_PRIORITY; } |
public void error(String msg) { | public static void error(String msg) { | public void error(String msg) { if (priority > Priority.ERROR) return; try { output.write(msg.getBytes()); output.write(Constants.NEW_LINE.getBytes()); } catch (IOException e) { System.err.println("error in Log.error()"); e.printStackTrace(); } } |
public void info(String msg) { | public static void info(String msg) { | public void info(String msg) { if (priority > Priority.INFO) return; try { output.write(msg.getBytes()); output.write(Constants.NEW_LINE.getBytes()); } catch (IOException e) { System.err.println("error in Log.info()"); e.printStackTrace(); } } |
public void warn(String msg) { | public static void warn(String msg) { | public void warn(String msg) { if (priority > Priority.WARN) return; try { output.write(msg.getBytes()); output.write(Constants.NEW_LINE.getBytes()); } catch (IOException e) { System.err.println("error in Log.warn()"); e.printStackTrace(); } } |
KeyEvent me = new KeyEvent(tk.getTop(), id, time, modifiers, keyCode, | Frame top = tk.getTop(); if(top == null){ return; } KeyEvent me = new KeyEvent(top, id, time, modifiers, keyCode, | private void postEvent(int id, long time, int modifiers, int keyCode, char keyChar) { JNodeToolkit tk = (JNodeToolkit) Toolkit.getDefaultToolkit(); KeyEvent me = new KeyEvent(tk.getTop(), id, time, modifiers, keyCode, keyChar); eventQueue.postEvent(me); } |
int keyCode, char keyChar) | int keyCode, char keyChar, int keyLocation) | public KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar) { this(source, id, when, modifiers, keyCode, keyChar, KEY_LOCATION_UNKNOWN); } |
this(source, id, when, modifiers, keyCode, keyChar, KEY_LOCATION_UNKNOWN); | super(source, id, when, modifiers); this.keyCode = keyCode; this.keyChar = keyChar; this.keyLocation = keyLocation; if ((id == KEY_TYPED && (keyCode != VK_UNDEFINED || keyChar == CHAR_UNDEFINED)) || keyLocation < KEY_LOCATION_UNKNOWN || keyLocation > KEY_LOCATION_NUMPAD) throw new IllegalArgumentException(); | public KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar) { this(source, id, when, modifiers, keyCode, keyChar, KEY_LOCATION_UNKNOWN); } |
{ new SecureRandom ().nextBytes(buffer); } | getDefaultPRNG().nextBytes(buffer); | protected void nextRandomBytes(byte[] buffer) { if (rnd != null) { rnd.nextBytes(buffer); } else if (irnd != null) { try { irnd.nextBytes(buffer, 0, buffer.length); } catch (IllegalStateException x) { throw new RuntimeException("nextRandomBytes(): " + String.valueOf(x)); } catch (LimitReachedException x) { throw new RuntimeException("nextRandomBytes(): " + String.valueOf(x)); } } else { new SecureRandom ().nextBytes(buffer); } } |
changes.firePropertyChange("cursorBottOffset", getStringProperty("cursorBottOffset"), cursorBottOffset.getText()); setProperty("cursorBottOffset",cursorBottOffset.getText()); | private void applyAttributes() { if (!getStringProperty("font").equals( (String)fontsList.getSelectedItem()) ) { changes.firePropertyChange("font", getStringProperty("font"), (String)fontsList.getSelectedItem()); setProperty("font",(String)fontsList.getSelectedItem()); } String newSelection = (String)colorList.getSelectedItem(); if (colorSchema != null) { if (!getColorProperty("colorBg").equals(colorSchema.getColorBg())) { changes.firePropertyChange("colorBg", getColorProperty("colorBg"), colorSchema.getColorBg()); setProperty("colorBg",Integer.toString(colorSchema.getColorBg().getRGB())); } if (!getColorProperty("colorBlue").equals(colorSchema.getColorBlue())) { changes.firePropertyChange("colorBlue", getColorProperty("colorBlue"), colorSchema.getColorBlue()); setProperty("colorBlue",Integer.toString(colorSchema.getColorBlue().getRGB())); } if (!getColorProperty("colorRed").equals(colorSchema.getColorRed())) { changes.firePropertyChange("colorRed", getColorProperty("colorRed"), colorSchema.getColorRed()); setProperty("colorRed",Integer.toString(colorSchema.getColorRed().getRGB())); } if (!getColorProperty("colorPink").equals(colorSchema.getColorPink())) { changes.firePropertyChange("colorPink", getColorProperty("colorPink"), colorSchema.getColorPink()); setProperty("colorPink",Integer.toString(colorSchema.getColorPink().getRGB())); } if (!getColorProperty("colorGreen").equals(colorSchema.getColorGreen())) { changes.firePropertyChange("colorGreen", getColorProperty("colorGreen"), colorSchema.getColorGreen()); setProperty("colorGreen",Integer.toString(colorSchema.getColorGreen().getRGB())); } if (!getColorProperty("colorTurq").equals(colorSchema.getColorTurq())) { changes.firePropertyChange("colorTurq", getColorProperty("colorTurq"), colorSchema.getColorTurq()); setProperty("colorTurq",Integer.toString(colorSchema.getColorTurq().getRGB())); } if (!getColorProperty("colorYellow").equals(colorSchema.getColorYellow())) { changes.firePropertyChange("colorYellow", getColorProperty("colorYellow"), colorSchema.getColorYellow()); setProperty("colorYellow",Integer.toString(colorSchema.getColorYellow().getRGB())); } if (!getColorProperty("colorWhite").equals(colorSchema.getColorWhite())) { changes.firePropertyChange("colorWhite", getColorProperty("colorWhite"), colorSchema.getColorWhite()); setProperty("colorWhite",Integer.toString(colorSchema.getColorWhite().getRGB())); } if (!getColorProperty("colorGUIField").equals(colorSchema.getColorGuiField())) { changes.firePropertyChange("colorGUIField", getColorProperty("colorGUIField"), colorSchema.getColorGuiField()); setProperty("colorGUIField",Integer.toString(colorSchema.getColorGuiField().getRGB())); } if (!getColorProperty("colorCursor").equals(colorSchema.getColorCursor())) { changes.firePropertyChange("colorCursor", getColorProperty("colorCursor"), colorSchema.getColorCursor()); setProperty("colorCursor",Integer.toString(colorSchema.getColorCursor().getRGB())); } if (!getColorProperty("colorSep").equals(colorSchema.getColorSeparator())) { changes.firePropertyChange("colorSep", getColorProperty("colorSep"), colorSchema.getColorSeparator()); setProperty("colorSep", Integer.toString(colorSchema.getColorSeparator().getRGB())); } if (!getColorProperty("colorHexAttr").equals(colorSchema.getColorHexAttr())) { changes.firePropertyChange("colorHexAttr", getColorProperty("colorHexAttr"), colorSchema.getColorHexAttr()); setProperty("colorHexAttr", Integer.toString(colorSchema.getColorHexAttr().getRGB())); } } else { Color nc = jcc.getColor(); if (newSelection.equals(LangTool.getString("sa.bg"))) { if (!getColorProperty("colorBg").equals(nc)) { changes.firePropertyChange("colorBg", getColorProperty("colorBg"), nc); setProperty("colorBg",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.blue"))) { if (!getColorProperty("colorBlue").equals(nc)) { changes.firePropertyChange("colorBlue", getColorProperty("colorBlue"), nc); setProperty("colorBlue",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.red"))) { if (!getColorProperty("colorRed").equals(nc)) { changes.firePropertyChange("colorRed", getColorProperty("colorRed"), nc); setProperty("colorRed",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.pink"))) { if (!getColorProperty("colorPink").equals(nc)) { changes.firePropertyChange("colorPink", getColorProperty("colorPink"), nc); setProperty("colorPink",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.green"))) { if (!getColorProperty("colorGreen").equals(nc)) { changes.firePropertyChange("colorGreen", getColorProperty("colorGreen"), nc); setProperty("colorGreen",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.turq"))) { if (!getColorProperty("colorTurq").equals(nc)) { changes.firePropertyChange("colorTurq", getColorProperty("colorTurq"), nc); setProperty("colorTurq",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.yellow"))) { if (!getColorProperty("colorYellow").equals(nc)) { changes.firePropertyChange("colorYellow", getColorProperty("colorYellow"), nc); setProperty("colorYellow",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.white"))) { if (!getColorProperty("colorWhite").equals(nc)) { changes.firePropertyChange("colorWhite", getColorProperty("colorWhite"), nc); setProperty("colorWhite",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.guiField"))) { if (!getColorProperty("colorGUIField").equals(nc)) { changes.firePropertyChange("colorGUIField", getColorProperty("colorGUIField"), nc); setProperty("colorGUIField",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.cursorColor"))) { if (!getColorProperty("colorCursor").equals(nc)) { changes.firePropertyChange("colorCursor", getColorProperty("colorCursor"), nc); setProperty("colorCursor",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.columnSep"))) { if (!getColorProperty("colorSep").equals(nc)) { changes.firePropertyChange("colorSep", getColorProperty("colorSep"), nc); setProperty("colorSep",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.cursorColor"))) { if (!getColorProperty("colorCursor").equals(nc)) { changes.firePropertyChange("colorCursor", getColorProperty("colorCursor"), nc); setProperty("colorCursor",Integer.toString(nc.getRGB())); } } if (newSelection.equals(LangTool.getString("sa.hexAttrColor"))) { if (!getColorProperty("colorHexAttr").equals(nc)) { changes.firePropertyChange("colorHexAttr", getColorProperty("colorHexAttr"), nc); setProperty("colorHexAttr",Integer.toString(nc.getRGB())); } } } if (csLine.isSelected()) { changes.firePropertyChange("colSeparator", getStringProperty("colSeparator"), "Line"); setProperty("colSeparator","Line"); } else if (csShortLine.isSelected()) { changes.firePropertyChange("colSeparator", getStringProperty("colSeparator"), "ShortLine"); setProperty("colSeparator","ShortLine"); } else { changes.firePropertyChange("colSeparator", getStringProperty("colSeparator"), "Dot"); setProperty("colSeparator","Dot"); } if (cFull.isSelected()) { changes.firePropertyChange("cursorSize", getStringProperty("cursorSize"), "Full"); setProperty("cursorSize","Full"); } if (cHalf.isSelected()) { changes.firePropertyChange("cursorSize", getStringProperty("cursorSize"), "Half"); setProperty("cursorSize","Half"); } if (cLine.isSelected()) { changes.firePropertyChange("cursorSize", getStringProperty("cursorSize"), "Line"); setProperty("cursorSize","Line"); } if (chNone.isSelected()) { changes.firePropertyChange("crossHair", getStringProperty("crossHair"), "None"); setProperty("crossHair","None"); } if (chHorz.isSelected()) { changes.firePropertyChange("crossHair", getStringProperty("crossHair"), "Horz"); setProperty("crossHair","Horz"); } if (chVert.isSelected()) { changes.firePropertyChange("crossHair", getStringProperty("crossHair"), "Vert"); setProperty("crossHair","Vert"); } if (chCross.isSelected()) { changes.firePropertyChange("crossHair", getStringProperty("crossHair"), "Both"); setProperty("crossHair","Both"); } if (rulerFixed.isSelected()) { changes.firePropertyChange("rulerFixed", getStringProperty("rulerFixed"), "Yes"); setProperty("rulerFixed","Yes"); } else { changes.firePropertyChange("rulerFixed", getStringProperty("rulerFixed"), "No"); setProperty("rulerFixed","No"); } if (saNormal.isSelected()) { changes.firePropertyChange("showAttr", getStringProperty("showAttr"), "Normal"); setProperty("showAttr","Normal"); } else { changes.firePropertyChange("showAttr", getStringProperty("showAttr"), "Hex"); setProperty("showAttr","Hex"); } if (dceCheck.isSelected()) { changes.firePropertyChange("doubleClick", getStringProperty("doubleClick"), "Yes"); setProperty("doubleClick","Yes"); } else { changes.firePropertyChange("doubleClick", getStringProperty("doubleClick"), "No"); setProperty("doubleClick","No"); } if (guiCheck.isSelected()) { changes.firePropertyChange("guiInterface", getStringProperty("guiInterface"), "Yes"); setProperty("guiInterface","Yes"); } else { changes.firePropertyChange("guiInterface", getStringProperty("guiInterface"), "No"); setProperty("guiInterface","No"); } if (guiShowUnderline.isSelected()) { changes.firePropertyChange("guiShowUnderline", getStringProperty("guiShowUnderline"), "Yes"); setProperty("guiShowUnderline","Yes"); } else { changes.firePropertyChange("guiShowUnderline", getStringProperty("guiShowUnderline"), "No"); setProperty("guiShowUnderline","No"); } if (hsCheck.isSelected()) { changes.firePropertyChange("hotspots", getStringProperty("hotspots"), "Yes"); setProperty("hotspots","Yes"); } else { changes.firePropertyChange("hotspots", getStringProperty("hotspots"), "No"); setProperty("hotspots","No"); } if (kpCheck.isSelected()) { changes.firePropertyChange("keypad", getStringProperty("keypad"), "Yes"); setProperty("keypad","Yes"); } else { changes.firePropertyChange("keypad", getStringProperty("keypad"), "No"); setProperty("keypad","No"); } changes.firePropertyChange("hsMore", getStringProperty("hsMore"), hsMore.getText()); setProperty("hsMore",hsMore.getText()); changes.firePropertyChange("connectMacro", getStringProperty("connectMacro"), connectMacro.getText()); setProperty("connectMacro",connectMacro.getText()); changes.firePropertyChange("hsBottom", getStringProperty("hsBottom"), hsBottom.getText()); setProperty("hsBottom",hsBottom.getText()); changes.firePropertyChange("fontScaleHeight", getStringProperty("fontScaleHeight"), verticalScale.getText()); setProperty("fontScaleHeight",verticalScale.getText()); changes.firePropertyChange("fontScaleWidth", getStringProperty("fontScaleWidth"), horizontalScale.getText()); setProperty("fontScaleWidth",horizontalScale.getText()); changes.firePropertyChange("fontPointSize", getStringProperty("fontPointSize"), pointSize.getText()); setProperty("fontPointSize",pointSize.getText()); setProperty("saveme","yes"); } |
|
cuPanel.add(bottOffPanel); | private void jbInit() throws Exception { changes = new PropertyChangeSupport(this); Dimension ps = null; // fonts Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); // define fonts panel final JPanel fp = new JPanel(); fp.setLayout(new BorderLayout()); JPanel flp = new JPanel(); TitledBorder tb = BorderFactory.createTitledBorder(LangTool.getString("sa.font")); flp.setBorder(tb); fontsList = new JComboBox(); String font = getStringProperty("font"); for (int x = 0; x < fonts.length; x++) { if (fonts[x].getFontName().indexOf('.') < 0) fontsList.addItem(fonts[x].getFontName()); } fontsList.setSelectedItem(font); flp.add(fontsList); JPanel fsp = new JPanel(); fsp.setLayout(new AlignLayout(2,5,5)); tb = BorderFactory.createTitledBorder(LangTool.getString("sa.scaleLabel")); fsp.setBorder(tb); verticalScale = new JTextField("1.2",5); horizontalScale = new JTextField("1.0",5); pointSize = new JTextField("0",5); if (getStringProperty("fontScaleWidth").length() != 0) horizontalScale.setText(getStringProperty("fontScaleWidth")); if (getStringProperty("fontScaleHeight").length() != 0) verticalScale.setText(getStringProperty("fontScaleHeight")); if (getStringProperty("fontPointSize").length() != 0) pointSize.setText(getStringProperty("fontPointSize")); fsp.add(new JLabel(LangTool.getString("sa.fixedPointSize"))); fsp.add(pointSize); fsp.add(new JLabel(LangTool.getString("sa.horScaleLabel"))); fsp.add(horizontalScale); fsp.add(new JLabel(LangTool.getString("sa.vertScaleLabel"))); fsp.add(verticalScale); fp.add(flp,BorderLayout.NORTH); fp.add(fsp,BorderLayout.SOUTH); // define colors panel final JPanel cpp = new JPanel(); cpp.setLayout(new BorderLayout()); JPanel cp = new JPanel(); cp.setLayout(new BorderLayout()); JPanel cschp = new JPanel(); tb = BorderFactory.createTitledBorder(LangTool.getString("sa.colorSchema")); cschp.setBorder(tb); colorSchemaList = new JComboBox(); loadSchemas(colorSchemaList); colorSchemaList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); Object obj = cb.getSelectedItem(); if (obj instanceof Schema) { System.out.println(" we got a schema "); colorSchema = (Schema)obj; } else { colorSchema = null; } } }); cschp.add(colorSchemaList); tb = BorderFactory.createTitledBorder(LangTool.getString("sa.colors")); cp.setBorder(tb); colorList = new JComboBox(); colorList.addItem(LangTool.getString("sa.bg")); colorList.addItem(LangTool.getString("sa.blue")); colorList.addItem(LangTool.getString("sa.red")); colorList.addItem(LangTool.getString("sa.pink")); colorList.addItem(LangTool.getString("sa.green")); colorList.addItem(LangTool.getString("sa.turq")); colorList.addItem(LangTool.getString("sa.yellow")); colorList.addItem(LangTool.getString("sa.white")); colorList.addItem(LangTool.getString("sa.guiField")); colorList.addItem(LangTool.getString("sa.cursorColor")); colorList.addItem(LangTool.getString("sa.columnSep")); colorList.addItem(LangTool.getString("sa.hexAttrColor")); jcc = new JColorChooser(); // set the default color for display as that being for back ground jcc.setColor(getColorProperty("colorBg")); colorList.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); String newSelection = (String)cb.getSelectedItem(); if (newSelection.equals(LangTool.getString("sa.bg"))) { jcc.setColor(getColorProperty("colorBg")); } if (newSelection.equals(LangTool.getString("sa.blue"))) { jcc.setColor(getColorProperty("colorBlue")); } if (newSelection.equals(LangTool.getString("sa.red"))) { jcc.setColor(getColorProperty("colorRed")); } if (newSelection.equals(LangTool.getString("sa.pink"))) { jcc.setColor(getColorProperty("colorPink")); } if (newSelection.equals(LangTool.getString("sa.green"))) { jcc.setColor(getColorProperty("colorGreen")); } if (newSelection.equals(LangTool.getString("sa.turq"))) { jcc.setColor(getColorProperty("colorTurq")); } if (newSelection.equals(LangTool.getString("sa.yellow"))) { jcc.setColor(getColorProperty("colorYellow")); } if (newSelection.equals(LangTool.getString("sa.white"))) { jcc.setColor(getColorProperty("colorWhite")); } if (newSelection.equals(LangTool.getString("sa.guiField"))) { jcc.setColor(getColorProperty("colorGUIField",Color.white)); } if (newSelection.equals(LangTool.getString("sa.cursorColor"))) { jcc.setColor(getColorProperty("colorCursor", getColorProperty("colorBg"))); } if (newSelection.equals(LangTool.getString("sa.columnSep"))) { jcc.setColor(getColorProperty("colorSep", getColorProperty("colorWhite"))); } if (newSelection.equals(LangTool.getString("sa.hexAttrColor"))) { jcc.setColor(getColorProperty("colorHexAttr", getColorProperty("colorWhite"))); } } }); cp.add(colorList,BorderLayout.NORTH); cp.add(jcc,BorderLayout.CENTER); cpp.add(cschp,BorderLayout.NORTH); cpp.add(cp,BorderLayout.CENTER); // define display panel final JPanel display = new JPanel(); display.setLayout(new BoxLayout(display,BoxLayout.Y_AXIS)); // define column separator panel JPanel csp = new JPanel(); tb = BorderFactory.createTitledBorder(LangTool.getString("sa.cs")); csp.setBorder(tb); csLine = new JRadioButton(LangTool.getString("sa.csLine")); csLine.setActionCommand("Line"); csDot = new JRadioButton(LangTool.getString("sa.csDot")); csDot.setActionCommand("Dot"); csShortLine = new JRadioButton(LangTool.getString("sa.csShortLine")); csShortLine.setActionCommand("ShortLine"); // Group the radio buttons. ButtonGroup csGroup = new ButtonGroup(); csGroup.add(csLine); csGroup.add(csDot); csGroup.add(csShortLine); if (getStringProperty("colSeparator").equals("Dot")) csDot.setSelected(true); else if (getStringProperty("colSeparator").equals("ShortLine")) csShortLine.setSelected(true); else csLine.setSelected(true); csp.add(csLine); csp.add(csDot); csp.add(csShortLine); // define show attributs panel JPanel sap = new JPanel(); sap.setBorder( BorderFactory.createTitledBorder(LangTool.getString("sa.showAttr"))); saNormal = new JRadioButton(LangTool.getString("sa.showNormal")); saNormal.setActionCommand("Normal"); JRadioButton saHex = new JRadioButton(LangTool.getString("sa.showHex")); saHex.setActionCommand("Hex"); // Group the radio buttons. ButtonGroup saGroup = new ButtonGroup(); saGroup.add(saNormal); saGroup.add(saHex); if (getStringProperty("showAttr").equals("Hex")) saHex.setSelected(true); else saNormal.setSelected(true); sap.add(saNormal); sap.add(saHex); // define gui panel JPanel cgp = new JPanel(); cgp.setBorder(BorderFactory.createTitledBorder(LangTool.getString("sa.cgp"))); cgp.setLayout(new AlignLayout(1,5,5));// cgp.setLayout(new BoxLayout(cgp,BoxLayout.Y_AXIS)); guiCheck = new JCheckBox(LangTool.getString("sa.guiCheck")); guiShowUnderline = new JCheckBox(LangTool.getString("sa.guiShowUnderline")); if (getStringProperty("guiInterface").equals("Yes")) guiCheck.setSelected(true); // since this is a new property added then it might not exist in existing // profiles and it should be defaulted to yes. String under = getStringProperty("guiShowUnderline"); if (under.equals("Yes") || under.length() == 0) guiShowUnderline.setSelected(true); cgp.add(guiCheck); cgp.add(guiShowUnderline); display.add(csp); display.add(sap); display.add(cgp); // define cursor panel final JPanel cuPanel = new JPanel(); cuPanel.setLayout(new BoxLayout(cuPanel,BoxLayout.Y_AXIS)); // define cursor size panel JPanel crp = new JPanel(); crp.setBorder(BorderFactory.createTitledBorder(LangTool.getString("sa.crsSize"))); cFull = new JRadioButton(LangTool.getString("sa.cFull")); cHalf = new JRadioButton(LangTool.getString("sa.cHalf")); cLine = new JRadioButton(LangTool.getString("sa.cLine")); // Group the radio buttons. ButtonGroup cGroup = new ButtonGroup(); cGroup.add(cFull); cGroup.add(cHalf); cGroup.add(cLine); int cursorSize = 0; if (getStringProperty("cursorSize").equals("Full")) cursorSize = 2; if (getStringProperty("cursorSize").equals("Half")) cursorSize = 1; switch (cursorSize) { case 0: cLine.setSelected(true); break; case 1: cHalf.setSelected(true); break; case 2: cFull.setSelected(true); break; } crp.add(cFull); crp.add(cHalf); crp.add(cLine); // define cursor ruler panel JPanel chp = new JPanel(); chp.setBorder(BorderFactory.createTitledBorder(LangTool.getString("sa.crossHair"))); chNone = new JRadioButton(LangTool.getString("sa.chNone")); chHorz = new JRadioButton(LangTool.getString("sa.chHorz")); chVert = new JRadioButton(LangTool.getString("sa.chVert")); chCross = new JRadioButton(LangTool.getString("sa.chCross")); // Group the radio buttons. ButtonGroup chGroup = new ButtonGroup(); chGroup.add(chNone); chGroup.add(chHorz); chGroup.add(chVert); chGroup.add(chCross); int crossHair = 0; if (getStringProperty("crossHair").equals("Horz")) crossHair = 1; if (getStringProperty("crossHair").equals("Vert")) crossHair = 2; if (getStringProperty("crossHair").equals("Both")) crossHair = 3; switch (crossHair) { case 0: chNone.setSelected(true); break; case 1: chHorz.setSelected(true); break; case 2: chVert.setSelected(true); break; case 3: chCross.setSelected(true); break; } chp.add(chNone); chp.add(chHorz); chp.add(chVert); chp.add(chCross); // define double click as enter JPanel rulerFPanel = new JPanel(); rulerFPanel.setBorder(BorderFactory.createTitledBorder("")); rulerFixed = new JCheckBox(LangTool.getString("sa.rulerFixed")); rulerFPanel.add(rulerFixed); cuPanel.add(crp); cuPanel.add(chp); cuPanel.add(rulerFPanel); // define onConnect panel final JPanel onConnect = new JPanel(); onConnect.setLayout(new BoxLayout(onConnect,BoxLayout.Y_AXIS)); // define onConnect macro to run JPanel ocMacrop = new JPanel(); ocMacrop.setBorder(BorderFactory.createTitledBorder(LangTool.getString("sa.connectMacro"))); connectMacro = new JTextField(); connectMacro.setColumns(30); // check if double click sends enter connectMacro.setText(getStringProperty("connectMacro")); ocMacrop.add(connectMacro); onConnect.add(ocMacrop); // define mouse panel final JPanel mouse = new JPanel(); mouse.setLayout(new BoxLayout(mouse,BoxLayout.Y_AXIS)); // define double click as enter JPanel dcep = new JPanel(); dcep.setBorder(BorderFactory.createTitledBorder(LangTool.getString("sa.doubleClick"))); dceCheck = new JCheckBox(LangTool.getString("sa.sendEnter")); // check if double click sends enter dceCheck.setSelected(getStringProperty("doubleClick").equals("Yes")); dcep.add(dceCheck); mouse.add(dcep); // define hotspot panel final JPanel hotspot = new JPanel(); hotspot.setLayout(new BoxLayout(hotspot,BoxLayout.Y_AXIS)); // define hsPanel panel JPanel hsp = new JPanel(); hsp.setBorder(BorderFactory.createTitledBorder(LangTool.getString("sa.hsp"))); hsCheck = new JCheckBox(LangTool.getString("sa.hsCheck")); if (getStringProperty("hotspots").equals("Yes")) hsCheck.setSelected(true); hsp.add(hsCheck); // define assignment panel JPanel hsap = new JPanel(); hsap.setBorder(BorderFactory.createTitledBorder(LangTool.getString("sa.hsap"))); hsap.setLayout(new GridLayout(2,2)); JLabel moreLabel = new JLabel(LangTool.getString("sa.hsMore")); JLabel bottomLabel = new JLabel(LangTool.getString("sa.hsBottom")); hsMore = new JTextField(getStringProperty("hsMore")); hsBottom = new JTextField(getStringProperty("hsBottom")); hsap.add(moreLabel); hsap.add(hsMore); hsap.add(bottomLabel); hsap.add(hsBottom); hotspot.add(hsp); hotspot.add(hsap); // define Key Pad panel final JPanel kp = new JPanel(); kp.setLayout(new BoxLayout(kp,BoxLayout.Y_AXIS)); // define kpPanel panel JPanel kpp = new JPanel(); kpp.setBorder(BorderFactory.createTitledBorder(LangTool.getString("sa.kpp"))); kpCheck = new JCheckBox(LangTool.getString("sa.kpCheck")); if (getStringProperty("keypad").equals("Yes")) kpCheck.setSelected(true); kpp.add(kpCheck); kp.add(kpp); // define default final JPanel jp = new JPanel(); jp.add(cpp,BorderLayout.CENTER); jp.setPreferredSize(cpp.getPreferredSize()); //Create the nodes. DefaultMutableTreeNode top = new DefaultMutableTreeNode(fileName); createNodes(top); //Create a tree that allows one selection at a time. final JTree tree = new JTree(top); tree.getSelectionModel().setSelectionMode (TreeSelectionModel.SINGLE_TREE_SELECTION); //Listen for when the selection changes. tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node == null) return; Object nodeInfo = node.getUserObject(); if (nodeInfo.toString().equals(LangTool.getString("sa.nodeFonts"))) { jp.removeAll(); jp.add(fp,BorderLayout.NORTH); jp.setPreferredSize(cpp.getPreferredSize()); jp.validate(); jpm.repaint(); } if (nodeInfo.toString().equals(LangTool.getString("sa.nodeColors"))) { jp.removeAll(); jp.add(cpp,BorderLayout.CENTER); jp.setPreferredSize(cpp.getPreferredSize()); jp.validate(); jpm.repaint(); } if (nodeInfo.toString().equals(LangTool.getString("sa.nodeDisplay"))) { jp.removeAll(); jp.add(display,BorderLayout.NORTH); jp.setPreferredSize(cpp.getPreferredSize()); jp.validate(); jpm.repaint(); } if (nodeInfo.toString().equals(LangTool.getString("sa.nodeCursor"))) { jp.removeAll(); jp.add(cuPanel,BorderLayout.CENTER); jp.setPreferredSize(cpp.getPreferredSize()); jp.validate(); jpm.repaint(); } if (nodeInfo.toString().equals(LangTool.getString("sa.nodeOnConnect"))) { jp.removeAll(); jp.add(onConnect,BorderLayout.CENTER); jp.setPreferredSize(cpp.getPreferredSize()); jp.validate(); jpm.repaint(); } if (nodeInfo.toString().equals(LangTool.getString("sa.nodeMouse"))) { jp.removeAll(); jp.add(mouse,BorderLayout.CENTER); jp.setPreferredSize(cpp.getPreferredSize()); jp.validate(); jpm.repaint(); } if (nodeInfo.toString().equals(LangTool.getString("sa.nodeHS"))) { jp.removeAll(); jp.add(hotspot,BorderLayout.CENTER); jp.setPreferredSize(cpp.getPreferredSize()); jp.validate(); jpm.repaint(); } if (nodeInfo.toString().equals(LangTool.getString("sa.nodeKP"))) { jp.removeAll(); jp.add(kp,BorderLayout.CENTER); jp.setPreferredSize(cpp.getPreferredSize()); jp.validate(); jpm.repaint(); } } }); // define tree selection panel JPanel jsp = new JPanel(); jsp.setBackground(Color.white); jsp.add(tree); jpm.add(jp,BorderLayout.EAST); jpm.add(jsp,BorderLayout.WEST); } |
|
boolean fit = true; Dimension size; if (this.getSize().width == 0 && this.getSize().width == 0) size = this.getPreferredSize(); else size = this.getSize(); if ((size.width > (rootContainer.getWidth() - popupLocation.x)) || (size.height > (rootContainer.getHeight() - popupLocation.y))) fit = false; if (lightWeightPopupEnabled && fit) popup = new LightWeightPopup(this); else { if (fit) popup = new MediumWeightPopup(this); else popup = new HeavyWeightPopup(this); } if (popup instanceof LightWeightPopup || popup instanceof MediumWeightPopup) { JLayeredPane layeredPane; | if ((size.width > (rootContainer.getWidth() - popupLocation.x)) || (size.height > (rootContainer.getHeight() - popupLocation.y))) fit = false; if (lightWeightPopupEnabled && fit) popup = new LightWeightPopup(this); else { if (fit) popup = new MediumWeightPopup(this); else { popup = new HeavyWeightPopup(this); setLightWeightPopupEnabled(false); } } if (popup instanceof LightWeightPopup || popup instanceof MediumWeightPopup) { JLayeredPane layeredPane; | public void setVisible(boolean visible) { if (visible == isVisible()) return; boolean old = isVisible(); this.visible = visible; if (old != isVisible()) { firePropertyChange("visible", old, isVisible()); if (visible) { firePopupMenuWillBecomeVisible(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); Dimension screenSize = getToolkit().getScreenSize(); boolean fit = true; Dimension size; // Determine the size of the popup menu if (this.getSize().width == 0 && this.getSize().width == 0) size = this.getPreferredSize(); else size = this.getSize(); if ((size.width > (rootContainer.getWidth() - popupLocation.x)) || (size.height > (rootContainer.getHeight() - popupLocation.y))) fit = false; if (lightWeightPopupEnabled && fit) popup = new LightWeightPopup(this); else { if (fit) popup = new MediumWeightPopup(this); else popup = new HeavyWeightPopup(this); } if (popup instanceof LightWeightPopup || popup instanceof MediumWeightPopup) { JLayeredPane layeredPane; layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane(); Point p = new Point(popupLocation.x, popupLocation.y); SwingUtilities.convertPointFromScreen(p, layeredPane); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(p.x, p.y, size.width, size.height); } else { // Subtract insets of the top-level container if popup menu's // top-left corner is inside it. Insets insets = rootContainer.getInsets(); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(popupLocation.x - insets.left, popupLocation.y - insets.top, size.width, size.height); } } else { firePopupMenuWillBecomeInvisible(); popup.hide(); } } } |
Point p = new Point(popupLocation.x, popupLocation.y); SwingUtilities.convertPointFromScreen(p, layeredPane); | Point p = new Point(popupLocation.x, popupLocation.y); if (layeredPane.isShowing()) SwingUtilities.convertPointFromScreen(p, layeredPane); | public void setVisible(boolean visible) { if (visible == isVisible()) return; boolean old = isVisible(); this.visible = visible; if (old != isVisible()) { firePropertyChange("visible", old, isVisible()); if (visible) { firePopupMenuWillBecomeVisible(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); Dimension screenSize = getToolkit().getScreenSize(); boolean fit = true; Dimension size; // Determine the size of the popup menu if (this.getSize().width == 0 && this.getSize().width == 0) size = this.getPreferredSize(); else size = this.getSize(); if ((size.width > (rootContainer.getWidth() - popupLocation.x)) || (size.height > (rootContainer.getHeight() - popupLocation.y))) fit = false; if (lightWeightPopupEnabled && fit) popup = new LightWeightPopup(this); else { if (fit) popup = new MediumWeightPopup(this); else popup = new HeavyWeightPopup(this); } if (popup instanceof LightWeightPopup || popup instanceof MediumWeightPopup) { JLayeredPane layeredPane; layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane(); Point p = new Point(popupLocation.x, popupLocation.y); SwingUtilities.convertPointFromScreen(p, layeredPane); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(p.x, p.y, size.width, size.height); } else { // Subtract insets of the top-level container if popup menu's // top-left corner is inside it. Insets insets = rootContainer.getInsets(); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(popupLocation.x - insets.left, popupLocation.y - insets.top, size.width, size.height); } } else { firePopupMenuWillBecomeInvisible(); popup.hide(); } } } |
} } else { firePopupMenuWillBecomeInvisible(); popup.hide(); | } } else { firePopupMenuWillBecomeInvisible(); popup.hide(); } | public void setVisible(boolean visible) { if (visible == isVisible()) return; boolean old = isVisible(); this.visible = visible; if (old != isVisible()) { firePropertyChange("visible", old, isVisible()); if (visible) { firePopupMenuWillBecomeVisible(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); Dimension screenSize = getToolkit().getScreenSize(); boolean fit = true; Dimension size; // Determine the size of the popup menu if (this.getSize().width == 0 && this.getSize().width == 0) size = this.getPreferredSize(); else size = this.getSize(); if ((size.width > (rootContainer.getWidth() - popupLocation.x)) || (size.height > (rootContainer.getHeight() - popupLocation.y))) fit = false; if (lightWeightPopupEnabled && fit) popup = new LightWeightPopup(this); else { if (fit) popup = new MediumWeightPopup(this); else popup = new HeavyWeightPopup(this); } if (popup instanceof LightWeightPopup || popup instanceof MediumWeightPopup) { JLayeredPane layeredPane; layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane(); Point p = new Point(popupLocation.x, popupLocation.y); SwingUtilities.convertPointFromScreen(p, layeredPane); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(p.x, p.y, size.width, size.height); } else { // Subtract insets of the top-level container if popup menu's // top-left corner is inside it. Insets insets = rootContainer.getInsets(); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(popupLocation.x - insets.left, popupLocation.y - insets.top, size.width, size.height); } } else { firePopupMenuWillBecomeInvisible(); popup.hide(); } } } |
} | public void setVisible(boolean visible) { if (visible == isVisible()) return; boolean old = isVisible(); this.visible = visible; if (old != isVisible()) { firePropertyChange("visible", old, isVisible()); if (visible) { firePopupMenuWillBecomeVisible(); Container rootContainer = (Container) SwingUtilities.getRoot(invoker); Dimension screenSize = getToolkit().getScreenSize(); boolean fit = true; Dimension size; // Determine the size of the popup menu if (this.getSize().width == 0 && this.getSize().width == 0) size = this.getPreferredSize(); else size = this.getSize(); if ((size.width > (rootContainer.getWidth() - popupLocation.x)) || (size.height > (rootContainer.getHeight() - popupLocation.y))) fit = false; if (lightWeightPopupEnabled && fit) popup = new LightWeightPopup(this); else { if (fit) popup = new MediumWeightPopup(this); else popup = new HeavyWeightPopup(this); } if (popup instanceof LightWeightPopup || popup instanceof MediumWeightPopup) { JLayeredPane layeredPane; layeredPane = SwingUtilities.getRootPane(invoker).getLayeredPane(); Point p = new Point(popupLocation.x, popupLocation.y); SwingUtilities.convertPointFromScreen(p, layeredPane); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(p.x, p.y, size.width, size.height); } else { // Subtract insets of the top-level container if popup menu's // top-left corner is inside it. Insets insets = rootContainer.getInsets(); if (size.width + popupLocation.x > screenSize.width) popupLocation.x -= size.width; if (size.height + popupLocation.y > screenSize.height) popupLocation.y -= size.height; popup.show(popupLocation.x - insets.left, popupLocation.y - insets.top, size.width, size.height); } } else { firePopupMenuWillBecomeInvisible(); popup.hide(); } } } |
|
setInvoker(component); Point p = new Point(x, y); SwingUtilities.convertPointToScreen(p, component); setLocation(p.x, p.y); setVisible(true); | if (component.isShowing()) { setInvoker(component); Point p = new Point(x, y); SwingUtilities.convertPointToScreen(p, component); setLocation(p.x, p.y); setVisible(true); } | public void show(Component component, int x, int y) { setInvoker(component); Point p = new Point(x, y); SwingUtilities.convertPointToScreen(p, component); setLocation(p.x, p.y); setVisible(true); } |
if(isRootDirectory(path)) return path; | public static final String toCanonicalForm(String path) { /*?? if(path.indexOf('.') < 0 && path.indexOf("..") < 0) return path; */ String tmppath = path.replace('/', separatorChar); StringBuffer canonpath; // We found it'll be more efficient and easy to handle to // return a lowercased canonical path if(isWindows) tmppath = tmppath.toLowerCase(); int i; if ((i = beginWithRootPathPrefix(tmppath)) == 0 ) return path; /* The original "canonpath = new StringBuffer(tmppath.substring(0, i))" isn't very efficient because StringBuffer's ensureCapacity_unsynchronized will fail definitely each time and will enlarge buffer and copy contents. . */ canonpath = new StringBuffer(INITIAL_MAX_PATH); canonpath.append(tmppath.substring(0, i)); tmppath = tmppath.substring(i); // pathdepth==0 indicates there're only root path in the buffer int pathdepth = 0; StringTokenizer st = new StringTokenizer(tmppath, separator); // Traverse each element of the path, handling "." and ".." // Should handle "~" too? if (st.hasMoreTokens()) do { String s = st.nextToken(); // Handle "." or an empty element. if (s.equals(".") || s.equals("")) continue; // Handle ".." by deleting the last element from the path if (s.equals("..")) { if (pathdepth == 0) continue; // Strip of trailing separator canonpath.setLength(canonpath.length() - 1/*separator.length()*/); String tmpstr = canonpath.toString(); int idx = tmpstr.lastIndexOf(separator); if ((idx == -1) || ((idx + 1/*separator.length()*/) > tmpstr.length())) //throw new IOException("Can't happen error"); return path; // Shouldn't happen canonpath.setLength(idx + 1/*separator.length()*/); pathdepth--; continue; } canonpath.append(s); pathdepth++; //now it's more than root path if (st.hasMoreTokens()) canonpath.append(separator); } while (st.hasMoreTokens()); if (endWithSeparator(path)) canonpath.append(separator); String tmpstr = canonpath.toString(); //if (pathdepth > 0 && endWithSeparator(tmpstr) ) // tmpstr = tmpstr.substring(0, tmpstr.length() - 1/*separator.length()*/); return tmpstr; } |
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { | public synchronized void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { | public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) {// synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y);// } } |
synchronized (lock) { | public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) {// synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y);// } } |
|
lock.notify(); } | public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) {// synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y);// } } |
|
super.layoutMajorAxis(targetSpan, axis, offsets, spans); | super.layoutMinorAxis(targetSpan, axis, offsets, spans); | protected void layoutMinorAxis(int targetSpan, int axis, int[] offsets, int[] spans) { // FIXME: Figure out how to fetch the row heights from the TableView's // element. super.layoutMajorAxis(targetSpan, axis, offsets, spans); } |
int viewCount = getViewCount(); if (columnRequirements == null || viewCount > columnRequirements.length) { columnRequirements = new SizeRequirements[viewCount]; for (int i = 0; i < columnRequirements.length; i++) columnRequirements[i] = new SizeRequirements(); } if (columnOffsets == null || columnOffsets.length < viewCount) columnOffsets = new int[viewCount]; if (columnSpans == null || columnSpans.length < viewCount) columnSpans = new int[viewCount]; | public void replace(int offset, int length, View[] views) { super.replace(offset, length, views); layoutChanged(X_AXIS); } |
|
int numChildren = el.getElementCount(); View[] rows = new View[numChildren]; for (int i = 0; i < numChildren; ++i) { Element rowEl = el.getElement(i); TableRow rowView = createTableRow(rowEl); rows[i] = rowView; } replace(0, 0, rows); | public TableView(Element el) { super(el, Y_AXIS); int numChildren = el.getElementCount(); View[] rows = new View[numChildren]; for (int i = 0; i < numChildren; ++i) { Element rowEl = el.getElement(i); TableRow rowView = createTableRow(rowEl); rows[i] = rowView; } replace(0, 0, rows); } |
|
updateColumnRequirements(); SizeRequirements r = calculateMinorAxisRequirements(X_AXIS, null); SizeRequirements.calculateTiledPositions(targetSpan, r, columnRequirements, offsets, spans); | protected void layoutColumns(int targetSpan, int[] offsets, int spans[], SizeRequirements[] reqs) { // TODO: Figure out what exactly to do here. } |
|
String[] getValues(Argument arg) { return (String[])args.get(arg); } | final String[] getValues(Argument arg) { return (String[]) args.get(arg); } | String[] getValues(Argument arg) { return (String[])args.get(arg); } |
boolean isSet(Parameter param) { return args.containsKey(param); } | final boolean isSet(Parameter param) { return args.containsKey(param); } | boolean isSet(Parameter param) { return args.containsKey(param); } |
public int size() { return args.size(); } | public final int size() { return args.size(); } | public int size() { return args.size(); } |
stopCellEditing(); | public void actionPerformed(ActionEvent event) { // TODO } // actionPerformed() |
|
fireEditingCanceled(); | public void cancelCellEditing() { // TODO } // cancelCellEditing() |
|
return null; | return value; | public Object getCellEditorValue() { return null; // TODO } // getCellEditorValue() |
return false; | if (!(event instanceof MouseEvent)) return true; return false; | public boolean isCellEditable(EventObject event) { return false; // TODO } // isCellEditable() |
stopCellEditing(); | public void itemStateChanged(ItemEvent event) { // TODO } // itemStateChanged() |
|
public void setValue(Object event) | public void setValue(Object value) | public void setValue(Object event) { } |
this.value = value; | public void setValue(Object event) { } |
|
return false; | return true; | public boolean shouldSelectCell(EventObject event) { return false; // TODO } // shouldSelectCell() |
return false; | return true; | public boolean startCellEditing(EventObject event) { return false; // TODO } // startCellEditing() |
return false; | fireEditingStopped(); return true; | public boolean stopCellEditing() { return false; // TODO } // stopCellEditing() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.