Jump to content
al-siput

Gui + Button Undo Dan Redo

Recommended Posts

salam,

tengah try buat GUI yang ada function redo + undo..

GUI dah buat tapi tak keluar... :x

tak tau salah kat mana.. :P

function untuk redo + undo masih belum buat..

tak tau nak guna apa..

nak guna list, array, stack atau sebagainya.. :?

mana yang lebih sesuai..

harap membantu.

Tq. :(

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

class Project extends JFrame implements ActionListener
{
    private JLabel lblTitle, lblText;
    private JTextField txtInput;
    private JButton btnRedo, btnUndo;
    private JPanel pAtas, pTengah, pBawah;
    
    
    public Project()
    {
        //Tajuk pada 'title bar'
        setTitle("*** Redo Undo *** ");
        
        
        Container bekas = getContentPane();
        
        //Panel Atas
        
        pAtas = new JPanel();
        bekas.add(pAtas,BorderLayout.NORTH);
        pAtas.setLayout(new FlowLayout(FlowLayout.CENTER));
        
        //Tajuk utama sistem
        lblTitle = new JLabel ("Redo and Undo");
        pAtas.add(lblTitle);
        
        
        //Panel tengah
        
        pTengah = new JPanel();
        bekas.add(pTengah,BorderLayout.CENTER);
        
        pTengah.setLayout(new GridLayout(1,2));
        
        
        lblText = new JLabel("Insert Text Here :");
        pTengah.add(lblText);
        
        txtInput = new JTextField(20);
        pTengah.add(txtInput);
        
        //Panel Bawah
        pBawah = new JPanel();
        bekas.add(pBawah,BorderLayout.SOUTH);
        pBawah.setLayout(new FlowLayout(FlowLayout.CENTER));
                
        //Button Count
        btnRedo = new JButton("Redo");
        pBawah.add(btnRedo);
        btnRedo.addActionListener(this);
        
        btnUndo = new JButton("Undo");
        pBawah.add(btnUndo);
        btnUndo.addActionListener(this);
    
    }
    
    public void actionPerformed(ActionEvent e)
    {
        if (e.getSource() == btnRedo)
        {
        
        }
        
        if (e.getSource() == btnUndo)
        {
        
        }
    }
    
    public static void main(String []arg)
    {
        Project projext = new Project();
        projext.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }
    

}

Share this post


Link to post
Share on other sites

Topik ditutup kerana jalan penyelesaian telah ditemui.

Sekian. Terima Kasih

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...