bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
public void write(long fileOffset, byte[] src, int off, int len) throws IOException { throw new UnsupportedOperationException("Not yet implemented"); }
public void write(long fileOffset, byte[] src, int off, int len) throws IOException { throw new UnsupportedOperationException("Not yet implemented"); }
8,869
public boolean send() throws Exception { try { if(!loadConfig(configFile)) return false; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from == null) from = SMTPProperties.getProperty("mail.smtp.from"); if (from != null && from.length() > 0) { pers = SMTPProperties.getProperty("mail.smtp.realname"); if (pers != null) msg.setFrom(new InternetAddress(from, pers)); } if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg); return true; } catch (SendFailedException sfe) { showFailedException(sfe); } return false; }
public boolean send() throws Exception { try { if(!loadConfig(configFile)) return false; Session session = Session.getDefaultInstance(SMTPProperties, null); session.setDebug(false); // create the Multipart and its parts to it Multipart mp = new MimeMultipart(); Message msg = new MimeMessage(session); InternetAddress[] toAddrs = null, ccAddrs = null; toAddrs = InternetAddress.parse(to, false); msg.setRecipients(Message.RecipientType.TO, toAddrs); if (cc != null) { ccAddrs = InternetAddress.parse(cc, false); msg.setRecipients(Message.RecipientType.CC, ccAddrs); } if (subject != null) msg.setSubject(subject.trim()); if (from == null) from = SMTPProperties.getProperty("mail.smtp.from"); if (from != null && from.length() > 0) { pers = SMTPProperties.getProperty("mail.smtp.realname"); if (pers != null) msg.setFrom(new InternetAddress(from, pers)); } if (message != null && message.length() > 0) { // create and fill the attachment message part MimeBodyPart mbp = new MimeBodyPart(); mbp.setText(message,"us-ascii"); mp.addBodyPart(mbp); } msg.setSentDate(new Date()); if (attachment != null && attachment.length() > 0) { // create and fill the attachment message part MimeBodyPart abp = new MimeBodyPart(); abp.setText(attachment,"us-ascii"); if (attachmentName == null || attachmentName.length() == 0) abp.setFileName("tn5250j.txt"); else abp.setFileName(attachmentName); mp.addBodyPart(abp); } if (fileName != null && fileName.length() > 0) { // create and fill the attachment message part MimeBodyPart fbp = new MimeBodyPart(); fbp.setText("File sent using tn5250j","us-ascii"); if (attachmentName == null || attachmentName.length() == 0) fbp.setFileName("tn5250j.txt"); else fbp.setFileName(attachmentName); // Get the attachment DataSource source = new FileDataSource(fileName); // Set the data handler to the attachment fbp.setDataHandler(new DataHandler(source)); mp.addBodyPart(fbp); } // add the Multipart to the message msg.setContent(mp); // send the message Transport.send(msg); return true; } catch (SendFailedException sfe) { showFailedException(sfe); } return false; }
8,870
public void load(String filename) { SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkLink(filename); if (loadLib(filename) == 0) throw new UnsatisfiedLinkError("Could not load library " + filename); }
public void load(String filename) { SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkLink(filename); if (loadLib(filename) == 0) throw new UnsatisfiedLinkError("Could not load library " + filename); }
8,871
private static int loadLib(String filename) { SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkRead(filename); return VMRuntime.nativeLoad(filename); }
private static int loadLib(String filename, ClassLoader loader) { SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkRead(filename); return VMRuntime.nativeLoad(filename); }
8,872
private static int loadLib(String filename) { SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkRead(filename); return VMRuntime.nativeLoad(filename); }
private static int loadLib(String filename) { SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkRead(filename); return VMRuntime.nativeLoad(filename); }
8,873
public void loadLibrary(String libname) { SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkLink(libname); String filename; ClassLoader cl = VMSecurityManager.currentClassLoader(); if (cl != null) { filename = cl.findLibrary(libname); if (filename != null) { if (loadLib(filename) != 0) return; else throw new UnsatisfiedLinkError("Could not load library " + filename); } } filename = VMRuntime.mapLibraryName(libname); for (int i = 0; i < libpath.length; i++) if (loadLib(libpath[i] + filename) != 0) return; throw new UnsatisfiedLinkError("Could not find library " + libname + "."); }
public void loadLibrary(String libname) { SecurityManager sm = SecurityManager.current; // Be thread-safe! if (sm != null) sm.checkLink(libname); String filename; ClassLoader cl = VMSecurityManager.currentClassLoader(); if (cl != null) { filename = cl.findLibrary(libname); if (filename != null) { if (loadLib(filename) != 0) return; else throw new UnsatisfiedLinkError("Could not load library " + filename); } } filename = VMRuntime.mapLibraryName(libname); for (int i = 0; i < libpath.length; i++) if (loadLib(libpath[i] + filename) != 0) return; throw new UnsatisfiedLinkError("Could not find library " + libname + "."); }
8,874
public PrivateKey readPrivateKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a private key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal private key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid private key, or encoded with an unknown codec"); } return kpc.decodePrivateKey(kb); }
public PrivateKey readPrivateKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a private key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal private key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid private key, or encoded with an unknown codec"); } return kpc.decodePrivateKey(kb); }
8,875
public PrivateKey readPrivateKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a private key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal private key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid private key, or encoded with an unknown codec"); } return kpc.decodePrivateKey(kb); }
public PrivateKey readPrivateKey() throws KeyAgreementException if (in.available() < 4) throw new KeyAgreementException( "not enough bytes for a private key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) throw new KeyAgreementException("illegal private key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) throw new KeyAgreementException( "invalid private key, or encoded with an unknown codec"); } return kpc.decodePrivateKey(kb); }
8,876
public PrivateKey readPrivateKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a private key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal private key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid private key, or encoded with an unknown codec"); } return kpc.decodePrivateKey(kb); }
public PrivateKey readPrivateKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a private key in message"); byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal private key encoding"); byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid private key, or encoded with an unknown codec"); return kpc.decodePrivateKey(kb); }
8,877
public PrivateKey readPrivateKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a private key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal private key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid private key, or encoded with an unknown codec"); } return kpc.decodePrivateKey(kb); }
public PrivateKey readPrivateKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a private key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal private key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid private key, or encoded with an unknown codec"); } return kpc.decodePrivateKey(kb); }
8,878
public PublicKey readPublicKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a public key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal public key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid public key, or encoded with an unknown codec"); } return kpc.decodePublicKey(kb); }
public PublicKey readPublicKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a public key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal public key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid public key, or encoded with an unknown codec"); } return kpc.decodePublicKey(kb); }
8,879
public PublicKey readPublicKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a public key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal public key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid public key, or encoded with an unknown codec"); } return kpc.decodePublicKey(kb); }
public PublicKey readPublicKey() throws KeyAgreementException if (in.available() < 4) throw new KeyAgreementException( "not enough bytes for a public key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) throw new KeyAgreementException("illegal public key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) throw new KeyAgreementException( "invalid public key, or encoded with an unknown codec"); } return kpc.decodePublicKey(kb); }
8,880
public PublicKey readPublicKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a public key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal public key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid public key, or encoded with an unknown codec"); } return kpc.decodePublicKey(kb); }
public PublicKey readPublicKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a public key in message"); byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal public key encoding"); byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid public key, or encoded with an unknown codec"); return kpc.decodePublicKey(kb); }
8,881
public PublicKey readPublicKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a public key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal public key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid public key, or encoded with an unknown codec"); } return kpc.decodePublicKey(kb); }
public PublicKey readPublicKey() throws KeyAgreementException { if (in.available() < 4) { throw new KeyAgreementException( "not enough bytes for a public key in message"); } byte[] elementLengthBytes = new byte[4]; in.read(elementLengthBytes, 0, 4); int elementLength = fourBytesToLength(elementLengthBytes); if (in.available() < elementLength) { throw new KeyAgreementException("illegal public key encoding"); } byte[] kb = new byte[elementLength]; in.read(kb, 0, elementLength); // instantiate the right codec and decode IKeyPairCodec kpc = KeyPairCodecFactory.getInstance(kb); if (kpc == null) { throw new KeyAgreementException( "invalid public key, or encoded with an unknown codec"); } return kpc.decodePublicKey(kb); }
8,882
public void reset() { userData.setEnabled(false); userData.setText(""); //select.setSelected(false); all.setSelected(true); }
publicvoidreset(){userData.setEnabled(false);userData.setText("");//select.setSelected(false);all.setSelected(true);}
8,883
protected void paintFocus(Graphics g, AbstractButton b, Rectangle vr, Rectangle tr, Rectangle ir) { if (b.hasFocus() && b.isFocusPainted()) { Color saved_color = g.getColor(); g.setColor(focusColor); Rectangle focusRect = ir.union(tr); g.drawRect(focusRect.x, focusRect.y, focusRect.width, focusRect.height); g.setColor(saved_color); } }
protected void paintFocus(Graphics g, AbstractButton b, Rectangle vr, Rectangle tr, Rectangle ir) { if (b.hasFocus() && b.isFocusPainted()) { Color saved_color = g.getColor(); g.setColor(focusColor); Rectangle focusRect = ir.union(tr); g.drawRect(focusRect.x, focusRect.y, focusRect.width, focusRect.height); g.setColor(saved_color); } }
8,886
private void getNewSessionOptions() { try { BufferedReader in = new BufferedReader( new InputStreamReader( socket.getInputStream())); String inputLine, outputLine; bootEvent = new BootEvent(this,in.readLine()); System.out.println(bootEvent.getNewSessionOptions()); fireBootEvent(); in.close(); socket.close(); } catch (IOException e) { e.printStackTrace(); } }
private void getNewSessionOptions() { try { BufferedReader in = new BufferedReader( new InputStreamReader( socket.getInputStream())); bootEvent = new BootEvent(this,in.readLine()); System.out.println(bootEvent.getNewSessionOptions()); fireBootEvent(); in.close(); socket.close(); } catch (IOException e) { e.printStackTrace(); } }
8,888
protected Component addSingletonComponent(Component oldComponent, Component newComponent) { return null; }
protected Component addSingletonComponent(Component oldComponent, Component newComponent) { return null; }
8,890
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); Point viewPos = viewport.getViewPosition(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); x3 = x4 - vsb.getPreferredSize().width; y3 = y4 - hsb.getPreferredSize().height; boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y3 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x3 - x2))); if (!showVsb) x3 = x4; if (!showHsb) y3 = y4; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } } }
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); Point viewPos = viewport.getViewPosition(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); x3 = x4 - vsb.getPreferredSize().width; y3 = y4 - hsb.getPreferredSize().height; boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y3 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x3 - x2))); if (!showVsb) x3 = x4; if (!showHsb) y3 = y4; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } } }
8,891
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); Point viewPos = viewport.getViewPosition(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); x3 = x4 - vsb.getPreferredSize().width; y3 = y4 - hsb.getPreferredSize().height; boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y3 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x3 - x2))); if (!showVsb) x3 = x4; if (!showHsb) y3 = y4; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } } }
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); Point viewPos = viewport.getViewPosition(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); x3 = x4 - vsb.getPreferredSize().width; y3 = y4 - hsb.getPreferredSize().height; boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y3 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x3 - x2))); if (!showVsb) x3 = x4; if (!showHsb) y3 = y4; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } } }
8,892
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); Point viewPos = viewport.getViewPosition(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); x3 = x4 - vsb.getPreferredSize().width; y3 = y4 - hsb.getPreferredSize().height; boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y3 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x3 - x2))); if (!showVsb) x3 = x4; if (!showHsb) y3 = y4; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } } }
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); Point viewPos = viewport.getViewPosition(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); x3 = x4 - vsb.getPreferredSize().width; y3 = y4 - hsb.getPreferredSize().height; boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y3 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x3 - x2))); if (!showVsb) x3 = x4; if (!showHsb) y3 = y4; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } } }
8,893
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); Point viewPos = viewport.getViewPosition(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); x3 = x4 - vsb.getPreferredSize().width; y3 = y4 - hsb.getPreferredSize().height; boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y3 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x3 - x2))); if (!showVsb) x3 = x4; if (!showHsb) y3 = y4; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } } }
public void layoutContainer(Container parent) { if (parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { JViewport viewport = sc.getViewport(); Dimension viewSize = viewport.getViewSize(); Point viewPos = viewport.getViewPosition(); int x1 = 0, x2 = 0, x3 = 0, x4 = 0; int y1 = 0, y2 = 0, y3 = 0, y4 = 0; Rectangle scrollPaneBounds = SwingUtilities.calculateInnerArea(sc, null); x1 = scrollPaneBounds.x; y1 = scrollPaneBounds.y; x4 = scrollPaneBounds.x + scrollPaneBounds.width; y4 = scrollPaneBounds.y + scrollPaneBounds.height; if (colHead != null) y2 = y1 + colHead.getPreferredSize().height; else y2 = y1; if (rowHead != null) x2 = x1 + rowHead.getPreferredSize().width; else x2 = x1; int vsbPolicy = sc.getVerticalScrollBarPolicy(); int hsbPolicy = sc.getHorizontalScrollBarPolicy(); x3 = x4 - vsb.getPreferredSize().width; y3 = y4 - hsb.getPreferredSize().height; boolean showVsb = (vsb != null) && ((vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) || (vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED && viewSize.height > (y3 - y2))); boolean showHsb = (hsb != null) && ((hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) || (hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED && viewSize.width > (x3 - x2))); if (!showVsb) x3 = x4; if (!showHsb) y3 = y4; // now set the layout if (viewport != null) viewport.setBounds(new Rectangle(x2, y2, x3-x2, y3-y2)); if (colHead != null) colHead.setBounds(new Rectangle(x2, y1, x3-x2, y2-y1)); if (rowHead != null) rowHead.setBounds(new Rectangle(x1, y2, x2-x1, y3-y2)); if (showVsb) { vsb.setVisible(true); vsb.setBounds(new Rectangle(x3, y2, x4-x3, y3-y2)); } else if (vsb != null) vsb.setVisible(false); if (showHsb) { hsb.setVisible(true); hsb.setBounds(new Rectangle(x2, y3, x3-x2, y4-y3)); } else if (hsb != null) hsb.setVisible(false); if (upperLeft != null) upperLeft.setBounds(new Rectangle(x1, y1, x2-x1, y2-y1)); if (upperRight != null) upperRight.setBounds(new Rectangle(x3, y1, x4-x3, y2-y1)); if (lowerLeft != null) lowerLeft.setBounds(new Rectangle(x1, y3, x2-x1, y4-y3)); if (lowerRight != null) lowerRight.setBounds(new Rectangle(x3, y3, x4-x3, y4-y3)); } } }
8,894
public Dimension preferredLayoutSize(Container parent) { if (parent != null && parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { Dimension insetsSize = new Dimension(0,0); Dimension viewportSize = new Dimension(0,0); Dimension viewportInsetsSize = new Dimension(0,0); Dimension columnHeaderSize = new Dimension(0,0); Dimension rowHeaderSize = new Dimension(0,0); Dimension verticalScrollBarSize = new Dimension(0,0); Dimension horizontalScrollBarSize = new Dimension(0,0); Insets insets = sc.getInsets(); Border viewportBorder = sc.getViewportBorder(); Insets viewportInsets = null; if (viewportBorder != null) { viewportInsets = viewportBorder.getBorderInsets(parent); if (viewportInsets != null) viewportInsetsSize.setSize(viewportInsets.left + viewportInsets.right, viewportInsets.top + viewportInsets.bottom); } if (insets != null) insetsSize.setSize(insets.left + insets.right, insets.top + insets.bottom); if (viewport != null) { Component view = null; Scrollable scr = null; Dimension pref = null; view = viewport.getView(); if (view != null && view instanceof Scrollable) scr = (Scrollable) view; if (scr != null) pref = scr.getPreferredScrollableViewportSize(); if (pref == null) pref = viewport.getPreferredSize(); if (pref != null) viewportSize.setSize(pref); } maybeSetPreferredSize(colHead, columnHeaderSize); maybeSetPreferredSize(rowHead, rowHeaderSize); maybeSetPreferredSize(vsb, verticalScrollBarSize); maybeSetPreferredSize(hsb, horizontalScrollBarSize); return new Dimension(insetsSize.width + viewportSize.width + viewportInsetsSize.width + rowHeaderSize.width + verticalScrollBarSize.width, insetsSize.height + viewportSize.height + viewportInsetsSize.height + columnHeaderSize.height + horizontalScrollBarSize.height); } } else { return new Dimension(0,0); } }
public Dimension preferredLayoutSize(Container parent) { if (parent != null && parent instanceof JScrollPane) { JScrollPane sc = (JScrollPane) parent; synchronized (sc.getTreeLock ()) { Dimension insetsSize = new Dimension(0,0); Dimension viewportSize = new Dimension(0,0); Dimension viewportInsetsSize = new Dimension(0,0); Dimension columnHeaderSize = new Dimension(0,0); Dimension rowHeaderSize = new Dimension(0,0); Dimension verticalScrollBarSize = new Dimension(0,0); Dimension horizontalScrollBarSize = new Dimension(0,0); Insets insets = sc.getInsets(); Border viewportBorder = sc.getViewportBorder(); Insets viewportInsets = null; if (viewportBorder != null) { viewportInsets = viewportBorder.getBorderInsets(parent); if (viewportInsets != null) viewportInsetsSize.setSize(viewportInsets.left + viewportInsets.right, viewportInsets.top + viewportInsets.bottom); } if (insets != null) insetsSize.setSize(insets.left + insets.right, insets.top + insets.bottom); if (viewport != null) { Component view = null; Scrollable scr = null; Dimension pref = null; view = viewport.getView(); if (view != null && view instanceof Scrollable) scr = (Scrollable) view; if (scr != null) pref = scr.getPreferredScrollableViewportSize(); if (pref == null) pref = viewport.getPreferredSize(); if (pref != null) viewportSize.setSize(pref); } maybeSetPreferredSize(colHead, columnHeaderSize); maybeSetPreferredSize(rowHead, rowHeaderSize); maybeSetPreferredSize(vsb, verticalScrollBarSize); maybeSetPreferredSize(hsb, horizontalScrollBarSize); return new Dimension(insetsSize.width + viewportSize.width + viewportInsetsSize.width + rowHeaderSize.width + verticalScrollBarSize.width, insetsSize.height + viewportSize.height + viewportInsetsSize.height + columnHeaderSize.height + horizontalScrollBarSize.height); } } else { return new Dimension(0,0); } }
8,895
public JApplet() { super.setLayout(new BorderLayout(1, 1)); getRootPane(); // Will do set/create. initStageDone = true; // Init stage is now over. }
public JApplet() { super.setLayout(new BorderLayout(1, 1)); getRootPane(); // Will do set/create. initStageDone = true; // Init stage is now over. }
8,898
public JApplet() { super.setLayout(new BorderLayout(1, 1)); getRootPane(); // Will do set/create. initStageDone = true; // Init stage is now over. }
public JApplet() { super.setLayout(new BorderLayout(1, 1)); getRootPane(); // Will do set/create. initStageDone = true; // Init stage is now over. }
8,899
protected void addImpl(Component comp, Object constraints, int index) { // If we're adding in the initialization stage use super.add. // Otherwise pass the add onto the content pane. if (!initStageDone) super.addImpl(comp, constraints, index); else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JApplet directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } }
protected void addImpl(Component comp, Object constraints, int index) { // If we're adding in the initialization stage use super.add. // Otherwise pass the add onto the content pane. if (!initStageDone) super.addImpl(comp, constraints, index); else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JApplet directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } }
8,900
protected void addImpl(Component comp, Object constraints, int index) { // If we're adding in the initialization stage use super.add. // Otherwise pass the add onto the content pane. if (!initStageDone) super.addImpl(comp, constraints, index); else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JApplet directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } }
protected void addImpl(Component comp, Object constraints, int index) { // If we're adding in the initialization stage use super.add. // Otherwise pass the add onto the content pane. if (!initStageDone) super.addImpl(comp, constraints, index); else { if (isRootPaneCheckingEnabled()) throw new Error("Do not use add() on JApplet directly. Use " + "getContentPane().add() instead"); getContentPane().add(comp, constraints, index); } }
8,901
public Component getGlassPane() { return getRootPane().getGlassPane(); }
public Component getGlassPane() { return getRootPane().getGlassPane(); }
8,902
public JRootPane getRootPane() { if (rootPane == null) setRootPane(createRootPane()); return rootPane; }
public JRootPane getRootPane() { if (rootPane == null) setRootPane(createRootPane()); return rootPane; }
8,903
protected boolean isRootPaneCheckingEnabled() { return rootPaneCheckingEnabled; }
protected boolean isRootPaneCheckingEnabled() { return rootPaneCheckingEnabled; }
8,904
protected String paramString() { return "JFrame"; }
protected String paramString() { return "JFrame"; }
8,905
protected void processKeyEvent(KeyEvent e) { super.processKeyEvent(e); }
protected void processKeyEvent(KeyEvent e) { super.processKeyEvent(e); }
8,906
public void remove(Component comp) { // If we're removing the root pane, use super.remove. Otherwise // pass it on to the content pane instead if (comp == rootPane) super.remove(rootPane); else getContentPane().remove(comp); }
public void remove(Component comp) { // If we're removing the root pane, use super.remove. Otherwise // pass it on to the content pane instead if (comp == rootPane) super.remove(rootPane); else getContentPane().remove(comp); }
8,907
public void setLayeredPane(JLayeredPane layeredPane) { getRootPane().setLayeredPane(layeredPane); }
public void setLayeredPane(JLayeredPane layeredPane) { getRootPane().setLayeredPane(layeredPane); }
8,908
public void setLayout(LayoutManager manager) { // Check if we're in initialization stage. If so, call super.setLayout // otherwise, valid calls go to the content pane if (initStageDone) { if (isRootPaneCheckingEnabled()) throw new Error("Cannot set layout. Use getContentPane().setLayout()" + "instead."); getContentPane().setLayout(manager); } else super.setLayout(manager); }
public void setLayout(LayoutManager manager) { // Check if we're in initialization stage. If so, call super.setLayout // otherwise, valid calls go to the content pane if (initStageDone) { if (isRootPaneCheckingEnabled()) throw new Error("Cannot set layout. Use getContentPane().setLayout()" + "instead."); getContentPane().setLayout(manager); } else super.setLayout(manager); }
8,909
public void setLayout(LayoutManager manager) { // Check if we're in initialization stage. If so, call super.setLayout // otherwise, valid calls go to the content pane if (initStageDone) { if (isRootPaneCheckingEnabled()) throw new Error("Cannot set layout. Use getContentPane().setLayout()" + "instead."); getContentPane().setLayout(manager); } else super.setLayout(manager); }
public void setLayout(LayoutManager manager) { // Check if we're in initialization stage. If so, call super.setLayout // otherwise, valid calls go to the content pane if (initStageDone) { if (isRootPaneCheckingEnabled()) throw new Error("Cannot set layout. Use getContentPane().setLayout()" + "instead."); getContentPane().setLayout(manager); } else super.setLayout(manager); }
8,910
protected void setRootPane(JRootPane root) { if (rootPane != null) remove(rootPane); rootPane = root; add(rootPane, BorderLayout.CENTER); }
protected void setRootPane(JRootPane root) { if (rootPane != null) remove(rootPane); rootPane = root; add(rootPane, BorderLayout.CENTER); }
8,911
protected void setRootPaneCheckingEnabled(boolean enabled) { rootPaneCheckingEnabled = enabled; }
protected void setRootPaneCheckingEnabled(boolean enabled) { rootPaneCheckingEnabled = enabled; }
8,912
public BasicPermission(String name) { super(name); if (name.indexOf("*") != -1) { if ((!name.endsWith(".*") && !name.equals("*")) || name.indexOf("*") != name.lastIndexOf("*")) throw new IllegalArgumentException("Bad wildcard: " + name); } if ("".equals(name)) throw new IllegalArgumentException("Empty name"); }
public BasicPermission(String name) { super(name); if (name.indexOf("*") != -1) { if ((!name.endsWith(".*") && !name.equals("*")) || name.indexOf("*") != name.lastIndexOf("*")) throw new IllegalArgumentException("Bad wildcard: " + name); } if ("".equals(name)) throw new IllegalArgumentException("Empty name"); }
8,913
public BasicPermission(String name) { super(name); if (name.indexOf("*") != -1) { if ((!name.endsWith(".*") && !name.equals("*")) || name.indexOf("*") != name.lastIndexOf("*")) throw new IllegalArgumentException("Bad wildcard: " + name); } if ("".equals(name)) throw new IllegalArgumentException("Empty name"); }
public BasicPermission(String name) { super(name); if (name.indexOf("*") != -1) { if ((!name.endsWith(".*") && !name.equals("*")) || name.indexOf("*") != name.lastIndexOf("*")) throw new IllegalArgumentException("Bad wildcard: " + name); } if ("".equals(name)) throw new IllegalArgumentException("Empty name"); }
8,914
public boolean equals(Object obj) { return getClass().isInstance(obj) && getName().equals(((BasicPermission) obj).getName()); }
public boolean equals(Object obj) { return getClass().isInstance(obj) && getName().equals(((BasicPermission) obj).getName()); }
8,915
public String getActions() { return ""; }
public String getActions() { return ""; }
8,916
public int hashCode() { return getName().hashCode(); }
public int hashCode() { return getName().hashCode(); }
8,917
public boolean implies(Permission perm) { if (!getClass().isInstance(perm)) return false; String otherName = perm.getName(); String name = getName(); if (name.equals(otherName)) return true; int last = name.length() - 1; return name.charAt(last) == '*' && otherName.startsWith(name.substring(0, last)); }
public boolean implies(Permission perm) { if (!getClass().isInstance(perm)) return false; String otherName = perm.getName(); String name = getName(); if (name.equals(otherName)) return true; int last = name.length() - 1; return name.charAt(last) == '*' && otherName.startsWith(name.substring(0, last)); }
8,918
public boolean implies(Permission perm) { if (!getClass().isInstance(perm)) return false; String otherName = perm.getName(); String name = getName(); if (name.equals(otherName)) return true; int last = name.length() - 1; return name.charAt(last) == '*' && otherName.startsWith(name.substring(0, last)); }
public boolean implies(Permission perm) { if (!getClass().isInstance(perm)) return false; String otherName = perm.getName(); String name = getName(); if (name.equals(otherName)) return true; int last = name.length() - 1; return name.charAt(last) == '*' && otherName.startsWith(name.substring(0, last)); }
8,919
public PermissionCollection newPermissionCollection() { return new BasicPermissionCollection(getClass()); }
public PermissionCollection newPermissionCollection() { return new BasicPermissionCollection(getClass()); }
8,920
BasicPermissionCollection(Class c) { permClass = c; }
BasicPermissionCollection(Class c) { permClass = c; }
8,921
public void add(Permission perm) { if (isReadOnly()) throw new SecurityException("readonly"); if (!permClass.isInstance(perm)) throw new IllegalArgumentException("Expecting instance of " + permClass); BasicPermission bp = (BasicPermission) perm; String name = bp.getName(); if (name.equals("*")) all_allowed = true; permissions.put(name, bp); }
public void add(Permission perm) { if (isReadOnly()) throw new SecurityException("readonly"); if (!permClass.isInstance(perm)) throw new IllegalArgumentException("Expecting instance of " + permClass); BasicPermission bp = (BasicPermission) perm; String name = bp.getName(); if (name.equals("*")) all_allowed = true; permissions.put(name, bp); }
8,922
public void add(Permission perm) { if (isReadOnly()) throw new SecurityException("readonly"); if (!permClass.isInstance(perm)) throw new IllegalArgumentException("Expecting instance of " + permClass); BasicPermission bp = (BasicPermission) perm; String name = bp.getName(); if (name.equals("*")) all_allowed = true; permissions.put(name, bp); }
public void add(Permission perm) { if (isReadOnly()) throw new SecurityException("readonly"); if (!permClass.isInstance(perm)) throw new IllegalArgumentException("Expecting instance of " + permClass); BasicPermission bp = (BasicPermission) perm; String name = bp.getName(); if (name.equals("*")) all_allowed = true; permissions.put(name, bp); }
8,923
public Enumeration elements() { return permissions.elements(); }
public Enumeration elements() { return permissions.elements(); }
8,924
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
8,925
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
8,926
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
8,927
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
8,928
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
public boolean implies(Permission permission) { if (!permClass.isInstance(permission)) return false; if (all_allowed) return true; BasicPermission toImply = (BasicPermission) permission; String name = toImply.getName(); if (name.equals("*")) return false; int prefixLength = name.length(); if (name.endsWith("*")) prefixLength -= 2; while (true) { if (permissions.get(name) != null) return true; prefixLength = name.lastIndexOf('.', prefixLength); if (prefixLength < 0) return false; name = name.substring(0, prefixLength + 1) + '*'; } }
8,929
public X86BytecodeVisitor(NativeStream outputStream, CompiledMethod cm, boolean isBootstrap, X86CompilerContext context) { this.os = (AbstractX86Stream) outputStream; this.context = context; this.vstack = new VirtualStack(os); final X86RegisterPool pool = new X86RegisterPool(); this.helper = new X86CompilerHelper(os, vstack.createStackMgr(pool), context, isBootstrap); this.cm = cm; this.slotSize = VmX86Architecture.SLOT_SIZE; this.arrayLengthOffset = VmArray.LENGTH_OFFSET * slotSize; this.arrayDataOffset = VmArray.DATA_OFFSET * slotSize; this.tibOffset = ObjectLayout.TIB_SLOT * slotSize; this.log = os.isLogEnabled(); this.eContext = new EmitterContext(os, helper, vstack, pool); }
public X86BytecodeVisitor(NativeStream outputStream, CompiledMethod cm, boolean isBootstrap, X86CompilerContext context) { this.os = (AbstractX86Stream) outputStream; this.context = context; this.vstack = new VirtualStack(os); final X86RegisterPool pool = new X86RegisterPool(); this.ifac = ItemFactory.getFactory(); this.helper = new X86CompilerHelper(os, vstack.createStackMgr(pool, ifac), context, isBootstrap); this.cm = cm; this.slotSize = VmX86Architecture.SLOT_SIZE; this.arrayLengthOffset = VmArray.LENGTH_OFFSET * slotSize; this.arrayDataOffset = VmArray.DATA_OFFSET * slotSize; this.tibOffset = ObjectLayout.TIB_SLOT * slotSize; this.log = os.isLogEnabled(); this.eContext = new EmitterContext(os, helper, vstack, pool); }
8,930
public X86BytecodeVisitor(NativeStream outputStream, CompiledMethod cm, boolean isBootstrap, X86CompilerContext context) { this.os = (AbstractX86Stream) outputStream; this.context = context; this.vstack = new VirtualStack(os); final X86RegisterPool pool = new X86RegisterPool(); this.helper = new X86CompilerHelper(os, vstack.createStackMgr(pool), context, isBootstrap); this.cm = cm; this.slotSize = VmX86Architecture.SLOT_SIZE; this.arrayLengthOffset = VmArray.LENGTH_OFFSET * slotSize; this.arrayDataOffset = VmArray.DATA_OFFSET * slotSize; this.tibOffset = ObjectLayout.TIB_SLOT * slotSize; this.log = os.isLogEnabled(); this.eContext = new EmitterContext(os, helper, vstack, pool); }
public X86BytecodeVisitor(NativeStream outputStream, CompiledMethod cm, boolean isBootstrap, X86CompilerContext context) { this.os = (AbstractX86Stream) outputStream; this.context = context; this.vstack = new VirtualStack(os); final X86RegisterPool pool = new X86RegisterPool(); this.helper = new X86CompilerHelper(os, vstack.createStackMgr(pool), context, isBootstrap); this.cm = cm; this.slotSize = VmX86Architecture.SLOT_SIZE; this.arrayLengthOffset = VmArray.LENGTH_OFFSET * slotSize; this.arrayDataOffset = VmArray.DATA_OFFSET * slotSize; this.tibOffset = ObjectLayout.TIB_SLOT * slotSize; this.log = os.isLogEnabled(); this.eContext = new EmitterContext(os, helper, vstack, pool, ifac); }
8,931
public void endInlinedMethod(VmMethod previousMethod) { helper.setMethod(previousMethod); os.setObjectRef(inlinedMethod.getEndOfInlineLabel()); this.currentMethod = previousMethod; inlinedMethod.pushExitStack(vstack); this.inlinedMethod = null; if (debug) { BootLog.debug("endInlinedMethod"); } }
public void endInlinedMethod(VmMethod previousMethod) { helper.setMethod(previousMethod); os.setObjectRef(inlinedMethod.getEndOfInlineLabel()); this.currentMethod = previousMethod; inlinedMethod.pushExitStack(ifac, vstack); this.inlinedMethod = null; if (debug) { BootLog.debug("endInlinedMethod"); } }
8,933
public void startBasicBlock(BasicBlock bb) { if (log) { os.log("Start of basic block " + bb); } if (debug) { BootLog.debug("-- Start of BB " + bb); } startOfBB = true; this.vstack.reset(); eContext.getPool().reset(os); // Push the result from the outer method stack on the vstack if (inlinedMethod != null) { inlinedMethod.pushOuterMethodStack(vstack); } // Push the items on the vstack the result from a previous basic block. final TypeStack tstack = bb.getStartStack(); vstack.pushAll(tstack); if (debug) { BootLog.debug("-- VStack: " + vstack.toString()); } }
public void startBasicBlock(BasicBlock bb) { if (log) { os.log("Start of basic block " + bb); } if (debug) { BootLog.debug("-- Start of BB " + bb); } startOfBB = true; this.vstack.reset(); eContext.getPool().reset(os); // Push the result from the outer method stack on the vstack if (inlinedMethod != null) { inlinedMethod.pushOuterMethodStack(ifac, vstack); } // Push the items on the vstack the result from a previous basic block. final TypeStack tstack = bb.getStartStack(); vstack.pushAll(tstack); if (debug) { BootLog.debug("-- VStack: " + vstack.toString()); } }
8,934
public void startBasicBlock(BasicBlock bb) { if (log) { os.log("Start of basic block " + bb); } if (debug) { BootLog.debug("-- Start of BB " + bb); } startOfBB = true; this.vstack.reset(); eContext.getPool().reset(os); // Push the result from the outer method stack on the vstack if (inlinedMethod != null) { inlinedMethod.pushOuterMethodStack(vstack); } // Push the items on the vstack the result from a previous basic block. final TypeStack tstack = bb.getStartStack(); vstack.pushAll(tstack); if (debug) { BootLog.debug("-- VStack: " + vstack.toString()); } }
public void startBasicBlock(BasicBlock bb) { if (log) { os.log("Start of basic block " + bb); } if (debug) { BootLog.debug("-- Start of BB " + bb); } startOfBB = true; this.vstack.reset(); eContext.getPool().reset(os); // Push the result from the outer method stack on the vstack if (inlinedMethod != null) { inlinedMethod.pushOuterMethodStack(vstack); } // Push the items on the vstack the result from a previous basic block. final TypeStack tstack = bb.getStartStack(); vstack.pushAll(ifac, tstack); if (debug) { BootLog.debug("-- VStack: " + vstack.toString()); } }
8,935
public final void visit_aconst_null() { vstack.push(RefItem.createConst(null)); }
public final void visit_aconst_null() { vstack.push(ifac.createAConst(null)); }
8,936
public final void visit_aload(int index) { vstack.push(RefItem.createLocal(stackFrame.getEbpOffset(index))); }
public final void visit_aload(int index) { vstack.push(ifac.createLocal(JvmType.REFERENCE, stackFrame.getEbpOffset(index))); }
8,937
public final void visit_daload() { final IntItem idx = vstack.popInt(); final RefItem ref = vstack.popRef(); idx.loadIf(eContext, ~Item.Kind.CONSTANT); ref.load(eContext); final Register refr = ref.getRegister(); checkBounds(ref, idx); FPUHelper.ensureStackCapacity(os, eContext, vstack, 1); if (idx.isConstant()) { final int offset = idx.getValue() * 8; os.writeFLD64(refr, offset + arrayDataOffset); } else { final Register idxr = idx.getRegister(); os.writeFLD64(refr, idxr, 8, arrayDataOffset); } // Release ref.release(eContext); idx.release(eContext); // Push result final Item result = DoubleItem.createFPUStack(); vstack.fpuStack.push(result); vstack.push(result); }
public final void visit_daload() { final IntItem idx = vstack.popInt(); final RefItem ref = vstack.popRef(); idx.loadIf(eContext, ~Item.Kind.CONSTANT); ref.load(eContext); final Register refr = ref.getRegister(); checkBounds(ref, idx); FPUHelper.ensureStackCapacity(os, eContext, vstack, 1); if (idx.isConstant()) { final int offset = idx.getValue() * 8; os.writeFLD64(refr, offset + arrayDataOffset); } else { final Register idxr = idx.getRegister(); os.writeFLD64(refr, idxr, 8, arrayDataOffset); } // Release ref.release(eContext); idx.release(eContext); // Push result final Item result = ifac.createFPUStack(JvmType.DOUBLE); vstack.fpuStack.push(result); vstack.push(result); }
8,939
public final void visit_dconst(double value) { vstack.push(DoubleItem.createConst(value)); }
public final void visit_dconst(double value) { vstack.push(ifac.createDConst(value)); }
8,940
public final void visit_dload(int index) { vstack.push(DoubleItem.createLocal(stackFrame.getWideEbpOffset(index))); }
public final void visit_dload(int index) { vstack.push(ifac.createLocal(JvmType.DOUBLE, stackFrame.getWideEbpOffset(index))); }
8,941
public final void visit_fconst(float value) { vstack.push(FloatItem.createConst(value)); }
public final void visit_fconst(float value) { vstack.push(ifac.createFConst(value)); }
8,942
public final void visit_fload(int index) { vstack.push(FloatItem.createLocal(stackFrame.getEbpOffset(index))); }
public final void visit_fload(int index) { vstack.push(ifac.createLocal(JvmType.FLOAT, stackFrame.getEbpOffset(index))); }
8,943
public final void visit_getfield(VmConstFieldRef fieldRef) { fieldRef.resolve(loader); final VmField field = fieldRef.getResolvedVmField(); if (field.isStatic()) { throw new IncompatibleClassChangeError( "getfield called on static field " + fieldRef.getName()); } final VmInstanceField inf = (VmInstanceField) field; final int fieldOffset = inf.getOffset(); final int type = JvmType.SignatureToType(fieldRef.getSignature()); final boolean isfloat = JvmType.isFloat(type); // Pop & load final RefItem ref = vstack.popRef(); ref.load(eContext); final Register refr = ref.getRegister(); // get field final Item result; if (!fieldRef.isWide()) { if (isfloat) { result = FloatItem.createFPUStack(); os.writeFLD32(refr, fieldOffset); vstack.fpuStack.push(result); } else { final WordItem iw = L1AHelper.requestWordRegister(eContext, type, false); os.writeMOV(INTSIZE, iw.getRegister(), refr, fieldOffset); result = iw; } } else { if (isfloat) { result = DoubleItem.createFPUStack(); os.writeFLD64(refr, fieldOffset); vstack.fpuStack.push(result); } else { final DoubleWordItem idw = L1AHelper .requestDoubleWordRegisters(eContext, type); final Register lsb = idw.getLsbRegister(); final Register msb = idw.getMsbRegister(); os.writeMOV(INTSIZE, lsb, refr, fieldOffset + LSB); os.writeMOV(INTSIZE, msb, refr, fieldOffset + MSB); result = idw; } } // Release ref.release(eContext); // Push result vstack.push(result); }
public final void visit_getfield(VmConstFieldRef fieldRef) { fieldRef.resolve(loader); final VmField field = fieldRef.getResolvedVmField(); if (field.isStatic()) { throw new IncompatibleClassChangeError( "getfield called on static field " + fieldRef.getName()); } final VmInstanceField inf = (VmInstanceField) field; final int fieldOffset = inf.getOffset(); final int type = JvmType.SignatureToType(fieldRef.getSignature()); final boolean isfloat = JvmType.isFloat(type); // Pop & load final RefItem ref = vstack.popRef(); ref.load(eContext); final Register refr = ref.getRegister(); // get field final Item result; if (!fieldRef.isWide()) { if (isfloat) { result = ifac.createFPUStack(JvmType.FLOAT); os.writeFLD32(refr, fieldOffset); vstack.fpuStack.push(result); } else { final WordItem iw = L1AHelper.requestWordRegister(eContext, type, false); os.writeMOV(INTSIZE, iw.getRegister(), refr, fieldOffset); result = iw; } } else { if (isfloat) { result = DoubleItem.createFPUStack(); os.writeFLD64(refr, fieldOffset); vstack.fpuStack.push(result); } else { final DoubleWordItem idw = L1AHelper .requestDoubleWordRegisters(eContext, type); final Register lsb = idw.getLsbRegister(); final Register msb = idw.getMsbRegister(); os.writeMOV(INTSIZE, lsb, refr, fieldOffset + LSB); os.writeMOV(INTSIZE, msb, refr, fieldOffset + MSB); result = idw; } } // Release ref.release(eContext); // Push result vstack.push(result); }
8,944
public final void visit_getfield(VmConstFieldRef fieldRef) { fieldRef.resolve(loader); final VmField field = fieldRef.getResolvedVmField(); if (field.isStatic()) { throw new IncompatibleClassChangeError( "getfield called on static field " + fieldRef.getName()); } final VmInstanceField inf = (VmInstanceField) field; final int fieldOffset = inf.getOffset(); final int type = JvmType.SignatureToType(fieldRef.getSignature()); final boolean isfloat = JvmType.isFloat(type); // Pop & load final RefItem ref = vstack.popRef(); ref.load(eContext); final Register refr = ref.getRegister(); // get field final Item result; if (!fieldRef.isWide()) { if (isfloat) { result = FloatItem.createFPUStack(); os.writeFLD32(refr, fieldOffset); vstack.fpuStack.push(result); } else { final WordItem iw = L1AHelper.requestWordRegister(eContext, type, false); os.writeMOV(INTSIZE, iw.getRegister(), refr, fieldOffset); result = iw; } } else { if (isfloat) { result = DoubleItem.createFPUStack(); os.writeFLD64(refr, fieldOffset); vstack.fpuStack.push(result); } else { final DoubleWordItem idw = L1AHelper .requestDoubleWordRegisters(eContext, type); final Register lsb = idw.getLsbRegister(); final Register msb = idw.getMsbRegister(); os.writeMOV(INTSIZE, lsb, refr, fieldOffset + LSB); os.writeMOV(INTSIZE, msb, refr, fieldOffset + MSB); result = idw; } } // Release ref.release(eContext); // Push result vstack.push(result); }
public final void visit_getfield(VmConstFieldRef fieldRef) { fieldRef.resolve(loader); final VmField field = fieldRef.getResolvedVmField(); if (field.isStatic()) { throw new IncompatibleClassChangeError( "getfield called on static field " + fieldRef.getName()); } final VmInstanceField inf = (VmInstanceField) field; final int fieldOffset = inf.getOffset(); final int type = JvmType.SignatureToType(fieldRef.getSignature()); final boolean isfloat = JvmType.isFloat(type); // Pop & load final RefItem ref = vstack.popRef(); ref.load(eContext); final Register refr = ref.getRegister(); // get field final Item result; if (!fieldRef.isWide()) { if (isfloat) { result = FloatItem.createFPUStack(); os.writeFLD32(refr, fieldOffset); vstack.fpuStack.push(result); } else { final WordItem iw = L1AHelper.requestWordRegister(eContext, type, false); os.writeMOV(INTSIZE, iw.getRegister(), refr, fieldOffset); result = iw; } } else { if (isfloat) { result = ifac.createFPUStack(JvmType.DOUBLE); os.writeFLD64(refr, fieldOffset); vstack.fpuStack.push(result); } else { final DoubleWordItem idw = L1AHelper .requestDoubleWordRegisters(eContext, type); final Register lsb = idw.getLsbRegister(); final Register msb = idw.getMsbRegister(); os.writeMOV(INTSIZE, lsb, refr, fieldOffset + LSB); os.writeMOV(INTSIZE, msb, refr, fieldOffset + MSB); result = idw; } } // Release ref.release(eContext); // Push result vstack.push(result); }
8,945
public final void visit_getstatic(VmConstFieldRef fieldRef) { fieldRef.resolve(loader); final int type = JvmType.SignatureToType(fieldRef.getSignature()); final VmStaticField sf = (VmStaticField) fieldRef.getResolvedVmField(); // Initialize if needed if (!sf.getDeclaringClass().isInitialized()) { final X86RegisterPool pool = eContext.getPool(); final Register tmp = L1AHelper.requestRegister(eContext, JvmType.INT, false); writeInitializeClass(fieldRef, tmp); pool.release(tmp); } // Get static field object if (JvmType.isFloat(type)) { final boolean is32bit = !fieldRef.isWide(); helper.writeGetStaticsEntryToFPU(curInstrLabel, sf, is32bit); final Item result = FPUHelper.createFPUStack(type); vstack.fpuStack.push(result); vstack.push(result); } else if (!fieldRef.isWide()) { final WordItem result = L1AHelper.requestWordRegister(eContext, type, false); final Register resultr = result.getRegister(); helper.writeGetStaticsEntry(curInstrLabel, resultr, sf); vstack.push(result); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters( eContext, type); final Register lsb = result.getLsbRegister(); final Register msb = result.getMsbRegister(); helper.writeGetStaticsEntry64(curInstrLabel, lsb, msb, sf); vstack.push(result); } }
public final void visit_getstatic(VmConstFieldRef fieldRef) { fieldRef.resolve(loader); final int type = JvmType.SignatureToType(fieldRef.getSignature()); final VmStaticField sf = (VmStaticField) fieldRef.getResolvedVmField(); // Initialize if needed if (!sf.getDeclaringClass().isInitialized()) { final X86RegisterPool pool = eContext.getPool(); final Register tmp = L1AHelper.requestRegister(eContext, JvmType.INT, false); writeInitializeClass(fieldRef, tmp); pool.release(tmp); } // Get static field object if (JvmType.isFloat(type)) { final boolean is32bit = !fieldRef.isWide(); helper.writeGetStaticsEntryToFPU(curInstrLabel, sf, is32bit); final Item result = ifac.createFPUStack(type); vstack.fpuStack.push(result); vstack.push(result); } else if (!fieldRef.isWide()) { final WordItem result = L1AHelper.requestWordRegister(eContext, type, false); final Register resultr = result.getRegister(); helper.writeGetStaticsEntry(curInstrLabel, resultr, sf); vstack.push(result); } else { final DoubleWordItem result = L1AHelper.requestDoubleWordRegisters( eContext, type); final Register lsb = result.getLsbRegister(); final Register msb = result.getMsbRegister(); helper.writeGetStaticsEntry64(curInstrLabel, lsb, msb, sf); vstack.push(result); } }
8,946
public final void visit_i2b() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(IntItem.createConst((byte) v.getValue())); } else { v.loadToBITS8GPR(eContext); final Register r = v.getRegister(); os.writeMOVSX(r, r, BYTESIZE); vstack.push(v); } }
public final void visit_i2b() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(ifac.createIConst((byte) v.getValue())); } else { v.loadToBITS8GPR(eContext); final Register r = v.getRegister(); os.writeMOVSX(r, r, BYTESIZE); vstack.push(v); } }
8,947
public final void visit_i2c() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(IntItem.createConst((char) v.getValue())); } else { v.load(eContext); final Register r = v.getRegister(); os.writeMOVZX(r, r, WORDSIZE); vstack.push(v); } }
public final void visit_i2c() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(ifac.createIConst((char) v.getValue())); } else { v.load(eContext); final Register r = v.getRegister(); os.writeMOVZX(r, r, WORDSIZE); vstack.push(v); } }
8,948
public final void visit_i2l() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(LongItem.createConst(v.getValue())); } else { final X86RegisterPool pool = eContext.getPool(); L1AHelper.requestRegister(eContext, EAX); L1AHelper.requestRegister(eContext, EDX); v.loadTo(eContext, EAX); final LongItem result = LongItem.createReg(EAX, EDX); os.writeCDQ(); /* Sign extend EAX -> EDX:EAX */ pool.transferOwnerTo(EAX, result); pool.transferOwnerTo(EDX, result); // We do not release v, because its register (EAX) is re-used in // result // Push result vstack.push(result); } }
public final void visit_i2l() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(ifac.createLConst(v.getValue())); } else { final X86RegisterPool pool = eContext.getPool(); L1AHelper.requestRegister(eContext, EAX); L1AHelper.requestRegister(eContext, EDX); v.loadTo(eContext, EAX); final LongItem result = LongItem.createReg(EAX, EDX); os.writeCDQ(); /* Sign extend EAX -> EDX:EAX */ pool.transferOwnerTo(EAX, result); pool.transferOwnerTo(EDX, result); // We do not release v, because its register (EAX) is re-used in // result // Push result vstack.push(result); } }
8,949
public final void visit_i2l() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(LongItem.createConst(v.getValue())); } else { final X86RegisterPool pool = eContext.getPool(); L1AHelper.requestRegister(eContext, EAX); L1AHelper.requestRegister(eContext, EDX); v.loadTo(eContext, EAX); final LongItem result = LongItem.createReg(EAX, EDX); os.writeCDQ(); /* Sign extend EAX -> EDX:EAX */ pool.transferOwnerTo(EAX, result); pool.transferOwnerTo(EDX, result); // We do not release v, because its register (EAX) is re-used in // result // Push result vstack.push(result); } }
public final void visit_i2l() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(LongItem.createConst(v.getValue())); } else { final X86RegisterPool pool = eContext.getPool(); L1AHelper.requestRegister(eContext, EAX); L1AHelper.requestRegister(eContext, EDX); v.loadTo(eContext, EAX); final LongItem result = (LongItem)ifac.createReg(JvmType.LONG, EAX, EDX); os.writeCDQ(); /* Sign extend EAX -> EDX:EAX */ pool.transferOwnerTo(EAX, result); pool.transferOwnerTo(EDX, result); // We do not release v, because its register (EAX) is re-used in // result // Push result vstack.push(result); } }
8,950
public final void visit_i2s() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(IntItem.createConst((short) v.getValue())); } else { v.load(eContext); final Register r = v.getRegister(); os.writeMOVSX(r, r, WORDSIZE); vstack.push(v); } }
public final void visit_i2s() { final IntItem v = vstack.popInt(); if (v.isConstant()) { vstack.push(ifac.createIConst((short) v.getValue())); } else { v.load(eContext); final Register r = v.getRegister(); os.writeMOVSX(r, r, WORDSIZE); vstack.push(v); } }
8,951
public final void visit_iconst(int value) { vstack.push(IntItem.createConst(value)); }
public final void visit_iconst(int value) { vstack.push(ifac.createIConst(value)); }
8,952
public final void visit_iload(int index) { vstack.push(IntItem.createLocal(stackFrame.getEbpOffset(index))); }
public final void visit_iload(int index) { vstack.push(ifac.createLocal(JvmType.INT, stackFrame.getEbpOffset(index))); }
8,953
public final void visit_ineg() { final IntItem val = vstack.popInt(); val.loadIf(eContext, ~Item.Kind.CONSTANT); if (val.isConstant()) { vstack.push(IntItem.createConst(-val.getValue())); } else { os.writeNEG(val.getRegister()); vstack.push(val); } }
public final void visit_ineg() { final IntItem val = vstack.popInt(); val.loadIf(eContext, ~Item.Kind.CONSTANT); if (val.isConstant()) { vstack.push(ifac.createIConst(-val.getValue())); } else { os.writeNEG(val.getRegister()); vstack.push(val); } }
8,954
public final void visit_instanceof(VmConstClass classRef) { // Prepare final X86RegisterPool pool = eContext.getPool(); // Pre-claim ECX L1AHelper.requestRegister(eContext, ECX); // Load reference final RefItem ref = vstack.popRef(); ref.load(eContext); final Register refr = ref.getRegister(); // Allocate tmp registers final Register classr = L1AHelper.requestRegister(eContext, JvmType.INT, false); final Register tmpr = L1AHelper.requestRegister(eContext, JvmType.INT, false); /* Objectref is already on the stack */ writeResolveAndLoadClassToReg(classRef, classr); final Label trueLabel = new Label(this.curInstrLabel + "io-true"); final Label endLabel = new Label(this.curInstrLabel + "io-end"); /* Is instanceof? */ instanceOf(refr, classr, tmpr, trueLabel, false); /* Not instanceof */ //TODO: use setcc instead of jumps os.writeXOR(refr, refr); os.writeJMP(endLabel); os.setObjectRef(trueLabel); os.writeMOV_Const(refr, 1); // Push result os.setObjectRef(endLabel); final IntItem result = IntItem.createReg(refr); pool.transferOwnerTo(refr, result); vstack.push(result); // Release pool.release(classr); pool.release(tmpr); pool.release(ECX); }
public final void visit_instanceof(VmConstClass classRef) { // Prepare final X86RegisterPool pool = eContext.getPool(); // Pre-claim ECX L1AHelper.requestRegister(eContext, ECX); // Load reference final RefItem ref = vstack.popRef(); ref.load(eContext); final Register refr = ref.getRegister(); // Allocate tmp registers final Register classr = L1AHelper.requestRegister(eContext, JvmType.INT, false); final Register tmpr = L1AHelper.requestRegister(eContext, JvmType.INT, false); /* Objectref is already on the stack */ writeResolveAndLoadClassToReg(classRef, classr); final Label trueLabel = new Label(this.curInstrLabel + "io-true"); final Label endLabel = new Label(this.curInstrLabel + "io-end"); /* Is instanceof? */ instanceOf(refr, classr, tmpr, trueLabel, false); /* Not instanceof */ //TODO: use setcc instead of jumps os.writeXOR(refr, refr); os.writeJMP(endLabel); os.setObjectRef(trueLabel); os.writeMOV_Const(refr, 1); // Push result os.setObjectRef(endLabel); final IntItem result = (IntItem)ifac.createReg(JvmType.INT, refr); pool.transferOwnerTo(refr, result); vstack.push(result); // Release pool.release(classr); pool.release(tmpr); pool.release(ECX); }
8,955
public final void visit_irem() { // Pre-claim result in EDX L1AHelper.requestRegister(eContext, EDX); final IntItem result = IntItem.createReg(EDX); eContext.getPool().transferOwnerTo(EDX, result); final IntItem v2 = vstack.popInt(); final IntItem v1 = vstack.popInt(); // v1 must be in EAX L1AHelper.requestRegister(eContext, EAX, v1); // Load v2.loadIf(eContext, ~Item.Kind.LOCAL); v1.loadTo(eContext, EAX); // Calculate os.writeCDQ(); // EAX -> EDX:EAX if (v2.isLocal()) { os.writeIDIV_EAX(FP, v2.getOffsetToFP()); } else { os.writeIDIV_EAX(v2.getRegister()); } // Result vstack.push(result); // Release v1.release(eContext); v2.release(eContext); }
public final void visit_irem() { // Pre-claim result in EDX L1AHelper.requestRegister(eContext, EDX); final IntItem result = (IntItem)ifac.createReg(JvmType.INT, EDX); eContext.getPool().transferOwnerTo(EDX, result); final IntItem v2 = vstack.popInt(); final IntItem v1 = vstack.popInt(); // v1 must be in EAX L1AHelper.requestRegister(eContext, EAX, v1); // Load v2.loadIf(eContext, ~Item.Kind.LOCAL); v1.loadTo(eContext, EAX); // Calculate os.writeCDQ(); // EAX -> EDX:EAX if (v2.isLocal()) { os.writeIDIV_EAX(FP, v2.getOffsetToFP()); } else { os.writeIDIV_EAX(v2.getRegister()); } // Result vstack.push(result); // Release v1.release(eContext); v2.release(eContext); }
8,956
public final void visit_l2i() { final LongItem v = vstack.popLong(); if (v.isConstant()) { vstack.push(IntItem.createConst((int) v.getValue())); } else { final X86RegisterPool pool = eContext.getPool(); v.load(eContext); final Register lsb = v.getLsbRegister(); v.release(eContext); pool.request(lsb); final IntItem result = IntItem.createReg(lsb); pool.transferOwnerTo(lsb, result); vstack.push(result); } }
public final void visit_l2i() { final LongItem v = vstack.popLong(); if (v.isConstant()) { vstack.push(ifac.createIConst((int) v.getValue())); } else { final X86RegisterPool pool = eContext.getPool(); v.load(eContext); final Register lsb = v.getLsbRegister(); v.release(eContext); pool.request(lsb); final IntItem result = IntItem.createReg(lsb); pool.transferOwnerTo(lsb, result); vstack.push(result); } }
8,957
public final void visit_l2i() { final LongItem v = vstack.popLong(); if (v.isConstant()) { vstack.push(IntItem.createConst((int) v.getValue())); } else { final X86RegisterPool pool = eContext.getPool(); v.load(eContext); final Register lsb = v.getLsbRegister(); v.release(eContext); pool.request(lsb); final IntItem result = IntItem.createReg(lsb); pool.transferOwnerTo(lsb, result); vstack.push(result); } }
public final void visit_l2i() { final LongItem v = vstack.popLong(); if (v.isConstant()) { vstack.push(IntItem.createConst((int) v.getValue())); } else { final X86RegisterPool pool = eContext.getPool(); v.load(eContext); final Register lsb = v.getLsbRegister(); v.release(eContext); pool.request(lsb); final IntItem result = (IntItem)ifac.createReg(JvmType.INT, lsb); pool.transferOwnerTo(lsb, result); vstack.push(result); } }
8,958
public final void visit_lconst(long v) { vstack.push(LongItem.createConst(v)); }
public final void visit_lconst(long v) { vstack.push(ifac.createLConst(v)); }
8,959
public final void visit_lload(int index) { vstack.push(LongItem.createLocal(stackFrame.getWideEbpOffset(index))); }
public final void visit_lload(int index) { vstack.push(ifac.createLocal(JvmType.LONG, stackFrame.getWideEbpOffset(index))); }
8,960
public final void visit_lneg() { final LongItem v = vstack.popLong(); if (v.isConstant()) { vstack.push(LongItem.createConst(-v.getValue())); } else { // Load val v.load(eContext); final Register lsb = v.getLsbRegister(); final Register msb = v.getMsbRegister(); // Calculate os.writeNEG(msb); // msb := -msb os.writeNEG(lsb); // lsb := -lsb os.writeSBB(msb, 0); // high += borrow // Push vstack.push(v); } }
public final void visit_lneg() { final LongItem v = vstack.popLong(); if (v.isConstant()) { vstack.push(ifac.createLConst(-v.getValue())); } else { // Load val v.load(eContext); final Register lsb = v.getLsbRegister(); final Register msb = v.getMsbRegister(); // Calculate os.writeNEG(msb); // msb := -msb os.writeNEG(lsb); // lsb := -lsb os.writeSBB(msb, 0); // high += borrow // Push vstack.push(v); } }
8,961
public final void visit_lshr() { final IntItem cnt = vstack.popInt(); final LongItem val = vstack.popLong(); final X86RegisterPool pool = eContext.getPool(); // Get cnt into ECX if (!cnt.uses(ECX)) { val.spillIfUsing(eContext, ECX); L1AHelper.requestRegister(eContext, ECX, cnt); cnt.loadTo(eContext, ECX); } // Load val val.load(eContext); final Register lsb = val.getLsbRegister(); final Register msb = val.getMsbRegister(); // Calculate os.writeAND(ECX, 63); os.writeCMP_Const(ECX, 32); final Label gt32Label = new Label(curInstrLabel + "gt32"); final Label endLabel = new Label(curInstrLabel + "end"); os.writeJCC(gt32Label, X86Constants.JAE); // JAE /** ECX < 32 */ os.writeSHRD_CL(lsb, msb); os.writeSAR_CL(msb); os.writeJMP(endLabel); /** ECX >= 32 */ os.setObjectRef(gt32Label); os.writeMOV(INTSIZE, lsb, msb); os.writeSAR(msb, 31); os.writeSAR_CL(lsb); os.setObjectRef(endLabel); // Push final LongItem result = LongItem.createReg(lsb, msb); pool.transferOwnerTo(lsb, result); pool.transferOwnerTo(msb, result); vstack.push(result); // Release cnt.release(eContext); }
public final void visit_lshr() { final IntItem cnt = vstack.popInt(); final LongItem val = vstack.popLong(); final X86RegisterPool pool = eContext.getPool(); // Get cnt into ECX if (!cnt.uses(ECX)) { val.spillIfUsing(eContext, ECX); L1AHelper.requestRegister(eContext, ECX, cnt); cnt.loadTo(eContext, ECX); } // Load val val.load(eContext); final Register lsb = val.getLsbRegister(); final Register msb = val.getMsbRegister(); // Calculate os.writeAND(ECX, 63); os.writeCMP_Const(ECX, 32); final Label gt32Label = new Label(curInstrLabel + "gt32"); final Label endLabel = new Label(curInstrLabel + "end"); os.writeJCC(gt32Label, X86Constants.JAE); // JAE /** ECX < 32 */ os.writeSHRD_CL(lsb, msb); os.writeSAR_CL(msb); os.writeJMP(endLabel); /** ECX >= 32 */ os.setObjectRef(gt32Label); os.writeMOV(INTSIZE, lsb, msb); os.writeSAR(msb, 31); os.writeSAR_CL(lsb); os.setObjectRef(endLabel); // Push final LongItem result = (LongItem)ifac.createReg(JvmType.LONG, lsb, msb); pool.transferOwnerTo(lsb, result); pool.transferOwnerTo(msb, result); vstack.push(result); // Release cnt.release(eContext); }
8,962
public final void visit_lushr() { final IntItem cnt = vstack.popInt(); final LongItem val = vstack.popLong(); final X86RegisterPool pool = eContext.getPool(); // Get cnt into ECX if (!cnt.uses(ECX)) { val.spillIfUsing(eContext, ECX); L1AHelper.requestRegister(eContext, ECX, cnt); cnt.loadTo(eContext, ECX); } // Load val val.load(eContext); final Register lsb = val.getLsbRegister(); final Register msb = val.getMsbRegister(); // Calculate os.writeAND(ECX, 63); os.writeCMP_Const(ECX, 32); final Label gt32Label = new Label(curInstrLabel + "gt32"); final Label endLabel = new Label(curInstrLabel + "end"); os.writeJCC(gt32Label, X86Constants.JAE); // JAE /** ECX < 32 */ os.writeSHRD_CL(lsb, msb); os.writeSHR_CL(msb); os.writeJMP(endLabel); /** ECX >= 32 */ os.setObjectRef(gt32Label); os.writeMOV(INTSIZE, lsb, msb); os.writeXOR(msb, msb); os.writeSHR_CL(lsb); os.setObjectRef(endLabel); // Push final LongItem result = LongItem.createReg(lsb, msb); pool.transferOwnerTo(lsb, result); pool.transferOwnerTo(msb, result); vstack.push(result); // Release cnt.release(eContext); }
public final void visit_lushr() { final IntItem cnt = vstack.popInt(); final LongItem val = vstack.popLong(); final X86RegisterPool pool = eContext.getPool(); // Get cnt into ECX if (!cnt.uses(ECX)) { val.spillIfUsing(eContext, ECX); L1AHelper.requestRegister(eContext, ECX, cnt); cnt.loadTo(eContext, ECX); } // Load val val.load(eContext); final Register lsb = val.getLsbRegister(); final Register msb = val.getMsbRegister(); // Calculate os.writeAND(ECX, 63); os.writeCMP_Const(ECX, 32); final Label gt32Label = new Label(curInstrLabel + "gt32"); final Label endLabel = new Label(curInstrLabel + "end"); os.writeJCC(gt32Label, X86Constants.JAE); // JAE /** ECX < 32 */ os.writeSHRD_CL(lsb, msb); os.writeSHR_CL(msb); os.writeJMP(endLabel); /** ECX >= 32 */ os.setObjectRef(gt32Label); os.writeMOV(INTSIZE, lsb, msb); os.writeXOR(msb, msb); os.writeSHR_CL(lsb); os.setObjectRef(endLabel); // Push final LongItem result = (LongItem)ifac.createReg(JvmType.LONG, lsb, msb); pool.transferOwnerTo(lsb, result); pool.transferOwnerTo(msb, result); vstack.push(result); // Release cnt.release(eContext); }
8,963
public final void visit_multianewarray(VmConstClass clazz, int dimensions) { // flush all vstack items to the stack // all registers are freed vstack.push(eContext); // Create the dimensions array os.writePUSH(10); /* type=int */ os.writePUSH(dimensions); /* elements */ invokeJavaMethod(context.getAllocPrimitiveArrayMethod()); final RefItem dims = vstack.popRef(); final Register dimsr = dims.getRegister(); // Dimension array is now in dimsr // Pop all dimensions (note the reverse order that allocMultiArray // expects) for (int i = 0; i < dimensions; i++) { final int ofs = arrayDataOffset + (i * slotSize); final IntItem v = vstack.popInt(); v.release1(eContext); os.writePOP(dimsr, ofs); } // Allocate tmp register final Register classr = L1AHelper.requestRegister(eContext, JvmType.REFERENCE, false); // Resolve the array class writeResolveAndLoadClassToReg(clazz, classr); // Release dims, because invokeJavaMethod needs EAX dims.release(eContext); // Now call the multianewarrayhelper os.writePUSH(classr); // array-class os.writePUSH(dimsr); // dimensions[] invokeJavaMethod(context.getAllocMultiArrayMethod()); // Result is now on the vstack // Release L1AHelper.releaseRegister(eContext, classr); }
public final void visit_multianewarray(VmConstClass clazz, int dimensions) { // flush all vstack items to the stack // all registers are freed vstack.push(eContext); // Create the dimensions array os.writePUSH(10); /* type=int */ os.writePUSH(dimensions); /* elements */ invokeJavaMethod(context.getAllocPrimitiveArrayMethod()); final RefItem dims = vstack.popRef(); final Register dimsr = dims.getRegister(); // Dimension array is now in dimsr // Pop all dimensions (note the reverse order that allocMultiArray // expects) for (int i = 0; i < dimensions; i++) { final int ofs = arrayDataOffset + (i * 4); final IntItem v = vstack.popInt(); v.release1(eContext); os.writePOP(dimsr, ofs); } // Allocate tmp register final Register classr = L1AHelper.requestRegister(eContext, JvmType.REFERENCE, false); // Resolve the array class writeResolveAndLoadClassToReg(clazz, classr); // Release dims, because invokeJavaMethod needs EAX dims.release(eContext); // Now call the multianewarrayhelper os.writePUSH(classr); // array-class os.writePUSH(dimsr); // dimensions[] invokeJavaMethod(context.getAllocMultiArrayMethod()); // Result is now on the vstack // Release L1AHelper.releaseRegister(eContext, classr); }
8,964
private final void waload(int jvmType) { final IntItem idx = vstack.popInt(); final RefItem ref = vstack.popRef(); final int valSize; final int scale; final int resultType; final boolean isfloat = (jvmType == JvmType.FLOAT); switch (jvmType) { case JvmType.BYTE: valSize = BYTESIZE; scale = 1; resultType = JvmType.INT; break; case JvmType.CHAR: case JvmType.SHORT: valSize = WORDSIZE; scale = 2; resultType = JvmType.INT; break; case JvmType.INT: valSize = INTSIZE; scale = 4; resultType = JvmType.INT; break; case JvmType.FLOAT: valSize = INTSIZE; scale = 4; resultType = JvmType.FLOAT; break; case JvmType.REFERENCE: valSize = INTSIZE; scale = 4; resultType = JvmType.REFERENCE; break; default: throw new IllegalArgumentException("Invalid type " + jvmType); } // Create result final WordItem result; final Register resultr; if (isfloat) { result = FloatItem.createFPUStack(); resultr = null; } else { result = L1AHelper.requestWordRegister(eContext, resultType, (valSize == BYTESIZE)); resultr = result.getRegister(); } // Load idx.loadIf(eContext, ~Item.Kind.CONSTANT); ref.load(eContext); final Register refr = ref.getRegister(); // Verify checkBounds(ref, idx); if (isfloat) { FPUHelper.ensureStackCapacity(os, eContext, vstack, 1); } // Load data if (idx.isConstant()) { final int offset = idx.getValue() * scale; if (isfloat) { os.writeFLD32(refr, offset + arrayDataOffset); } else { os.writeMOV(valSize, resultr, refr, offset + arrayDataOffset); } } else { final Register idxr = idx.getRegister(); if (isfloat) { os.writeFLD32(refr, idxr, scale, arrayDataOffset); } else { os.writeMOV(valSize, resultr, refr, idxr, scale, arrayDataOffset); } } // Post process switch (jvmType) { case JvmType.BYTE: os.writeMOVSX(resultr, resultr, BYTESIZE); break; case JvmType.CHAR: os.writeMOVZX(resultr, resultr, WORDSIZE); break; case JvmType.SHORT: os.writeMOVSX(resultr, resultr, WORDSIZE); break; } // Release ref.release(eContext); idx.release(eContext); // Push result vstack.push(result); if (isfloat) { vstack.fpuStack.push(result); } }
private final void waload(int jvmType) { final IntItem idx = vstack.popInt(); final RefItem ref = vstack.popRef(); final int valSize; final int scale; final int resultType; final boolean isfloat = (jvmType == JvmType.FLOAT); switch (jvmType) { case JvmType.BYTE: valSize = BYTESIZE; scale = 1; resultType = JvmType.INT; break; case JvmType.CHAR: case JvmType.SHORT: valSize = WORDSIZE; scale = 2; resultType = JvmType.INT; break; case JvmType.INT: valSize = INTSIZE; scale = 4; resultType = JvmType.INT; break; case JvmType.FLOAT: valSize = INTSIZE; scale = 4; resultType = JvmType.FLOAT; break; case JvmType.REFERENCE: valSize = INTSIZE; scale = 4; resultType = JvmType.REFERENCE; break; default: throw new IllegalArgumentException("Invalid type " + jvmType); } // Create result final WordItem result; final Register resultr; if (isfloat) { result = (WordItem)ifac.createFPUStack(JvmType.FLOAT); resultr = null; } else { result = L1AHelper.requestWordRegister(eContext, resultType, (valSize == BYTESIZE)); resultr = result.getRegister(); } // Load idx.loadIf(eContext, ~Item.Kind.CONSTANT); ref.load(eContext); final Register refr = ref.getRegister(); // Verify checkBounds(ref, idx); if (isfloat) { FPUHelper.ensureStackCapacity(os, eContext, vstack, 1); } // Load data if (idx.isConstant()) { final int offset = idx.getValue() * scale; if (isfloat) { os.writeFLD32(refr, offset + arrayDataOffset); } else { os.writeMOV(valSize, resultr, refr, offset + arrayDataOffset); } } else { final Register idxr = idx.getRegister(); if (isfloat) { os.writeFLD32(refr, idxr, scale, arrayDataOffset); } else { os.writeMOV(valSize, resultr, refr, idxr, scale, arrayDataOffset); } } // Post process switch (jvmType) { case JvmType.BYTE: os.writeMOVSX(resultr, resultr, BYTESIZE); break; case JvmType.CHAR: os.writeMOVZX(resultr, resultr, WORDSIZE); break; case JvmType.SHORT: os.writeMOVSX(resultr, resultr, WORDSIZE); break; } // Release ref.release(eContext); idx.release(eContext); // Push result vstack.push(result); if (isfloat) { vstack.fpuStack.push(result); } }
8,965
public BasicBlock(int startPC) { this(startPC, -1, false); }
public BasicBlock(int startPC) { this(startPC, -1, false); }
8,966
public Rectangle2D getBounds2D() { // XXX Implement. throw new Error("not implemented"); }
public Rectangle2D getBounds2D() { // XXX Implement. if (solids.size() == 0) return new Rectangle2D.Double(0.0, 0.0, 0.0, 0.0); double xmin; double xmax; double ymin; double ymax; xmin = xmax = ((Segment) solids.elementAt(0)).P1.getX(); ymin = ymax = ((Segment) solids.elementAt(0)).P1.getY(); for (int path = 0; path < solids.size(); path++) { Rectangle2D r = ((Segment) solids.elementAt(path)).getPathBounds(); xmin = Math.min(r.getMinX(), xmin); ymin = Math.min(r.getMinY(), ymin); xmax = Math.max(r.getMaxX(), xmax); ymax = Math.max(r.getMaxY(), ymax); }
8,967
public KeyConfigure(Frame parent, String[] macros, CodePage cp) { super(parent); codePage = cp; macrosList = macros; if (OperatingSystem.isUnix() && !OperatingSystem.isMacOS()) {// if (System.getProperty("os.name").toLowerCase().indexOf("linux") != -1) {// System.out.println("using os " + os); isLinux = true; } try { jbInit(); pack(); } catch(Exception ex) { ex.printStackTrace(); } }
public KeyConfigure(Frame parent, String[] macros, CodePage cp) {super(parent);codePage = cp;macrosList = macros;if (OperatingSystem.isUnix() && !OperatingSystem.isMacOS()) {//if (System.getProperty("os.name").toLowerCase().indexOf("linux") != -1) {// System.out.println("using os " + os); isLinux = true;}try { jbInit(); pack();}catch(Exception ex) { ex.printStackTrace();} }
8,969
void jbInit() throws Exception { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); mapper = new KeyMapper(); mapper.init(); functions = new JList(lm); // add list selection listener to our functions list so that we // can display the mapped key(s) to the function when a new // function is selected. functions.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { setKeyDescription(functions.getSelectedIndex()); } } }); loadList(LangTool.getString("key.labelKeys")); functions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane functionsScroll = new JScrollPane(functions); JPanel fp = new JPanel(); JComboBox whichKeys = new JComboBox(); whichKeys.addItem(LangTool.getString("key.labelKeys")); whichKeys.addItem(LangTool.getString("key.labelMacros")); whichKeys.addItem(LangTool.getString("key.labelSpecial")); whichKeys.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); loadList((String)cb.getSelectedItem()); } }); fp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelDesc"))); fp.setLayout(new BoxLayout(fp,BoxLayout.Y_AXIS)); fp.add(whichKeys); fp.add(functionsScroll); strokeDesc.setColumns(30); strokeDesc.setBackground(functions.getBackground()); strokeDesc.setEditable(false); strokeDescAlt.setColumns(30); strokeDescAlt.setBackground(functions.getBackground()); strokeDescAlt.setEditable(false); JPanel dp = new JPanel(); dp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelMapTo"))); dp.setLayout(new BoxLayout(dp,BoxLayout.Y_AXIS)); JPanel primeKeyPanel = new JPanel(); primeKeyPanel.add(strokeDesc); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Prime", primeKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Prime", primeKeyPanel,true); JPanel altKeyPanel = new JPanel(); altKeyPanel.add(strokeDescAlt); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Alt", altKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Alt", altKeyPanel,true); dp.add(primeKeyPanel); dp.add(altKeyPanel); keyPanel.setLayout(borderLayout); keyPanel.add(fp,BorderLayout.WEST); keyPanel.add(dp,BorderLayout.CENTER); // add the panels to our dialog getContentPane().add(keyPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // add option buttons to options panel// addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP",options,true);// addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE",options,true); addOptButton(LangTool.getString("key.labelDone","Done"),"DONE",options,true); this.setModal(true); this.setTitle(LangTool.getString("key.title")); // pack it and center it on the screen pack(); 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); // now show the world what we can do show(); }
void jbInit() throws Exception { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); mapper = new KeyMapper(); mapper.init(); functions = new JList(lm); // add list selection listener to our functions list so that we // can display the mapped key(s) to the function when a new // function is selected. functions.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { setKeyDescription(functions.getSelectedIndex()); } } }); loadList(LangTool.getString("key.labelKeys")); functions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane functionsScroll = new JScrollPane(functions); JPanel fp = new JPanel(); JComboBox whichKeys = new JComboBox(); whichKeys.addItem(LangTool.getString("key.labelKeys")); whichKeys.addItem(LangTool.getString("key.labelMacros")); whichKeys.addItem(LangTool.getString("key.labelSpecial")); whichKeys.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); loadList((String)cb.getSelectedItem()); } }); fp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelDesc"))); fp.setLayout(new BoxLayout(fp,BoxLayout.Y_AXIS)); fp.add(whichKeys); fp.add(functionsScroll); strokeDesc.setColumns(30); strokeDesc.setBackground(functions.getBackground()); strokeDesc.setEditable(false); strokeDescAlt.setColumns(30); strokeDescAlt.setBackground(functions.getBackground()); strokeDescAlt.setEditable(false); JPanel dp = new JPanel(); dp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelMapTo"))); dp.setLayout(new BoxLayout(dp,BoxLayout.Y_AXIS)); JPanel primeKeyPanel = new JPanel(); primeKeyPanel.add(strokeDesc); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Prime", primeKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Prime", primeKeyPanel,true); JPanel altKeyPanel = new JPanel(); altKeyPanel.add(strokeDescAlt); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Alt", altKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Alt", altKeyPanel,true); dp.add(primeKeyPanel); dp.add(altKeyPanel); keyPanel.setLayout(borderLayout); keyPanel.add(fp,BorderLayout.WEST); keyPanel.add(dp,BorderLayout.CENTER); // add the panels to our dialog getContentPane().add(keyPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // add option buttons to options panel// addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP",options,true);// addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE",options,true); addOptButton(LangTool.getString("key.labelDone","Done"),"DONE",options,true); this.setModal(true); this.setTitle(LangTool.getString("key.title")); // pack it and center it on the screen pack(); 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); // now show the world what we can do show(); }
8,970
void jbInit() throws Exception { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); mapper = new KeyMapper(); mapper.init(); functions = new JList(lm); // add list selection listener to our functions list so that we // can display the mapped key(s) to the function when a new // function is selected. functions.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { setKeyDescription(functions.getSelectedIndex()); } } }); loadList(LangTool.getString("key.labelKeys")); functions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane functionsScroll = new JScrollPane(functions); JPanel fp = new JPanel(); JComboBox whichKeys = new JComboBox(); whichKeys.addItem(LangTool.getString("key.labelKeys")); whichKeys.addItem(LangTool.getString("key.labelMacros")); whichKeys.addItem(LangTool.getString("key.labelSpecial")); whichKeys.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); loadList((String)cb.getSelectedItem()); } }); fp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelDesc"))); fp.setLayout(new BoxLayout(fp,BoxLayout.Y_AXIS)); fp.add(whichKeys); fp.add(functionsScroll); strokeDesc.setColumns(30); strokeDesc.setBackground(functions.getBackground()); strokeDesc.setEditable(false); strokeDescAlt.setColumns(30); strokeDescAlt.setBackground(functions.getBackground()); strokeDescAlt.setEditable(false); JPanel dp = new JPanel(); dp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelMapTo"))); dp.setLayout(new BoxLayout(dp,BoxLayout.Y_AXIS)); JPanel primeKeyPanel = new JPanel(); primeKeyPanel.add(strokeDesc); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Prime", primeKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Prime", primeKeyPanel,true); JPanel altKeyPanel = new JPanel(); altKeyPanel.add(strokeDescAlt); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Alt", altKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Alt", altKeyPanel,true); dp.add(primeKeyPanel); dp.add(altKeyPanel); keyPanel.setLayout(borderLayout); keyPanel.add(fp,BorderLayout.WEST); keyPanel.add(dp,BorderLayout.CENTER); // add the panels to our dialog getContentPane().add(keyPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // add option buttons to options panel// addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP",options,true);// addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE",options,true); addOptButton(LangTool.getString("key.labelDone","Done"),"DONE",options,true); this.setModal(true); this.setTitle(LangTool.getString("key.title")); // pack it and center it on the screen pack(); 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); // now show the world what we can do show(); }
void jbInit() throws Exception { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); mapper = new KeyMapper(); mapper.init(); functions = new JList(lm); // add list selection listener to our functions list so that we // can display the mapped key(s) to the function when a new // function is selected. functions.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { setKeyDescription(functions.getSelectedIndex()); } } }); loadList(LangTool.getString("key.labelKeys")); functions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane functionsScroll = new JScrollPane(functions); JPanel fp = new JPanel(); JComboBox whichKeys = new JComboBox(); whichKeys.addItem(LangTool.getString("key.labelKeys")); whichKeys.addItem(LangTool.getString("key.labelMacros")); whichKeys.addItem(LangTool.getString("key.labelSpecial")); whichKeys.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); loadList((String)cb.getSelectedItem()); } }); fp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelDesc"))); fp.setLayout(new BoxLayout(fp,BoxLayout.Y_AXIS)); fp.add(whichKeys); fp.add(functionsScroll); strokeDesc.setColumns(30); strokeDesc.setBackground(functions.getBackground()); strokeDesc.setEditable(false); strokeDescAlt.setColumns(30); strokeDescAlt.setBackground(functions.getBackground()); strokeDescAlt.setEditable(false); JPanel dp = new JPanel(); dp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelMapTo"))); dp.setLayout(new BoxLayout(dp,BoxLayout.Y_AXIS)); JPanel primeKeyPanel = new JPanel(); primeKeyPanel.add(strokeDesc); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Prime", primeKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Prime", primeKeyPanel,true); JPanel altKeyPanel = new JPanel(); altKeyPanel.add(strokeDescAlt); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Alt", altKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Alt", altKeyPanel,true); dp.add(primeKeyPanel); dp.add(altKeyPanel); keyPanel.setLayout(borderLayout); keyPanel.add(fp,BorderLayout.WEST); keyPanel.add(dp,BorderLayout.CENTER); // add the panels to our dialog getContentPane().add(keyPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // add option buttons to options panel// addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP",options,true);// addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE",options,true); addOptButton(LangTool.getString("key.labelDone","Done"),"DONE",options,true); this.setModal(true); this.setTitle(LangTool.getString("key.title")); // pack it and center it on the screen pack(); 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); // now show the world what we can do show(); }
8,971
void jbInit() throws Exception { // create some reusable borders and layouts BorderLayout borderLayout = new BorderLayout(); mapper = new KeyMapper(); mapper.init(); functions = new JList(lm); // add list selection listener to our functions list so that we // can display the mapped key(s) to the function when a new // function is selected. functions.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent lse) { if (!lse.getValueIsAdjusting()) { setKeyDescription(functions.getSelectedIndex()); } } }); loadList(LangTool.getString("key.labelKeys")); functions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane functionsScroll = new JScrollPane(functions); JPanel fp = new JPanel(); JComboBox whichKeys = new JComboBox(); whichKeys.addItem(LangTool.getString("key.labelKeys")); whichKeys.addItem(LangTool.getString("key.labelMacros")); whichKeys.addItem(LangTool.getString("key.labelSpecial")); whichKeys.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JComboBox cb = (JComboBox)e.getSource(); loadList((String)cb.getSelectedItem()); } }); fp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelDesc"))); fp.setLayout(new BoxLayout(fp,BoxLayout.Y_AXIS)); fp.add(whichKeys); fp.add(functionsScroll); strokeDesc.setColumns(30); strokeDesc.setBackground(functions.getBackground()); strokeDesc.setEditable(false); strokeDescAlt.setColumns(30); strokeDescAlt.setBackground(functions.getBackground()); strokeDescAlt.setEditable(false); JPanel dp = new JPanel(); dp.setBorder(BorderFactory.createTitledBorder( LangTool.getString("key.labelMapTo"))); dp.setLayout(new BoxLayout(dp,BoxLayout.Y_AXIS)); JPanel primeKeyPanel = new JPanel(); primeKeyPanel.add(strokeDesc); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Prime", primeKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Prime", primeKeyPanel,true); JPanel altKeyPanel = new JPanel(); altKeyPanel.add(strokeDescAlt); addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Alt", altKeyPanel,true); addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Alt", altKeyPanel,true); dp.add(primeKeyPanel); dp.add(altKeyPanel); keyPanel.setLayout(borderLayout); keyPanel.add(fp,BorderLayout.WEST); keyPanel.add(dp,BorderLayout.CENTER); // add the panels to our dialog getContentPane().add(keyPanel,BorderLayout.CENTER); getContentPane().add(options, BorderLayout.SOUTH); // add option buttons to options panel// addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP",options,true);// addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE",options,true); addOptButton(LangTool.getString("key.labelDone","Done"),"DONE",options,true); this.setModal(true); this.setTitle(LangTool.getString("key.title")); // pack it and center it on the screen pack(); 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); // now show the world what we can do show(); }
void jbInit() throws Exception {// create some reusable borders and layoutsBorderLayout borderLayout = new BorderLayout();mapper = new KeyMapper();mapper.init();functions = new JList(lm);// add list selection listener to our functions list so that we// can display the mapped key(s) to the function when a new// function is selected.functions.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent lse) {if (!lse.getValueIsAdjusting()) { setKeyDescription(functions.getSelectedIndex());} }});loadList(LangTool.getString("key.labelKeys"));functions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);JScrollPane functionsScroll = new JScrollPane(functions);JPanel fp = new JPanel();JComboBox whichKeys = new JComboBox();whichKeys.addItem(LangTool.getString("key.labelKeys"));whichKeys.addItem(LangTool.getString("key.labelMacros"));whichKeys.addItem(LangTool.getString("key.labelSpecial"));whichKeys.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e) {JComboBox cb = (JComboBox)e.getSource();loadList((String)cb.getSelectedItem());}});fp.setBorder(BorderFactory.createTitledBorder(LangTool.getString("key.labelDesc")));fp.setLayout(new BoxLayout(fp,BoxLayout.Y_AXIS));fp.add(whichKeys);fp.add(functionsScroll);strokeDesc.setColumns(30);strokeDesc.setBackground(functions.getBackground());strokeDesc.setEditable(false);strokeDescAlt.setColumns(30);strokeDescAlt.setBackground(functions.getBackground());strokeDescAlt.setEditable(false);JPanel dp = new JPanel();dp.setBorder(BorderFactory.createTitledBorder(LangTool.getString("key.labelMapTo")));dp.setLayout(new BoxLayout(dp,BoxLayout.Y_AXIS));JPanel primeKeyPanel = new JPanel();primeKeyPanel.add(strokeDesc);addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Prime", primeKeyPanel,true);addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Prime", primeKeyPanel,true);JPanel altKeyPanel = new JPanel();altKeyPanel.add(strokeDescAlt);addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP-Alt", altKeyPanel,true);addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE-Alt", altKeyPanel,true);dp.add(primeKeyPanel);dp.add(altKeyPanel);keyPanel.setLayout(borderLayout);keyPanel.add(fp,BorderLayout.WEST);keyPanel.add(dp,BorderLayout.CENTER);// add the panels to our dialoggetContentPane().add(keyPanel,BorderLayout.CENTER);getContentPane().add(options, BorderLayout.SOUTH);// add option buttons to options panel//addOptButton(LangTool.getString("key.labelMap","Map Key"),"MAP",options,true);//addOptButton(LangTool.getString("key.labelRemove","Remove"),"REMOVE",options,true);addOptButton(LangTool.getString("key.labelDone","Done"),"DONE",options,true);this.setModal(true);this.setTitle(LangTool.getString("key.title"));// pack it and center it on the screenpack();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);// now show the world what we can doshow(); }
8,972
private void mapIt() { Object[] message = new Object[1]; JPanel kgp = new JPanel(); final KeyGetter kg = new KeyGetter(); kg.setForeground(Color.blue); message[0] = kgp; String function; if (functions.getSelectedValue() instanceof String) function = (String)functions.getSelectedValue(); else if (functions.getSelectedValue() instanceof Macro) { function = ((Macro)functions.getSelectedValue()).toString(); } else function = ((KeyDescription)functions.getSelectedValue()).toString(); kg.setText(LangTool.getString("key.labelMessage") + function); kgp.add(kg); String[] options = new String[1]; options[0] = LangTool.getString("key.labelClose"); JOptionPane opain = new JOptionPane(message, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, // option type null, options, options[0]); dialog = opain.createDialog(this, getTitle()); // add window listener to the dialog so that we can place focus on the // key getter label instead of default and set the new key value when // the window is closed. dialog.addWindowListener(new WindowAdapter() { boolean gotFocus = false; public void windowClosed(WindowEvent we) { setNewKeyStrokes(kg.keyevent); } public void windowActivated(WindowEvent we) { // Once window gets focus, set initial focus to our KeyGetter // component if (!gotFocus) { kg.grabFocus(); gotFocus = true; } } }); dialog.setVisible(true); }
private void mapIt() { Object[] message = new Object[1]; JPanel kgp = new JPanel(); final KeyGetterInterface kg = getMeAKeyProcessor(); kg.setForeground(Color.blue); message[0] = kgp; String function; if (functions.getSelectedValue() instanceof String) function = (String)functions.getSelectedValue(); else if (functions.getSelectedValue() instanceof Macro) { function = ((Macro)functions.getSelectedValue()).toString(); } else function = ((KeyDescription)functions.getSelectedValue()).toString(); kg.setText(LangTool.getString("key.labelMessage") + function); kgp.add(kg); String[] options = new String[1]; options[0] = LangTool.getString("key.labelClose"); JOptionPane opain = new JOptionPane(message, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, // option type null, options, options[0]); dialog = opain.createDialog(this, getTitle()); // add window listener to the dialog so that we can place focus on the // key getter label instead of default and set the new key value when // the window is closed. dialog.addWindowListener(new WindowAdapter() { boolean gotFocus = false; public void windowClosed(WindowEvent we) { setNewKeyStrokes(kg.keyevent); } public void windowActivated(WindowEvent we) { // Once window gets focus, set initial focus to our KeyGetter // component if (!gotFocus) { kg.grabFocus(); gotFocus = true; } } }); dialog.setVisible(true); }
8,973
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); mapper.removeKeyStroke(mnemonicData[index]); strokeDesc.setText(mapper.getKeyStrokeDesc( mnemonicData[index])); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } mapper.removeKeyStroke(name); strokeDesc.setText(mapper.getKeyStrokeDesc( name)); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); mapper.removeKeyStroke(k); strokeDesc.setText(mapper.getKeyStrokeDesc( (String)functions.getSelectedValue())); } } mods = true; }
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); mapper.removeKeyStroke(mnemonicData[index]); strokeDesc.setText(mapper.getKeyStrokeDesc( mnemonicData[index])); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } mapper.removeKeyStroke(name); strokeDesc.setText(mapper.getKeyStrokeDesc( name)); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); mapper.removeKeyStroke(k); strokeDesc.setText(mapper.getKeyStrokeDesc( (String)functions.getSelectedValue())); } } mods = true; }
8,975
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); mapper.removeKeyStroke(mnemonicData[index]); strokeDesc.setText(mapper.getKeyStrokeDesc( mnemonicData[index])); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } mapper.removeKeyStroke(name); strokeDesc.setText(mapper.getKeyStrokeDesc( name)); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); mapper.removeKeyStroke(k); strokeDesc.setText(mapper.getKeyStrokeDesc( (String)functions.getSelectedValue())); } } mods = true; }
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); mapper.removeKeyStroke(mnemonicData[index]); strokeDesc.setText(mapper.getKeyStrokeDesc( mnemonicData[index])); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } mapper.removeKeyStroke(name); strokeDesc.setText(mapper.getKeyStrokeDesc( name)); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); mapper.removeKeyStroke(k); strokeDesc.setText(mapper.getKeyStrokeDesc( (String)functions.getSelectedValue())); } } mods = true; }
8,976
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); mapper.removeKeyStroke(mnemonicData[index]); strokeDesc.setText(mapper.getKeyStrokeDesc( mnemonicData[index])); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } mapper.removeKeyStroke(name); strokeDesc.setText(mapper.getKeyStrokeDesc( name)); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); mapper.removeKeyStroke(k); strokeDesc.setText(mapper.getKeyStrokeDesc( (String)functions.getSelectedValue())); } } mods = true; }
private void removeIt() { if (!macros && !special) { int index = ((KeyDescription)functions.getSelectedValue()).getIndex(); mapper.removeKeyStroke(mnemonicData[index]); strokeDesc.setText(mapper.getKeyStrokeDesc( mnemonicData[index])); } else { if (macros) { Object o = functions.getSelectedValue(); String name; if (o instanceof Macro) { name = ((Macro)o).getFullName(); } else { name = (String)o; } mapper.removeKeyStroke(name); strokeDesc.setText(mapper.getKeyStrokeDesc( name)); } if (special) { String k = ""; k += ((String)functions.getSelectedValue()).charAt(7); mapper.removeKeyStroke(k); strokeDesc.setText(mapper.getKeyStrokeDesc( (String)functions.getSelectedValue())); } } mods = true; }
8,977
private void setKeyDescription(int index) { // This try and catch is to fix a problem in JDK1.4-betas try { if (!macros && !special) { KeyDescription kd = (KeyDescription)lm.getElementAt(index); strokeDesc.setText(mapper.getKeyStrokeDesc(mnemonicData[kd.getIndex()])); strokeDescAlt.setText(mapper.getKeyStrokeDesc(mnemonicData[kd.getIndex()] + ".alt2")); } else { if (macros) { Object o = lm.getElementAt(index); if (o instanceof String) { System.out.println((String)o); strokeDesc.setText(mapper.getKeyStrokeDesc((String)o)); strokeDescAlt.setText(mapper.getKeyStrokeDesc((String)o + ".alt2")); } else if (o instanceof Macro) { Macro m = (Macro)o; strokeDesc.setText(mapper.getKeyStrokeDesc(m.getFullName())); strokeDescAlt.setText(mapper.getKeyStrokeDesc(m.getFullName() + ".alt2")); } } if (special) { System.out.println((String)lm.getElementAt(index)); String k = parseSpecialCharacter((String)lm.getElementAt(index)); strokeDesc.setText(mapper.getKeyStrokeDesc(k)); } } } catch (ArrayIndexOutOfBoundsException ar) { System.out.println("ar at index " + index + " - " + ar.getMessage()); } }
private void setKeyDescription(int index) { // This try and catch is to fix a problem in JDK1.4-betas try { if (!macros && !special) { KeyDescription kd = (KeyDescription)lm.getElementAt(index); strokeDesc.setText(mapper.getKeyStrokeDesc(mnemonicData[kd.getIndex()])); strokeDescAlt.setText(mapper.getKeyStrokeDesc(mnemonicData[kd.getIndex()] + ".alt2")); } else { if (macros) { Object o = lm.getElementAt(index); if (o instanceof String) { System.out.println((String)o); strokeDesc.setText(mapper.getKeyStrokeDesc((String)o)); strokeDescAlt.setText(mapper.getKeyStrokeDesc((String)o + ".alt2")); } else if (o instanceof Macro) { Macro m = (Macro)o; strokeDesc.setText(mapper.getKeyStrokeDesc(m.getFullName())); strokeDescAlt.setText(mapper.getKeyStrokeDesc(m.getFullName() + ".alt2")); } } if (special) { System.out.println((String)lm.getElementAt(index)); String k = parseSpecialCharacter((String)lm.getElementAt(index)); strokeDesc.setText(mapper.getKeyStrokeDesc(k)); } } } catch (ArrayIndexOutOfBoundsException ar) { System.out.println("ar at index " + index + " - " + ar.getMessage()); } }
8,978