Douglas McAuley

Greenhorn
+ Follow
since Jul 21, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Douglas McAuley

Thanks Micheal, your code works perfect and makes mine look like hard work, which for me it was, neanderthal that I am, I am now looking for a way to store the answers and output a final score but to be honest I don't know where to start....any pointers?
Regards Douglas
13 years ago
I am trying to create a quiz program but each time I move to the new question I create a brand new frame each time. Is there any way that I can destroy the previous frame without having to start all over again.
Thanks..........code below.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Quiz extends JFrame implements ItemListener,ActionListener
{
JRadioButton radio1, radio2, radio3, radio4;
ButtonGroup group;
Button b;
JTextField text;
JLabel jl;
public void showGui()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
jl = new JLabel("(1) Who played the guitar solo on Peg?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("Dennis Dias.");
radio2 = new JRadioButton("Walter Becker.");
radio3 = new JRadioButton("Steve Gadd.");
radio4 = new JRadioButton("Jeff Skunk Baxter");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);
b = new Button("Question Two.");
b.addActionListener(this);
contentPane.add(b);
setSize(350,300);
setVisible(true);
}
public static void main(String args[])
{
Quiz f = new Quiz();
f.showGui();
f.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == b) {
Quiz2 f = new Quiz2();
f.showGui2();
}
}
public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("Dennis Dias.");
} else if (e.getItemSelectable() == radio2) {
text.setText("Walter Becker.");
} else if (e.getItemSelectable() == radio3) {
text.setText("Steve Gadd.");
} else if (e.getItemSelectable() == radio4) {
text.setText("Jeff Skunk Baxter.");
}
}
class Quiz2 extends JFrame implements ItemListener,ActionListener
{
public void showGui2()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
jl = new JLabel("(2) Who was the song Chain lightning written about?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("The Christians.");
radio2 = new JRadioButton("The Klu Klux Klan.");
radio3 = new JRadioButton("The Nazi Party.");
radio4 = new JRadioButton("The Mormons.");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);
b = new Button("Question Three.");
b.addActionListener(this);
contentPane.add(b);
setSize(350,300);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == b) {
Quiz3 f = new Quiz3();
f.showGui3();
}
}
public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("The Christians.");
} else if (e.getItemSelectable() == radio2) {
text.setText("The Klu Klux Klan.");
} else if (e.getItemSelectable() == radio3) {
text.setText("The Nazi Party.");
} else if (e.getItemSelectable() == radio4) {
text.setText("The Mormons.");
}
}
}

class Quiz3 extends JFrame implements ItemListener,ActionListener
{
public void showGui3()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
jl = new JLabel("(3) What famous guitarist played on 'Time out of mind'?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("Eric Clapton.");
radio2 = new JRadioButton("BB King.");
radio3 = new JRadioButton("George Benson.");
radio4 = new JRadioButton("Mark Knopfler.");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);
b = new Button("Question Four.");
b.addActionListener(this);
contentPane.add(b);
setSize(350,300);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == b) {
Quiz4 f = new Quiz4();
f.showGui4();
}
}
public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("Eric Clapton.");
} else if (e.getItemSelectable() == radio2) {
text.setText("BB King.");
} else if (e.getItemSelectable() == radio3) {
text.setText("George Benson.");
} else if (e.getItemSelectable() == radio4) {
text.setText("Mark Knopfler.");
}
}
}

class Quiz4 extends JFrame implements ItemListener//ActionListener
{
public void showGui4()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
jl = new JLabel("(4) Who played the keyboard solo on 'Black Cow'?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("Donald Fagen.");
radio2 = new JRadioButton("Herbie Hancock.");
radio3 = new JRadioButton("Victor Feldman.");
radio4 = new JRadioButton("Tino Beggs.");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);
b = new Button("Question Five.");
//b.addActionListener(this);
contentPane.add(b);
setSize(350,300);
setVisible(true);
}
//public void actionPerformed(ActionEvent e) {
//if(e.getSource() == b);
//Quiz f = new Quiz();
//f.ShowGui4();
//}
public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("Donald Fagen.");
} else if (e.getItemSelectable() == radio2) {
text.setText("Herbie Hancock.");
} else if (e.getItemSelectable() == radio3) {
text.setText("Victor Feldman.");
} else if (e.getItemSelectable() == radio4) {
text.setText("Tino Beggs.");
}
}
}}
13 years ago
I am trying to create a quiz program but each time I move to the new question I create a brand new frame each time. Is there any way that I can destroy the previous frame without having to start all over again.
Thanks..........code below.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Quiz extends JFrame implements ItemListener,ActionListener
{
JRadioButton radio1, radio2, radio3, radio4;
ButtonGroup group;
Button b;
JTextField text;
JLabel jl;
public void showGui()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
jl = new JLabel("(1) Who played the guitar solo on Peg?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("Dennis Dias.");
radio2 = new JRadioButton("Walter Becker.");
radio3 = new JRadioButton("Steve Gadd.");
radio4 = new JRadioButton("Jeff Skunk Baxter");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);
b = new Button("Question Two.");
b.addActionListener(this);
contentPane.add(b);
setSize(350,300);
setVisible(true);
}
public static void main(String args[])
{
Quiz f = new Quiz();
f.showGui();
f.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == b) {
Quiz2 f = new Quiz2();
f.showGui2();
}
}
public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("Dennis Dias.");
} else if (e.getItemSelectable() == radio2) {
text.setText("Walter Becker.");
} else if (e.getItemSelectable() == radio3) {
text.setText("Steve Gadd.");
} else if (e.getItemSelectable() == radio4) {
text.setText("Jeff Skunk Baxter.");
}
}
class Quiz2 extends JFrame implements ItemListener,ActionListener
{
public void showGui2()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
jl = new JLabel("(2) Who was the song Chain lightning written about?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("The Christians.");
radio2 = new JRadioButton("The Klu Klux Klan.");
radio3 = new JRadioButton("The Nazi Party.");
radio4 = new JRadioButton("The Mormons.");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);
b = new Button("Question Three.");
b.addActionListener(this);
contentPane.add(b);
setSize(350,300);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == b) {
Quiz3 f = new Quiz3();
f.showGui3();
}
}
public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("The Christians.");
} else if (e.getItemSelectable() == radio2) {
text.setText("The Klu Klux Klan.");
} else if (e.getItemSelectable() == radio3) {
text.setText("The Nazi Party.");
} else if (e.getItemSelectable() == radio4) {
text.setText("The Mormons.");
}
}
}

class Quiz3 extends JFrame implements ItemListener,ActionListener
{
public void showGui3()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
jl = new JLabel("(3) What famous guitarist played on 'Time out of mind'?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("Eric Clapton.");
radio2 = new JRadioButton("BB King.");
radio3 = new JRadioButton("George Benson.");
radio4 = new JRadioButton("Mark Knopfler.");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);
b = new Button("Question Four.");
b.addActionListener(this);
contentPane.add(b);
setSize(350,300);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == b) {
Quiz4 f = new Quiz4();
f.showGui4();
}
}
public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("Eric Clapton.");
} else if (e.getItemSelectable() == radio2) {
text.setText("BB King.");
} else if (e.getItemSelectable() == radio3) {
text.setText("George Benson.");
} else if (e.getItemSelectable() == radio4) {
text.setText("Mark Knopfler.");
}
}
}

class Quiz4 extends JFrame implements ItemListener//ActionListener
{
public void showGui4()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
jl = new JLabel("(4) Who played the keyboard solo on 'Black Cow'?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("Donald Fagen.");
radio2 = new JRadioButton("Herbie Hancock.");
radio3 = new JRadioButton("Victor Feldman.");
radio4 = new JRadioButton("Tino Beggs.");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);
b = new Button("Question Five.");
//b.addActionListener(this);
contentPane.add(b);
setSize(350,300);
setVisible(true);
}
//public void actionPerformed(ActionEvent e) {
//if(e.getSource() == b);
//Quiz f = new Quiz();
//f.ShowGui4();
//}
public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("Donald Fagen.");
} else if (e.getItemSelectable() == radio2) {
text.setText("Herbie Hancock.");
} else if (e.getItemSelectable() == radio3) {
text.setText("Victor Feldman.");
} else if (e.getItemSelectable() == radio4) {
text.setText("Tino Beggs.");
}
}
}}
13 years ago
Could anyone please point me in the direction of the best way to go about learning PHP, does SQL have to be learned with it?
The names of any good books or forums would be much appreciated.
Thanks in advance.
I am trying to insert a video file on to a website which is a .VOB file, my problem is that it is too large a file for my space restrictions. Is there any way to save it so as it does not use as much memory and if anyone could also point me to a program which will convert this file to a less greedy format.
Thanks in advance.
Douglas.
I have come accross a few opportunities in my area with small companies looking to set up an online shopping branch to their business.
Can anyone suggest a book where I could learn how to specifically learn this skill.
I already have a little experience of JSP and SERVLETS but I need something to cut to the chase.
Thanks Douglas.
14 years ago
JSP
Can anyone suggest a cheapish book for learning Javascript or even some free online resourses.
Thanks Douglas.
I hope this isn't to tall an order to ask of someone, but if anyone would be kind enough to look at the code below.....
I am trying to basically go from one page to the next by clicking on a button, the fist page comes up OK, but the button doesn't seem to be working, I can't think why, if anyone has got the time to look at it and come up with a solution I would be much obliged..............Frustrating business this programming game!!!

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Quiz extends JFrame implements ItemListener,ActionListener
{

JRadioButton radio1, radio2, radio3, radio4;
ButtonGroup group;
Button b;
JTextField text;
JLabel jl;

public void showGui()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
b.addActionListener(this);
jl = new JLabel("Who played the guitar solo on Peg?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("Dennis Dias.");
radio2 = new JRadioButton("Walter Becker.");
radio3 = new JRadioButton("Steve Gadd.");
radio4 = new JRadioButton("Jeff Skunk Baxter");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);

b = new Button("Question Two.");

contentPane.add(b);

setSize(300,300);
setVisible(true);

}
public static void main(String args[])
{
Quiz f = new Quiz();
f.showGui();
f.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
f.addWindowListener(new WindowAdapter() {
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});
}

public void actionPerformed(ActionEvent e) {
if(e.getSource() == b);
Quiz f = new Quiz();
f.ShowGui2();
}

public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("Dennis Dias.");
} else if (e.getItemSelectable() == radio2) {
text.setText("Walter Becker.");
} else if (e.getItemSelectable() == radio3) {
text.setText("Steve Gadd.");
} else if (e.getItemSelectable() == radio4) {
text.setText("Jeff Skunk Baxter.");
}
}

public class Quiz2 extends JFrame implements ItemListener//,ActionListener
{



public void showGui2()
{
Container contentPane = getContentPane();
contentPane.setLayout(new GridLayout(0,1));
//b.addActionListener(this);
jl = new JLabel("Who was the song Chain lightning written about?");
contentPane.add(jl);
group = new ButtonGroup();
radio1 = new JRadioButton("The Christians.");
radio2 = new JRadioButton("The Klu Klux Klan.");
radio3 = new JRadioButton("The Nazi Party.");
radio4 = new JRadioButton("The Mormons.");
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
radio1.addItemListener(this);
radio2.addItemListener(this);
radio3.addItemListener(this);
radio4.addItemListener(this);
contentPane.add(radio1);
contentPane.add(radio2);
contentPane.add(radio3);
contentPane.add(radio4);
text = new JTextField(15);
contentPane.add(text);

b = new Button("Question Two.");

contentPane.add(b);

setSize(300,300);
setVisible(true);

}

//public void actionPerformed(ActionEvent e) {
//if(e.getSource() == b);
//Quiz f = new Quiz();
//f.ShowGui2();
//}

public void itemStateChanged(ItemEvent e)
{
if (e.getItemSelectable() == radio1) {
text.setText("The Christians.");
} else if (e.getItemSelectable() == radio2) {
text.setText("The Klu Klux Klan.");
} else if (e.getItemSelectable() == radio3) {
text.setText("The Nazi Party.");
} else if (e.getItemSelectable() == radio4) {
text.setText("The Mormons.");
}
}
}

}
14 years ago
What's the best way to display uneditable text in a GUI?
I have tried using labels but come across problems trying to measure the size of the lines.
Regards. Douglas
14 years ago
Hi
I am trying to develop a very simple quiz applet but can't really think where to start, can anyone give me a blueprint or even better some code.
Thanks
Douglas.
14 years ago
Thank you, thats an interesting way to go about it, I shall check it out.
14 years ago
I have attached some source code with two GUI'S in it, one of them has a button which when clicked I would like it to go to the other GUI, but unfortunately I can' t seem to find a way to achieve this, basically I am looking for a way to go from one page to the next.

Any ideas would be most welcome.

Regards Douglas
import java.awt.*;
import java.awt.event.*;
public class Test1 extends Frame implements ActionListener {
Button b = new Button("Click me");
public void ShowGui() {
this.setLayout(new FlowLayout());
b.addActionListener(this);
this.add(b);
setSize (300,300);
setVisible (true);
}
public void ShowGui2() {
setBackground(Color.red);
setSize (300,300);
setVisible (true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource() == b)
System.out.println("Hello");
}
public static void main(String args[]) {
Test1 t = new Test1();
t.ShowGui();
}
}
14 years ago
I am due to go for an interview to maintain a website and I am trying to view the source code to see what technologies are used on it, but the index page is all frames. Is there anyway to view the rest of the source code?
This is the source code below.
Thanks Douglas.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Deaf Connections</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<frameset rows="163,*" cols="*" frameborder="NO" border="0" framespacing="0">
<frame src="top1.html" name="top" scrolling="NO" noresize>
<frameset cols="200,100%" frameborder="NO" border="0" framespacing="0">
<frame src="left1-1.html" name="left">
<frame src="midh1.html" name="main">
</frameset>
</frameset>
<noframes>
<body>
</body>
</noframes>
</html>
I have just passed my SCJP 1.2 and am looking to go for the SCWCD next, I have read a lot of good things about the SCWCD exam study kit by Hanumant Deshmuck and Jignesh Malavia but as I have not studied much about SCWCD yet could someone tell me if this book is the right choice at the moment or should I take some other study guide first.