i want to design a GUI such that when i click a button (eg. next), i get a new look ie. having different no. of buttons at different place( just like a next or back buttons in website)...
-
import javax.swing.*;
-
public class authenticate extends JFrame
-
{
-
JButton Blogin;
-
private JPanel mainPanel = new JPanel()
-
{
-
//@Override
-
protected void paintComponent(Graphics g)
-
{
-
-
super.paintComponent(g);
-
-
if (img != null)
-
{
-
-
int width = mainPanel.getWidth();
-
int height = mainPanel.getHeight();
-
// and do the drawing here:
-
g.drawImage(img,0,0, width, height, mainPanel);
-
}
-
}
-
};
-
public authenticate() throws Exception
-
{
-
setContentPane(mainPanel);
-
-
Container con=getContentPane();
-
con.setLayout(null);
-
Blogin = new JButton("Login");
-
con.add(Blogin); //Blogin Button
-
Blogin.setBounds(800,100,80,30);
-
Blogin.addActionListener(this);
-
-
}
-
public static void main(String[] argv) throws Exception
-
{
-
-
authenticate frame= new authenticate();
-
frame.setVisible(true);
-
frame.setSize(1024,768);
-
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
-
-
}
-
}
-