Listener for JTabbedPane. Which to choose?
Hello,
I have written an application using JTabbedPane
which displays 7 tab values.
I would like to use some sort of Action Listener for each of the tabs.
ie when a particular tab is clicked,some action takes place.
Which actionListener shud I use that will perform the concerned action
on each tab chosen?
tabbedPane2.addTab("Proxy A",null,null, "Proxy");
tabbedPane2.add(?????) // Action Listener
Can anybody please help.
I have a list of proxyNames which are stored in a Vector.
These proxy names are then displayed as Tabs accordingly.
For every tab there is a specific action to be performed.
I want to write a single class for handling all events.
What I have is this:
while(eNum.hasMoreElements()){
Object proxyName = eNum.nextElement();
tabbedPane.addTab(proxyName.toString(), null, null, "Proxy");
tabbedPane.addChangeListener(itemHandler);
panel4.add(tabbedPane2);
class ItemHandler implements ChangeListener{
public void stateChanged(ChangeEvent e){
for(int i=0; i < v.size(); i++){
// Perform action on choosing the concerned tab...
How do I have a single event listener?
Similar Messages
-
Listen for JTabbedPane scroll events
I want to execute a method each time the op scrolls through the tabs in a JTabbedPane in "SCROLL_TAB_LAYOUT". I have tried implementing ChangeListener, propertychangelistener and componentlistener but none of them seem to notify me when the op scrolls through tabs?
Thanks in adavce
CalypsoThanks Camickr, sorry for the late reply below is working solution
These are my custom actions which extends wrappedAction
class ScrollRight extends WrappedAction {
public ScrollRight(JComponent component, KeyStroke keyStroke) {
super(component, keyStroke);
public void actionPerformed(ActionEvent e) {
this.invokeOriginalAction(e);
System.out.println("\nScrolling Right");
class ScrollLeft extends WrappedAction {
public ScrollLeft(JComponent component, KeyStroke keyStroke) {
super(component, keyStroke);
public void actionPerformed(ActionEvent e) {
this.invokeOriginalAction(e);
System.out.println("\nScrolling Left");
}This code was added to my constructor
KeyStroke right = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_MASK);
KeyStroke left = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_MASK);
InputMap im = tabbedPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(right, "scrollTabsForwardAction");
im.put(left, "scrollTabsBackwardAction");
ScrollLeft sl = new ScrollLeft(tabbedPane,left);
tabbedPane.getActionMap().put(sl.getValue(Action.NAME),sl);
ScrollRight sr = new ScrollRight(tabbedPane,right);
tabbedPane.getActionMap().put(sr.getValue(Action.NAME),sr);Thanks again
Calypso -
Mouse motion listener for JTable with JScrollpane
Hi All,
I have added mouse motion listener for JTable which is added in JScrollPane. But if i move the mouse, over the vertical/horizontal scroll bars, mouse motion listener doesn't works.
So it it required to add mousemotionlistener for JTable, JScrollPane, JScrollBar and etc.
Thanks in advance.
Regards,
TamizhanI am having one popup window which shows address information. This window contains JTable with JScrollPane and JButton components to show the details. While showing this information window, if the mouse cursor is over popupwindow, it should show the window otherwise it should hide the window after 30 seconds.
To achieve this, i have added mouse listener to JPanel, JTable, JButton and JScrollPane. so if the cursor is in any one of the component, it will not hide the window.
but for this i need to add listener to all the components in the JPanel. For JScrollPane i have to add horizontal, vertical and all the top corner buttons of Scroll bar.
Is this the only way to do this? -
If anyone can help me with this I would be seriously grateful.
When exporting mutliple files to web pages Aperture keeping losing files, so for instance, if I choose to export 600 images to a new web page, it might make 524 pages but not the full 600. I've tried resetting Aperture and its persmission and am using the latest version of 3.
I have 3600 images which I need to upload as sublfolders, each with their own URL and at the moment Aperture is dropping of anything from 1 to 90 images.
This is critical as people need to see each and every on of these images online. So if a file has 600 photos in it, Aperture should make a URL with 600 full image pages. And this is what it's not doing. On small files, say 30 or so it seems to work well, it's when it gets to more than that the problem starts.
I've used Aperture in the past under previous versions and not had this problem.
Any help would be great.
Thanks.
Bob.Hi Jack,
Thanks for responding (as it seems as though no one else has been able to provide any insight as of yet)! Not sure if you saw my recent post, but the version of Aperture on the 2008 MacBook has been upgraded to 3.1.2 (not sure how; I bought it in 2009, but only have OS X 10.5.8... which apparently can't house 3.1.2 of Aperture, but hey, like many other anomalies i'm encountering, I'm no longer surprised!). I am unable to upgrade it any further, as it warns me that my OS X does not fit the requirements. I exported the projects as libraries; however, like I posted before, apparently these are from too old of a version for the new Aperture (3.3.1) to handle and import.
It's getting to the point where I'd almost pay to upgrade the OS X on my previous MacBook (10.5.8) to something newer in order to THEN update Aperture to a newer version; however, my previous MacBook simply cannot handle this (the specs are awful -- hence my decision to save up and upgrade to the newest MBP with Retina).
I've spent hours upon hours transferring files, libraries as projects, previews, versions, even masters (though, apparently some of them aren't accessible?) with no luck. I've rebuilt the library and reprocessed everything. And this is all after having to return one MBP already since Aperture 3.3.1 is glitch-y as it is, and froze everything for having a "managed library". So, now that I know that I have to deal with a referenced library in Aperture... I just need to actually transfer my previous library to my new one (hopefully WITH adjustments since these are years worth of photos and work).
Again, any help is appreciated. I've lost enough sleep, time, and vision health over this at this point.
Also, I know Migration Assistant is an option, I was told that it wouldn't work properly anyway because of the different operating systems, and the potential for problems. -
Huge performance differences between a map listener for a key and filter
Hi all,
I wanted to test different kind of map listener available in Coherence 3.3.1 as I would like to use it as an event bus. The result was that I found huge performance differences between them. In my use case, I have data which are time stamped so the full key of the data is the key which identifies its type and the time stamp. Unfortunately, when I had my map listener to the cache, I only know the type id but not the time stamp, thus I cannot add a listener for a key but for a filter which will test the value of the type id. When I launch my test, I got terrible performance results then I tried a listener for a key which gave me much better results but in my case I cannot use it.
Here are my results with a Dual Core of 2.13 GHz
1) Map Listener for a Filter
a) No Index
Create (data always added, the key is composed by the type id and the time stamp)
Cache.put
Test 1: Total 42094 millis, Avg 1052, Total Tries 40, Cache Size 80000
Cache.putAll
Test 2: Total 43860 millis, Avg 1096, Total Tries 40, Cache Size 80000
Update (data added then updated, the key is only composed by the type id)
Cache.put
Test 3: Total 56390 millis, Avg 1409, Total Tries 40, Cache Size 2000
Cache.putAll
Test 4: Total 51734 millis, Avg 1293, Total Tries 40, Cache Size 2000
b) With Index
Cache.put
Test 5: Total 39594 millis, Avg 989, Total Tries 40, Cache Size 80000
Cache.putAll
Test 6: Total 43313 millis, Avg 1082, Total Tries 40, Cache Size 80000
Update
Cache.put
Test 7: Total 55390 millis, Avg 1384, Total Tries 40, Cache Size 2000
Cache.putAll
Test 8: Total 51328 millis, Avg 1283, Total Tries 40, Cache Size 2000
2) Map Listener for a Key
Update
Cache.put
Test 9: Total 3937 millis, Avg 98, Total Tries 40, Cache Size 2000
Cache.putAll
Test 10: Total 1078 millis, Avg 26, Total Tries 40, Cache Size 2000
Please help me to find what is wrong with my code because for now it is unusable.
Best Regards,
Nicolas
Here is my code
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.tangosol.io.ExternalizableLite;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.NamedCache;
import com.tangosol.util.Filter;
import com.tangosol.util.MapEvent;
import com.tangosol.util.MapListener;
import com.tangosol.util.extractor.ReflectionExtractor;
import com.tangosol.util.filter.EqualsFilter;
import com.tangosol.util.filter.MapEventFilter;
public class TestFilter {
* To run a specific test, just launch the program with one parameter which
* is the test index
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage : java TestFilter 1-10|all");
System.exit(1);
final String arg = args[0];
if (arg.endsWith("all")) {
for (int i = 1; i <= 10; i++) {
test(i);
} else {
final int testIndex = Integer.parseInt(args[0]);
if (testIndex < 1 || testIndex > 10) {
System.out.println("Usage : java TestFilter 1-10|all");
System.exit(1);
test(testIndex);
@SuppressWarnings("unchecked")
private static void test(int testIndex) {
final NamedCache cache = CacheFactory.getCache("test-cache");
final int totalObjects = 2000;
final int totalTries = 40;
if (testIndex >= 5 && testIndex <= 8) {
// Add index
cache.addIndex(new ReflectionExtractor("getKey"), false, null);
// Add listeners
for (int i = 0; i < totalObjects; i++) {
final MapListener listener = new SimpleMapListener();
if (testIndex < 9) {
// Listen to data with a given filter
final Filter filter = new EqualsFilter("getKey", i);
cache.addMapListener(listener, new MapEventFilter(filter), false);
} else {
// Listen to data with a given key
cache.addMapListener(listener, new TestObjectSimple(i), false);
// Load data
long time = System.currentTimeMillis();
for (int iTry = 0; iTry < totalTries; iTry++) {
final long currentTime = System.currentTimeMillis();
final Map<Object, Object> buffer = new HashMap<Object, Object>(totalObjects);
for (int i = 0; i < totalObjects; i++) {
final Object obj;
if (testIndex == 1 || testIndex == 2 || testIndex == 5 || testIndex == 6) {
// Create data with key with time stamp
obj = new TestObjectComplete(i, currentTime);
} else {
// Create data with key without time stamp
obj = new TestObjectSimple(i);
if ((testIndex & 1) == 1) {
// Load data directly into the cache
cache.put(obj, obj);
} else {
// Load data into a buffer first
buffer.put(obj, obj);
if (!buffer.isEmpty()) {
cache.putAll(buffer);
time = System.currentTimeMillis() - time;
System.out.println("Test " + testIndex + ": Total " + time + " millis, Avg " + (time / totalTries) + ", Total Tries " + totalTries + ", Cache Size " + cache.size());
cache.destroy();
public static class SimpleMapListener implements MapListener {
public void entryDeleted(MapEvent evt) {}
public void entryInserted(MapEvent evt) {}
public void entryUpdated(MapEvent evt) {}
public static class TestObjectComplete implements ExternalizableLite {
private static final long serialVersionUID = -400722070328560360L;
private int key;
private long time;
public TestObjectComplete() {}
public TestObjectComplete(int key, long time) {
this.key = key;
this.time = time;
public int getKey() {
return key;
public void readExternal(DataInput in) throws IOException {
this.key = in.readInt();
this.time = in.readLong();
public void writeExternal(DataOutput out) throws IOException {
out.writeInt(key);
out.writeLong(time);
public static class TestObjectSimple implements ExternalizableLite {
private static final long serialVersionUID = 6154040491849669837L;
private int key;
public TestObjectSimple() {}
public TestObjectSimple(int key) {
this.key = key;
public int getKey() {
return key;
public void readExternal(DataInput in) throws IOException {
this.key = in.readInt();
public void writeExternal(DataOutput out) throws IOException {
out.writeInt(key);
public int hashCode() {
return key;
public boolean equals(Object o) {
return o instanceof TestObjectSimple && key == ((TestObjectSimple) o).key;
}Here is my coherence config file
<?xml version="1.0"?>
<!DOCTYPE cache-config SYSTEM "cache-config.dtd">
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>test-cache</cache-name>
<scheme-name>default-distributed</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<distributed-scheme>
<scheme-name>default-distributed</scheme-name>
<backing-map-scheme>
<class-scheme>
<scheme-ref>default-backing-map</scheme-ref>
</class-scheme>
</backing-map-scheme>
</distributed-scheme>
<class-scheme>
<scheme-name>default-backing-map</scheme-name>
<class-name>com.tangosol.util.SafeHashMap</class-name>
</class-scheme>
</caching-schemes>
</cache-config>Message was edited by:
user620763Hi Robert,
Indeed, only the Filter.evaluate(Object obj)
method is invoked, but the object passed to it is a
MapEvent.<< In fact, I do not need to implement EntryFilter to
get a MapEvent, I could get the same result (in my
last message) by writting
cache.addMapListener(listener, filter,
true)instead of
cache.addMapListener(listener, new
MapEventFilter(filter) filter, true)
I believe, when the MapEventFilter delegates to your filter it always passes a value object to your filter (old or new), meaning a value will be deserialized.
If you instead used your own filter, you could avoid deserializing the value which usually is much larger, and go to only the key object. This would of course only be noticeable if you indeed used a much heavier cached value class.
The hashCode() and equals() does not matter on
the filter class<< I'm not so sure since I noticed that these methods
were implemented in the EqualsFilter class, that they
are called at runtime and that the performance
results are better when you add them
That interests me... In what circumstances did you see them invoked? On the storage node before sending an event, or upon registering a filtered listener?
If the second, then I guess the listeners are stored in a hash-based map of collections keyed by a filter, and indeed that might be relevant as in that case it will cause less passes on the filter for multiple listeners with an equalling filter.
DataOutput.writeInt(int) writes 4 bytes.
ExternalizableHelper.writeInt(DataOutput, int) writes
1-5 bytes (or 1-6?), with numbers with small absolute
values consuming less bytes.Similar differences exist
for the long type as well, but your stamp attribute
probably will be a large number...<< I tried it but in my use case, I got the same
results. I guess that it must be interesting, if I
serialiaze/deserialiaze many more objects.
Also, if Coherence serializes an
ExternalizableLite object, it writes out its
class-name (except if it is a Coherence XmlBean). If
you define your key as an XmlBean, and add your class
into the classname cache configuration in
ExternalizableHelper.xml, then instead of the
classname, only an int will be written. This way you
can spare a large percentage of bandwidth consumed by
transferring your key instance as it has only a small
number of attributes. For the value object, it might
or might not be so relevant, considering that it will
probably contain many more attributes. However, in
case of a lite event, the value is not transferred at
all.<< I tried it too and in my use case, I noticed that
we get objects nearly twice lighter than an
ExternalizableLite object but it's slower to get
them. But it is very intersting to keep in mind, if
we would like to reduce the network traffic.
Yes, these are minor differences at the moment.
As for the performance of XMLBean, it is a hack, but you might try overriding the readExternal/writeExternal method with your own usual ExternalizableLite implementation stuff. That way you get the advantages of the xmlbean classname cache, and avoid its reflection-based operation, at the cost of having to extend XMLBean.
Also, sooner or later the TCMP protocol and the distributed cache storages will also support using PortableObject as a transmission format, which enables using your own classname resolution and allow you to omit the classname from your objects. Unfortunately, I don't know when it will be implemented.
>
But finally, I guess that I found the best solution
for my specific use case which is to use a map
listener for a key which has no time stamp, but since
the time stamp is never null, I had just to check
properly the time stamp in the equals method.
I would still recommend to use a separate key class, use a custom filter which accesses only the key and not the value, and if possible register a lite listener instead of a heavy one. Try it with a much heavier cached value class where the differences are more pronounced.
Best regards,
Robert -
How do I listen for changes in a container's components?
I have a JScrollPane that contains a JTextPane. I want any Container that can possibly contain my JScrollPane to be able to listen for changes in the JTextPane's Document.
For example, at the moment I'm using a JTabbedPane to hold a number of my JScrollPanes and I want to alter the tab title when any associated JScrollPane-JTextPane-Document is updated.
Any suggestions on how best to handle this?I would use a controller object that manages all your gui components (tabs, scrolls, documents, text panes). Your controller object can register as a listener to the appropriate component, and when it changes, update the title of a tab (or do whatever else) as appropriate.
Never put business logic like this stuff inside the actual gui components. Create, layout, etc. all the gui components (and related components like Document) from another controller like object instead. It makes handling the various listener stuff like this much easier. Read up on MVC (model view controller) stuff for more info.
As for the actual mechanics, you could get the document that is used in the JTextPane and register as a DocumentListener. As a document listener, you get notified of all changes that are made to that document. -
"Object Picker cannot open because no locations from which to choose objects can be found"
Hi,
When I try in AD management console in the domain controller to add a new group for a user I get the following error:
"Object Picker cannot open because no locations from which to choose objects can be found" error message when you try to select objects from an Active Directory domain in Windows 2000
Our domain controller is a W2000 cluster (two W2000 advanced server machines) and this happens in one of the nodes of the controller while in the other node it Works well (the difference between them is where it fails, has the resources: print,
file sharing and quorum services). Both nodes of the controller have the remote registry service disabled and in the node where it fails when you start this service it works well but I don`t think this is the reason because in the other node with remote registry
service disabled it works. Solutions from the following support articles don`t work:
kb 263231
kb 284914
I have checked that the situation is independent of the domain administrator who tries to add the group to the user.
Can anybody help me? Which is the reason of this different behaviour from one cluster node to another ?
Thanks.Hi Milos,
Thanks for your answer but I think this is not the case because the problem is not with NTFS and we don' have these problems:
Users or groups that have Full Control access cannot delegate permissions.
Users who have Full Control access cannot make permission changes on a DFS share.
If you give the non-privileged user the right to log on locally and you log on locally to the file server where the error message occurs, you can successfully edit the ACL.
It only happens with the AD management console. Now, for us it is not posible to upgrade the system. -
Hi,
system i am using for Oracle SOA is :
Windows 64 Bit
i5 Processor
6 GB RAM
29 GB on C Drive is already free after installation of all SOA related products.
I have installed wlserver_10.3 for SOA 11g Development purpose and followed exact installation sequence and procedure as mention in oracle documentation
i created domain also and every thing look correct but after installation procedure there are "Additional actions required just after every thing installed" :
setting memory limit
starting weblogic server (Admin Server)
starting weblogic managed server
and so on
now Problem is when i execute C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin startWebLogic.cmd
as mention in oracle documentation i am getting following error message : (i have only included last error lines instead of complete console log)
oConsole= -Dweblogic.ext.dirs=C:\Oracle\MIDDLE~1\patch_wls1036\profiles\default\
sysext_manifest_classpath;C:\Oracle\MIDDLE~1\patch_oepe180\profiles\default\syse
xt_manifest_classpath;C:\Oracle\MIDDLE~1\patch_ocp371\profiles\default\sysext_ma
nifest_classpath;C:\Oracle\MIDDLE~1\patch_adfr1111\profiles\default\sysext_manif
est_classpath weblogic.Server
Listening for transport dt_socket at address: 8453
Exception in thread "main" java.lang.NoClassDefFoundError: vXmx512m
Caused by: java.lang.ClassNotFoundException: vXmx512m
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: ++Xmx512m. Program will exit.
Now to resolve this what i already tried are :
I change JAVA_HOME and PATH to jdk6 which came with web logic installer
Location is at :
JAVA_HOME : C:\Oracle\Middleware\jdk160_29
PATH : C:\Oracle\Middleware\jdk160_29\bin
The above dose not include any space between path
I ran the startWebLogic.cmd and got same error
After that I also added
CLASSPATH : C:\Oracle\Middleware\jdk160_29\lib\tool.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\jdk160_29\bin
WL_HOME: C:\Oracle\Middleware\wlserver_10.3
I ran the startWebLogic.cmd and got same error
I also used earlier path which I used with eclipse when I was working on other java development.
JAVA_HOME : C:\Program Files\Java\jdk1.7.0_21
PATH : C:\Program Files\Java\jdk1.7.0_21\bin
I ran the startWebLogic.cmd and got same error
Then I also gave PATH: C:\Oracle\Middleware\wlserver_10.3\server\lib (including the existing one using ; )
I ran the startWebLogic.cmd and got same error
Now may be there is a file called setSOADomainEnv.cmd in
< C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\ setSOADomainEnv.cmd>
That include some values for memory set :
set JAVA_OPTIONS=%JAVA_OPTIONS%
set DEFAULT_MEM_ARGS=-Xms512m –Xmx512m
set PORT_MEM_ARGS=-Xms512m –Xmx768m
if "%JAVA_VENDOR%" == "Oracle" goto OracleJVM
set DEFAULT_MEM_ARGS=%DEFAULT_MEM_ARGS% -XX:PermSize=128m -XX:MaxPermSize=768m
set PORT_MEM_ARGS=%PORT_MEM_ARGS% -XX:PermSize=256m -XX:MaxPermSize=768m
now as I change the red highlighted value to 512 value because I have less memory resource and I checked in installation documentation to change the above red highlighted value to 512 original is 1024 which is too high and it was crating problem and showing memory space problem so I change it to 512 and now I am not getting that memory space problem error but may be the above error is related with change value in setSOADomainEnv.cmd file or not
Following are my domain, weblogic and soa home directory path and all these path are exactly what it suppose to be according to Oracle Installation Documentation:
WebLogic :
C:\Oracle\Middleware\wlserver_10.3
C:\Oracle\Middleware\coherence_3.7
C:\Oracle\Middleware\oepe_11.1.1.8.0
SOA Oracle Home Directory :
C:\Oracle\Middleware\Oracle_SOA1
OSB Home Location :
C:\Oracle\Middleware\Oracle_OSB1
Domain name : soa_div_domain
Domain Location : C:\Oracle\Middleware\user_projects\domains
Application Location : C:\Oracle\Middleware\user_projects\applications
Domain Location: C:\Oracle\Middleware\user_projects\domains\soa_div_domain
form here i am trying to start weblogic : C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\startWebLogic.cmd
Please tell me any body want more details.
Thanks.I think you are missing a character '-'
USER_MEM_ARGS="Xms512m -Xmx512m -XX:MaxPermSize=128m"Add this character like follows
"-Xms512m -Xmx512m -XX:MaxPermSize=128m" -
Listening for the end of a movie
Hi, I have some code that loads a movieclip into an empty
clip
var container:MovieClip =
this.createEmptyMovieClip("container", this.getNextHighestDepth());
container.attachMovie("twdc_mc", "twdc_mc", 1, {_x:300,
_y:275});
then i want to wait until the end of the movieclip, unload it
and load another in its place - all without leaving frame one of my
main timeline...so my initial thought was to add this:
function getframes(numFrames,totalFrames) {
if (numFrames == totalFrames){
trace("removed") //changed the return variable to this for
testing
container.twdc_mc.onEnterFrame =
getframes(container.twdc_mc._currentframe,container.twdc_mc._totalframes);
(the use of a function because i want to re-use it)
the problem is that the if statement is parsed and evaluated
to false immediately, then it moves on to the next statement
without looking back despite the existance of the onEnterFrame
function
So my question is how can I listen for this event without the
need to add unLoad or removeMovieClip to the end of the offending
mc?
Thankyou in advance for any replies, I'm trying hard to get
to grips with "as" but Im a php boy at heart and really struggling!
SamHi Sam,
in AS, you can't pass parameters to an event or callback
function like onEnterFrame this way. You can either pass a function
reference (without brackets, otherwise the function would execute
immediately and the event is undefined after that):
container.twdc_mc.onEnterFrame = getframes;
or define a function 'on the fly':
container.twdc_mc.onEnterFrame = function(){
Since you want to use the first way, getframes() can't have
any parameters, but instead it can use the scope of the event it is
bound to through the 'this' keyword:
function getframes() {
// trace(this._totalframes);
if (this._currentframe == this._totalframes){
trace("removed")
Now 'this' depends on the scope in which getframes() is
called, so you can use it with the onEnterFrame event of the loaded
clip:
container.twdc_mc.onEnterFrame = getframes;
and it will compare twdc_mc's position to it's end. Bound to
another MC it would take that MC's values.
cheers,
blemmo -
Here are the things I will do with this laptop:
-Writing essays for college (which will be a lot)
-PowerPoints
-Personal Writing (Stories and things like that)
-Internet Surfing and Research (which means multiple tabs at a time)
-Watching Videos and Streaming Anime (DVDs, Hulu, Crunchyroll, etc)
-Downloads (PDFs)
-I don't play games.
So, with all of this in mind, what kind of specs and OS would be best? I will admit to not knowing a lot about computers and what's needed to do what I want, or much about the technicalities. I do know that I will be using 8gb of RAM, though I am not sure about HDD vs. SSD. I've basically been living off my iPad for Internet and stuff for the past two years and writing my papers at campus, but now that I'm going to be taking more English and writing-based classes, I'm going to need a laptop.There's only one non-Retina MacBook Pro being sold by Apple now - the 13" on the left of the Apple Store page for MBPs.
If I were you, I would look for a refurbished 2012 15" from Apple. You can add RAM and a SSD (should you choose) yourself.
Clinton -
How do I listen for change in the global position of a Node
Hi there,
I want to create a Wire/Connection node between two scene nodes. I want this Wire node to be updated when one of the nodes is moving. In the common scenario I would listen for change events in the target nodes position and update the Wire :
targetNode1.translateXProperty().addListener(new ChangeListener<Number>() {
public void changed(ObservableValue value, Number oldValue, Number newValue) {
wire.setStartX(targetNode1.getTranslateX());
wire.setStartX(targetNode1.getTranslateY());
wire.setEndX(targetNode2.getTranslateX());
wire.setEndY(targetNode2.getTranslateY());
The problem is that the target nodes are children of another container nodes(that are actually moving). So listening for change events in the translate properties of the target nodes does not work(their parent nodes are actually moving)
Is there way to listent for change in the global position of the target nodes relative to the Scene?It sounds very similar to a problem I posted about earlier...
How to implement a UI similar to a UML Diagram with connections?
I ended up making my own special bounds property, that updates when the parent's special bounds property changes.
I also had to listen to the parentProperty change event to add/remove my listener on the parent node.
All in all, a pain in the butt. There should be an easier way.
The shortcoming of the solution is that all the nodes in the hierarchy must have my special bounds property implemented (ie. they're all classes under my codebase such that I can implement it), which for the moment is true... I'd like a cleaner solution however. -
Port of the TNS Listener for the second SAP system
Hello!
I had problems during the installation of the second SAP system with second Oracle DB on the same host (OP is SOLARIS).
The error occurs was faced with TNS Listener.
(> error: TNS Listener is started)
Which settings are applied for the TNS Listener per default in SAPINST?
(e.g. on the same port)
Which settings should I apply in SAPINST for TNS Listener, e.g. configure an another port?
Thank you very much!
regards
ThomHello!
Thank you very much!
Even that is the question.
1) If I have selected "ok" during the installation and no further values selected, will SAPINST check whether the Port 1527 is allocated by the first SAP System and create the second Port 1528?
2) Do I have one TNS Listener with two file entries or two TNS Listener?
Thank you very much!
regards
Thom -
Multiple Buttons in JTable Headers: Listening for Mouse Clicks
I am writing a table which has table headers that contain multiple buttons. For the header cells, I am using a custom cell renderer which extends JPanel. A JLabel and JButtons are added to the JPanel.
Unfortunately, the buttons do not do anything. (Clicking in the area of a button doesn't appear to have any effect; the button doesn't appear to be pressed.)
Looking through the archives, I read a suggestion that the way to solve this problem is to listen for mouse clicks on the table header and then determine whether the mouse clicks fall in the area of the button. However, I cannot seem to get coordinates for the button that match the coordinates I see for mouse clicks.
The coordinates for mouse clicks seem to be relative to the top left corner of the table header (which would match the specification for mouse listeners). I haven't figured out how to get corresponding coordinates for the button. The coordinates returned by JButton.getBounds() seem to be relative to the top left corner of the panel. I hoped I could just add those to the coordinates for the panel to get coordinates relative to the table header, but JPanel.getBounds() gives me negative numbers for x and y (?!?). JPanel.getLocation() gives me the same negative numbers. When I tried JPanel.getLocationOnScreen(), I get an IllegalComponentStateException:
Exception in thread "AWT-EventQueue-0" java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location
Can someone tell me how to get coordinates for the button on the JTableHeader? Or is there an easier way to do this (some way to make the buttons actually work so I can just use an ActionListener like I normally would)?
Here is relevant code:
public class MyTableHeaderRenderer extends JPanel implements TableCellRenderer {
public MyTableHeaderRenderer() {
setOpaque(true);
// ... set colors...
setBorder(UIManager.getBorder("TableHeader.cellBorder"));
setLayout(new FlowLayout(FlowLayout.LEADING));
setAlignmentY(Component.CENTER_ALIGNMENT);
public Component getTableCellRendererComponent(JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column){
if (table != null){
removeAll();
String valueString = (value == null) ? "" : value.toString();
add(new JLabel(valueString));
Insets zeroInsets = new Insets(0, 0, 0, 0);
final JButton sortAscendingButton = new JButton("1");
sortAscendingButton.setMargin(zeroInsets);
table.getTableHeader().addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e) {
Rectangle buttonBounds = sortAscendingButton.getBounds();
Rectangle panelBounds = MyTableHeaderRenderer.this.getBounds();
System.out.println(Revising based on (" + panelBounds.x + ", "
+ panelBounds.y + ")...");
buttonBounds.translate(panelBounds.x, panelBounds.y);
if (buttonBounds.contains(e.getX(), e.getY())){ // The click was on this button.
System.out.println("Calling sortAscending...");
((MyTableModel) table.getModel()).sortAscending(column);
else{
System.out.println("(" + e.getX() + ", " + e.getY() + ") is not within "
+ sortAscendingButton.getBounds() + " [ revised to " + buttonBounds + "].");
sortAscendingButton.setEnabled(true);
add(sortAscendingButton);
JButton button2 = new JButton("2");
button2.setMargin(zeroInsets);
add(button2);
//etc
return this;
}I found a solution to this: It's the getHeaderRect method in class JTableHeader.
table.getTableHeader().addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e) {
Rectangle panelBounds = table.getTableHeader().getHeaderRect(column);
Rectangle buttonBounds = sortAscendingButton.getBounds();
buttonBounds.translate(panelBounds.x, panelBounds.y);
if (buttonBounds.contains(e.getX(), e.getY()) && processedEvents.add(e)){ // The click was on this button.
((MyTableModel) table.getModel()).sortAscending(column);
}); -
With big apps it's boring to wait 10 minutes to package ios app just to be able to retry something. Is there a way to make flash builder listen for usb debugging like after the debug packaging bug without re-package ?
Just FYI, Whatsapp is not free indefinitely even on Android phones. They give a one-year trial period after which you have to pay per year for the subscription (a miniscule amount, but you have to pay nonetheless), whereas with the iOS app you pay once up front and then don't have to pay again. So in the long run, the iOS version comes out cheaper (at least unless Whatsapp changes their pricing model). And also just FYI, Whatsapp doesn't work on the iPod touch, only on the iPhone.
In any case, as planb77 said, pricing is totally up to the developer of the app. It's completely the developer's choice what price to charge for an app.
Regards. -
Advice to implement a mouse listener for card game
Hi,
I am wondering about the best way to apply a mouselistener in my card game.
- i only want to listen for 'clicks'
- I have a JFrame with a JPanel inside. The JPanel has a null layout and many JLabels. The JLabels are the cards, i want to listen for mouse clicks on these 'cards'
I have seen it is not possible to apply a mouse listener to a JPanel or JLabel so is the most efficient way to apply the listener to the JFrame and then use getComponent () to determine which JLabel has been clicked ? or is there a better way ?
any thoughts appreciated . .hey dubai, thanks for your quick help today, it is much appreciated !
i know the event should provide a reference to the source, i use the toString to overide the methods in the mouseEvent object and im printing this string to the console. It gives me the correct dimensions within my JPanel of where i clicked but the source is always given as the panel name. Have you any idea why it does not return the name of the JLabel ? I checked out the Action interface, thanks, it cud be very useful to seperate the code by using this.
Maybe you are looking for
-
My computer and ipod were stolen and im trying to download library from to new computer without device to sync with is this possible? i already addd new computer to account but its showing empty library
-
ITunes doesn't open when I tell it to.
My itunes will not open or start when I click on it. It has worked before, so I don't understand why it's not working now. Has anybody else had this problem or know how to fix it?
-
Hi all, While initializing NI PXI-4130 power source I got the error "Error -1073807343 occurred at niDCPower Initialize With Channels.vi". The routine is in a sub VI already working since two years. No problem accessing the supply with NI-DCPower Sof
-
Issue with Calendar Invites after changing a user's name
Hey all, Strange issue we are having (Exchange 2007). One of the employees got married and had a name change. I changed the name in AD Users & Computers, updated the mailbox, etc. Now, when someone invites her via an Outlook Calendar Invite, she gets
-
Hi, Can anyone tell me how to preserve the list of structured tags in the PDF Setup > Tags windows? I'd like the paragraph formats and structure I set up to become part of the template, so that it is always the default for new files I create from the