bugged
stringlengths 6
599k
| fixed
stringlengths 6
40.8M
| __index_level_0__
int64 0
3.24M
|
|---|---|---|
public ActivationDesc(String className, String location, MarshalledObject data) throws ActivationException { this(ActivationGroup.currentGroupID(), className, location, data, false);}
|
public ActivationDesc(String className, String location, MarshalledObject data) throws ActivationException { this(ActivationGroup.currentGroupID(), className, location, data, false);}
| 7,048
|
public ActivationDesc(String className, String location, MarshalledObject data) throws ActivationException { this(ActivationGroup.currentGroupID(), className, location, data, false);}
|
public ActivationDesc(String className, String location, MarshalledObject data) throws ActivationException { this(ActivationGroup.currentGroupID(), className, location, data, false);}
| 7,049
|
public boolean equals(Object obj) { if (!(obj instanceof ActivationDesc)) { return (false); } ActivationDesc that = (ActivationDesc)obj; if (this.groupid.equals(that.groupid) && this.classname.equals(that.classname) && this.location.equals(that.location) && this.data.equals(that.data) && this.restart == that.restart) { return (true); } return (false);}
|
public boolean equals(Object obj) { if (!(obj instanceof ActivationDesc)) { return (false); } ActivationDesc that = (ActivationDesc)obj; if (this.groupid.equals(that.groupid) && this.classname.equals(that.classname) && this.location.equals(that.location) && this.data.equals(that.data) && this.restart == that.restart) { return (true); } return (false);}
| 7,050
|
public String getClassName() { return (classname);}
|
public String getClassName() { return (classname);}
| 7,051
|
public MarshalledObject getData() { return (data);}
|
public MarshalledObject getData() { return (data);}
| 7,052
|
public ActivationGroupID getGroupID() { return (groupid);}
|
public ActivationGroupID getGroupID() { return (groupid);}
| 7,053
|
public String getLocation() { return (location);}
|
public String getLocation() { return (location);}
| 7,054
|
public boolean getRestartMode() { return (restart);}
|
public boolean getRestartMode() { return (restart);}
| 7,055
|
public int hashCode() { return (groupid.hashCode() ^ classname.hashCode() ^ location.hashCode() ^ data.hashCode());}
|
public int hashCode() { return (groupid.hashCode() ^ classname.hashCode() ^ location.hashCode() ^ data.hashCode());}
| 7,056
|
protected int calculateBreakPosition(int p0, int p1) { Container c = getContainer(); Rectangle alloc = c.isValid() ? c.getBounds() : new Rectangle(c.getPreferredSize()); updateMetrics(); try { getDocument().getText(p0, p1 - p0, getLineBuffer()); } catch (BadLocationException ble) { // this shouldn't happen } // FIXME: Should we account for the insets of the container? if (wordWrap) return p0 + Utilities.getBreakLocation(lineBuffer, metrics, alloc.x, alloc.x + alloc.width, this, 0); else { return p0 + Utilities.getTabbedTextOffset(lineBuffer, metrics, alloc.x, alloc.x + alloc.width, this, 0); } }
|
protected int calculateBreakPosition(int p0, int p1) { Container c = getContainer(); Rectangle alloc = c.isValid() ? c.getBounds() : new Rectangle(c.getPreferredSize()); updateMetrics(); try { getDocument().getText(p0, p1 - p0, getLineBuffer()); } catch (BadLocationException ble) { // this shouldn't happen } // FIXME: Should we account for the insets of the container? if (wordWrap) return p0 + Utilities.getBreakLocation(lineBuffer, metrics, alloc.x, alloc.x + alloc.width, this, 0); else { return p0 + Utilities.getTabbedTextOffset(lineBuffer, metrics, alloc.x, alloc.x + alloc.width, this, 0); } }
| 7,057
|
public Document createDefaultDocument() { HTMLDocument document = new HTMLDocument(); document.setParser(getParser()); return document; }
|
public Document createDefaultDocument() { HTMLDocument document = new HTMLDocument(getStyleSheet()); document.setParser(getParser()); return document; }
| 7,058
|
public ComponentView(Element elem) { super(elem); }
|
public ComponentView(Element elem) { super(elem); }
| 7,061
|
public void importStyleSheet(URL url) { try { // FIXME: Need to make sure url points to a valid CSS document. loadRules(new BufferedReader(new InputStreamReader(url.openStream())), url); } catch (IOException ioe) { // Do nothing here. } }
|
public void importStyleSheet(URL url) { try { // FIXME: Need to make sure url points to a valid CSS document. loadRules(new BufferedReader(new InputStreamReader(url.openStream())), url); } catch (IOException ioe) { // Do nothing here. } }
| 7,062
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != -1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != -1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
| 7,063
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
| 7,064
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if ((isPlainShort || opt.isJoined()) && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
| 7,065
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == - 1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
|
private void handleLongOption(String real, int index) throws OptionException { String option = real.substring(index); String justName = option; int eq = option.indexOf('='); if (eq != - 1) justName = option.substring(0, eq); char shortName = 0; if (justName.length() == 1) shortName = justName.charAt(0); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (justName.equals(opt.getLongName())) { found = opt; break; } if (shortName != 0 && opt.getShortName() == shortName) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.Unrecognized"), //$NON-NLS-1$ new Object[] { real }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (eq == -1) argument = getArgument(real); else argument = option.substring(eq + 1); } else if (eq != - 1) { String msg = MessageFormat.format(Messages.getString("Parser.NoArg"), //$NON-NLS-1$ new Object[] { real.substring(0, eq + index) }); throw new OptionException(msg); } found.parsed(argument); }
| 7,066
|
private void handleShortOptions(String option) throws OptionException { for (int i = 1; i < option.length(); ++i) { handleShortOption(option.charAt(i)); } }
|
private void handleShortOptions(String option) throws OptionException { for (int charIndex = 1; charIndex < option.length(); ++charIndex) { handleShortOption(option.charAt(i)); } }
| 7,067
|
private void handleShortOptions(String option) throws OptionException { for (int i = 1; i < option.length(); ++i) { handleShortOption(option.charAt(i)); } }
|
private void handleShortOptions(String option) throws OptionException { for (int i = 1; i < option.length(); ++i) { char optChar = option.charAt(charIndex); Option found = null; for (int i = options.size() - 1; i >= 0; --i) { Option opt = (Option) options.get(i); if (optChar == opt.getShortName()) { found = opt; break; } } if (found == null) { String msg = MessageFormat.format(Messages.getString("Parser.UnrecDash"), new Object[] { "" + optChar }); throw new OptionException(msg); } String argument = null; if (found.getTakesArgument()) { if (found.isJoined() && charIndex + 1 < option.length()) { argument = option.substring(charIndex + 1); charIndex = option.length(); } else argument = getArgument("-" + optChar); } found.parsed(argument); } }
| 7,068
|
public void printHelp(PrintStream out, boolean longOnly) { // Compute maximum lengths. int maxArgLen = 0; boolean shortOptionSeen = false; Iterator it; // The first pass only looks to see if we have a short option. it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); if (option.getShortName() != '\0') { shortOptionSeen = true; break; } } it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); String argName = option.getArgumentName(); // First compute the width required for the short // option. "2" is the initial indentation. In the // GNU style we don't print an argument name for // a short option if there is also a long name for // the option. int thisArgLen = 2; if (shortOptionSeen) thisArgLen += 4; if (option.getLongName() != null) { // Handle either '-' or '--'. thisArgLen += 1 + option.getLongName().length(); if (! longOnly) ++thisArgLen; } // Add in the width of the argument name. if (argName != null) thisArgLen += 1 + argName.length(); maxArgLen = Math.max(maxArgLen, thisArgLen); } // Print the help. if (name != null) out.println(name + ":"); it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); String argName = option.getArgumentName(); int column = 0; if (option.getShortName() != '\0') { out.print(" -"); out.print(option.getShortName()); column += 4; if (option.getLongName() == null) { if (argName != null) { // This is a silly hack just for '-J'. We don't // support joined options in general, but this option // is filtered out before argument processing can see it. if (option.getShortName() != 'J') { out.print(' '); ++column; } out.print(argName); column += argName.length(); } out.print(" "); } else out.print(", "); column += 2; } // Indent the long option past the short options, if one // was seen. for (; column < (shortOptionSeen ? 6 : 2); ++column) out.print(' '); if (option.getLongName() != null) { out.print(longOnly ? "-" : "--"); out.print(option.getLongName()); column += (longOnly ? 1 : 2) + option.getLongName().length(); if (argName != null) { out.print(" " + argName); column += 1 + argName.length(); } } // FIXME: should have a better heuristic for padding. out.print(FILLER.substring(0, maxArgLen + 4 - column)); formatText(out, option.getDescription(), maxArgLen + 4); } }
|
public void printHelp(PrintStream out, boolean longOnly) { // Compute maximum lengths. int maxArgLen = 0; boolean shortOptionSeen = false; Iterator it; // The first pass only looks to see if we have a short option. it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); if (option.getShortName() != '\0') { shortOptionSeen = true; break; } } it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); String argName = option.getArgumentName(); // First compute the width required for the short // option. "2" is the initial indentation. In the // GNU style we don't print an argument name for // a short option if there is also a long name for // the option. int thisArgLen = 2; if (shortOptionSeen) thisArgLen += 4; if (option.getLongName() != null) { // Handle either '-' or '--'. thisArgLen += 1 + option.getLongName().length(); if (! longOnly) ++thisArgLen; } // Add in the width of the argument name. if (argName != null) thisArgLen += 1 + argName.length(); maxArgLen = Math.max(maxArgLen, thisArgLen); } // Print the help. if (name != null) out.println(name + ":"); it = options.iterator(); while (it.hasNext()) { Option option = (Option) it.next(); String argName = option.getArgumentName(); int column = 0; if (option.getShortName() != '\0') { out.print(" -"); out.print(option.getShortName()); column += 4; if (option.getLongName() == null) { if (argName != null) { // This is a silly hack just for '-J'. We don't // support joined options in general, but this option // is filtered out before argument processing can see it. if (! option.isJoined()) { out.print(' '); ++column; } out.print(argName); column += argName.length(); } out.print(" "); } else out.print(", "); column += 2; } // Indent the long option past the short options, if one // was seen. for (; column < (shortOptionSeen ? 6 : 2); ++column) out.print(' '); if (option.getLongName() != null) { out.print(longOnly ? "-" : "--"); out.print(option.getLongName()); column += (longOnly ? 1 : 2) + option.getLongName().length(); if (argName != null) { out.print(" " + argName); column += 1 + argName.length(); } } // FIXME: should have a better heuristic for padding. out.print(FILLER.substring(0, maxArgLen + 4 - column)); formatText(out, option.getDescription(), maxArgLen + 4); } }
| 7,069
|
public void run() { for (;serverThread != null;) { // if serverThread==null, then exit thread try {//System.out.println("Waiting for connection on " + serverPort); UnicastConnection conn = getServerConnection(); // use a thread pool to improve performance //ConnectionRunnerPool.dispatchConnection(conn); (new Thread(conn)).start(); } catch (Exception e) { e.printStackTrace(); } }}
|
public void run() { for (;serverThread != null;) { // if serverThread==null, then exit thread try {//System.out.println("Waiting for connection on " + serverPort); UnicastConnection conn = getServerConnection(); // use a thread pool to improve performance //ConnectionRunnerPool.dispatchConnection(conn); (new Thread(conn)).start(); } catch (Exception e) { e.printStackTrace(); } }}
| 7,071
|
public void connect() { failIfConnected(); if (!isSignificant(this.user)) { connectSimple(); } else { if (this.embeddedSignon) connectEmbedded(); else connectSimulated(); Runnable runnable = new Runnable() { int tryConnection; public void run() { if ((tryConnection++ < 30) && //If it is still not connected after 3 seconds, //stop with trying (session.isConnected() == false)) { try { Thread.currentThread().sleep(100); } catch (InterruptedException ex) { ; } SwingUtilities.invokeLater(this); } else { doAfterSignon(); doInitialCommand(); } } }; runnable.run(); } }
|
public void connect() { failIfConnected(); if (!isSignificant(this.user)) { connectSimple(); } else { if (this.embeddedSignon) connectEmbedded(); else connectSimulated(); Runnable runnable = new Runnable() { int tryConnection; public void run() { if ((tryConnection++ < 30) && //If it is still not connected after 3 seconds, //stop with trying (session.isConnected() == false)) { try { Thread.sleep(100); } catch (InterruptedException ex) { ; } SwingUtilities.invokeLater(this); } else { doAfterSignon(); doInitialCommand(); } } }; runnable.run(); } }
| 7,072
|
public void run() { if ((tryConnection++ < 30) && //If it is still not connected after 3 seconds, //stop with trying (session.isConnected() == false)) { try { Thread.currentThread().sleep(100); } catch (InterruptedException ex) { ; } SwingUtilities.invokeLater(this); } else { doAfterSignon(); doInitialCommand(); } }
|
public void run() { if ((tryConnection++ < 30) && //If it is still not connected after 3 seconds, //stop with trying (session.isConnected() == false)) { try { Thread.sleep(100); } catch (InterruptedException ex) { ; } SwingUtilities.invokeLater(this); } else { doAfterSignon(); doInitialCommand(); } }
| 7,073
|
public void executeCall() throws Exception { byte returncode; ObjectInput oin; // signal the call when constructing try { DataOutputStream dout = conn.getDataOutputStream(); dout.write(MESSAGE_CALL); oout = conn.getObjectOutputStream(); objid.write(oout); oout.writeInt(opnum); oout.writeLong(hash); } catch(IOException ex) { throw new MarshalException("Try to write header but failed.", ex); } try { releaseOutputStream(); DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) throw new RemoteException("Call not acked"); oin = getInputStream(); returncode = oin.readByte(); UID.read(oin); } catch(IOException ex) { throw new UnmarshalException("Try to read header but failed:", ex); } //check return code switch(returncode) { case RETURN_ACK: //it's ok return; case RETURN_NACK: Object returnobj; try { returnobj = oin.readObject(); } catch(Exception ex2) { throw new UnmarshalException ("Try to read exception object but failed", ex2); } if(!(returnobj instanceof Exception)) throw new UnmarshalException("Should be Exception type here: " + returnobj); throw (Exception)returnobj; default: throw new UnmarshalException("Invalid return code"); } }
|
public void executeCall() throws Exception { byte returncode; ObjectInput oin; // signal the call when constructing try { DataOutputStream dout = conn.getDataOutputStream(); dout.write(MESSAGE_CALL); oout = conn.getObjectOutputStream(); objid.write(oout); oout.writeInt(opnum); oout.writeLong(hash); } catch(IOException ex) { throw new MarshalException("Try to write header but failed.", ex); } try { releaseOutputStream(); DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) throw new RemoteException("Call not acked"); oin = getInputStream(); returncode = oin.readByte(); UID.read(oin); } catch(IOException ex) { throw new UnmarshalException("Try to read header but failed:", ex); } //check return code switch(returncode) { case RETURN_ACK: //it's ok return; case RETURN_NACK: Object returnobj; try { returnobj = oin.readObject(); } catch(Exception ex2) { throw new UnmarshalException ("Try to read exception object but failed", ex2); } if(!(returnobj instanceof Exception)) throw new UnmarshalException("Should be Exception type here: " + returnobj); throw (Exception)returnobj; default: throw new UnmarshalException("Invalid return code"); } }
| 7,074
|
public void executeCall() throws Exception { byte returncode; ObjectInput oin; // signal the call when constructing try { DataOutputStream dout = conn.getDataOutputStream(); dout.write(MESSAGE_CALL); oout = conn.getObjectOutputStream(); objid.write(oout); oout.writeInt(opnum); oout.writeLong(hash); } catch(IOException ex) { throw new MarshalException("Try to write header but failed.", ex); } try { releaseOutputStream(); DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) throw new RemoteException("Call not acked"); oin = getInputStream(); returncode = oin.readByte(); UID.read(oin); } catch(IOException ex) { throw new UnmarshalException("Try to read header but failed:", ex); } //check return code switch(returncode) { case RETURN_ACK: //it's ok return; case RETURN_NACK: Object returnobj; try { returnobj = oin.readObject(); } catch(Exception ex2) { throw new UnmarshalException ("Try to read exception object but failed", ex2); } if(!(returnobj instanceof Exception)) throw new UnmarshalException("Should be Exception type here: " + returnobj); throw (Exception)returnobj; default: throw new UnmarshalException("Invalid return code"); } }
|
public void executeCall() throws Exception { byte returncode; ObjectInput oin; // signal the call when constructing try { DataOutputStream dout = conn.getDataOutputStream(); dout.write(MESSAGE_CALL); oout = conn.getObjectOutputStream(); objid.write(oout); oout.writeInt(opnum); oout.writeLong(hash); } catch(IOException ex) { throw new MarshalException("Try to write header but failed.", ex); } try { releaseOutputStream(); DataInputStream din = conn.getDataInputStream(); if (din.readByte() != MESSAGE_CALL_ACK) throw new RemoteException("Call not acked"); oin = startInputStream(); returncode = oin.readByte(); UID.read(oin); } catch(IOException ex) { throw new UnmarshalException("Try to read header but failed:", ex); } //check return code switch(returncode) { case RETURN_ACK: //it's ok return; case RETURN_NACK: Object returnobj; try { returnobj = oin.readObject(); } catch(Exception ex2) { throw new UnmarshalException ("Try to read exception object but failed", ex2); } if(!(returnobj instanceof Exception)) throw new UnmarshalException("Should be Exception type here: " + returnobj); throw (Exception)returnobj; default: throw new UnmarshalException("Invalid return code"); } }
| 7,075
|
public void write(ObjectOutput out) throws IOException { DataOutput dout = (DataOutput)out; dout.writeLong(objNum); space.write(dout);}
|
public void write(ObjectOutput out) throws IOException { DataOutput dout = (DataOutput)out; dout.writeLong(objNum); space.write(dout);}
| 7,076
|
public void write(ObjectOutput out) throws IOException { DataOutput dout = (DataOutput)out; dout.writeLong(objNum); space.write(dout);}
|
public void write(ObjectOutput out) throws IOException { DataOutput dout = (DataOutput)out; dout.writeLong(objNum); space.write(dout);}
| 7,077
|
public static UID read(DataInput in) throws IOException { UID id = new UID(); id.unique = in.readInt(); id.time = in.readLong(); id.count = in.readShort(); return (id);}
|
public static UID read(DataInput in) throws IOException { UID id = new UID(); id.unique = in.readInt(); id.time = in.readLong(); id.count = in.readShort(); return (id);}
| 7,078
|
private void jbInit() throws Exception { this.setTitle(LangTool.getString("spool.title")); this.setIconImage(GUIGraphicsUtils.getApplicationIcon().getImage()); this.getContentPane().add(createFilterPanel(), BorderLayout.NORTH); // get an instance of our table model stm = new SpoolTableModel(); // create a table using our custom table model spools = new JSortTable(stm); TableColumn column = null; for (int x = 0;x < stm.getColumnCount(); x++) { column = spools.getColumnModel().getColumn(x); column.setPreferredWidth(stm.getColumnPreferredSize(x)); } spools.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // create our mouse listener on the table spools.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { spools_mouseClicked(e); } public void mousePressed (MouseEvent event) { if (SwingUtilities.isRightMouseButton(event)) showPopupMenu(event); } public void mouseReleased (MouseEvent event) { if (SwingUtilities.isRightMouseButton(event)) showPopupMenu(event); } }); spools.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(spools); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // setup the number of rows we should be working with spools.setPreferredScrollableViewportSize( new Dimension( spools.getPreferredScrollableViewportSize().width, spools.getFontMetrics(spools.getFont()).getHeight() * 8) ); scrollPane.getViewport().setBackground(spools.getBackground()); scrollPane.setBackground(spools.getBackground()); //Setup our selection model listener rowSM = spools.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); } }); rowSM.setSelectionMode(rowSM.SINGLE_SELECTION); this.getContentPane().add(scrollPane, BorderLayout.CENTER); status = new JLabel("0 " + LangTool.getString("spool.count")); status.setBorder(BorderFactory.createEtchedBorder()); this.getContentPane().add(status, BorderLayout.SOUTH); pack(); //Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { // close the spool file list// if (splfList != null)// splfList.close(); // close the system connection if (system != null) system.disconnectAllServices(); setVisible(false); dispose(); } }); }
|
private void jbInit() throws Exception { this.setTitle(LangTool.getString("spool.title")); this.setIconImage(GUIGraphicsUtils.getApplicationIcon().getImage()); this.getContentPane().add(createFilterPanel(), BorderLayout.NORTH); // get an instance of our table model stm = new SpoolTableModel(); // create a table using our custom table model spools = new JSortTable(stm); TableColumn column = null; for (int x = 0;x < stm.getColumnCount(); x++) { column = spools.getColumnModel().getColumn(x); column.setPreferredWidth(stm.getColumnPreferredSize(x)); } spools.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // create our mouse listener on the table spools.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { spools_mouseClicked(e); } public void mousePressed (MouseEvent event) { if (SwingUtilities.isRightMouseButton(event)) showPopupMenu(event); } public void mouseReleased (MouseEvent event) { if (SwingUtilities.isRightMouseButton(event)) showPopupMenu(event); } }); spools.setShowGrid(false); //Create the scroll pane and add the table to it. scrollPane = new JScrollPane(spools); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // setup the number of rows we should be working with spools.setPreferredScrollableViewportSize( new Dimension( spools.getPreferredScrollableViewportSize().width, spools.getFontMetrics(spools.getFont()).getHeight() * 8) ); scrollPane.getViewport().setBackground(spools.getBackground()); scrollPane.setBackground(spools.getBackground()); //Setup our selection model listener rowSM = spools.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { //Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel)e.getSource(); } }); rowSM.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.getContentPane().add(scrollPane, BorderLayout.CENTER); status = new JLabel("0 " + LangTool.getString("spool.count")); status.setBorder(BorderFactory.createEtchedBorder()); this.getContentPane().add(status, BorderLayout.SOUTH); pack(); //Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = getSize(); if (frameSize.height > screenSize.height) frameSize.height = screenSize.height; if (frameSize.width > screenSize.width) frameSize.width = screenSize.width; setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { // close the spool file list// if (splfList != null)// splfList.close(); // close the system connection if (system != null) system.disconnectAllServices(); setVisible(false); dispose(); } }); }
| 7,079
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
|
public synchronized void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
| 7,080
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
| 7,081
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
|
public void drawImageBuffer(Graphics2D gg2d,int x, int y, int width, int height) { /** * @todo this is a hack and should be fixed at the root of the problem */ if (gg2d == null) { System.out.println(" we got a null graphic object "); return; } synchronized (lock) { gg2d.drawImage(bi.getSubimage(x,y,width,height),null,x,y); // tell waiting threads to wake up lock.notifyAll(); } }
| 7,082
|
private void writeObject(ObjectOutputStream is) throws IOException { }
|
private void writeObject(ObjectOutputStream os) throws IOException { }
| 7,086
|
public static void set32(byte[] data, int offset, long value) { data[offset] = (byte)(value & 0xFF); data[offset+1] = (byte)((value >> 8) & 0xFF); data[offset+2] = (byte)((value >> 16) & 0xFF); data[offset+3] = (byte)((value >> 32) & 0xFF); }
|
public static void set32(byte[] data, int offset, long value) { data[offset] = (byte)(value & 0xFF); data[offset+1] = (byte)((value >> 8) & 0xFF); data[offset+2] = (byte)((value >> 16) & 0xFF); data[offset+3] = (byte)((value >> 32) & 0xFF); }
| 7,088
|
public synchronized void setData(byte[] buf) { // This form of setData requires setLength to be called separately // and subsequently. if (buf == null) throw new NullPointerException("Null buffer"); buffer = buf; }
|
public synchronized void setData(byte[] buf) { // This form of setData requires setLength to be called separately // and subsequently. if (buf == null) throw new NullPointerException("Null buffer"); buffer = buf; }
| 7,095
|
public SwingChoicePeer(Choice choice) { super(); SwingToolkit.add(choice, this); SwingToolkit.copyAwtProperties(choice, this); final int cnt = choice.getItemCount(); for (int i = 0; i < cnt; i++) { addItem(choice.getItem(i), i); } }
|
public SwingChoicePeer(Choice choice) { super(); SwingToolkit.add(choice, this); SwingToolkit.copyAwtProperties(choice, this); final int cnt = choice.getItemCount(); for (int i = 0; i < cnt; i++) { addItem(choice.getItem(i), i); } }
| 7,096
|
public boolean isLeaf() { return (childValue == null || !(childValue instanceof Hashtable || childValue instanceof Vector || childValue.getClass() .isArray())); }
|
public boolean isLeaf() { return (childValue == null || !(childValue instanceof Hashtable || childValue instanceof Vector || childValue.getClass() .isArray())); }
| 7,097
|
public void setLeadSelectionPath(TreePath path) { if (selectionModel != null) { TreePath oldValue = selectionModel.getLeadSelectionPath(); if (path.equals(oldValue)) return; // Repaint the previous and current rows with the lead selection path. if (path != null) { repaint(getPathBounds(path)); selectionModel.addSelectionPath(path); } if (oldValue!=null) repaint(getPathBounds(oldValue)); firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, path); } }
|
public void setLeadSelectionPath(TreePath path) { if (selectionModel != null) { TreePath oldValue = selectionModel.getLeadSelectionPath(); if (path.equals(oldValue)) return; // Repaint the previous and current rows with the lead selection path. if (path != null) { repaint(getPathBounds(path)); selectionModel.addSelectionPath(path); } if (oldValue != null) repaint(getPathBounds(oldValue)); firePropertyChange(LEAD_SELECTION_PATH_PROPERTY, oldValue, path); } }
| 7,098
|
public TreePath[] getPaths() { return (TreePath[]) paths.clone(); } // getPaths()
|
public TreePath[] getPaths() { return (TreePath[]) paths.clone(); } // getPaths()
| 7,099
|
protected RegisterGroupUsage[] initialize() { // The order of this array determines the cost of using the // register. // The cost of a register is lower when its index in this // array is higher. return new RegisterGroupUsage[] { new RegisterGroupUsage(new RegisterEntry(X86Register.EAX, JvmType.INT), new RegisterEntry(X86Register.EAX, JvmType.REFERENCE), new RegisterEntry( X86Register.EAX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.EDX, JvmType.INT), new RegisterEntry(X86Register.EDX, JvmType.REFERENCE), new RegisterEntry( X86Register.EDX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.ECX, JvmType.INT), new RegisterEntry(X86Register.ECX, JvmType.REFERENCE), new RegisterEntry( X86Register.ECX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.EBX, JvmType.INT), new RegisterEntry(X86Register.EBX, JvmType.REFERENCE), new RegisterEntry( X86Register.EBX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.ESI, JvmType.INT), new RegisterEntry(X86Register.ESI, JvmType.REFERENCE), new RegisterEntry( X86Register.ESI, JvmType.FLOAT), false) }; // EDI always points to the statics, do not use }
|
protected RegisterGroupUsage[] initialize() { // The order of this array determines the cost of using the // register. // The cost of a register is lower when its index in this // array is higher. return new RegisterGroupUsage[] { new RegisterGroupUsage(new RegisterEntry(X86Register.EAX, JvmType.INT), new RegisterEntry(X86Register.EAX, JvmType.REFERENCE), new RegisterEntry( X86Register.EAX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.EDX, JvmType.INT), new RegisterEntry(X86Register.EDX, JvmType.REFERENCE), new RegisterEntry( X86Register.EDX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.ECX, JvmType.INT), new RegisterEntry(X86Register.ECX, JvmType.REFERENCE), new RegisterEntry( X86Register.ECX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.EBX, JvmType.INT), new RegisterEntry(X86Register.EBX, JvmType.REFERENCE), new RegisterEntry( X86Register.EBX, JvmType.FLOAT), false), new RegisterGroupUsage(new RegisterEntry(X86Register.ESI, JvmType.INT), new RegisterEntry(X86Register.ESI, JvmType.REFERENCE), new RegisterEntry( X86Register.ESI, JvmType.FLOAT), false) }; // EDI always points to the statics, do not use }
| 7,101
|
public X86Register request(Item owner, int jvmType, boolean supportBits8) { final int cnt = regs.length; for (int i = 0; i < cnt; i++) { final RegisterEntry re = regs[i]; if (re.jvmType == jvmType) { if (!supportBits8 || re.reg.isSuitableForBits8()) { return request(owner, re.reg); } } } return null; }
|
public X86Register request(Item owner, int jvmType, boolean supportBits8) { final int cnt = regs.length; for (int i = 0; i < cnt; i++) { final RegisterEntry re = regs[i]; if (re.jvmType == jvmType) { if (!supportBits8 || re.reg.isSuitableForBits8()) { return request(owner, re.reg); } } } return null; }
| 7,102
|
public X86RegisterPool() { this.registers = initialize(); this.regCount = registers.length; }
|
public X86RegisterPool(boolean lastFirst, int minimumRequestIndex) { this.lastFirst = lastFirst; this.minimumRequestIndex = minimumRequestIndex; this.registers = initialize(); this.regCount = registers.length; }
| 7,103
|
public void mouseMoved(MouseEvent e) { // Not interested in where the mouse // is unless it is being dragged. }
|
if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; public void mouseMoved(MouseEvent e)if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; {if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; // Not interested in where the mouseif (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; // is unless it is being dragged.if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; if (thumbRect.contains(e.getPoint())) thumbRollover = true; else thumbRollover = false; }
| 7,106
|
boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (thumbRect.contains(currentMouseX, currentMouseY)) return false; if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
|
boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (thumbRect.contains(currentMouseX, currentMouseY)) return false; if (direction == POSITIVE_SCROLL) return value > scrollbar.getValue(); else return (value < scrollbar.getValue()); }
| 7,107
|
boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (thumbRect.contains(currentMouseX, currentMouseY)) return false; if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
|
boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (thumbRect.contains(currentMouseX, currentMouseY)) return false; if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return value < scrollbar.getValue(); }
| 7,108
|
protected void installComponents() { int orientation = scrollbar.getOrientation(); switch (orientation) { case (JScrollBar.HORIZONTAL): incrButton = createIncreaseButton(EAST); decrButton = createDecreaseButton(WEST); break; default: incrButton = createIncreaseButton(SOUTH); decrButton = createDecreaseButton(NORTH); break; } if (incrButton != null) scrollbar.add(incrButton); if (decrButton != null) scrollbar.add(decrButton); }
|
protected void installComponents() { int orientation = scrollbar.getOrientation(); switch (orientation) { case JScrollBar.HORIZONTAL: incrButton = createIncreaseButton(EAST); decrButton = createDecreaseButton(WEST); break; default: incrButton = createIncreaseButton(SOUTH); decrButton = createDecreaseButton(NORTH); break; } if (incrButton != null) scrollbar.add(incrButton); if (decrButton != null) scrollbar.add(decrButton); }
| 7,109
|
int valueForXPosition(int xPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = ((xPos - trackRect.x) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
|
int valueForXPosition(int xPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return (max - min) / 2; value = ((xPos - trackRect.x) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
| 7,112
|
int valueForXPosition(int xPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = ((xPos - trackRect.x) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
|
int valueForXPosition(int xPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.width; int value; // If the length is 0, you shouldn't be able to even see where the slider is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = (xPos - trackRect.x) * (max - min) / len + min; // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
| 7,113
|
int valueForYPosition(int yPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the thumb is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = ((yPos - trackRect.y) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
|
int valueForYPosition(int yPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the thumb is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return (max - min) / 2; value = ((yPos - trackRect.y) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
| 7,114
|
int valueForYPosition(int yPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the thumb is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = ((yPos - trackRect.y) * (max - min) / len + min); // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
|
int valueForYPosition(int yPos) { int min = scrollbar.getMinimum(); int max = scrollbar.getMaximum(); int len = trackRect.height; int value; // If the length is 0, you shouldn't be able to even see where the thumb is. // This really shouldn't ever happen, but just in case, we'll return the middle. if (len == 0) return ((max - min) / 2); value = (yPos - trackRect.y) * (max - min) / len + min; // If this isn't a legal value, then we'll have to move to one now. if (value > max) value = max; else if (value < min) value = min; return value; }
| 7,115
|
public void mousePressed(MouseEvent e) { scrollTimer.stop(); scrollListener.setScrollByBlock(false); if (e.getSource() == incrButton) scrollListener.setDirection(POSITIVE_SCROLL); else scrollListener.setDirection(NEGATIVE_SCROLL); scrollTimer.start(); }
|
public void mousePressed(MouseEvent e) { scrollTimer.stop(); scrollListener.setScrollByBlock(false); if (e.getSource() == incrButton) scrollListener.setDirection(POSITIVE_SCROLL); else scrollListener.setDirection(NEGATIVE_SCROLL); scrollTimer.start(); }
| 7,116
|
public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals("model")) { ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener); scrollbar.getModel().addChangeListener(modelListener); getThumbBounds(); } else if (e.getPropertyName().equals("orientation")) { incrButton.removeMouseListener(buttonListener); decrButton.removeMouseListener(buttonListener); int orientation = scrollbar.getOrientation(); switch (orientation) { case (JScrollBar.HORIZONTAL): incrButton = createIncreaseButton(EAST); decrButton = createDecreaseButton(WEST); break; default: incrButton = createIncreaseButton(SOUTH); decrButton = createDecreaseButton(NORTH); break; } incrButton.addMouseListener(buttonListener); decrButton.addMouseListener(buttonListener); calculatePreferredSize(); } scrollbar.repaint(); }
|
public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals("model")) { ((BoundedRangeModel) e.getOldValue()).removeChangeListener(modelListener); scrollbar.getModel().addChangeListener(modelListener); getThumbBounds(); } else if (e.getPropertyName().equals("orientation")) { incrButton.removeMouseListener(buttonListener); decrButton.removeMouseListener(buttonListener); int orientation = scrollbar.getOrientation(); switch (orientation) { case (JScrollBar.HORIZONTAL): incrButton = createIncreaseButton(EAST); decrButton = createDecreaseButton(WEST); break; default: incrButton = createIncreaseButton(SOUTH); decrButton = createDecreaseButton(NORTH); break; } incrButton.addMouseListener(buttonListener); decrButton.addMouseListener(buttonListener); calculatePreferredSize(); } scrollbar.repaint(); }
| 7,118
|
public void actionPerformed(ActionEvent e) { if (block) { // Only need to check it if it's block scrolling // We only block scroll if the click occurs // in the track. if (!trackListener.shouldScroll(direction)) { trackHighlight = NO_HIGHLIGHT; scrollbar.repaint(); return; } scrollByBlock(direction); } else scrollByUnit(direction); }
|
public void actionPerformed(ActionEvent e) { if (block) { // Only need to check it if it's block scrolling // We only block scroll if the click occurs // in the track. if (!trackListener.shouldScroll(direction)) { trackHighlight = NO_HIGHLIGHT; scrollbar.repaint(); return; } scrollByBlock(direction); } else scrollByUnit(direction); }
| 7,119
|
public void actionPerformed(ActionEvent e) { if (block) { // Only need to check it if it's block scrolling // We only block scroll if the click occurs // in the track. if (!trackListener.shouldScroll(direction)) { trackHighlight = NO_HIGHLIGHT; scrollbar.repaint(); return; } scrollByBlock(direction); } else scrollByUnit(direction); }
|
public void actionPerformed(ActionEvent e) { if (block) { // Only need to check it if it's block scrolling // We only block scroll if the click occurs // in the track. if (!trackListener.shouldScroll(direction)) { trackHighlight = NO_HIGHLIGHT; scrollbar.repaint(); return; } scrollByBlock(direction); } else scrollByUnit(direction); }
| 7,120
|
public void actionPerformed(ActionEvent e) { if (block) { // Only need to check it if it's block scrolling // We only block scroll if the click occurs // in the track. if (!trackListener.shouldScroll(direction)) { trackHighlight = NO_HIGHLIGHT; scrollbar.repaint(); return; } scrollByBlock(direction); } else scrollByUnit(direction); }
|
public void actionPerformed(ActionEvent e) { if (block) { // Only need to check it if it's block scrolling // We only block scroll if the click occurs // in the track. if (!trackListener.shouldScroll(direction)) { trackHighlight = NO_HIGHLIGHT; scrollbar.repaint(); return; } scrollByBlock(direction); } else scrollByUnit(direction); }
| 7,121
|
public void mouseDragged(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); if (scrollbar.getValueIsAdjusting()) { int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) value = valueForXPosition(currentMouseX) - offset; else value = valueForYPosition(currentMouseY) - offset; scrollbar.setValue(value); } }
|
public void mouseDragged(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); if (scrollbar.getValueIsAdjusting()) { int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) value = valueForXPosition(currentMouseX) - offset; else value = valueForYPosition(currentMouseY) - offset; scrollbar.setValue(value); } }
| 7,122
|
public void mousePressed(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (value == scrollbar.getValue()) return; if (! thumbRect.contains(e.getPoint())) { scrollTimer.stop(); scrollListener.setScrollByBlock(true); if (value > scrollbar.getValue()) { trackHighlight = INCREASE_HIGHLIGHT; scrollListener.setDirection(POSITIVE_SCROLL); } else { trackHighlight = DECREASE_HIGHLIGHT; scrollListener.setDirection(NEGATIVE_SCROLL); } scrollTimer.start(); } else { // We'd like to keep track of where the cursor // is inside the thumb. // This works because the scrollbar's value represents // "lower" edge of the thumb. The value at which // the cursor is at must be greater or equal // to that value. scrollbar.setValueIsAdjusting(true); offset = value - scrollbar.getValue(); } scrollbar.repaint(); }
|
public void mousePressed(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (value == scrollbar.getValue()) return; if (! thumbRect.contains(e.getPoint())) { scrollTimer.stop(); scrollListener.setScrollByBlock(true); if (value > scrollbar.getValue()) { trackHighlight = INCREASE_HIGHLIGHT; scrollListener.setDirection(POSITIVE_SCROLL); } else { trackHighlight = DECREASE_HIGHLIGHT; scrollListener.setDirection(NEGATIVE_SCROLL); } scrollTimer.start(); } else { // We'd like to keep track of where the cursor // is inside the thumb. // This works because the scrollbar's value represents // "lower" edge of the thumb. The value at which // the cursor is at must be greater or equal // to that value. scrollbar.setValueIsAdjusting(true); offset = value - scrollbar.getValue(); } scrollbar.repaint(); }
| 7,123
|
public void mousePressed(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (value == scrollbar.getValue()) return; if (! thumbRect.contains(e.getPoint())) { scrollTimer.stop(); scrollListener.setScrollByBlock(true); if (value > scrollbar.getValue()) { trackHighlight = INCREASE_HIGHLIGHT; scrollListener.setDirection(POSITIVE_SCROLL); } else { trackHighlight = DECREASE_HIGHLIGHT; scrollListener.setDirection(NEGATIVE_SCROLL); } scrollTimer.start(); } else { // We'd like to keep track of where the cursor // is inside the thumb. // This works because the scrollbar's value represents // "lower" edge of the thumb. The value at which // the cursor is at must be greater or equal // to that value. scrollbar.setValueIsAdjusting(true); offset = value - scrollbar.getValue(); } scrollbar.repaint(); }
|
public void mousePressed(MouseEvent e) { currentMouseX = e.getX(); currentMouseY = e.getY(); int value; if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (value == scrollbar.getValue()) return; if (! thumbRect.contains(e.getPoint())) { scrollTimer.stop(); scrollListener.setScrollByBlock(true); if (value > scrollbar.getValue()) { trackHighlight = INCREASE_HIGHLIGHT; scrollListener.setDirection(POSITIVE_SCROLL); } else { trackHighlight = DECREASE_HIGHLIGHT; scrollListener.setDirection(NEGATIVE_SCROLL); } scrollTimer.start(); } else { // We'd like to keep track of where the cursor // is inside the thumb. // This works because the scrollbar's value represents // "lower" edge of the thumb. The value at which // the cursor is at must be greater or equal // to that value. scrollbar.setValueIsAdjusting(true); offset = value - scrollbar.getValue(); } scrollbar.repaint(); }
| 7,124
|
public void mouseReleased(MouseEvent e) { trackHighlight = NO_HIGHLIGHT; scrollTimer.stop(); if (scrollbar.getValueIsAdjusting()) scrollbar.setValueIsAdjusting(false); scrollbar.repaint(); }
|
public void mouseReleased(MouseEvent e) { trackHighlight = NO_HIGHLIGHT; scrollTimer.stop(); if (scrollbar.getValueIsAdjusting()) scrollbar.setValueIsAdjusting(false); scrollbar.repaint(); }
| 7,125
|
public boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
|
public boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
| 7,126
|
public boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
|
public boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
| 7,127
|
public boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
|
public boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
| 7,128
|
public boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
|
public boolean shouldScroll(int direction) { int value; if (scrollbar.getOrientation() == HORIZONTAL) value = valueForXPosition(currentMouseX); else value = valueForYPosition(currentMouseY); if (direction == POSITIVE_SCROLL) return (value > scrollbar.getValue()); else return (value < scrollbar.getValue()); }
| 7,129
|
protected void configureScrollBarColors() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); trackColor = defaults.getColor("ScrollBar.track"); trackHighlightColor = defaults.getColor("ScrollBar.trackHighlight"); thumbColor = defaults.getColor("ScrollBar.thumb"); thumbHighlightColor = defaults.getColor("ScrollBar.thumbHighlight"); thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow"); thumbLightShadowColor = defaults.getColor("ScrollBar.thumbShadow"); }
|
protected void configureScrollBarColors() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); trackColor = defaults.getColor("ScrollBar.track"); trackHighlightColor = defaults.getColor("ScrollBar.trackHighlight"); thumbColor = defaults.getColor("ScrollBar.thumb"); thumbHighlightColor = defaults.getColor("ScrollBar.thumbHighlight"); thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow"); thumbLightShadowColor = defaults.getColor("ScrollBar.thumbShadow"); }
| 7,130
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
| 7,131
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
| 7,132
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
|
protected Rectangle getThumbBounds() { int max = scrollbar.getMaximum(); int min = scrollbar.getMinimum(); int value = scrollbar.getValue(); int extent = scrollbar.getVisibleAmount(); // System.err.println(this + ".getThumbBounds()"); if (max == min) { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y; if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.width = getMinimumThumbSize().width; thumbRect.height = trackRect.height; } else { thumbRect.width = trackRect.width; thumbRect.height = getMinimumThumbSize().height; } return thumbRect; } if (scrollbar.getOrientation() == HORIZONTAL) { thumbRect.x = trackRect.x; thumbRect.x += (value - min) * trackRect.width / (max - min); thumbRect.y = trackRect.y; thumbRect.width = Math.max(extent * trackRect.width / (max - min), getMinimumThumbSize().width); thumbRect.height = trackRect.height; } else { thumbRect.x = trackRect.x; thumbRect.y = trackRect.y + value * trackRect.height / (max - min); thumbRect.width = trackRect.width; thumbRect.height = Math.max(extent * trackRect.height / (max - min), getMinimumThumbSize().height); } return thumbRect; }
| 7,133
|
public void installUI(JComponent c) { super.installUI(c); if (c instanceof JScrollBar) { scrollbar = (JScrollBar) c; trackRect = new Rectangle(); thumbRect = new Rectangle(); scrollTimer = new Timer(50, null); scrollTimer.setRepeats(true); installComponents(); installDefaults(); configureScrollBarColors(); installListeners(); calculatePreferredSize(); } }
|
public void installUI(JComponent c) { super.installUI(c); if (c instanceof JScrollBar) { scrollbar = (JScrollBar) c; trackRect = new Rectangle(); thumbRect = new Rectangle(); scrollTimer = new Timer(50, null); scrollTimer.setRepeats(true); installComponents(); installDefaults(); configureScrollBarColors(); installListeners(); calculatePreferredSize(); } }
| 7,134
|
protected void paintDecreaseHighlight(Graphics g) { Color saved = g.getColor(); g.setColor(trackHighlightColor); if (scrollbar.getOrientation() == HORIZONTAL) g.fillRect(trackRect.x, trackRect.y, thumbRect.x - trackRect.x, trackRect.height); else g.fillRect(trackRect.x, trackRect.y, trackRect.width, thumbRect.y - trackRect.y); g.setColor(saved); }
|
protected void paintDecreaseHighlight(Graphics g) { Color saved = g.getColor(); g.setColor(trackHighlightColor); if (scrollbar.getOrientation() == HORIZONTAL) g.fillRect(trackRect.x, trackRect.y, thumbRect.x - trackRect.x, trackRect.height); else g.fillRect(trackRect.x, trackRect.y, trackRect.width, thumbRect.y - trackRect.y); g.setColor(saved); }
| 7,135
|
protected void paintIncreaseHighlight(Graphics g) { Color saved = g.getColor(); g.setColor(trackHighlightColor); if (scrollbar.getOrientation() == HORIZONTAL) g.fillRect(thumbRect.x + thumbRect.width, trackRect.y, trackRect.x + trackRect.width - thumbRect.x - thumbRect.width, trackRect.height); else g.fillRect(trackRect.x, thumbRect.y + thumbRect.height, trackRect.width, trackRect.y + trackRect.height - thumbRect.y - thumbRect.height); g.setColor(saved); }
|
protected void paintIncreaseHighlight(Graphics g) { Color saved = g.getColor(); g.setColor(trackHighlightColor); if (scrollbar.getOrientation() == HORIZONTAL) g.fillRect(thumbRect.x + thumbRect.width, trackRect.y, trackRect.x + trackRect.width - thumbRect.x - thumbRect.width, trackRect.height); else g.fillRect(trackRect.x, thumbRect.y + thumbRect.height, trackRect.width, trackRect.y + trackRect.height - thumbRect.y - thumbRect.height); g.setColor(saved); }
| 7,136
|
protected void uninstallListeners() { scrollTimer.removeActionListener(scrollListener); scrollbar.getModel().removeChangeListener(modelListener); scrollbar.removePropertyChangeListener(propertyChangeListener); decrButton.removeMouseListener(buttonListener); incrButton.removeMouseListener(buttonListener); scrollbar.removeMouseListener(trackListener); scrollbar.removeMouseMotionListener(trackListener); propertyChangeListener = null; modelListener = null; buttonListener = null; trackListener = null; scrollListener = null; }
|
protected void uninstallListeners() { scrollTimer.removeActionListener(scrollListener); scrollbar.getModel().removeChangeListener(modelListener); scrollbar.removePropertyChangeListener(propertyChangeListener); decrButton.removeMouseListener(buttonListener); incrButton.removeMouseListener(buttonListener); scrollbar.removeMouseListener(trackListener); scrollbar.removeMouseMotionListener(trackListener); propertyChangeListener = null; modelListener = null; buttonListener = null; trackListener = null; scrollListener = null; }
| 7,137
|
protected void uninstallListeners() { scrollTimer.removeActionListener(scrollListener); scrollbar.getModel().removeChangeListener(modelListener); scrollbar.removePropertyChangeListener(propertyChangeListener); decrButton.removeMouseListener(buttonListener); incrButton.removeMouseListener(buttonListener); scrollbar.removeMouseListener(trackListener); scrollbar.removeMouseMotionListener(trackListener); propertyChangeListener = null; modelListener = null; buttonListener = null; trackListener = null; scrollListener = null; }
|
protected void uninstallListeners() { scrollTimer.removeActionListener(scrollListener); scrollbar.getModel().removeChangeListener(modelListener); scrollbar.removePropertyChangeListener(propertyChangeListener); decrButton.removeMouseListener(buttonListener); incrButton.removeMouseListener(buttonListener); scrollbar.removeMouseListener(trackListener); scrollbar.removeMouseMotionListener(trackListener); propertyChangeListener = null; modelListener = null; buttonListener = null; trackListener = null; scrollListener = null; }
| 7,138
|
protected void uninstallListeners() { scrollTimer.removeActionListener(scrollListener); scrollbar.getModel().removeChangeListener(modelListener); scrollbar.removePropertyChangeListener(propertyChangeListener); decrButton.removeMouseListener(buttonListener); incrButton.removeMouseListener(buttonListener); scrollbar.removeMouseListener(trackListener); scrollbar.removeMouseMotionListener(trackListener); propertyChangeListener = null; modelListener = null; buttonListener = null; trackListener = null; scrollListener = null; }
|
protected void uninstallListeners() { scrollTimer.removeActionListener(scrollListener); scrollbar.getModel().removeChangeListener(modelListener); scrollbar.removePropertyChangeListener(propertyChangeListener); decrButton.removeMouseListener(buttonListener); incrButton.removeMouseListener(buttonListener); scrollbar.removeMouseListener(trackListener); scrollbar.removeMouseMotionListener(trackListener); propertyChangeListener = null; modelListener = null; buttonListener = null; trackListener = null; scrollListener = null; }
| 7,139
|
protected void uninstallListeners() { scrollTimer.removeActionListener(scrollListener); scrollbar.getModel().removeChangeListener(modelListener); scrollbar.removePropertyChangeListener(propertyChangeListener); decrButton.removeMouseListener(buttonListener); incrButton.removeMouseListener(buttonListener); scrollbar.removeMouseListener(trackListener); scrollbar.removeMouseMotionListener(trackListener); propertyChangeListener = null; modelListener = null; buttonListener = null; trackListener = null; scrollListener = null; }
|
protected void uninstallListeners() { scrollTimer.removeActionListener(scrollListener); scrollbar.getModel().removeChangeListener(modelListener); scrollbar.removePropertyChangeListener(propertyChangeListener); decrButton.removeMouseListener(buttonListener); incrButton.removeMouseListener(buttonListener); scrollbar.removeMouseListener(trackListener); scrollbar.removeMouseMotionListener(trackListener); propertyChangeListener = null; modelListener = null; buttonListener = null; trackListener = null; scrollListener = null; }
| 7,140
|
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallListeners(); uninstallComponents(); scrollTimer = null; thumbRect = null; trackRect = null; trackColor = null; trackHighlightColor = null; thumbColor = null; thumbHighlightColor = null; thumbDarkShadowColor = null; thumbLightShadowColor = null; scrollbar = null; }
|
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallListeners(); uninstallComponents(); scrollTimer = null; thumbRect = null; trackRect = null; trackColor = null; trackHighlightColor = null; thumbColor = null; thumbHighlightColor = null; thumbDarkShadowColor = null; thumbLightShadowColor = null; scrollbar = null; }
| 7,141
|
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallListeners(); uninstallComponents(); scrollTimer = null; thumbRect = null; trackRect = null; trackColor = null; trackHighlightColor = null; thumbColor = null; thumbHighlightColor = null; thumbDarkShadowColor = null; thumbLightShadowColor = null; scrollbar = null; }
|
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallListeners(); uninstallComponents(); scrollTimer = null; thumbRect = null; trackRect = null; trackColor = null; trackHighlightColor = null; thumbColor = null; thumbHighlightColor = null; thumbDarkShadowColor = null; thumbLightShadowColor = null; scrollbar = null; }
| 7,142
|
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallListeners(); uninstallComponents(); scrollTimer = null; thumbRect = null; trackRect = null; trackColor = null; trackHighlightColor = null; thumbColor = null; thumbHighlightColor = null; thumbDarkShadowColor = null; thumbLightShadowColor = null; scrollbar = null; }
|
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallListeners(); uninstallComponents(); scrollTimer = null; thumbRect = null; trackRect = null; trackColor = null; trackHighlightColor = null; thumbColor = null; thumbHighlightColor = null; thumbDarkShadowColor = null; thumbLightShadowColor = null; scrollbar = null; }
| 7,143
|
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallListeners(); uninstallComponents(); scrollTimer = null; thumbRect = null; trackRect = null; trackColor = null; trackHighlightColor = null; thumbColor = null; thumbHighlightColor = null; thumbDarkShadowColor = null; thumbLightShadowColor = null; scrollbar = null; }
|
public void uninstallUI(JComponent c) { uninstallDefaults(); uninstallListeners(); uninstallComponents(); scrollTimer = null; thumbRect = null; trackRect = null; trackColor = null; trackHighlightColor = null; thumbColor = null; thumbHighlightColor = null; thumbDarkShadowColor = null; thumbLightShadowColor = null; scrollbar = null; }
| 7,144
|
public final void printMe() { Thread printerThread = new PrinterThread(screen,font,numCols,numRows,colorBg); printerThread.start();// //--- Create a printerJob object// PrinterJob printJob = PrinterJob.getPrinterJob ();// printJob.setJobName("tn5250j");//// //--- Set the printable class to this one since we// //--- are implementing the Printable interface// printJob.setPrintable (this);////// //--- Show a print dialog to the user. If the user// //--- clicks the print button, then print, otherwise// //--- cancel the print job// if (printJob.printDialog()) {// try {// printJob.print();// } catch (Exception PrintException) {// PrintException.printStackTrace();// }// } }
|
public final void printMe() { Thread printerThread = new PrinterThread(screen,font,numCols,numRows,colorBg); printerThread.start();// //--- Create a printerJob object// PrinterJob printJob = PrinterJob.getPrinterJob ();// printJob.setJobName("tn5250j");//// //--- Set the printable class to this one since we// //--- are implementing the Printable interface// printJob.setPrintable (this);////// //--- Show a print dialog to the user. If the user// //--- clicks the print button, then print, otherwise// //--- cancel the print job// if (printJob.printDialog()) {// try {// printJob.print();// } catch (Exception PrintException) {// PrintException.printStackTrace();// }// } }
| 7,145
|
private final void resizeScreenArea(int width, int height) { Font k = null; LineMetrics l; FontRenderContext f = null; k = GUIGraphicsUtils.getDerivedFont(font,width,height,numRows,numCols,sfh,sfw,ps132); f = new FontRenderContext(k.getTransform(),true,true); l = k.getLineMetrics("Wy",f); if (font.getSize() != k.getSize() || updateFont) { // set up all the variables that are used in calculating the new // size font = k; FontRenderContext frc = new FontRenderContext(font.getTransform(),true,true); lm = font.getLineMetrics("Wy",frc); fmWidth = (int)font.getStringBounds("W",frc).getWidth() + 2; fmHeight = (int)(font.getStringBounds("g",frc).getHeight() + lm.getDescent() + lm.getLeading()); // clear the bufferimage that we use to draw on// bi = null; bi.resize(fmWidth * numCols,fmHeight * (numRows + 2)); drawOIA(); // create the new drawable image that we will use// checkOffScreenImage(); // and loop through the screen buffer to draw the new image with // the correct attributes for (int m = 0;m < lenScreen; m++) { screen[m].setRowCol(getRow(m),getCol(m)); } updateFont = false; } }
|
private final void resizeScreenArea(int width, int height) {Font k = null;LineMetrics l;FontRenderContext f = null;k = GUIGraphicsUtils.getDerivedFont(font,width,height,numRows,numCols,sfh,sfw,ps132);f = new FontRenderContext(k.getTransform(),true,true);l = k.getLineMetrics("Wy",f);if (font.getSize() != k.getSize() || updateFont) {// set up all the variables that are used in calculating the new// sizefont = k;FontRenderContext frc = new FontRenderContext(font.getTransform(),true,true);lm = font.getLineMetrics("Wy",frc);fmWidth = (int)font.getStringBounds("W",frc).getWidth() + 2;fmHeight = (int)(font.getStringBounds("g",frc).getHeight() +lm.getDescent() + lm.getLeading());// clear the bufferimage that we use to draw on//bi = null;bi.resize(fmWidth * numCols,fmHeight * (numRows + 2));drawOIA();// create the new drawable image that we will use//checkOffScreenImage();// and loop through the screen buffer to draw the new image with// the correct attributesfor (int m = 0;m < lenScreen; m++) {screen[m].setRowCol(getRow(m),getCol(m));}updateFont = false;}}
| 7,146
|
private final void resizeScreenArea(int width, int height) { Font k = null; LineMetrics l; FontRenderContext f = null; k = GUIGraphicsUtils.getDerivedFont(font,width,height,numRows,numCols,sfh,sfw,ps132); f = new FontRenderContext(k.getTransform(),true,true); l = k.getLineMetrics("Wy",f); if (font.getSize() != k.getSize() || updateFont) { // set up all the variables that are used in calculating the new // size font = k; FontRenderContext frc = new FontRenderContext(font.getTransform(),true,true); lm = font.getLineMetrics("Wy",frc); fmWidth = (int)font.getStringBounds("W",frc).getWidth() + 2; fmHeight = (int)(font.getStringBounds("g",frc).getHeight() + lm.getDescent() + lm.getLeading()); // clear the bufferimage that we use to draw on// bi = null; bi.resize(fmWidth * numCols,fmHeight * (numRows + 2)); drawOIA(); // create the new drawable image that we will use// checkOffScreenImage(); // and loop through the screen buffer to draw the new image with // the correct attributes for (int m = 0;m < lenScreen; m++) { screen[m].setRowCol(getRow(m),getCol(m)); } updateFont = false; } }
|
private final void resizeScreenArea(int width, int height) {Font k = null;LineMetrics l;FontRenderContext f = null;k = GUIGraphicsUtils.getDerivedFont(font,width,height,numRows,numCols,sfh,sfw,ps132);f = new FontRenderContext(k.getTransform(),true,true);l = k.getLineMetrics("Wy",f);if (font.getSize() != k.getSize() || updateFont) { // set up all the variables that are used in calculating the new // size font = k; FontRenderContext frc = new FontRenderContext(font.getTransform(),true,true); lm = font.getLineMetrics("Wy",frc); fmWidth = (int)font.getStringBounds("W",frc).getWidth() + 2; fmHeight = (int)(font.getStringBounds("g",frc).getHeight() + lm.getDescent() + lm.getLeading()); // clear the bufferimage that we use to draw on// bi = null; bi.resize(fmWidth * numCols,fmHeight * (numRows + 2)); drawOIA(); // create the new drawable image that we will use// checkOffScreenImage(); // and loop through the screen buffer to draw the new image with // the correct attributes for (int m = 0;m < lenScreen; m++) {screen[m].setRowCol(getRow(m),getCol(m)); } updateFont = false;} }
| 7,147
|
public void updateDirty() { // update the image updateImage(dirty); // update dirty to show that we have already painted that region of the // screen so do not do it again. dirty.setBounds(dirty.x,dirty.height,dirty.width,(int)(tArea.getHeight() - dirty.height)); }
|
public void updateDirty() { // update the image updateImage(r); // update dirty to show that we have already painted that region of the // screen so do not do it again. dirty.setBounds(dirty.x,dirty.height,dirty.width,(int)(tArea.getHeight() - dirty.height)); }
| 7,148
|
public float getSpan(GlyphView view, int p0, int p1, TabExpander te, float x) { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font); Segment txt = view.getText(p0, p1); int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0); return span; }
|
public float getSpan(GlyphView view, int p0, int p1, TabExpander te, float x) { Font font = view.getFont(); FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font); Segment txt = view.getText(p0, p1); int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0); return span; }
| 7,149
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); Rectangle bounds = a instanceof Rectangle ? (Rectangle) a : a.getBounds(); TabExpander expander = view.getTabExpander(); int width = Utilities.getTabbedTextWidth(txt, fm, bounds.x, expander, view.getStartOffset()); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
| 7,150
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
| 7,151
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, bounds.x + width, height); return result; }
|
public Shape modelToView(GlyphView view, int pos, Position.Bias b, Shape a) throws BadLocationException { Element el = view.getElement(); Font font = view.getFont(); FontMetrics fm = view.getContainer().getFontMetrics(font); Segment txt = view.getText(el.getStartOffset(), pos); int width = fm.charsWidth(txt.array, txt.offset, txt.count); int height = fm.getHeight(); Rectangle bounds = a.getBounds(); Rectangle result = new Rectangle(bounds.x + width, bounds.y, 0, height); return result; }
| 7,152
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
| 7,153
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.x + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
| 7,154
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.height + width, bounds.y + lineHeight); } g.setColor(oldColor); }
|
public void paint(GlyphView view, Graphics g, Shape a, int p0, int p1) { Color oldColor = g.getColor(); int height = (int) getHeight(view); Segment txt = view.getText(p0, p1); Rectangle bounds = a.getBounds(); TabExpander tabEx = null; View parent = view.getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; int width = Utilities.getTabbedTextWidth(txt, g.getFontMetrics(), bounds.x, tabEx, txt.offset); // Fill the background of the text run. Color background = view.getBackground(); if (background != null) { g.setColor(background); g.fillRect(bounds.x, bounds.y, width, height); } // Draw the actual text. g.setColor(view.getForeground()); g.setFont(view.getFont()); int ascent = g.getFontMetrics().getAscent(); if (view.isSuperscript()) // TODO: Adjust font for superscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent - height / 2, g, tabEx, txt.offset); else if (view.isSubscript()) // TODO: Adjust font for subscripting. Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent + height / 2, g, tabEx, txt.offset); else Utilities.drawTabbedText(txt, bounds.x, bounds.y + ascent, g, tabEx, txt.offset); if (view.isStrikeThrough()) { int strikeHeight = (int) (getAscent(view) / 2); g.drawLine(bounds.x, bounds.y + strikeHeight, bounds.height + width, bounds.y + strikeHeight); } if (view.isUnderline()) { int lineHeight = (int) getAscent(view); g.drawLine(bounds.x, bounds.y + lineHeight, bounds.x + width, bounds.y + lineHeight); } g.setColor(oldColor); }
| 7,155
|
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); GlyphPainter painter = getGlyphPainter(); // Try to find a suitable line break. BreakIterator lineBreaker = BreakIterator.getLineInstance(); Segment txt = new Segment(); try { int start = getStartOffset(); int length = getEndOffset() - start; getDocument().getText(start, length, txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } int breakLocation = Utilities.getBreakLocation(txt, getContainer().getFontMetrics(getFont()), (int) pos, (int) (pos + len), getTabExpander(), p0); View brokenView = createFragment(p0, breakLocation); return brokenView; }
|
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); // Try to find a suitable line break. BreakIterator lineBreaker = BreakIterator.getLineInstance(); Segment txt = new Segment(); try { int start = getStartOffset(); int length = getEndOffset() - start; getDocument().getText(start, length, txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } int breakLocation = Utilities.getBreakLocation(txt, getContainer().getFontMetrics(getFont()), (int) pos, (int) (pos + len), getTabExpander(), p0); View brokenView = createFragment(p0, breakLocation); return brokenView; }
| 7,156
|
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); GlyphPainter painter = getGlyphPainter(); // Try to find a suitable line break. BreakIterator lineBreaker = BreakIterator.getLineInstance(); Segment txt = new Segment(); try { int start = getStartOffset(); int length = getEndOffset() - start; getDocument().getText(start, length, txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } int breakLocation = Utilities.getBreakLocation(txt, getContainer().getFontMetrics(getFont()), (int) pos, (int) (pos + len), getTabExpander(), p0); View brokenView = createFragment(p0, breakLocation); return brokenView; }
|
public View breakView(int axis, int p0, float pos, float len) { if (axis == Y_AXIS) return this; checkPainter(); GlyphPainter painter = getGlyphPainter(); // Try to find a suitable line break. Segment txt = new Segment(); try { int start = getStartOffset(); int length = getEndOffset() - start; getDocument().getText(start, length, txt); } catch (BadLocationException ex) { AssertionError err = new AssertionError("BadLocationException must not " + "be thrown here."); err.initCause(ex); throw err; } int breakLocation = Utilities.getBreakLocation(txt, getContainer().getFontMetrics(getFont()), (int) pos, (int) (pos + len), getTabExpander(), p0); View brokenView = createFragment(p0, breakLocation); return brokenView; }
| 7,157
|
public float getAlignment(int axis) { float align; if (axis == Y_AXIS) { checkPainter(); GlyphPainter painter = getGlyphPainter(); float height = painter.getHeight(this); float descent = painter.getDescent(this); align = (height - descent) / height; } else align = super.getAlignment(axis); return align; }
|
public float getAlignment(int axis) { float align; if (axis == Y_AXIS) { GlyphPainter painter = getGlyphPainter(); float height = painter.getHeight(this); float descent = painter.getDescent(this); align = (height - descent) / height; } else align = super.getAlignment(axis); return align; }
| 7,158
|
public float getAlignment(int axis) { float align; if (axis == Y_AXIS) { checkPainter(); GlyphPainter painter = getGlyphPainter(); float height = painter.getHeight(this); float descent = painter.getDescent(this); align = (height - descent) / height; } else align = super.getAlignment(axis); return align; }
|
public float getAlignment(int axis) { float align; if (axis == Y_AXIS) { checkPainter(); GlyphPainter painter = getGlyphPainter(); float height = painter.getHeight(this); float descent = painter.getDescent(this); float ascent = painter.getAscent(this); if (isSuperscript()) align = 1.0F; else if (isSubscript()) align = height > 0 ? (height - (descent + (ascent / 2))) / height : 0; else align = height > 0 ? (height - descent) / height : 0; } else align = super.getAlignment(axis); return align; }
| 7,159
|
public Font getFont() { Element el = getElement(); AttributeSet atts = el.getAttributes(); String family = StyleConstants.getFontFamily(atts); int size = StyleConstants.getFontSize(atts); int style = Font.PLAIN; if (StyleConstants.isBold(atts)) style |= Font.BOLD; if (StyleConstants.isItalic(atts)) style |= Font.ITALIC; Font font = new Font(family, style, size); return font; }
|
public Font getFont() { Element el = getElement(); AttributeSet atts = el.getAttributes(); String family = StyleConstants.getFontFamily(atts); int size = StyleConstants.getFontSize(atts); int style = Font.PLAIN; if (StyleConstants.isBold(atts)) style |= Font.BOLD; if (StyleConstants.isItalic(atts)) style |= Font.ITALIC; Font font = new Font(family, style, size); return font; }
| 7,160
|
public float getPreferredSpan(int axis) { float span = 0; checkPainter(); GlyphPainter painter = getGlyphPainter(); if (axis == X_AXIS) { Element el = getElement(); TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; span = painter.getSpan(this, getStartOffset(), getEndOffset(), tabEx, 0.F); } else span = painter.getHeight(this); return span; }
|
public float getPreferredSpan(int axis) { float span = 0; checkPainter(); GlyphPainter painter = getGlyphPainter(); switch (axis) { Element el = getElement(); TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; span = painter.getSpan(this, getStartOffset(), getEndOffset(), tabEx, 0.F); } else span = painter.getHeight(this); return span; }
| 7,161
|
public float getPreferredSpan(int axis) { float span = 0; checkPainter(); GlyphPainter painter = getGlyphPainter(); if (axis == X_AXIS) { Element el = getElement(); TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; span = painter.getSpan(this, getStartOffset(), getEndOffset(), tabEx, 0.F); } else span = painter.getHeight(this); return span; }
|
public float getPreferredSpan(int axis) { float span = 0; checkPainter(); GlyphPainter painter = getGlyphPainter(); if (axis == X_AXIS) { case X_AXIS: TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; span = painter.getSpan(this, getStartOffset(), getEndOffset(), tabEx, 0.F); } else span = painter.getHeight(this); return span; }
| 7,162
|
public float getPreferredSpan(int axis) { float span = 0; checkPainter(); GlyphPainter painter = getGlyphPainter(); if (axis == X_AXIS) { Element el = getElement(); TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; span = painter.getSpan(this, getStartOffset(), getEndOffset(), tabEx, 0.F); } else span = painter.getHeight(this); return span; }
|
public float getPreferredSpan(int axis) { float span = 0; checkPainter(); GlyphPainter painter = getGlyphPainter(); if (axis == X_AXIS) { Element el = getElement(); TabExpander tabEx = null; View parent = getParent(); if (parent instanceof TabExpander) tabEx = (TabExpander) parent; span = painter.getSpan(this, getStartOffset(), getEndOffset(), tabEx, 0.F); } else span = painter.getHeight(this); return span; }
| 7,163
|
public void paint(Graphics g, Shape a) { Element el = getElement(); checkPainter(); getGlyphPainter().paint(this, g, a, getStartOffset(), getEndOffset()); }
|
public void paint(Graphics g, Shape a) { checkPainter(); getGlyphPainter().paint(this, g, a, getStartOffset(), getEndOffset()); }
| 7,164
|
public void paint(Graphics g, Shape a) { Element el = getElement(); checkPainter(); getGlyphPainter().paint(this, g, a, getStartOffset(), getEndOffset()); }
|
public void paint(Graphics g, Shape a) { Element el = getElement(); checkPainter(); int p0 = getStartOffset(); int p1 = getEndOffset(); Container c = getContainer(); if (c instanceof JTextComponent) { JTextComponent tc = (JTextComponent) c; Highlighter h = tc.getHighlighter(); if (h instanceof LayeredHighlighter) { LayeredHighlighter lh = (LayeredHighlighter) h; lh.paintLayeredHighlights(g, p0, p1, a, tc, this); } } getGlyphPainter().paint(this, g, a, p0, p1); }
| 7,165
|
public int getIconHeight() { return 12; }
|
public int getIconHeight() { return 12; }
| 7,166
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.