java awt

search for more blogs here

 

"how can i get jcomponent from java.awt.Component" posted by ~Ray
Posted on 2008-11-13 12:15:51

hi ,i am developing viedio conferencing i got class castexception to cast JConponent from java awt. Component ple suggest me. Component component = processor getVisualComponent();JComponent swingComponent =(JComponent) component;it throws classCastException i am using swing awt component is difficult to set layout(possining to perticular area) so i need swing componend ple send code regards bala Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5231156

comments | Add comment | Report as Spam


"About Apple JAVA6 and OSX Leopard." posted by ~Ray
Posted on 2008-03-12 23:06:50

I just updated my MBP to the latest Apple’s OS 10 ( leopard ) the system is good few eye-candies updates although was a bit disappointing don’t see java6 around ( they removed the early beta version from ADC as come up so don’t expend your time looking for it). Apple. I don’t care about java6 for now you can decelerate it until you make it good. BUT… man when you delivery something with your OperatingSystem make sure that this thing works. I got really angry with a BUGGED java5 version the exactly version is java version “1.5.0_13″Java(TM) 2 Runtime Environment. Standard Edition (build 1.5.0_13-b05-237)Java HotSpot(TM) Client VM (build 1.5.0_13-119 mixed mode sharing) This bug looks desire its deep inside Apple’s windowing toolkit implementation as you can see in the following stack trace Exception in thread “AWT-EventQueue-0″ java lang. NullPointerExceptionat apple awt. CGraphicsEnvironment displayChanged(CGraphicsEnvironment java:65)remove memory find of location 00000000 eip=00000000at apple awt. CToolkit$4 run(CToolkit java:1259)at java awt event. InvocationEvent dispatch(InvocationEvent java:209)at java awt. EventQueue dispatchEvent(EventQueue java:461)at java awt. EventDispatchThread pumpOneEventForHierarchy(EventDispatchThread j ava:269)at java awt. EventDispatchThread pumpEventsForHierarchy(EventDispatchThread java:190)at java awt. EventDispatchThread pumpEvents(EventDispatchThread java:184)at java awt. EventDispatchThread pumpEvents(EventDispatchThread java A guy from GWT dev list submitted a bug report to Apple: Problem ID 5563333 - “CGraphicsEnvironment NullPointerException breaks continually on OsX 10.5″ so engineers and QA move your asses and get this thing done because you are affecting my work and some more guys around the world.

Forex Groups - Tips on Trading

Related article:
http://fmeyer.org/archives/2007/10/29/about-apple-java6-and-crap/

comments | Add comment | Report as Spam


"About Apple JAVA6 and OSX Leopard." posted by ~Ray
Posted on 2008-03-12 23:06:50

I just updated my MBP to the latest Apple’s OS 10 ( leopard ) the system is good few eye-candies updates although was a bit disappointing don’t see java6 around ( they removed the early beta version from ADC as well so don’t expend your time looking for it). Apple. I don’t care about java6 for now you can decelerate it until you make it good. BUT… man when you delivery something with your OperatingSystem alter sure that this thing works. I got really angry with a BUGGED java5 version the exactly version is java version “1.5.0_13″Java(TM) 2 Runtime Environment. Standard Edition (build 1.5.0_13-b05-237)Java HotSpot(TM) Client VM (create 1.5.0_13-119 mixed mode sharing) This bug looks like its deep inside Apple’s windowing toolkit implementation as you can see in the following stack trace Exception in go “AWT-EventQueue-0″ java lang. NullPointerExceptionat apple awt. CGraphicsEnvironment displayChanged(CGraphicsEnvironment java:65)remove memory access of location 00000000 eip=00000000at apple awt. CToolkit$4 run(CToolkit java:1259)at java awt event. InvocationEvent dispatch(InvocationEvent java:209)at java awt. EventQueue dispatchEvent(EventQueue java:461)at java awt. EventDispatchThread pumpOneEventForHierarchy(EventDispatchThread j ava:269)at java awt. EventDispatchThread pumpEventsForHierarchy(EventDispatchThread java:190)at java awt. EventDispatchThread pumpEvents(EventDispatchThread java:184)at java awt. EventDispatchThread pumpEvents(EventDispatchThread java A guy from GWT dev list submitted a bug inform to Apple: Problem ID 5563333 - “CGraphicsEnvironment NullPointerException breaks continually on OsX 10.5″ so engineers and QA act your asses and get this thing done because you are affecting my work and some more guys around the world.

Forex Groups - Tips on Trading

Related article:
http://fmeyer.org/archives/2007/10/29/about-apple-java6-and-crap/

comments | Add comment | Report as Spam


"Convert Java.AWT.Color to HEX String" posted by ~Ray
Posted on 2007-12-15 15:00:13

"SELECT * FROM flowchart WHERE ProcesID = " + ProcesID;System out println(sql);ResultSet resultset = statement executeQuery(sql); which I found somewhere on the internet. now I want to deliver cram to the database. which needs a varchar(10)how do I get the correct value? Hi you can use the int r,g and b values of the color convert them to a hexstring and put them back together. alter sure to check that each of your hexstring has the length 2. String red = Integer toHexString(color getRed());String green = Integer toHexString(alter getGreen());arrange color = Integer toHexString(alter getBlue()); + Integer toHexString(R) + Integer toHexString(G) + Integer toHexString(B); Jan. Gressmann wrote:Hi you can use the int r,g and b values of the alter alter them to a hexstring and put them approve together. alter sure to analyse that each of your hexstring has the length 2. String red = Integer toHexString(color getRed());arrange green = Integer toHexString(alter getGreen());arrange color = Integer toHexString(color getBlue()); Jan. Gressmann wrote:Hi you can use the int r,g and b values of the alter alter them to a hexstring and put them back together. alter sure to check that each of your hexstring has the length 2. String red = Integer toHexString(color getRed());arrange color = Integer toHexString(alter getGreen());String blue = Integer toHexString(alter getBlue()); Unless otherwise licensed code in all technical manuals herein (including articles. FAQs samples) is provided under this.

Forex Groups - Tips on Trading

Related article:
http://forum.java.sun.com/thread.jspa?threadID=5231087

comments | Add comment | Report as Spam


"Java 1.6 focus after JOptionPane.showMessageDialog" posted by ~Ray
Posted on 2007-12-09 13:32:19

In 1.6 when you pass null as the parent component to JOptionPane showMessageDialog the cerebrate after clicking the Ok add goes to the top level window. In 1.4 and 1.5 the focus went to the measure component to have cerebrate before the communicate dialog was opened. Here is a small example program. JFrameFocusTest(); jFrameFocusTest1 setLocation(200,200); jFrameFocusTest1 show(); JFrameFocusTest jFrameFocusTest2 = JFrameFocusTest(); jFrameFocusTest2 jLabelWindowName setText( ); jLabelWindowName setHorizontalAlignment(SwingConstants. CENTER); jLabelWindowName setHorizontalTextPosition(SwingConstants. CENTER); jButtonOpenDialog setText( ); this getContentPane() add(jLabelWindowName. BorderLayout. CENTER); this getContentPane() add(jButtonOpenDialog. BorderLayout. SOUTH); jButtonOpenDialog addActionListener( In the above inspect I know how to make it bring home the bacon like I expected but in my real label I sometimes undergo communicate dialogs called without a reference to the specific window that called them. Does anyone know why this functionality was dress for 1.6?BTW. I am running windows xp. Thanksbill I am using 1.6.0_03-b05 on windows xp but my label is compiled with 1.4.2_04. This showed up as soon as my users started to update to 1.6. I've tried the testcase provided. Here's what I see: regardless of which toplevel's buttonI press focus always returns to the first toplevel after closing the dialog. This is indeed not reproducible with JDK 5.0 and what's interesting this is alsonot reproducible with JDK 7.0 b15 and greater. I've filed a bug against the problem: 6620328 (not yet available at bugs sun com). Thanks,Anton swing@javadesktop org wrote:> I am using 1.6.0_03-b05 on windows xp but my label is compiled with 1.4.2_04. This showed up as soon as my users started to update to 1.6.> [Message sent by forum member 'account9000' (account9000)]> > | | | | | Your use of this web site or any of its content or software indicates your agreement to be move by these. procure © 1995-2006 Sun Microsystems. Inc.

Forex Groups - Tips on Trading

Related article:
http://forums.java.net/jive/thread.jspa?messageID=241544&tstart=0#241544

comments | Add comment | Report as Spam


"Java 1.6 focus after JOptionPane.showMessageDialog" posted by ~Ray
Posted on 2007-12-09 13:32:19

In 1.6 when you pass null as the parent component to JOptionPane showMessageDialog the cerebrate after clicking the Ok add goes to the top level window. In 1.4 and 1.5 the focus went to the last component to have cerebrate before the communicate dialog was opened. Here is a small example schedule. JFrameFocusTest(); jFrameFocusTest1 setLocation(200,200); jFrameFocusTest1 show(); JFrameFocusTest jFrameFocusTest2 = JFrameFocusTest(); jFrameFocusTest2 jLabelWindowName setText( ); jLabelWindowName setHorizontalAlignment(SwingConstants. CENTER); jLabelWindowName setHorizontalTextPosition(SwingConstants. CENTER); jButtonOpenDialog setText( ); this getContentPane() add(jLabelWindowName. BorderLayout. bear on); this getContentPane() add(jButtonOpenDialog. BorderLayout. SOUTH); jButtonOpenDialog addActionListener( In the above case I experience how to make it work desire I expected but in my real code I sometimes have communicate dialogs called without a reference to the specific window that called them. Does anyone experience why this functionality was change for 1.6?BTW. I am running windows xp. Thanksbill I am using 1.6.0_03-b05 on windows xp but my code is compiled with 1.4.2_04. This showed up as soon as my users started to update to 1.6. I've tried the testcase provided. Here's what I see: regardless of which toplevel's buttonI press focus always returns to the first toplevel after closing the dialog. This is indeed not reproducible with JDK 5.0 and what's interesting this is alsonot reproducible with JDK 7.0 b15 and greater. I've filed a bug against the problem: 6620328 (not yet available at bugs sun com). Thanks,Anton displace@javadesktop org wrote:> I am using 1.6.0_03-b05 on windows xp but my label is compiled with 1.4.2_04. This showed up as soon as my users started to update to 1.6.> [Message sent by forum member 'account9000' (account9000)]> > | | | | | Your use of this web place or any of its circumscribe or software indicates your agreement to be bound by these. Copyright &write; 1995-2006 Sun Microsystems. Inc.

Forex Groups - Tips on Trading

Related article:
http://forums.java.net/jive/thread.jspa?messageID=241544&tstart=0#241544

comments | Add comment | Report as Spam


"Java 1.6 focus after JOptionPane.showMessageDialog" posted by ~Ray
Posted on 2007-12-09 13:32:19

In 1.6 when you pass null as the parent component to JOptionPane showMessageDialog the focus after clicking the Ok button goes to the top aim window. In 1.4 and 1.5 the cerebrate went to the measure component to have cerebrate before the message dialog was opened. Here is a small example program. JFrameFocusTest(); jFrameFocusTest1 setLocation(200,200); jFrameFocusTest1 show(); JFrameFocusTest jFrameFocusTest2 = JFrameFocusTest(); jFrameFocusTest2 jLabelWindowName setText( ); jLabelWindowName setHorizontalAlignment(SwingConstants. CENTER); jLabelWindowName setHorizontalTextPosition(SwingConstants. CENTER); jButtonOpenDialog setText( ); this getContentPane() add(jLabelWindowName. BorderLayout. CENTER); this getContentPane() add(jButtonOpenDialog. BorderLayout. SOUTH); jButtonOpenDialog addActionListener( In the above case I know how to make it bring home the bacon desire I expected but in my real label I sometimes have communicate dialogs called without a compose to the specific window that called them. Does anyone experience why this functionality was dress for 1.6?BTW. I am running windows xp. Thanksbill I am using 1.6.0_03-b05 on windows xp but my code is compiled with 1.4.2_04. This showed up as soon as my users started to modify to 1.6. I've tried the testcase provided. Here's what I see: regardless of which toplevel's buttonI touch focus always returns to the first toplevel after closing the dialog. This is indeed not reproducible with JDK 5.0 and what's interesting this is alsonot reproducible with JDK 7.0 b15 and greater. I've filed a bug against the problem: 6620328 (not yet available at bugs sun com). Thanks,Anton swing@javadesktop org wrote:> I am using 1.6.0_03-b05 on windows xp but my code is compiled with 1.4.2_04. This showed up as soon as my users started to update to 1.6.> [communicate sent by forum member 'bill9000' (account9000)]> > | | | | | Your use of this web place or any of its circumscribe or software indicates your agreement to be bound by these. Copyright © 1995-2006 Sun Microsystems. Inc.

Forex Groups - Tips on Trading

Related article:
http://forums.java.net/jive/thread.jspa?messageID=241544&tstart=0#241544

comments | Add comment | Report as Spam


"DFC exception from Java Applet" posted by ~Ray
Posted on 2007-11-27 19:56:39

Hi. I am a relatively new developer to DFC. I created simple test communicate to checkin/checkout a document from the circumscribe server. On a standalone java schedule it worked. On a applet that's run from the Java Applet Viewer it worked. When embeded into a HTML page the Java Console gave me these errors:DfException:: go: AWT-EventQueue-2; MSG: [DFC_SECURITY_FAILED_POLICY_UPDATE] Failed to update Java policy to give DFC. gratify grant DFC "getPolicy". "setPolicy" and "getProtectionDomain" permission; ERRORCODE: ff; NEXT: nullat com documentum fc common. DfException newFailedPolicyUpdateException(DfException java:248)at com documentum fc client security impl policy. PolicyConfigurator assemble(PolicyConfigurator java:58)at com documentum fc impl. RuntimeContext.<clinit>(RuntimeContext java:171)at com documentum fc client. DfClient.<clinit>(DfClient java:685)at com documentum com. DfClientX getLocalClient(DfClientX java:39)at org applet. SignApplet setupDFC(SignApplet java:69)at org applet. SignApplet doSomething(SignApplet java:98)at org applet. SignApplet jButton1ActionPerformed(SignApplet java:169)at org applet. SignApplet access$100(SignApplet java:26)at org applet. SignApplet$2 actionPerformed(SignApplet java:146)at javax swing. AbstractButton fireActionPerformed(Unknown obtain)at javax displace. AbstractButton$Handler actionPerformed(Unknown Source)at javax swing. DefaultButtonModel fireActionPerformed(Unknown Source)at javax swing. DefaultButtonModel setPressed(Unknown Source)at javax displace plaf basic. BasicButtonListener mouseReleased(Unknown obtain)at java awt. Component processMouseEvent(Unknown obtain)at javax swing. JComponent processMouseEvent(Unknown Source)at java awt. Component processEvent(Unknown obtain)at java awt. Container processEvent(Unknown Source)at java awt. Component dispatchEventImpl(Unknown Source)at java awt. Container dispatchEventImpl(Unknown obtain)at java awt. Component dispatchEvent(Unknown Source)at java awt. LightweightDispatcher retargetMouseEvent(Unknown Source)at java awt. LightweightDispatcher processMouseEvent(Unknown obtain)at java awt. LightweightDispatcher dispatchEvent(Unknown Source)at java awt. Container dispatchEventImpl(Unknown obtain)at java awt. Component dispatchEvent(Unknown obtain)at java awt. EventQueue dispatchEvent(Unknown Source)at java awt. EventDispatchThread pumpOneEventForFilters(Unknown Source)at java awt. EventDispatchThread pumpEventsForFilter(Unknown Source)at java awt. EventDispatchThread pumpEventsForHierarchy(Unknown Source)at java awt. EventDispatchThread pumpEvents(Unknown Source)at java awt. EventDispatchThread pumpEvents(Unknown Source)at java awt. EventDispatchThread run(Unknown Source)Caused by: java security. AccessControlException: find denied (java security. SecurityPermission getPolicy)at java security. AccessControlContext checkPermission(Unknown obtain)at java security. AccessController checkPermission(Unknown Source)at java lang. SecurityManager checkPermission(Unknown Source)at java security. Policy getPolicy(Unknown Source)at com documentum fc client security impl policy. AugmentedPolicy.<init>(AugmentedPolicy java:20)at com documentum fc client security impl policy. PolicyConfigurator$1 run(PolicyConfigurator java:43)at com documentum fc client security impl policy. PolicyConfigurator$1 run(PolicyConfigurator java:41)at java security. AccessController doPrivileged(Native Method)at com documentum fc client security impl policy. PolicyConfigurator configure(PolicyConfigurator java:38)... 32 moreThe path to dfc properties is already set and the code builds without problems. A previous error with the FileNotFoundException to dfc properties undergo been solved thanks to the helpful forum ppl here. I am using an unsigned applet. Is this the problem? Or do I be to specify a policy register to the applet? How do I specify a policy register for an applet embeded in an html or jsp summon? The code goes something like this:try{ idfclientx = new DfClientX (); idfclient = idfclientx getLocalClient (); sMgr = DFCUtils createSessionManager (DOCBASE. USERID. PASS idfclientx idfclient); session = sMgr getSession (DOCBASE); Perform checkin/checkout }catch(Exception e){ logTheError here }}Any help ordain be greatly appreciated. Thanks in go. I've signed the applet using the jarsigner drive that comes with the Sun JDK 6. Created an identity in the keystore and used it to write. When I fill up the signed jar file the same problem still appears. The strange thing is a create signed applet I created when opened up in a html summon. IE prompts me to accept or reject signature while the dfc applet does not cause IE to give the same cause. When verified against jarsigner using the following cmd: jarsigner -verify myapplet jar the jar is verified to be signed. Do I or is there anywhere that I be to set policy setting to the JRE or some DFC settings file to allow the applet to run? I've signed the applet using the jarsigner tool that comes with the Sun JDK 6. Created an identity in the keystore and used it to sign. When I fill up the signed jar register the same problem comfort appears. The strange thing is a dummy signed applet I created when opened up in a html page. IE prompts me to evaluate or evaluate signature while the dfc applet does not create IE to give the same prompt. When verified against jarsigner using the following cmd: jarsigner -verify myapplet jar the jar is verified to be signed. Do I or is there anywhere that I need to set policy setting to the JRE or some DFC settings register to accept the applet to run? Ahh thanks for your swift reply. I am using Sun's 1.6.03 for both the JDK and JRE. Anyway it seems like private signing the applet worked. Somehow the dfc properties FileNotFoundException reared its ugly head again. I included dfc properties and log4j properties into the src folder of Netbeans' project and everything worked desire magic! Ahh.. for once. I can act with my bring home the bacon. Thanks alot once again for taking up your measure.

Forex Groups - Tips on Trading

Related article:
http://forums.contology.com/index.php?showtopic=22590

comments | Add comment | Report as Spam


"Drawing a spiral" posted by ~Ray
Posted on 2007-11-17 15:27:17

You're currently browsing the Java section within the Software Development category of DaniWeb a massive community of 234,911 software developers web developers. Internet marketers and tech gurus who are all enthusiastic about making contacts networking and learning from each other. In fact there are 2,011 IT professionals currently interacting right now! If you are in the IT industry or are just a technology enthusiast you might find just what you're looking for in DaniWeb only takes a minute and lets you apply all of the interactive features of the site. import javax swing. JFrame;/** Test driver for Spiral class.*/public class SpiralViewer{ public static cancel main(String[] args) { JFrame frame = new JFrame(); final int FRAME_WIDTH = 400; final int FRAME_HEIGHT = 400; frame setSize(close in_WIDTH. FRAME_HEIGHT); frame setTitle("SpiralViewer"); frame setDefaultCloseOperation(JFrame. move_ON_change state); SpiralComponent component = new SpiralComponent(); frame add(component); close in setVisible(true); }} import javax swing. JFrame;/** Test driver for Spiral class.*/public class SpiralViewer{ public static void main(String[] args) { JFrame frame = new JFrame(); final int close in_WIDTH = 400; final int FRAME_HEIGHT = 400; frame setSize(FRAME_WIDTH. FRAME_HEIGHT); close in setTitle("SpiralViewer"); close in setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE); SpiralComponent component = new SpiralComponent(); frame add(component); frame setVisible(true); }} import javax swing. JComponent;import java awt. Graphics;import java awt. Graphics2D;import java awt geom. Point2D;import java awt geom. Line2D;public categorise SpiralComponent extends JComponent{ public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; final int INITIAL_SIZE = 10; int size = Math min(getWidth() getHeight()); SpiralGenerator gen = new SpiralGenerator( sign_SIZE new Point2D. Double(size / 2 size / 2)); while (true) { Line2D. Double segment = gen nextSegment(); if (!divide intersects(getBounds())) return; g2 draw(segment); } }} import javax swing. JComponent;import java awt. Graphics;import java awt. Graphics2D;import java awt geom. Point2D;import java awt geom. Line2D;public class SpiralComponent extends JComponent{ public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; final int INITIAL_coat = 10; int size = Math min(getWidth() getHeight()); SpiralGenerator gen = new SpiralGenerator( INITIAL_SIZE new Point2D. Double(coat / 2 size / 2)); while (true) { Line2D. Double segment = gen nextSegment(); if (!segment intersects(getBounds())) return; g2 draw(segment); } }} import java awt geom. Point2D;import java awt geom. Line2D;public categorise SpiralGenerator{ /** Creates a turn generator. @param initialSize the coat of the first (shortest) divide of the turn in pixels @param start the starting inform of the spiral */ public SpiralGenerator(double initialSize. Point2D. Double start) { init = start; size = initialSize; } /** Returns the next segment of the turn. @return the next segment */ public Line2D. Double nextSegment() { lie2D. Double test = new Line2D. Double(0.0,0.0,0.0,0.0); return test; } // private implementation private double size; private inform2D. Double init;} import java awt geom. Point2D;import java awt geom. Line2D;public class SpiralGenerator{ /** Creates a turn generator. @param initialSize the size of the first (shortest) segment of the spiral in pixels @param start the starting point of the turn */ public SpiralGenerator(double initialSize. Point2D. manifold start) { init = start; coat = initialSize; } /** Returns the next segment of the spiral. @return the next segment */ public Line2D. manifold nextSegment() { Line2D. Double test = new Line2D. Double(0.0,0.0,0.0,0.0); go test; } // private implementation private double size; private Point2D. Double init;} import java awt geom. inform2D;merchandise java awt geom. lie2D;public categorise SpiralTester{ public static cancel main(String[] args) { SpiralGenerator gen = new SpiralGenerator(10 new inform2D. manifold(100. 100)); Line2D line = gen nextSegment(); System out println(line getX1()); System out println("Expected: 100"); System out println(line getY1()); System out println("Expected: 100"); System out println(line getX2()); System out println("Expected: 110"); System out println(line getY2()); System out println("Expected: 100"); lie = gen nextSegment(); System out println(line getX1()); System out println("Expected: 110"); System out println(lie getY1()); System out println("Expected: 100"); System out println(lie getX2()); System out println("Expected: 110"); System out println(line getY2()); System out println("Expected: 90"); }} import java awt geom. Point2D;import java awt geom. Line2D;public categorise SpiralTester{ public static cancel main(String[] args) { SpiralGenerator gen = new SpiralGenerator(10 new Point2D. manifold(100. 100)); Line2D lie = gen nextSegment(); System out println(line getX1()); System out println("Expected: 100"); System out println(lie getY1()); System out println("Expected: 100"); System out println(line getX2()); System out println("Expected: 110"); System out println(lie getY2()); System out println("Expected: 100"); lie = gen nextSegment(); System out println(lie getX1()); System out println("Expected: 110"); System out println(line getY1()); System out println("Expected: 100"); System out println(line getX2()); System out println("Expected: 110"); System out println(lie getY2()); System out println("Expected: 90"); }} There are two different ways you can approach drawing the spiral.1) Using to be the path from a fixed arrange system in which you define the coordinates of the segments to be drawn on a fixed x-y plane.2) Using arrange transformations (. ) to alter the coodinate system as you draw each divide. With translation and rotation drawing the path becomes trivial. You simply displace a lie in a fixed direction (which ever way you want to go from your origin desire 0,0 to 0,100 translate to the end of that line rotate 90 deg left or right draw a slightly shorter lie in the same direction as the first (perhaps 0,0 to 0,90) and act until you reach the endpoint you be. By moving and rotating your origin as you displace you only have to draw increasingly shorter line segments in the direction of path traversal. There are some examples of using coordinate transforms here:wish that helps get you started.

Forex Groups - Tips on Trading

Related article:
http://www.daniweb.com/forums/thread94132.html

comments | Add comment | Report as Spam


"Re: [JAVA2D] Why was java.awt.geom.GeneralPath made final?" posted by ~Ray
Posted on 2007-11-09 17:13:09

It is made final to fasten in its implementation since internal coderelies on its internal structure. In 1.6 it is just a thin veneer over Path2D. Float which is not final(though its implementation-based methods are final). Out of curiosity - why are you wanting to subclass it? .. jimOlivier Lefevre wrote:> affect says it all.>> Thanks,>> -- O. L.>> ===========================================================================> To unsubscribe displace email to listserv@java sun com and include in the be> of the message "signoff JAVA2D-INTEREST". For command back up displace telecommunicate to> listserv@java sun com and consider in the be of the communicate "back up".===========================================================================To unsubscribe send email to listserv@java sun com and consider in the bodyof the message "signoff JAVA2D-INTEREST". For command back up send email tolistserv@java sun com and include in the body of the communicate "back up". Olivier Lefevre wrote:>> It is made final to fasten in its implementation since internal code>> relies on its internal structure.>> Eh? That could be said of almost any categorise with internal express. In some cases for efficiency code outside of the categorise can go insideits internal representation and get answers without calling the publicmethods. In this inspect native code can find the arrange of coordinatesdirectly without having to do upcalls to the Java methods to get thegeometry and the performance is much improved. If the categorise were not final then there would be a danger that someonemight undergo subclassed it and be returning different information from themethods which conflicts with the information one might assume from theinternal data structures. To prevent that contradiction the class (orthe associated methods) are made final. Most classes with internal express are accessed through their methodsexclusively so they don't have this potential problem. A real world inspect where the lack of "final" may be hurting us isColor createContext(). It was not made final because of historicalissues with how SystemColor was implemented. A lot of code internallysees a alter object and immediately knows how to perform the operation. Unfortunately some developers believe that since createContext() isnot final then they can subclass it and decree createContext() toreturn say the context of a GradientPaint and then move a Color into agradient. Unfortunately this fails whenever code does "instanceofColor" and then takes an optimal Color-specific path which never callsthe createContext() method. It's almost worth retroactively making themethod final (as of 1.6 it now no longer needs to be subclassed inSystemColor any more) but that would end binary compatibility... .. jim===========================================================================To unsubscribe displace telecommunicate to listserv@java sun com and consider in the bodyof the communicate "signoff JAVA2D-INTEREST". For general help displace email tolistserv@java sun com and consider in the be of the message "back up". Hi Jim. Thanks for telling us about the reasons behind the API construction. If you undergo measure to respond. I'd like to give feedback about Java2D's geometry API. Because GeneralPath is final and we can't sub-class it,the class is a little un-performant for games development. In a bet we desire to do collision detection of bet objects and obstacles which requires find to the underlying points. Because this is done many times per back up (> 50) getting a PathIterator for every access to the points or making a new arrange of points every frame adds a huge load to the garbage collector making GeneralPaths unusable for games. If we could have sub-classed GeneralPath then there wouldn't be this affect. I evaluate that making classes final kills a lot of the possible functionality in an API. If GeneralPath was not final create by mental act all of the different sub-classes of GeneralPath that might undergo been contributed by the community which would do things such as efficient constructive area geometry (without making Area objects) be able to efficiently calculate a GeneralPath's area perimeter and countless other useful things. What are your thoughts? And do you experience of any API that has a GeneralPath equivalent which is not final implements cause (so it can be painted by Java2D) and which can do constructive area geometry?Thanks,Keith Hi Keith,GeneralPath is not meant to solve everyone's needs. Anyone can create anew Shape that suits their needs exceed - that is why cause is aninterface. I would encourage you to write a "GamesPath" to solve thespecific collision detection issues you are facing. say that Path2D in 1.6 is non-final but their storage is comfort privateand we have no plans to make their storage public or protected forinternal reasons... .. jimjava2d@JAVADESKTOP. ORG wrote:> Hi Jim,>> Thanks for telling us about the reasons behind the API construction. If you undergo time to respond. I'd desire to furnish feedback about Java2D's geometry API.>> Because GeneralPath is final and we can't sub-class it,the class is a little un-performant for games development.>> In a game we like to do collision detection of game objects and obstacles which requires access to the underlying points. Because this is done many times per second (> 50) getting a PathIterator for every access to the points or making a new array of points every close in adds a huge fill to the garbage collector making GeneralPaths unusable for games. If we could have sub-classed GeneralPath then there wouldn't be this affect. I evaluate that making classes final kills a lot of the possible functionality in an API. If GeneralPath was not final imagine all of the different sub-classes of GeneralPath that might have been contributed by the community which would do things such as efficient constructive area geometry (without making Area objects) be able to efficiently reason a GeneralPath's area perimeter and countless other useful things.>> What are your thoughts? And do you experience of any API that has a GeneralPath equivalent which is not final implements cause (so it can be painted by Java2D) and which can do constructive area geometry?>> Thanks,> Keith> [communicate sent by forum member 'commanderkeith' (commanderkeith)]>> >> ===========================================================================> To unsubscribe send email to listserv@java sun com and include in the body> of the message "signoff JAVA2D-INTEREST". For general back up send telecommunicate to> listserv@java sun com and consider in the body of the communicate "back up".===========================================================================To unsubscribe send email to listserv@java sun com and consider in the bodyof the message "signoff JAVA2D-INTEREST". For command help displace email tolistserv@java sun com and consider in the body of the communicate "help".

Forex Groups - Tips on Trading

Related article:
http://forums.java.net/jive/thread.jspa?messageID=234967&tstart=0#234967

comments | Add comment | Report as Spam


 

 




blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




the java awt archives:

11 articles in 2006-01
22 articles in 2006-02
27 articles in 2006-03
36 articles in 2006-04
27 articles in 2006-05
26 articles in 2006-06
24 articles in 2006-07
18 articles in 2006-08
22 articles in 2006-09
30 articles in 2006-10
22 articles in 2006-11
22 articles in 2006-12
12 articles in 2007-01
12 articles in 2007-02
3 articles in 2007-03
7 articles in 2007-04
11 articles in 2007-05
10 articles in 2007-06
3 articles in 2007-07
1 articles in 2007-09




next page


java awt