Results 1 to 6 of 6
Thread: Clear menu item in swing
- 10-24-2012, 03:03 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 37
- Rep Power
- 0
Clear menu item in swing
I am supposed to make it so that when I press the clear button under file in my program, it clears the demension boxes, output label and sets it to circleRadioButton. This code should do that. any idea as to why this would not be working?
Java Code:private void ClearActionPerformed(java.awt.event.ActionEvent evt) { outputLabel.setText(""); dimension1Label.setText(""); dimension2Label.setText(""); circleRadioButton.setSelected(true); }
- 10-24-2012, 03:23 AM #2
Senior Member
- Join Date
- Oct 2012
- Posts
- 108
- Rep Power
- 0
Re: Clear menu item in swing
Are you getting an error? Are the Labels/Radio Button visible to this action listener?
I'm no swing expert, but I think your action listener may need to be in the form:
Java Code:private class ClearActionListener implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { //Do clear stuff here. } } .... ActionListener clearAL = new ClearActionListener(); clearBtn.addActionListener(clearAL);
- 10-24-2012, 04:54 AM #3
Re: Clear menu item in swing
1. Learn to follow the Java coding conventions: Code Conventions for the Java Programming Language: Contents
2. To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem.
Oh, and 'not working' doesn't tell us anything. It just leads to more questions, so you might as well tell us all the relevant details upfront.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 10-25-2012, 02:56 AM #4
Member
- Join Date
- Oct 2012
- Posts
- 37
- Rep Power
- 0
Re: Clear menu item in swing
I kind of wish that all of the moderaters on this site were nice... That other one from the other post I made was cool, but you are just getting annoying. post something positive for once in your life.
-
Re: Clear menu item in swing
You can read his posts any way you wish. The way I read it, if you follow his advice, we'll be able to better understand your code and your problem and be better able to help you. Your mileage may vary. So if you're still stuck, please tell and show us more, and again if you code that you posts conforms with convention, we'll all have a much better ability to understand it. Luck.
Edit: but heck, I've suggested this to you before.
- 10-25-2012, 10:04 AM #6
Re: Clear menu item in swing
So you think it's nicer that people leave you to unknowingly violate coding conventions and continue to write code that is difficult for other coders to read? And that it would be nicer if I didn't tell you how to get better help sooner?
Get real. Or get a paid tutor -- and pay him/her extra to be 'nice' about everything.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Add item to menu context
By ahmakki in forum New To JavaReplies: 2Last Post: 02-15-2012, 07:58 PM -
menu item event
By Johanis in forum New To JavaReplies: 6Last Post: 10-26-2011, 10:10 PM -
How can you add an action listener to a menu item?
By SerbianSergeant in forum New To JavaReplies: 7Last Post: 08-24-2011, 07:55 PM -
How to clear checkboc item in swing
By man4ish in forum AWT / SwingReplies: 2Last Post: 01-08-2010, 05:58 AM -
Checking toggle state of a menu item
By xsive in forum SWT / JFaceReplies: 1Last Post: 09-22-2008, 02:42 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks