public Frame appendFrame(Frame frame) { frameCount++; frame.timeline = this; frame.frameNumber = frameCount; frames.put(new Integer(frameCount), frame); return frame; }
private static void enter_section_impl_( PsiBuilder builder, int level, int modifiers, @Nullable String frameName) { ErrorState state = ErrorState.get(builder); Frame frame = state.FRAMES.alloc().init(builder, state, level, modifiers, frameName); Frame prevFrame = state.frameStack.peekLast(); if (prevFrame != null && prevFrame.errorReportedAt > frame.position) { // report error for previous unsuccessful frame reportError(builder, state, frame, null, true, false); } if (((frame.modifiers & _LEFT_) | (frame.modifiers & _LEFT_INNER_)) != 0) { PsiBuilder.Marker left = (PsiBuilder.Marker) builder.getLatestDoneMarker(); if (invalid_left_marker_guard_(builder, left, frameName)) { frame.leftMarker = left; } } state.frameStack.add(frame); if ((modifiers & _AND_) != 0) { if (state.predicateCount == 0 && !state.predicateSign) { throw new AssertionError("Incorrect false predicate sign"); } state.predicateCount++; } else if ((modifiers & _NOT_) != 0) { if (state.predicateCount == 0) { state.predicateSign = false; } else { state.predicateSign = !state.predicateSign; } state.predicateCount++; } }
public void mouseClicked(MouseEvent ev) { Window w = (Window) ev.getSource(); Frame f = null; if (w instanceof Frame) { f = (Frame) w; } else { return; } Point convertedPoint = SwingUtilities.convertPoint(w, ev.getPoint(), getTitlePane()); int state = f.getExtendedState(); if (getTitlePane() != null && getTitlePane().contains(convertedPoint)) { if ((ev.getClickCount() % 2) == 0 && ((ev.getModifiers() & InputEvent.BUTTON1_MASK) != 0)) { if (f.isResizable()) { if ((state & Frame.MAXIMIZED_BOTH) != 0) { f.setExtendedState(state & ~Frame.MAXIMIZED_BOTH); } else { f.setExtendedState(state | Frame.MAXIMIZED_BOTH); } return; } } } }
public void beginExecution() { if (cam == null) { int numBuffers = 2; env = GraphicsEnvironment.getLocalGraphicsEnvironment(); device = env.getDefaultScreenDevice(); // MultiBufferTest test = new MultiBufferTest(numBuffers, device); try { GraphicsConfiguration gc = device.getDefaultConfiguration(); mainFrame = new Frame(gc); mainFrame.setUndecorated(true); mainFrame.setIgnoreRepaint(true); device.setFullScreenWindow(mainFrame); if (device.isDisplayChangeSupported()) { chooseBestDisplayMode(device); } mainFrame.createBufferStrategy(numBuffers); bufferStrategy = mainFrame.getBufferStrategy(); } catch (Exception e) { e.printStackTrace(); } } }
public static BufferedImage getCardImage(IRenderableCard cardDef) { File cropFile = MagicFileSystem.getCroppedCardImageFile(cardDef); if (cropFile.exists()) { if (cardDef.isPlaneswalker()) { BufferedImage crop = GraphicsUtils.scale(ImageFileIO.toImg(cropFile, MagicImages.MISSING_CARD), 320, 234); if (OracleText.getPlaneswalkerAbilityCount(cardDef) == 3) { BufferedImage blend = ResourceManager.newFrame(ResourceManager.getPlaneswalkerImageBlend); return Frame.getBlendedFrame( new BufferedImage(320, 234, BufferedImage.TYPE_INT_ARGB), blend, crop); } else { BufferedImage cropSmall = crop.getSubimage(0, 0, 320, 201); BufferedImage blend = GraphicsUtils.scale( ResourceManager.newFrame(ResourceManager.getPlaneswalkerImageBlend), 320, 201); return Frame.getBlendedFrame( new BufferedImage(320, 210, BufferedImage.TYPE_INT_ARGB), blend, cropSmall); } } else { BufferedImage image = ImageFileIO.toImg(cropFile, MagicImages.MISSING_CARD); return GraphicsUtils.scale(image, 316, 231); } } if (cardDef.isPlaneswalker()) { return buildPlaneswalkerImage(cardDef); } return buildDefaultImage(cardDef); }
public void launchCalc() { f.add(tf, BorderLayout.NORTH); p2 = new Panel(); p2.setLayout(new GridLayout(4, 5)); p2.add(b1); p2.add(b2); p2.add(b3); p2.add(b18); p2.add(b10); p2.add(b6); p2.add(b7); p2.add(b8); p2.add(b19); p2.add(b4); p2.add(b11); p2.add(b12); p2.add(b13); p2.add(b14); p2.add(b9); p2.add(b16); p2.add(b17); p2.add(b20); p2.add(b15); p2.add(b5); f.add(p2, BorderLayout.CENTER); f.pack(); f.setSize(250, 200); f.setVisible(true); }
/** * Creates a new connection to the specified host of specified type. <br> * <br> * type: Type of connection to create <br> * destination: Host to connect to (in "host:port" or "host" syntax) */ public Connection(java.net.InetAddress host, int port, PluginContext ctx) throws MessagingNetworkException, java.io.IOException { if (TRAKTOR_USED) { if (traktorConnectionDown) throw new IOException("network is down"); traktor = new Frame("" + host + ":" + port + " - Traktor"); final Checkbox c = new Checkbox("break this & ALL future connections"); c.setState(traktorConnectionDown); c.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { traktorConnectionDown = c.getState(); try { if (traktorConnectionDown) closeSocket(); } catch (Exception ex) { } } }); traktor.add(c); traktor.setSize(100, 50); traktor.setLocation(230, 450); traktor.setVisible(true); } else { traktor = null; } }
private void merge(final int insn, final Frame frame, final Subroutine subroutine) throws AnalyzerException { Frame oldFrame = frames[insn]; Subroutine oldSubroutine = subroutines[insn]; boolean changes; if (oldFrame == null) { frames[insn] = newFrame(frame); changes = true; } else { changes = oldFrame.merge(frame, interpreter); } if (oldSubroutine == null) { if (subroutine != null) { subroutines[insn] = subroutine.copy(); changes = true; } } else { if (subroutine != null) { changes |= oldSubroutine.merge(subroutine); } } if (changes && !queued[insn]) { queued[insn] = true; queue[top++] = insn; } }
private void merge( final int insn, final Frame beforeJSR, final Frame afterRET, final Subroutine subroutineBeforeJSR, final boolean[] access) throws AnalyzerException { Frame oldFrame = frames[insn]; Subroutine oldSubroutine = subroutines[insn]; boolean changes; afterRET.merge(beforeJSR, access); if (oldFrame == null) { frames[insn] = newFrame(afterRET); changes = true; } else { changes = oldFrame.merge(afterRET, access); } if (oldSubroutine != null && subroutineBeforeJSR != null) { changes |= oldSubroutine.merge(subroutineBeforeJSR); } if (changes && !queued[insn]) { queued[insn] = true; queue[top++] = insn; } }
public static void main(String[] args) { Frame f = new Frame(); f.setSize(200, 100); Label lb = new Label("Hello World!!"); f.add(lb); f.setVisible(true); }
public Animation(ArrayList<Frame> frames, int frameDelay) { this(frames); for (Frame frame : frames) { frame.setDuration(frameDelay); } this.frameDelay = frameDelay; }
public void addClient() { client = new Canvas() { public void paint(Graphics g) { super.paint(g); } }; client.setBackground(new Color(30, 220, 40)); clientCont.add(client); clientCont.validate(); final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); WindowIDProvider pid = (WindowIDProvider) acc.getPeer(client); log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow()); Rectangle toFocusBounds = toFocus.getBounds(); toFocusBounds.setLocation(toFocus.getLocationOnScreen()); f.validate(); // KDE doesn't accept clicks on title as activation - click below title Rectangle fbounds = f.getBounds(); fbounds.y += f.getInsets().top; fbounds.height -= f.getInsets().top; Process proc = startClient( new Rectangle[] { fbounds, dummy.getBounds(), toFocusBounds, new Rectangle(b_modal.getLocationOnScreen(), b_modal.getSize()), new Rectangle(10, 130, 20, 20) }, pid.getWindow()); new ClientWatcher(client, proc, clientCont).start(); }
public static void main(String[] args) { for (int i = 0; i < 100; i++) { Frame f = new Frame(); f.pack(); f.dispose(); } Vector garbage = new Vector(); while (true) { try { garbage.add(new byte[1000]); } catch (OutOfMemoryError e) { break; } } garbage = null; Vector<WeakReference<Window>> windowList = (Vector<WeakReference<Window>>) AppContext.getAppContext().get(Window.class); if (windowList != null && !windowList.isEmpty()) { throw new RuntimeException("Test FAILED: Window list is not empty: " + windowList.size()); } System.out.println("Test PASSED"); }
/** Tests the computation of the absolute position. */ @Test public void getAbsolutePosition() { double u = Math.PI / 180d; Layout layout = new Layout(null); Page page = new Page(PageFormat.defaultValue); layout.addPage(page); GroupFrame frame = createFrameWithChildren(); page.addFrame(frame); // frame Point2f p = frame.getAbsolutePosition(); assertEquals(50, p.x, Delta.DELTA_FLOAT); assertEquals(75, p.y, Delta.DELTA_FLOAT); // child frame GroupFrame child = (GroupFrame) frame.children.get(0); p = child.getAbsolutePosition(); float r = 30; double childX = 50 + 20 * Math.cos(r * u) + 10 * Math.sin(r * u); double childY = 75 - 20 * Math.sin(r * u) + 10 * Math.cos(r * u); assertEquals(childX, p.x, Delta.DELTA_FLOAT_ROUGH); assertEquals(childY, p.y, Delta.DELTA_FLOAT_ROUGH); // child frame of child frame Frame child2 = child.children.get(0); p = child2.getAbsolutePosition(); r += 30; assertEquals( childX + -15 * Math.cos(r * u) + -10 * Math.sin(r * u), p.x, Delta.DELTA_FLOAT_ROUGH); assertEquals( childY - -15 * Math.sin(r * u) + -10 * Math.cos(r * u), p.y, Delta.DELTA_FLOAT_ROUGH); }
public static void main(String[] args) { try { if (args.length != 1) throw new IllegalArgumentException("Wrong number of arguments"); FileReader in = new FileReader(args[0]); HardcopyWriter out = null; Frame f = new Frame("PrintFile: " + args[0]); f.setSize(200, 50); f.show(); try { out = new HardcopyWriter(f, args[0], 10, .75, .75, .75, .75); } catch (HardcopyWriter.PrintCanceledException e) { System.exit(0); } f.setVisible(false); char[] buffer = new char[4096]; int numchars; while ((numchars = in.read(buffer)) != -1) out.write(buffer, 0, numchars); out.close(); } catch (Exception e) { System.err.println(e); System.err.println("Usage: java HardcopyWriter$PrintFile <filename>"); System.exit(1); } System.exit(0); }
public int computeScoreOfGame(Frame[] frames) { int scoreOfGame = 0; for (Frame frame : frames) { scoreOfGame += frame.getScore(); } return scoreOfGame; }
@Override public void actionPerformed(ActionEvent e) { Frame frame = getFrame(); JFileChooser chooser = new JFileChooser(); int ret = chooser.showOpenDialog(frame); if (ret != JFileChooser.APPROVE_OPTION) { return; } File f = chooser.getSelectedFile(); if (f.isFile() && f.canRead()) { Document oldDoc = getEditor().getDocument(); if (oldDoc != null) { oldDoc.removeUndoableEditListener(undoHandler); } if (elementTreePanel != null) { elementTreePanel.setEditor(null); } getEditor().setDocument(new PlainDocument()); frame.setTitle(f.getName()); Thread loader = new FileLoader(f, editor.getDocument()); loader.start(); } else { JOptionPane.showMessageDialog( getFrame(), "Could not open file: " + f, "Error opening file", JOptionPane.ERROR_MESSAGE); } }
public ChannelBuffer getContent() { ChannelBuffer cb = ChannelBuffers.dynamicBuffer(); for (Frame frame : frames) { cb.writeBytes(frame.getPayload(), frame.getFrameSize() - 12); } return cb; }
private final void realSpriteRendering(final int layer) { for (int x = 0; x < 8; x++) { if (layer == 0) { // behind sprites frameManager.setPixelLayer0( (sprite.paletteUpperBitsColor << 2) | tile[x][lineToRender], sprite.xCoordinate + x, y); colorIndex = ppu.vram.readUnhandled( VideoMemoryMap.SPR_PALLETE_START + frameManager.getPixelLayer0At(sprite.xCoordinate + x, y)); } else { // front sprites frameManager.setPixelLayer2( (sprite.paletteUpperBitsColor << 2) | tile[x][lineToRender], sprite.xCoordinate + x, y); colorIndex = ppu.vram.readUnhandled( VideoMemoryMap.SPR_PALLETE_START + frameManager.getPixelLayer2At(sprite.xCoordinate + x, y)); } // just rendering when the colour isn't the transparency one! if (colorIndex != ppu.vram.readUnhandled(VideoMemoryMap.SPR_PALLETE_START)) { frameManager.setPixel(NesPalette.getRGBAt(colorIndex), sprite.xCoordinate + x, y); } } }
void redraw(GL2 gl) { if (uncaught != null) throw (new RuntimeException( "Exception occurred during init but was somehow discarded", uncaught)); if ((state == null) || (state.cgl.gl != gl)) state = new GLState.Applier(new CurrentGL(gl, glconf)); Frame f; synchronized (curdraw) { f = curdraw[0]; curdraw[0] = null; } if ((f != null) && (f.on.gl == gl)) { GPUProfile.Frame curgf = null; if (Config.profilegpu) curgf = gprof.new Frame((GL3) gl); if (f.pf != null) f.pf.tick("awt"); f.buf.run(gl); GOut.checkerr(gl); if (f.pf != null) f.pf.tick("gl"); if (curgf != null) { curgf.tick("draw"); curgf.fin(); } if (glconf.pref.dirty) { glconf.pref.save(); glconf.pref.dirty = false; } f.doneat = System.currentTimeMillis(); } }
/** * @param owner the owner of this component * @param maxVersion the maximum version number which is valid */ public CheckOutVersionDialog(Frame owner, int maxVersion) { super(owner, true); this.maxVersion = maxVersion; parentFrame = owner; versionTF = new JTextField(5); okButton = new JButton("Ok"); okButton.addActionListener(this); JPanel versionPanel = new JPanel(); JPanel buttonPanel = new JPanel(); versionPanel.add(new JLabel("Version number to check out: ")); versionPanel.add(versionTF); buttonPanel.add(okButton); getContentPane().setLayout(new BorderLayout()); getContentPane().add(versionPanel, BorderLayout.CENTER); getContentPane().add(buttonPanel, BorderLayout.SOUTH); setLocation((int) owner.getLocation().getX() + 100, (int) owner.getLocation().getY() + 100); pack(); }
public void RequestFromInternet() { // load frame and header with information Frame frame = new Frame(); frame.loadNetworkData("request for webpage from " + Websites.getRandom() + ".com"); frame.macHeader.sourceMAC = this.MAC; frame.macHeader.destinationMAC = this.AP.getMAC(); frame.setAssociatedDevice(this); frame.size = 20 + frame.networkData.length(); // "sense" the channel to see if it's in use while (AP.channel_2G.inUse) { // there was a collision so increase counter & wait random amnt of time MainSimulation.numCollisions++; try { Thread.sleep(AccessPoint.randInt(50, 150)); } catch (InterruptedException e) { } } // send request frame to the AP AP.channel_2G.inUse = true; stopwatch.start(); AP.channel_2G.sendFrameToAP(frame); try { Thread.sleep((100 - signalStrength)); } catch (InterruptedException e) { } AP.channel_2G.inUse = false; AP.getRequestedFromInternet(); }
/** * Sets a binding for a special dynamic variable in this Environment. This is not for end-users, * and will throw an AssertionError in case of conflict. * * @param varname the name of the dynamic variable to be bound * @param value a value to bind to the variable * @return this Environment, in fluid style */ public Environment setupDynamic(String varname, Object value) { if (dynamicFrame.get(varname) != null) { throw new AssertionError( String.format("Trying to bind dynamic variable '%s' but it is already bound", varname)); } if (lexicalFrame != null && lexicalFrame.get(varname) != null) { throw new AssertionError( String.format( "Trying to bind dynamic variable '%s' but it is already bound lexically", varname)); } if (globalFrame.get(varname) != null) { throw new AssertionError( String.format( "Trying to bind dynamic variable '%s' but it is already bound globally", varname)); } try { dynamicFrame.put(this, varname, value); } catch (MutabilityException e) { // End users don't have access to setupDynamic, and it is an implementation error // if we encounter a mutability exception. throw new AssertionError( Printer.format( "Trying to bind dynamic variable '%s' in frozen environment %r", varname, this), e); } return this; }
private String getMethodNameFromFrame(Frame current) { String methodName = current.getName(); if (current.getName() == null) { methodName = UNKNOWN_NAME; } return methodName; }
public static BufferedImage getDefaultBackground(IRenderableCard cardDef) { if (cardDef.isMulti()) { if (cardDef.isHybrid()) { List<BufferedImage> colorDefaults = Frame.getColorPairOrder(cardDef) .stream() .filter(cardDef::hasColor) .map(ImageFrame::defaultBackground) .collect(Collectors.toList()); return Frame.getBlendedFrame( ResourceManager.newFrame(colorDefaults.get(0)), ResourceManager.newFrame(ResourceManager.defaultHybridBlend), ResourceManager.newFrame(colorDefaults.get(1))); } else { return ResourceManager.newFrame(ResourceManager.defaultMulti); } } for (MagicColor color : MagicColor.values()) { if (cardDef.hasColor(color)) { return defaultBackground(color); } } if (cardDef.hasType(MagicType.Land)) { return ResourceManager.newFrame(ResourceManager.defaultLand); } if (cardDef.hasType(MagicType.Artifact)) { return ResourceManager.newFrame(ResourceManager.defaultArtifact); } return ResourceManager.newFrame(ResourceManager.defaultColorless); }
private Frame pushFrameForEval(Binding binding) { Frame lastFrame = getNextFrame(); Frame f = pushFrame(binding.getFrame()); setFileAndLine(binding.getFile(), binding.getLine()); f.setVisibility(binding.getVisibility()); return lastFrame; }
public void mouseMoved(MouseEvent ev) { JRootPane root = getRootPane(); if (root.getWindowDecorationStyle() == JRootPane.NONE) { return; } Window w = (Window) ev.getSource(); Frame f = null; Dialog d = null; if (w instanceof Frame) { f = (Frame) w; } else if (w instanceof Dialog) { d = (Dialog) w; } // Update the cursor int cursor = getCursor(calculateCorner(w, ev.getX(), ev.getY())); if (cursor != 0 && ((f != null && (f.isResizable() && (f.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0)) || (d != null && d.isResizable()))) { w.setCursor(Cursor.getPredefinedCursor(cursor)); } else { w.setCursor(lastCursor); } }
public static void Field1(){ fieldT.Label(); fieldT.panel(); f1.setSize(400, 400); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); // 화면 픽셀 계산 Dimension frm = f1.getSize();//창 크기 계산 int xpos = (int)(screen.getWidth() / 2 - frm.getWidth() / 2); // 창 중앙 위치 계산 int ypos = (int)(screen.getHeight() / 2 - frm.getHeight() / 2); f1.setLayout(new GridLayout(4, 4));// 프레임 레이아웃 f1.setBackground(Color.cyan); //프레임 배경 f1.addWindowListener(new WEventHandler()); f1.addKeyListener(new KEventHandler()); f1.setResizable(false); for(int i =0;i<4;i++){ for(int j=0;j<4;j++){ f1.add(p[i][j]); } } f1.setLocation(xpos, ypos); f1.setVisible(true); }
private void merge(final int insn, final Frame frame, final Subroutine subroutine) throws AnalyzerException { if (insn > n - 1) { throw new AnalyzerException("Execution can fall off end of the code"); } else { Frame oldFrame = frames[insn]; Subroutine oldSubroutine = subroutines[insn]; boolean changes = false; if (oldFrame == null) { frames[insn] = newFrame(frame); changes = true; } else { changes |= oldFrame.merge(frame, interpreter); } newControlFlowEdge(frame, oldFrame); if (oldSubroutine == null) { if (subroutine != null) { subroutines[insn] = subroutine.copy(); changes = true; } } else { if (subroutine != null) { changes |= oldSubroutine.merge(subroutine, !jsr); } } if (changes && !queued[insn]) { queued[insn] = true; queue[top++] = insn; } } }
protected int defineSymbol(Movie movie, SWFTagTypes timelineWriter, SWFTagTypes definitionWriter) throws IOException { // flush all symbol definitions for (Iterator<Frame> iter = frames.values().iterator(); iter.hasNext(); ) { Frame frame = iter.next(); frame.flushDefinitions(movie, timelineWriter, definitionWriter); } int id = getNextId(movie); SWFTagTypes spriteWriter = definitionWriter.tagDefineSprite(id); int lastFrame = 0; for (Iterator<Frame> iter = frames.values().iterator(); iter.hasNext(); ) { Frame frame = iter.next(); int number = frame.getFrameNumber(); // write any intermediate empty frames while (number > (lastFrame + 1)) { spriteWriter.tagShowFrame(); lastFrame++; } frame.write(movie, definitionWriter, spriteWriter); lastFrame = number; } // end of time line spriteWriter.tagEnd(); return id; }