here is what I have so far:
Im stuck
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusListener;
public class TestImageIcon extends JFrame {
private static ImageIcon myIcon = new ImageIcon("src/Resources/my.png");
public TestImageIcon() {
// Create two buttons
JButton jbtOK = new JButton("Begin");
JButton jbtCancel = new JButton("Quit");
// Create a panel to hold buttons
JPanel panel = new JPanel();
panel.add(jbtOK);
panel.add(jbtCancel);
add(panel); // Add panel to the frame
// Register listeners
CancelListenerClass listener2 = new CancelListenerClass();
jbtCancel.addActionListener(listener2);
// setLayout(new GridLayout(1, 4, 5, 5));
//
// //add(new JLabel(myIcon));
// add(new JButton("Genetics FlashCard Quiz", myIcon), BorderLayout.CENTER);
//
// JCheckBox jchk = new JCheckBox("Begin", false);
// jchk.setForeground(Color.BLACK);
// jchk.setBackground(Color.LIGHT_GRAY);
// jchk.setMnemonic('B');
//
// final JCheckBox jchk1 = new JCheckBox("Quit", false);
// jchk1.setForeground(Color.BLACK);
// jchk1.setBackground(Color.LIGHT_GRAY);
// jchk1.setMnemonic('Q');
//
//
// //This code below adds a check box
//
// add(jchk);
// add(jchk1);
//
// //Register a listener for the check boxes
//
// jchk1.addActionListener(new ActionListener() {
//
// @Override
// public void actionPerformed(ActionEvent e) {
//
// //jchk1.
// }});
//
////
// //This code below creates a selectable bulletpoint, good for multiple choice questions.
//
//// JRadioButton jrb1 = new JRadioButton("Student", true);
//// jrb1.setForeground(Color.RED);
//// jrb1.setBackground(Color.WHITE);
//// jrb1.setMnemonic('S');
////
//// ButtonGroup group = new ButtonGroup();
//// add(jrb1);
////
//
//
}
class OKListenerClass implements ActionListener{
public void actionPerformed(ActionEvent e) {
System.out.println("OK button clicked");
}
}
class CancelListenerClass implements ActionListener{
public void actionPerformed(ActionEvent e) {
System.out.println("Cancel button clicked");
}
}
/** Main method */
public static void main(String[] args) {
// TestImageIcon frame = new TestImageIcon();
// frame.pack();
// frame.setTitle("Genetics Flashcard Quiz");
// frame.setSize(300, 150);
// frame.setLocationRelativeTo(null); // Center the frame
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// frame.setVisible(true);
//
TestImageIcon frame = new TestImageIcon();
frame.setTitle("Genetics FlashCard Quiz");
frame.setSize(300, 75);
frame.setLocation(200, 100);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}

New Topic/Question
Reply



MultiQuote



|