微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在 Java 中只输出 diff-match-patch 的 DELETE 操作?

如何解决如何在 Java 中只输出 diff-match-patch 的 DELETE 操作?

您好,我需要这方面的帮助,提前感谢您的时间和考虑

我的要求是:如何在 class SelectRect: def __init__(self,xpos: int,ypos: int,w: int,h: int,rect_colour: tuple or list): self.rect = pygame.Rect(xpos,ypos,w,h) self.colour = rect_colour self.x = xpos self.y = ypos def render(self,surf): pygame.draw.rect(surf,self.colour,self.rect) selected_rects = [] colour_rects = [] for i in range(15): colour_rects.append(SelectRect(512,16 * i,TILE_SIZE,colours[i])) colour = WHITE l_mouse_down = False r_mouse_down = False export_surf = pygame.Surface((32,32)) export_surf.set_at((32,32),CYAN) rects = [] y = 0 for i in range(32): x = 0 for o in range(32): rects.append(SelectRect(x * TILE_SIZE,y * TILE_SIZE,None)) x += 1 y += 1 while True: screen.fill((32,32,32)) mx,my = pygame.mouse.get_pos() if l_mouse_down: for rect in rects: if rect.rect.collidepoint(mx,my): if rect not in selected_rects: selected_rects.append(rect) rect.colour = colour for rect in colour_rects: if rect.rect.collidepoint(mx,my): colour = rect.colour if r_mouse_down: for rect in rects: if rect.rect.collidepoint(mx,my): if rect in selected_rects: selected_rects.remove(rect) for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: pygame.quit() sys.exit() if event.type == pygame.KEYUP: if event.key == pygame.K_e: # todo,export in jpeg or png,sup2 for rect in selected_rects: export_surf.set_at((rect.x,rect.y),rect.colour) if event.key == pygame.K_c: selected_rects.clear() if event.key == pygame.K_f: for rect in rects: selected_rects.append(rect) rect.colour = colour if event.type == pygame.MOUSEBUTTONDOWN: if event.button == 1: l_mouse_down = True if event.button == 3: r_mouse_down = True if event.type == pygame.MOUSEBUTTONUP: if event.button == 1: l_mouse_down = False if event.button == 3: r_mouse_down = False for rect in rects: if rect not in selected_rects: pygame.draw.rect(screen,(64,64,64),rect.rect) else: rect.render(screen) for rect in colour_rects: rect.render(screen) pygame.draw.rect(screen,colour,[512,496,16,16]) screen.blit(export_surf,(0,0)) pygame.display.update() clock.tick(framerate) 中仅显示 DELETE 操作

这是我的代码:(这是一个 ActionPerformed JTextArea

JButton

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。