本文介绍了Java中的幻灯片放映吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用Java编写幻灯片演示程序,并希望使实现尽可能简单.

I am trying to write a slide show program in Java and would like to make the implementation as simple as possible.

目标是显示一系列幻灯片,除了依赖于幻灯片内容的其他按钮之外,每个幻灯片还具有导航按钮. (显示文字的幻灯片将带有magnifyTextButton,而具有图像的幻灯片将没有此按钮.)

The goal is to show a series of slides, each of which has navigation buttons, in addition to other buttons that depend on the slide's content. (A slide showing text would have a magnifyTextButtonand a slide with an image would not have this button.)

我当时认为抽象的Slide类是合适的,每个幻灯片类型都有子类:TextSlideImageSlide.我将如何实现这些子类,以使magnifyTextButton出现在TextSlide s中,而不出现在其他任何幻灯片中?

I was thinking an abstract Slide class would be appropriate, with subclasses for each slide type: TextSlide and ImageSlide. How would I implement these subclasses so that the magnifyTextButton would show up in TextSlides , and not in any other slide?

此外,我的Slide类扩展了JFrame.如果展示被设计为在单个窗口中(例如在PowerPoint中)进行,Slide子类的每个实例是否都需要构造一个JFrame对象?

Also, my Slide class extends JFrame. Would each instance of a subclass of Slide need to construct a JFrame object if the show is designed to take place in a single window, like in PowerPoint?

推荐答案

  • 查看了 CardLayout

    将图像作为 Icon/ImageIcon 放入 JLabel

    放置JLabel包含图像作为新卡

    put JLabel contains Image as new Card

    这篇关于Java中的幻灯片放映吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 10:04