Re: Combobox Listener troubles
Your JPanel should not be implementing ItemListener. The ItemListener is added anonymously to the ComboBox:
jComboBox1.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
jComboBox1_itemStateChanged(e);
Just remove the "implements ItemListener" from the cptables class declaration.
You're using JBuilder?
Ok, then
1) click to the Design tab.
2) select the combobox
3) on the right hand side, there's a panel with all the component attributes. There's another tab (look at the bottom) for events. Click that tab
4) Now select the event handler you'd like for the combobox (I suggest "actionPerformed")
In the method that it creates for you:
String item = combobox.getSelectedItem();
Similar Messages
-
UPDATING WITH COMBOBOX LISTENER
hello,
an issue i have encountered:
i have a comboBox with text sizes in it, and a listener to
register the "change" event.
there is also a dynamic rectangle behind the textField which
changes its height to reflect the new height of the textField.
now, when i change the size of the text, this is what
happens: the textField gets larger or smaller, but the background
rectangle stays at its current size. then, if i change the text
size again, the rectangle resizes itself to the size that it should
have been after the first text size change, but then the textField
resizes to the new size, leaving the rectangle either larger or
smaller than the textField again... it's always one step behind.
can anyone tell me why this is? and is there a way to
"update" the height of the rectangle?
thank youhello,
hmmm... it seems too complicated to post so much code...
i will try to distill the problem down to it's essence, then
post
Thank you -
hi ALL:
who can help me? oracle listener can't start now. when run lsnrctl start,the error list:
oracle@sun1 admin]$ lsnrctl start
LSNRCTL for Linux: Version 9.2.0.1.0 - Production on 18-JUN-2003 16:40:15
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Starting /home/oracle/oracle9i/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 9.2.0.1.0 - Production
System parameter file is /home/oracle/oracle9i/network/admin/listener.ora
Log messages written to /home/oracle/oracle9i/network/log/listener.log
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
TNS-12542: TNS:address already in use
TNS-12560: TNSrotocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use
Listener failed to start. See the error message(s) above
The platform is redhat 9,oracle9.0,Now what can i do?Your listener is already running.
[oracle@rhpc2 oracle]$ lsnrctl status
LSNRCTL for Linux: Version 9.2.0.1.0 - Production on 19-JUN-2003 09:34:07
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rhpc2)(PORT=1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 9.2.0.1.0 - Production
Start Date 30-MAY-2003 14:31:12
Uptime 19 days 19 hr. 2 min. 54 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File /u01/app/oracle/product/9.2.0/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/9.2.0/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rhpc2)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC)))
Services Summary...
Service "OEMREP" has 2 instance(s).
Instance "OEMREP", status UNKNOWN, has 1 handler(s) for this service...
Instance "OEMREP", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@rhpc2 oracle]$ lsnrctl start
LSNRCTL for Linux: Version 9.2.0.1.0 - Production on 19-JUN-2003 09:41:29
Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.
Starting /u01/app/oracle/product/9.2.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 9.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/9.2.0/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/9.2.0/network/log/listener.log
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rhpc2)(PORT=1521)))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use
Listener failed to start. See the error message(s) above...TTFN
John -
Hi all
Just trying to get my draw applet to draw the rectangles in 3d. At the moment i can draw in 3d and if i click inside the newly created rectangle and drag it moves it.
Now the problem has come that i want to make the rectangles 3d. I've done this, tested it separately in another class so i know it works. I am trying to activate "3D mode" by holding down Control and clicking in the rectangle. It should then redraw the rectangle at the place where the mouse was released. The only problem is it just moves the rectangle and doens't make it 3d as ifs ignoring the keyEvent.
So basically i'm just wondering if i have a keyEvent that occurs when ctrl is pressed, then i click in rectangle will the mouse listener take over and therefore the keyEvent be forgotton and my booleans for drawing in 3d be reset???
Cheers for any assistance in answering this question.if you want it in conjunction with mouse clicks, you can get the fact of the control, shift or alt (and a couple others) are being held at the time of the mouse event...
if((me.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK) {
System.out.println("CTRL_MASK is held down..."); -
How can I use this arrray?
I have written arguemnts to add severals shapes to the scene(by using createVrmlFromString()), all the shape nodes stored in shapeArray[], now I'd like to use another array(b[]) to get the index of each shape nodes which has been added to the secne, so that I can record the their sequence.
1. Can I use the arguments as following:
shapeArray = {shape1,shape2,shape3.....}
if(clickedButton = shape1)
{ b.add(shapeArray.indexof(0)); b++ }
if (clickedButton = shape2)
{ b.add(shapeArray.indexof(1)); b++}
2. Since the length of b[] is dynamically changed according to the number that the nodes added to the scene, shoudl I use the vector, how can I get the index of the shapeArray to a vector. should I use
Vector b = new Vector;
b.addElement(shapeArray.indexof(0));
b++; //?I haven't used createVrmlFromString(), but maybe this will help...
Note at Square, Circle, and Rectangle extends Shape.
Shape[] shapeArray = { new Square(0, 0, 10, 10),
new Circle(10, 10, 10),
new Rectangle(20, 20, 150, 100)
Vector clickedShapes = new Vector();
// in the combobox listener
clickedShapes.add(shapeArray(cb.getSelectedIndex()));
// in the 'submit button' actionlistener; get first item
Shape s = (Shape)v.get(0);
[/code[ -
Trying to write a Listener on a CheckBox to change the Model of a ComboBox
I am trying to change the list that appears in a ComboBox dynamically based on if a CheckBox is selected or not. I have multiple CheckBoxes and ComboBoxes being created in a loop based on a variable assigned at creation. Every tutorial i have seen writes out a listener that explicitly defines the checkbox instance but in my case i don't acctually know. My checkboxes are in an array of checkboxes as are the comboboxes as they are being created at runtime. Any help would be much apreciated this issue has been with me for two days now.
here is a snippit of my code in how i was implementing this:
int numButton = 17; //this is for testing only, this variable is set from another class normally
// these variables are defined private elsewhere in the class
JCheckBox PlayerByeCheck[] = new JCheckBox[numButton + 1];
JCheckBox PlayerHomeCheck[] = new JCheckBox[numButton + 1];
boolean PlayerOnBye[] = new boolean[numButton + 1];
for (int i = 1; i <= numButton; i++) {
PlayerByeCheck[i] = new JCheckBox();
PlayerHomeCheck[i] = new JCheckBox();
PlayerOnBye[i] = false;
// more code here for building the gui it is not important for this problem
// code to build the list starts here
for (int i = 1; i <= numButton; i++) {
((TableLayout)PlayerRosterPanel.getLayout()).insertRow(1, TableLayout.PREFERRED);
PlayerByeCheck.setOpaque(false);
PlayerByeCheck[i].addItemListener(this);
PlayerByeCheck[i].setName("PlayerByeCheck" + i);
PlayerRosterPanel.add(PlayerByeCheck[i], new TableLayoutConstraints(2, 1, 2, 1, TableLayoutConstraints.CENTER, TableLayoutConstraints.FULL));
//the comboox that i want to change
//---- PlayerTeamSelect1 ----
if (PlayerOnBye[i] = true) {
PlayerTeamSelect[i].setModel(new DefaultComboBoxModel(new String[] {
"ARI",
"ATL",
"BAL",
"BUF",
"BYE"
PlayerTeamSelect[i].setSelectedItem("BYE");
} else {
PlayerTeamSelect[i].setModel(new DefaultComboBoxModel(new String[] {
"ARI",
"ATL",
"BAL",
"BUF",
"CAR",
"BYE"
PlayerTeamSelect[i].setOpaque(false);
PlayerRosterPanel.add(PlayerTeamSelect[i], new TableLayoutConstraints(4, 1, 4, 1, TableLayoutConstraints.FULL, TableLayoutConstraints.FULL));
//more gui code here method gets closed
//Item Action Listener starts here this is where i am having the problem
public void itemStateChanged(ItemEvent e) {
Object source = e.getItem();
if (source == PlayerByeCheck[1])
int select = e.getStateChange();
if (select == ItemEvent.SELECTED)
PlayerOnBye[1] = true;
PlayerRosterPanel.repaint();
//repaint the window i think can't get the listener to work to see if this is the right way to do this
//i doubt it is
I have tried several different ways to write the listener, the example in the code above is following the java swing tutorial by explicitly defining the checkbox. I have tried to write the listener as i am creating the checkbox, which doesn't seem to work or i am wrting it wrong, which is entirely possible. Once the listener sets the value i think it should repaint the screen but i am sure that that is wrong right now as well. As my hunch is the repaint will reset the checkbox to DESELCTED the default value. I will come to that issue once i figure out how to get the listener working. Ideally i want to be able to set the listener for the checkboxes regardless as to how many there are. As stated above i am generating a list of checkboxes, comboboxes and other fields based on a variable that is defined in one of my objects. If the user selects checkbox 3 than combobox 3 should be changed, and the others should not. if the user selects all the checkboxes than all the comboboxes change.
thanks for any help. Still plugging along on it trying to figure this one out. -
Hi, basically i have no sound at all on my Iphone, it doent notify me when i get a text, when someone rings, when i play music or watch videos, the volume slider that is usually present while watching videos or listening to music is no longer there at all, ive turned my phone on and off a couple of times now ive put headphones in and out to see if i had a sticky jack but still no luck Someone help??
And to clarify, these are all iTunes movie and music downloads, so there should not be a compatability issue. And no, the iPod did not come damaged from Apple, it was a hand-me-down from a friend who busted the internal speaker. But it's never done anything like this before. It just had crappy sound. And yes, the timing of the movies and music having issues is the same as the speaker dying. And no, this has NOTHING To do with music videos. I don't have any on any of our devices.
-
Trouble skinning AS2 ComboBox component
I'm using Flash CS3 and want to create a custom ComboBox. I've followed the steps outlined in "Editing component skins in a new document" (http://livedocs.adobe.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/common/html/wwhelp.htm?cont ext=Flash_MX_2004&file=00002045.html#1120753), but every time I get to the step where I drag the ComboBox Assets folder from the HaloTheme.fla library into my library, if I test movie at that point my combobox has become an unclickable white rectangle with no label, button or anything. Am I doing something wrong? Any suggestions would be welcome.
Thanks!start with a new fla and follow the directions.
-
Trouble creating a custom combobox
I'm building a custom component consisting of a combo box
that autopopulates with a list of states. So far it works fine
except I can't retreive the selected item from an instance when the
user makes a new selection. I've tried setting a custom property
& setting the value equal to the current selection using a
"change" event handler on the combobox but I could only retreive
the value that was selected when the component was initialized, not
when a new item is selected. I've tried setting up the class in the
.as file to extend the "mx.controls.ComboBox" class instead of the
usual "mx.core.UIComponent". That exposed the normal combobox
properties to the caller, but the "selectedItem.data" property
always comes up blank. Has anyone dealt with this issue before?? If
so, I REALLY hope you managed to resolve it!!I'm building a custom component consisting of a combo box
that autopopulates with a list of states. So far it works fine
except I can't retreive the selected item from an instance when the
user makes a new selection. I've tried setting a custom property
& setting the value equal to the current selection using a
"change" event handler on the combobox but I could only retreive
the value that was selected when the component was initialized, not
when a new item is selected. I've tried setting up the class in the
.as file to extend the "mx.controls.ComboBox" class instead of the
usual "mx.core.UIComponent". That exposed the normal combobox
properties to the caller, but the "selectedItem.data" property
always comes up blank. Has anyone dealt with this issue before?? If
so, I REALLY hope you managed to resolve it!! -
Trouble creating custom combobox
I'm building a custom component consisting of a combo box
that autopopulates with a list of states. So far it works fine
except I can't retreive the selected item from an instance when the
user makes a new selection. I've tried setting a custom property
& setting the value equal to the current selection using a
"change" event handler on the combobox but I could only retreive
the value that was selected when the component was initialized, not
when a new item is selected. I've tried setting up the class in the
.as file to extend the "mx.controls.ComboBox" class instead of the
usual "mx.core.UIComponent". That exposed the normal combobox
properties to the caller, but the "selectedItem.data" property
always comes up blank. Has anyone dealt with this issue before?? If
so, I REALLY hope you managed to resolve it!!This Forum is to discuss issues of the forums. Best to post in Forum of application you are using. Here is link to list. http://forums.adobe.com/index.jspa
-
Trouble with a JMS proxy listening to a distributed topic
Hi all,
I've setup an ALSB cluster with 1 admin instance and 2 managed instances (m01 and m02).
I've also configured 1 distributed topic A and defined the two below proxies:
- proxy P1 is a http proxy that publishes a message into the distributed topic A. The proxy uses a business service with jms protocol and endpoint uri:
jms://wasdv1r3n1.dev.b-source.net:7301,wasdv1r3n1.dev.b-source.net:7303/my.ConnectionFactory/DistributedTopicA
- proxy P2 is a JMS proxy listening to
jms://wasdv1r3n1.dev.b-source.net:7301,wasdv1r3n1.dev.b-source.net:7303/my.ConnectionFactory/DistributedTopicA
that logs the received message and writes it to file.
The strange behaviour is that on the managed m01 log file I see the message received from P2 but also on the managed m02 log file I see the message received from P2.
So I'm sending out 1 message and receiving 1 x managed that is total = 2.
This strange behaviour is also confirmed from the fact that I see on the file system 2 files and not only 1.
I thought it was a problem concerning the config of business service that publishes message into the distributed topicA; but I tried with an external 'normal' java JMS subscriber that listens to t3://wasdv1r3n1.dev.b-source.net:7301,wasdv1r3n1.dev.b-source.net:7303 and it works properly: it receives only 1 message.
I'm trying to understand where is my fault.
Do you have any idea ?
Thanks in advance
PatrizioIf you publish a message to a topic, all the proxy that subscribed to this topic will receive the message. If you want the message to be processed by only one managed server you can publish to a queue instead.
Gregory Haardt
ALSB Prg. Manager
[email protected] -
Having trouble listening to podcast......suddenly
Windows XP
can anyone help?
after listening to a podcast daily, suddenly i get the following prompt when trying to download the last show, or any show for that matter:
"There was a problem downoading "FTL2006-03-07". You do not have any access privileges for this operation.
Please check that the URL is correct and the connection to the network is active and try again."
Well, the URL is correct, for I unsubscribed and resubscribed to the podcast. Any help would be appreciated.
I'm still waiting on btabz for some help with another problem that unfortunately, he made worse...sorry.
thanks
Windows XP
Windows XP
Windows XPI was never having a direct conversation with you and never learned the specifics of the problem. My messages were replies to someone named csshawke. That's why it is better to create your own thread, to try to keep everything nice, organized, and working No worries though
Do you know where the iTunes Music Library.xml file is? Not what your iTunes library looks like or what is in it, but where that file is? Your music is still on your computer, iTunes just isn't showing it. Just, do you know where that file is? That file tells iTunes where to look. If you have it, you are fine.
btabz -
One class (class 1)implements mouse listener and responds to a mouse events.
As part of that response it needs to call a variable set method in another class (class 2)and also have that setMethod call it's own ActionPerformed.
Seems the problem is I don't have aaction event to pass
I only have a mouse event. As follows:
class 1
public void mousePressed(MouseEvent e) {
int y1=Math.abs(e.getY()-y);
this.sourceReference.setVar(y1);
repaint();
class 2
int var;
public void setVar(int y)
var=y;
this.ActionPerformed(?? ); //This is what I want to do
Same question slightly different.
From class 1 I scould first call the setVar method
and then issue a call to class 2's ActionPerformed.
But again I don't seem to have the proper action event e to pass it.
Thanks
PS I posted this on the beginner site but no response.You can create an appropriate ActionEvent with an appropriate constructor.
public ActionEvent(Object source, int id, String command)
source should be the source (possibly component) that generated the event.
id should be ActionEvent.ACTION_PERFORMED
command should be whatever is meaningful for the event you are firing.
Rather than tightly coupling this to a single actionPerformed method, you should look into making a fireActionPerformed-esque method (See the source for some of the swing components for examples) and registering action listeners... this means that you can extend the system at a later date so two or more other components are notified by the event. -
Trouble with Phase Listener?
I am having a problem getting my page beans' "init", "preprocess" and "prerender" methods to fire. My page beans are inherited from "com.sun.jsfcl.app.AbstractPageBean" which do have these methods defined. From what I've found, it appears that my problem is a lack of a "phase-listener" in my faces-config.xml file. How should this be configured? If I put in:
<lifecycle>
<phase-listener>com.sun.jsfcl.app.AbstractPageBean</phase-listener>
</lifecycle>
I get an error that the phase listener can't be instantiated (which makes sense, it is abstract). How do I configure my application so that the "init", "preprocess" and "prerender" methods fire?
Thanks,
LonnieI have absolutely no idea what you're talking about. This is not JSF specific.
Maybe you're using some additional JSF component library which offers this stuff. I guess that it is Woodstock again. In any way, you should consult the documentation which come along with the component library for answers on this kind of questions. -
Trouble adding listener to JCalendar bean
Has anyone ever used the JCalendar bean from toedter.com?
It inherits .addPropertyChangeListener(PropertyChangeListener pcl) from JComponent, but the compiler will not recognize this method.
Anyone ran into this problem before?
Thanks,
Tim- Are you sure that JCalendarName is a variable that
contains a JCalendar object?JCalendarName is just what I used to represent to you my instance of JCalendar (I actually just call it cal.
- Are you sure that "this" refers to an object of a
class that implements PropertyChangeListener? For
instance is the above line of code within an inner
class of the actual PropertyChangeListener
implementation where "this" refers to the inner class
object not the enclosing class object?This particular bean's API says that it inherits .addPropertyChangeListener(PropertyChangeListener pcl) from JComponent. I assumed that using this would work, as it does with any other listener I've used before.
Is there perhaps some other listener to which I should make a reference in this method's argument?
Thanks,
Tim
Maybe you are looking for
-
Source of Supply for SNP Planned Order
Hi All, I have a situation where we are feeding SNP planned orders using /sapapo/lcin (Time series to Order Network). When we use this transaction SNP planned orders are created in SNP but PDS is not attached to such orders. I would like to know how
-
Issuess in creation of New company
Hi By mistake i have created "S" (Branch Company ) in 2000 in OM. As parent company (R) has created on 2004 i want to change the date of the Company "S" on 2004 or after 2004. But when i m changing the date in the changed mode in OM its not taking t
-
I cannot open my iphone in Itunes. I have cleanly uninstalled/reinstalled Turned off/restarted etc as to instructions. My personal apps are listed but when I do the device detectivity / sync test NO Iphone. PLz Help Thx
-
Expose EJB through Java Bean model importer in Web Dynpro
Hi, I am planning to expose EJB like following: 1. Create Stateless session bean as a façade for DAO access. 2. Create DAO to access database. In my case is Oracle DB 3. Create Java Bean to encapsulate session bean 4. Import java bean model to web dy
-
Is this a Pie Chart Tooltip bug? (Xcelsius 2008)
Hi Folks, I have a series of pie charts on two different dashboards. Neither of them are displaying percentage of total values, instead I get only the value of the 'slice' in the pie chart. Any idea why? I'm nearly sure I was getting % values before.