Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » *** NOT WORKING ***(JComponents Issue)
*** NOT WORKING *** [message #1802523] Mon, 11 February 2019 11:46 Go to next message
John Langley is currently offline John LangleyFriend
Messages: 1
Registered: February 2019
Junior Member
In the code below I've created some simple items for a control bar in a simple program while learning how to code Java.

The behavior of one of the items (JButton "Clear") doesn't appear clicked even when it is if fact, clicked. No indication that it was depressed even though it actually works to remove all graphical elements from the canvas of this simple program.

All the other items do not work. Checkbox won't allow itself to be checked, radiobuttons the same, and the combobox drops down but also will not allow a particular selection.

Far as I can tell, I have all the right imports, at this point I'm at a loss to explain why things aren't functioning....

Eclipse IDE for Java Developers
Version: 2018-12 (4.10.0)
Build id: 20181214-0600


import acm.program.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.ButtonGroup;
import javax.swing.JRadioButton;
import javax.swing.JComboBox;

public class testprogram extends GraphicsProgram {

private JCheckBox bx;
private JButton clear;
private JRadioButton small;
private JRadioButton medium;
private JRadioButton large;

private JComboBox clr;
private String[] clrs = {"Black", "Red", "Green"};

public void init () {
clear = new JButton ("Clear");
add(clear, SOUTH);


bx = new JCheckBox ("Test");
add(bx, SOUTH);

clr = new JComboBox (clrs);
add(clr, SOUTH);



public void actionPerformed (ActionEvent e) {
if (e.getActionCommand().equals("Clear")) {

private void putRadioButtons (){

small = new JRadioButton ("Small");
medium = new JRadioButton ("Medium");
large = new JRadioButton ("Large");

ButtonGroup sizeGroup = new ButtonGroup ();

add(small, SOUTH);
add(medium, SOUTH);
add(large, SOUTH);


Re: *** NOT WORKING *** [message #1802624 is a reply to message #1802523] Tue, 12 February 2019 22:32 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 3712
Registered: July 2009
Senior Member

This isn't a general programming question forum. You might find more help at or .

Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Jetty webserver launch failing and giving " fatal error: 40: no cipher suites in common"
Next Topic:Command to clean workspace
Goto Forum:

Current Time: Sun Jun 07 10:46:28 GMT 2020

Powered by FUDForum. Page generated in 0.03169 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top