相关疑难解决方法(0)

在同一个jlabel上重新显示其他img的困难

我有点卡住了.当我按下按钮时,提交应该重新显示JLabel图像在同一位置的另一张图片,所以如果有人有任何想法我会很感激他们我正在使用eclipse并且该程序正在编译和运行.这是代码

/** Here is the GUI of the program
 * class name SlideShowGui.java
 * @author Kiril Anastasov
 * @date 07/03/2012
 */

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;   

public class SlideShowGui extends JPanel  implements ActionListener
{
    JLabel name, comments, images;
    JTextField namejtf, commentsjtf, captionjtf;
    JButton submit;
    ImageIcon pictures;


    SlideShowGui()
    {


        name = new JLabel("Name:");
        this.add(name);

        namejtf = new JTextField(15);
        this.add(namejtf);

        comments = new JLabel("Comments:");
        this.add(comments);

        commentsjtf = new JTextField(15);
        this.add(commentsjtf);

        submit = new JButton("Submit");
        this.add(submit);
        submit.addActionListener(this);


        pictures = new …
Run Code Online (Sandbox Code Playgroud)

java swing

2
推荐指数
2
解决办法
174
查看次数

标签 统计

java ×1

swing ×1