From 6efe187d05836bc46c6e43f095bf20cd4f12b1d1 Mon Sep 17 00:00:00 2001 From: Kumar Priyansh <30593201+luciferreeves@users.noreply.github.com> Date: Tue, 14 Nov 2017 16:53:33 +0530 Subject: Java Files --- OnlineTest.class | Bin 0 -> 5644 bytes OnlineTest.java | 185 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 OnlineTest.class create mode 100644 OnlineTest.java diff --git a/OnlineTest.class b/OnlineTest.class new file mode 100644 index 0000000..dcfc44d Binary files /dev/null and b/OnlineTest.class differ diff --git a/OnlineTest.java b/OnlineTest.java new file mode 100644 index 0000000..77371b0 --- /dev/null +++ b/OnlineTest.java @@ -0,0 +1,185 @@ +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +class OnlineTest extends JFrame implements ActionListener +{ + JLabel l; + JRadioButton jb[]=new JRadioButton[5]; + JButton b1,b2; + ButtonGroup bg; + int count=0,current=0,x=1,y=1,now=0; + int m[]=new int[10]; + OnlineTest(String s) + { + super(s); + l=new JLabel(); + add(l); + bg=new ButtonGroup(); + for(int i=0;i<5;i++) + { + jb[i]=new JRadioButton(); + add(jb[i]); + bg.add(jb[i]); + } + b1=new JButton("Next"); + b2=new JButton("Bookmark"); + b1.addActionListener(this); + b2.addActionListener(this); + add(b1);add(b2); + set(); + l.setBounds(30,40,450,20); + jb[0].setBounds(50,80,100,20); + jb[1].setBounds(50,110,100,20); + jb[2].setBounds(50,140,100,20); + jb[3].setBounds(50,170,100,20); + b1.setBounds(100,240,100,30); + b2.setBounds(270,240,100,30); + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setLayout(null); + setLocation(250,100); + setVisible(true); + setSize(600,350); + } + public void actionPerformed(ActionEvent e) + { + if(e.getSource()==b1) + { + if(check()) + count=count+1; + current++; + set(); + if(current==9) + { + b1.setEnabled(false); + b2.setText("Result"); + } + } + if(e.getActionCommand().equals("Bookmark")) + { + JButton bk=new JButton("Bookmark"+x); + bk.setBounds(480,20+30*x,100,30); + add(bk); + bk.addActionListener(this); + m[x]=current; + x++; + current++; + set(); + if(current==9) + b2.setText("Result"); + setVisible(false); + setVisible(true); + } + for(int i=0,y=1;i