Set Composite on a JComponent

So I posted this on the java ranch forums... http://www.coderanch.com/t/440197/Swing-AWT-SWT-JFace/java/Compositing-every-component-Component
and have received no answer. However maybe I was not making my self entirely clear. Here is what I want to do... Using JButton as an example...
but = new JButton("head");
gd = (Graphics2D)but.getGraphics();
gd.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .5f)); This does not work for me and was wondering what exactly I should do to set the composite of any jcomponent?
Sincerely,
Chris Dancy

I do that, but it´s hard posted here, because the size of the code...
global variable
float alphaPanel = 1f;
painel p;in the constructor
p = new painel();I create the jPanel2 in netbeans6.5...
and then,
jPanel2 = p;this is the panel...
  class painel extends JPanel {
        painel() {
                      setSize(400, 400);
        public void paintComponent(Graphics g) {
            //  System.out.println("pintando "+alphaPanel);
            ((Graphics2D) g).setComposite(
                    AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
                    alphaPanel));
            g.setColor(getBackground());
            g.fillRect(0, 0, getWidth(), getHeight());
    }this is the timer...
javax.swing.Timer timerFadeOutPanel = new javax.swing.Timer(100, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            alphaPanel -= 0.1f;
            System.out.println(alphaPanel);
            if (alphaPanel < 0) {
                alphaPanel = 0;
                timerFadeOutPanel.stop();
                invisivelPanel();
                p.repaint();
            // p.setVisible(false);
            // timerFadeInPanel.start();
            p.repaint();
// this is the jbuttons etc which should be setVisible(false)...
        private void invisivelPanel() {
            fade2button.setVisible(false);
            fadeButton.setVisible(false);
            fadeInButton.setVisible(false);
            buttonFadeOutPanel.setVisible(false);
            transpbutton.setVisible(false);
            fadeOutButton.setVisible(false);
            jSlider1.setVisible(false);
    });here the jbutton... call method that overhide jpanel
  if (alphaPanel == 1f) {
            p.setOpaque(false);
            alphaPanel = 1f;
            timerFadeOutPanel.start();
        }

Similar Messages

  • Setting composite key in Container Managed Entity Bean

    In my database table i set primary key to two columns making them as composite key. how do i set that in my container managed entity bean home interface findByPrimaryKey() method and in deployment descriptor file.

    1. create another class (say CompositePK) that will embed the two fields keyA and keyB corresponding to the two pk of your table (declare them public) .
    2. in your Bean declare keyA and keyB public.
    3. in the dd declare your bean primary-key-class as CompositePK and the primary-key-field as keyA and keyB.
    this is the method i use (with BAS) even if the key is simple (such as Integer).

  • Problem in  setting Composite Instance Index in SOA 11G

    In SOA 11G the setIndex() xpath function is not working . But It was working in 10G.
    If I use this setIndex function in BPEL Java Embedding , in audit trails the function is executed. But If I see the result by querying the DEV_SOAINFRA.COMPOSITE_INSTANCE table INDEX1 column it is empty. No values is inserted into this INDEX columns.
    Can anyone please give a solution to set the composite instance index in SOA 11G ?
    Thanks in Advance

    1. setIndex() Xpath function in SOA 11G is working .
    2. syntax : setIndex(1,'anyValue');
    3. To view the index value for the instance created , query "DEV_SOAINFRA.CI_INDEXES" table.
    Edited by: saba on Dec 6, 2011 6:22 AM

  • Set Composition In and Out Points

    Hello
    I'm sure this is simple but a new look to CS6 has thrown me!
    Say I have created a composition named 'MasterComp' which comprises several layers of Footage. I now want to place frames 100 to 300 of MasterComp within a new composition named Comp01, how do I do this?
    I used to simply double-click MasterComp in the Project panel and then in the preview window set the time to 100 using the timeline and click the 'In Point' button. I would repeat this to set the 'Out Point' and then drag the MasterComp from the Projects pallete into my Comp01 panel.
    There appears to be no timeline in CS6 when previewing a composition along with the associated ability to set the in/out point.
    Any guidance would be very helpful.
    Chris

    Hello Rick
    Thanks for your thoughts. Perhaps I was not clear. If I remember correctly, in CS5.5 I could double-click a composition to preview it and there would be a timeline beneath it so that I could scrub up and down and set the in/out points. I have reset my Standard Workspace and there is no timeline beneath a Composition when previewed. There is, however, for a Footage item.
    Composition Settings only lets me adjust the Start Frame and Duration. I don't want to make a global change to the composition, simply set an in and out point for the composition's use when placed within another composition.

  • Set composite state to "Completed" when fault retry Succeeds

    I have a composite that comprises of a BPEL process that invokes a mediator which invokes an external service. I have set up a fault policy file that will fire up on a remote fault and retry the call a few times. When the external service call fails the first time, the mediator component state gets set as Faulted. However, after the retry happens successfully, the state of the mediator instance is set as "Completed" but the composite state still displays as "Faulted". Is there a way to change the state of the composite to "Completed" after a successful retry?
    Appreciate your help.

    I think I have already provided you a reference on this error earlier -
    SOA-20001: Message Router for {0} is not able to process messages.
    Login to SOA EM console and "Start up" and "Activate" your composite (default/EBIZ_Sync_SummaryOrders!2.0). You may refer section "7.4.2 Managing the State of an Application from the SOA Composite Application Home Page" at -
    http://docs.oracle.com/cd/E23943_01/admin.1111/e10226/soacompapp_deploy.htm#CHDDFEGH
    Regards,
    Anuj

  • Setting Composition Rule In Mail

    THE SET-UP
    I've got mail configured to send and receive from a gmail account and my school-issued student account with the outrageously long extension @student.schoolname.edu. I use my school account strictly for communicating with other students and faculty. Everything else goes through gmail. The extensions for faculty are simply @schoolname.edu
    THE PROBLEM
    Seeing as how my composing rules are currently set to default new messages as being sent from my gmail account, and seeing as how I'm too spacy to double check stuff and switch my address in the message window before I send, I realized I just sent a whole bunch of emails to school people from my gmail. This is certainly not a tragedy, it's just kind of annoying and unprofessional-looking in my opinion.
    HERE'S THE QUESTION
    When I'm composing message, is there a way to program Mail or set a rule so that when I enter "schoolname.edu" in the TO: line, the message will default to my school account?
    For example, if I open a new message window and type "[email protected]" or "[email protected]," I'd like for the sending address to change to my school address rather than my gmail.
    I've clicked around in the menus and haven't seen anything incredibly obvious to this effect, so I'm hoping somebody out there can help. If you can't, I guess I'll just have to learn to double check things.

    no, there is now way to do that in mail.

  • Composite sensor problem

    Hi all,
    at work we are facing with following problem.
    We are trying to set composite sensors on an exposed service. For a specific requirement the wsdl exposed has a message with three parts like below:
    +<wsdl:message name="requestMessage">+
    +<wsdl:part name="partMC" element="inp1:ManageCustomerRequest"/>+
    +<wsdl:part name="partMCA" element="inp2:ManageCustomerAccountRequest"/>+
    +<wsdl:part name="partMP" element="inp3:ManageProductRequest"/>+
    +</wsdl:message>+
    We set composite sensors, with same name, for following elements:
    - sensor "businessID" = $in.partMCA/inp2:ManageCustomerAccountRequest/ns4:Header/ns3:businessID
    - sensor "businessID" = $in.partMC/inp1:ManageCustomerRequest/ns4:Header/ns3:businessID
    - sensor "businessID" = $in.partMP/inp3:ManageProductRequest/ns4:Header/ns3:businessID
    The problem is that every time a composite instance is created, on EM we can find a sensor named businessID, but, since we can't predict what message part is received, on log we also find exceptions like below:
    +<May 14, 2013 5:55:36 PM CEST> <Error> <oracle.integration.platform.sensor> <BEA-000000> <Unable to process the sensor : Sensor [Name = businessID, Component = ManageMxRequestOperation/Event = exec+
    +uteExpression = Expression = /inp2:ManageCustomerAccountRequest/ns4:Header/ns3:businessID, MessageType = 1, MessageSection = 1, Part = partMCA]+
    oracle.integration.platform.sensor.SensorException: No payload found for the expression : Expression = /inp2:ManageCustomerAccountRequest/ns4:Header/ns3:businessID, MessageType = 1, MessageSection
    += 1, Part = partMCA+
    at oracle.integration.platform.sensor.expr.XPathEvaluator.evaluate(XPathEvaluator.java:174)
    at oracle.integration.platform.sensor.CompositeSensor.getValue(CompositeSensor.java:207)
    at oracle.integration.platform.sensor.CompositeSensor.getValue(CompositeSensor.java:188)
    at oracle.integration.platform.sensor.SensorManagerImpl.processMessageSensors(SensorManagerImpl.java:241)
    at oracle.integration.platform.sensor.SensorManagerImpl.requestReceived(SensorManagerImpl.java:147)
    at oracle.integration.platform.instance.InstanceManagerImpl.publishSensorData(InstanceManagerImpl.java:1099)
    at oracle.integration.platform.instance.InstanceManagerImpl.persistCompositeInstanceBean(InstanceManagerImpl.java:1080)
    at oracle.integration.platform.blocks.local.LocalInvocationProcessor.createCompositeInstance(LocalInvocationProcessor.java:739)
    at oracle.integration.platform.blocks.local.LocalInvocationProcessor.doPreInvocationProcessing(LocalInvocationProcessor.java:229)
    at oracle.integration.platform.blocks.local.LocalInvocationProcessor.post(LocalInvocationProcessor.java:198)
    at oracle.integration.platform.blocks.soap.WebServiceExternalBindingComponent.post(WebServiceExternalBindingComponent.java:906)
    at oracle.integration.platform.blocks.mesh.AsynchronousMessageHandler.doPost(AsynchronousMessageHandler.java:142)
    at oracle.integration.platform.blocks.mesh.MessageRouter.post(MessageRouter.java:197)
    at oracle.integration.platform.blocks.mesh.MeshImpl.post(MeshImpl.java:215)
    at sun.reflect.GeneratedMethodAccessor1279.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at oracle.integration.platform.metrics.PhaseEventAspect.invoke(PhaseEventAspect.java:71)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy297.post(Unknown Source)
    at oracle.tip.mediator.serviceEngine.MediatorServiceEngine.post2Mesh(MediatorServiceEngine.java:1153)
    at oracle.tip.mediator.service.BaseActionHandler.requestProcess(BaseActionHandler.java:205)
    at oracle.tip.mediator.service.BaseActionHandler.requestProcess(BaseActionHandler.java:95)
    at oracle.tip.mediator.service.BaseActionHandler.requestProcess(BaseActionHandler.java:75)
    at oracle.tip.mediator.service.OneWayActionHandler.process(OneWayActionHandler.java:47)
    at oracle.tip.mediator.service.ActionProcessor.onMessage(ActionProcessor.java:64)
    at oracle.tip.mediator.dispatch.MessageDispatcher.executeCase(MessageDispatcher.java:137)
    at oracle.tip.mediator.dispatch.InitialMessageDispatcher.processCase(InitialMessageDispatcher.java:500)
    at oracle.tip.mediator.dispatch.InitialMessageDispatcher.processCases(InitialMessageDispatcher.java:398)
    at oracle.tip.mediator.dispatch.InitialMessageDispatcher.processNormalCases(InitialMessageDispatcher.java:279)
    at oracle.tip.mediator.dispatch.InitialMessageDispatcher.processCases(InitialMessageDispatcher.java:253)
    at oracle.tip.mediator.dispatch.InitialMessageDispatcher.dispatch(InitialMessageDispatcher.java:151)
    at oracle.tip.mediator.serviceEngine.MediatorServiceEngine.process(MediatorServiceEngine.java:878)
    at oracle.tip.mediator.serviceEngine.MediatorServiceEngine.post(MediatorServiceEngine.java:663)
    at oracle.integration.platform.blocks.mesh.AsynchronousMessageHandler.doPost(AsynchronousMessageHandler.java:142)
    at oracle.integration.platform.blocks.mesh.MessageRouter.post(MessageRouter.java:197)
    at oracle.integration.platform.blocks.mesh.MeshImpl.post(MeshImpl.java:215)
    at sun.reflect.GeneratedMethodAccessor1279.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    at oracle.integration.platform.metrics.PhaseEventAspect.invoke(PhaseEventAspect.java:59)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy297.post(Unknown Source)
    at oracle.integration.platform.blocks.adapter.fw.jca.mdb.AdapterServiceMDB.publishToMesh(AdapterServiceMDB.java:746)
    at oracle.integration.platform.blocks.adapter.fw.jca.mdb.AdapterServiceMDB.onMessage(AdapterServiceMDB.java:669)
    at oracle.tip.adapter.fw.jca.messageinflow.MessageEndpointImpl.onMessage(MessageEndpointImpl.java:507)
    at oracle.tip.adapter.jms.inbound.JmsConsumer.doSend(JmsConsumer.java:714)
    at oracle.tip.adapter.jms.inbound.JmsConsumer.sendInboundMessage(JmsConsumer.java:467)
    at oracle.tip.adapter.jms.inbound.JmsConsumer.send(JmsConsumer.java:1184)
    at oracle.tip.adapter.jms.inbound.JmsConsumer.run(JmsConsumer.java:1064)
    at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)
    at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:184)
    at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)>
    Do you have any idea how we can manage the problem in order to don't have any exception on log?
    Thanks,
    Antonio

    It is the expected behavior. If you refer to the documentation @ http://docs.oracle.com/cd/E17904_01/integration.1111/e10224/sca_compsensors.htm, this is what it says:
    *47.1.1 Restrictions on Use of Composite Sensors*
    Functions can only be used with the payload. For example, XPath functions such as concat() and others cannot be used with properties.Thanks,
    Patrick

  • Access composite level property in BPEL

    Hi,
       I have a composite level "auditLevel" property defined in composite.xml as given below. Can anyone suggest a way to access that property in BPEL process ?
    <composite name="SetInstanceTitle"
                   revision="1.0"
                   label="2015-04-12_18-52-43_897"
                   mode="active"
                   state="on"
                   xmlns="http://xmlns.oracle.com/sca/1.0"
                   xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                   xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy"
                   xmlns:ui="http://xmlns.oracle.com/soa/designer/">
          <import namespace="http://xmlns.oracle.com/CompositeSamples/SetInstanceTitle/SetInstanceTitleWithCondition"
                  location="SetInstanceTitleWithCondition.wsdl" importType="wsdl"/>
          <service name="setinstancetitlewithcondition_client_ep"
                   ui:wsdlLocation="SetInstanceTitleWithCondition.wsdl">
            <interface.wsdl interface="http://xmlns.oracle.com/CompositeSamples/SetInstanceTitle/SetInstanceTitleWithCondition#wsdl.interface(SetInstanceTitleWithCondition)"/>
            <binding.ws port="http://xmlns.oracle.com/CompositeSamples/SetInstanceTitle/SetInstanceTitleWithCondition#wsdl.endpoint(setinstancetitlewithcondition_client_ep/SetInstanceTitleWithCondition_pt)"/>
          </service>
         <property name="auditLevel" many="false">Off</property>
      <component name="SetInstanceTitleWithCondition" version="1.1">
        <implementation.bpel src="SetInstanceTitleWithCondition.bpel"/>
       </component>
    Thanks in advance,
    Saba

    Hi AnatoliAtanasov,
      Thank you for your reply.
    My requirement is to set composite instance title by retrieving SOA Audit Level settings in BPEL process.
    Need to set composite instance title If "auditLevel" is not "Off" or "Inherit".
    If I use this composite level property "<property name="auditLevel" many="false">Off</property>", it is getting reflected in EM Console. Also this property value get change if do auditLevel change from EM console.
    So I thought, I can use this property to control composite instance title setting in BPEL process dynamically.
    Please advise me any possible solution to achieve my requirement.
    Thanks in advance,
    Saba

  • Setting Timeline Markers Script in After Effects CS6

    So I'm without my desktop computer for the time being and am using a laptop in its place-which means I do not have access to a numpad. Going out to buy one is my last resort, as I don't have enough leisure time to visit a trusty electronics store. So I downloaded keyED Up, by Jeff Almasol, and I can change shortcuts at will-truly a useful tool. Yet, while I can change all other shortcuts, I found that the "set timeline marker tool" which is typically the "asterisk" key on the numpad is missing from the script list, and the marker list only includes "set composition markers 1-8," and "go to composition markers 1-8." Is this a discrepancy only in my keyEd Up script, or is it not an available option? Is there any other simple way to modify the "set timeline marker" shortcut?

    See this:
    Alternate keyboard shortcutd

  • Is it possible to set default table attributes?

    The default font in my tables is different than the default composition font I selected.
    I know I can work around this by editing the table properties, then going to advanced settings, and specifying font attributes under the "inline styles" tab (every single time I create a table :\), but why should I have go through this when I have already declared my default font styles for all compositions?
    Can't figure out a way around this :( It's making me reconsider using Thunderbid altogether (as much as I love Thunderbird - I need an easy way to send simple clean tables.)

    What Os ?
    What version of Thunderbird are you using?
    Confirm you are not pasting anything into the table cell; you are actually typing the text in the cell.
    In my version the default settings are being used in the table.
    This is what i'm using:
    Tools > Options > Display > formatting tab
    Default font: Times new roman
    Tools > Options > Composition > General tab
    HTML: Font: variable width
    So can you try these settings - set the font you wish to use in Display, so it is used generically and set Composition font to variable width.
    then retest and post results.

  • Composite Settings Have No Effect?

    The composition settings were working fine until I retimed an animation clip that was set to "Darken".   No, the composite settings don't work on this clip or ANY other clip in my timeline. 
    What the heck happened?

    I've figured something out....still struggling to make it look right.
    - Composition Settings do NOT work in a Storyline. It wasn't the retiming that broke it, it was putting it into a story line, which I did to this and other clips in order to be able to put a transition on them.
    - I can't add a transition to the clip unless it is in a Storyline or a Compound clip.
    - Transitions do NOT work in Compound Clips - for the duration of the transition, the clip is solid black, and then suddenly comes on after the transition is over or the transition just has no effect.
    The only solution I can find to this is to add a white fill generator than I can apply a transition to and lay it over the top, but it's not going to look the way I want it to.
    this portion of the video is an off-white background and I am trying to eliminate the pure white background of the animation clip I am using - normal solution is setting composite to darken or multiply. FCPx just added about 15 steps to accomplish this.

  • Resource cost / composite limit  --  translation

    Hi friends.
    I'm running Oracle EE 11.2 on Solaris 10.
    I'm digging into the use of composite limit to limit some of the resources that the report users can use on our OLTP database.
    Obviously, my intention is to prevent them from bringing down our OLTP database to its knees with some runaway or heavy reports.
    We all know how easy it is for report writers using Crystal Reports or some other tool to develop ad-hoc queries, joining views to views, etc.
    So, I figured I could create them a profile, (e.g., reports_profile) and limit their composite_limit.
    I checked out a couple of web pages and then it just got more confusing.
    Wondering if anyone has done this and figured it out and able to explain it easily.
    References:
    ALTER RESOURCE COST
    and
    CREATE PROFILE
    Any help would be appreciated.  I read the docs, but it is still confusing.

    Hi Justin.  Sorry if I was unable to make my question clear.
    The bottom line is that I would like to know specifically what value I should put for the composite limit to use for my new profile for the folks running reports so as not to bring our OLTP database to its knees during peak times.
    The problem is that the composite limit is not something simple like a percentage of total resources.  If it were, I could simply set composite limit to 30% of total resources and that would guarantee I would always have at least 70% of the available resources for the OLTP users.
    So, researching documents such as: 
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_6010.htm
    It says:   COMPOSITE_LIMIT Specify the total resource cost for a session, expressed in service units. Oracle Database calculates the total service units as a weighted sum of CPU_PER_SESSION, CONNECT_TIME, LOGICAL_READS_PER_SESSION, and PRIVATE_SGA.
    Then, a link to Resource Cost:
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_2008.htm#i2227717
    It says:  (The alter resource cost) statement lets you apply weights to the four resources. Oracle Database then applies the weights to the value of these resources that were specified for a profile to establish a formula for calculating total resource cost. You can limit this cost for a session with the COMPOSITE_LIMIT parameter of the CREATE PROFILE statement.
    Oracle Database calculates the total resource cost by first multiplying the amount of each resource used in the session by the weight of the resource, and then summing the products for all four resources. For any session, this cost is limited by the value of the COMPOSITE_LIMIT parameter in the user's profile. Both the products and the total cost are expressed in units called service units.
    Then, Specify the weight of each resource. The weight that you assign to each resource determines how much the use of that resource contributes to the total resource cost. If you do not assign a weight to a resource, then the weight defaults to 0, and use of the resource subsequently does not contribute to the cost. The weights you assign apply to all subsequent sessions in the database.
    So, it all gets confusing determining the service units value to assign to composite limit.  (Oracle did not make this easy which I assume is why they came out with resource manager.)
    On another site, which I can not find now, it says that in order to come up with the right values for each resource of the composite limit formula, you have to monitor sessions over long periods of time, but it does not give details for what to monitor, or how to apply the values you capture.
    Any help would be appreciated, or perhaps suggest how to use resource management instead.  My concern with resource management is that if I understand it correctly, it is based on "services", and I don't know how to restrict users to only specific services that I would set up for them.

  • Linear Compositing Mode

    I am learning to love the look of how linear color compositing mode combines my content.  While I'm loving the results, I'm one of those people who likes to know why I get a certain result.
    It seems that there is a difference between compositing over a black solid or black video versus compositing over nothing. I find that cross and film dissolves to an empty portion of timline has different results than dissolving to a black layer. There are lots of great results that I get from using the sequence setting "Composite in Linear Color."
    Could someone explain how transparency and various compositing methods works in linear color mode that makes it different from the flat look I acheived FCP and when using non linear mode?  Does anyone know of a whitepaper explaining the theory and math to help me understand what I'm seeing in the linear color world?

    I've not seen any technical explanations put forth by Adobe on this, other than the following:
    "...processing is done in a linear color space (i.e., gamma = 1.0) at 32 bits per channel (bpc), which results in more realistic results, finer gradations in color, and better results for midtones."

  • How to use renderrend in the tutorial?

    i wish to shade the area or textfield or table when i point my arrow to that particular place..
    someme guide me to http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    n use the renderer..
    how i implement to my code?
    thanks for drop the time read and help me

    Look up the classes I mentioned in the Javadoc, that should tell you all you need to know.
    Detect the mouse location with,
    MouseListener.mouseMoved()
    Get the cell position with,
    JTable.columnAtPoint(), JTable.rowAtPoint()
    And in your TableCellRenderer, if the cell in question is the one which is hovered over, set the background with,
    JComponent.setBackground()
    This article tells you enough to get you sorted with implementing your own renderer,
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

  • Problems displaying deserialized components

    I'm trying to save the state of some objects which extend JComponent and JLayeredPane, and they don't all redisplay on deserializing, although they seem to be in the containment tree.
    Basically, I have a class GamePanel which extends JLayeredPane. Also classes Square and Region both of which extend JComponent and use 2D graphics for painting themselves. It seems to serialize OK (but how does one tell?). But when I deserialize, only the lower level of the GamePanel is painted. However, the higher level is populated.
    Does anyone have any idea why they're not displaying? The code is below (TestKiller and its menus are generated by NetBeans - hence the slightly odd code). There are 5 menu items (I've simplified a lot from the original so it's a bit clunky): Add Region (you can only do this once in this version), Save As which serializes to a file, Restore which deserializes from a file, Exit which is obvious and Print which outputs the containment hierarchy of GamePanel to standard output.
    If you want to try it out, fire up the program, do a File|Add to add a Region (see the dotted lines) and File|Print to see that there's a Square at level 2 and a Region at level 3. Then File|Save as... to save it. Quit the program.
    Fire it up again and do a File|Restore and a File|Print. You'll see from the output that the Square and Region are there with identical parameters to the output before, but the Region hasn't displayed its outline.
    The output's below, with java-like comments added to show what I've done:
    D:>java -jar test*
    Painting gridlayer
    // File|Add Region
    New region 1
    Selecting square
    Checking region 1
    Painting gridlayer
    Painting region 1
    //File|Print
    Printing Gamepanel components
    com.ptoye.TestSBug1.Region[Region-1,4,4,60x60,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minim
    umSize=,preferredSize=]
    Bounds java.awt.Rectangle[x=4,y=4,width=60,height=60]
    Layer 3
    com.ptoye.TestSBug1.Square[Square-0:0,4,4,60x60,alignmentX=0.0,alignmentY=0.0,border=,flags=16777224,maximumSi
    ze=,minimumSize=,preferredSize=]
    Bounds java.awt.Rectangle[x=4,y=4,width=60,height=60]
    Layer 2
    \\File|Save
    Saving game to bug1.ksd
    D:>java -jar test*
    Painting gridlayer
    \\File|Restore
    Restoring game bug1.ksd
    Restored
    \\File|Print - same as above but only Square is displayed
    Printing Gamepanel components
    com.ptoye.TestSBug1.Region[Region-1,4,4,60x60,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minim
    umSize=,preferredSize=]
    Bounds java.awt.Rectangle[x=4,y=4,width=60,height=60]
    Layer 3
    com.ptoye.TestSBug1.Square[Square-0:0,4,4,60x60,alignmentX=0.0,alignmentY=0.0,border=,flags=16777224,maximumSi
    ze=,minimumSize=,preferredSize=]
    Bounds java.awt.Rectangle[x=4,y=4,width=60,height=60]
    Layer 2
    D:>
    Please someone tell me what I'm doing wrong. As a serialization newbie it's probably something simple, but no amount of validate() and pack() makes any difference.
    The code's below - a bit long I'm afraid but it's difficult to cut it down much more and display the problem. The main class (TestKiller) was generated by NetBeans.
    * TestKiller.java
    * Created on 01 August 2006, 22:13
    package com.ptoye.TestSBug1;
    import java.io.File;
    import java.io.FileFilter;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import javax.swing.JFileChooser;
    import javax.swing.JOptionPane;
    * @author  PToye
    public class TestKiller extends javax.swing.JFrame {
      private GamePanel p;
      final String fileExtension="ksd";
       * Creates new form TestKiller
      public TestKiller() {
        initComponents();
        p=new GamePanel();
        setContentPane(p);
        p.setOpaque(true);
        setSize(p.getPreferredSize());
        pack();
      public static void showMessage(String s) {
        JOptionPane.showMessageDialog(null,s,"Error",JOptionPane.ERROR_MESSAGE);
      /** This method is called from within the constructor to
       * initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is
       * always regenerated by the Form Editor.
      private void initComponents() {                         
        jMenuBar1 = new javax.swing.JMenuBar();
        jmFile = new javax.swing.JMenu();
        jmiAddRegion = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        jmiSaveAs = new javax.swing.JMenuItem();
        jmiRestore = new javax.swing.JMenuItem();
        jmiExit = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        jmiPrint = new javax.swing.JMenuItem();
        FormListener formListener = new FormListener();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Restore bug");
        jmFile.setText("File");
        jmiAddRegion.setText("Add region");
        jmiAddRegion.addActionListener(formListener);
        jmFile.add(jmiAddRegion);
        jmFile.add(jSeparator2);
        jmiSaveAs.setMnemonic('s');
        jmiSaveAs.setText("Save as...");
        jmiSaveAs.addActionListener(formListener);
        jmFile.add(jmiSaveAs);
        jmiRestore.setMnemonic('r');
        jmiRestore.setText("Restore");
        jmiRestore.addActionListener(formListener);
        jmFile.add(jmiRestore);
        jmiExit.setMnemonic('x');
        jmiExit.setText("Exit");
        jmiExit.addActionListener(formListener);
        jmFile.add(jmiExit);
        jmFile.add(jSeparator1);
        jmiPrint.setText("Print");
        jmiPrint.addActionListener(formListener);
        jmFile.add(jmiPrint);
        jMenuBar1.add(jmFile);
        setJMenuBar(jMenuBar1);
        pack();
      // Code for dispatching events from components to event handlers.
      private class FormListener implements java.awt.event.ActionListener {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
          if (evt.getSource() == jmiSaveAs) {
            TestKiller.this.jmiSaveAsActionPerformed(evt);
          else if (evt.getSource() == jmiRestore) {
            TestKiller.this.jmiRestoreActionPerformed(evt);
          else if (evt.getSource() == jmiExit) {
            TestKiller.this.jmiExitActionPerformed(evt);
          else if (evt.getSource() == jmiPrint) {
            TestKiller.this.jmiPrintActionPerformed(evt);
          else if (evt.getSource() == jmiAddRegion) {
            TestKiller.this.jmiAddRegionActionPerformed(evt);
      private void jmiAddRegionActionPerformed(java.awt.event.ActionEvent evt) {                                            
        p.dummyAdd();
        jmiAddRegion.setEnabled(false);
      private void jmiPrintActionPerformed(java.awt.event.ActionEvent evt) {                                        
        p.print();
      private void jmiSaveAsActionPerformed(java.awt.event.ActionEvent evt) {                                         
        File f;
        ObjectOutputStream oos=null;
        JFileChooser jfc=new JFileChooser();
        jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        jfc.setMultiSelectionEnabled(false);
        jfc.addChoosableFileFilter(jfc.getAcceptAllFileFilter());
        jfc.addChoosableFileFilter(new KDSFileFilter());
        jfc.showSaveDialog(this);
        f=jfc.getSelectedFile();
        if (f==null) {
          showMessage("Null file found");
        int i=f.getName().lastIndexOf(".");
        if (i==-1) {
          f=new File(f.getAbsolutePath()+"."+fileExtension);
        try {
          oos=new ObjectOutputStream(new FileOutputStream(f));
        } catch (FileNotFoundException ex) {
          showMessage("Cannot find file "+f.getName());
          return;
        } catch (IOException ex) {
          showMessage("Cannot open file "+f.getName());
          return;
        if (oos!=null) {
          System.out.println("Saving game to "+f.getName());
          try {
            oos.writeObject(p);
          } catch (IOException ex) {
            showMessage("Cannot write game to "+f.getName()+"\n"+ex.getMessage());
          } finally {
            try {
              oos.close();
            } catch (IOException ex) {
      private void jmiExitActionPerformed(java.awt.event.ActionEvent evt) {                                       
        System.exit(0);
      private void jmiRestoreActionPerformed(java.awt.event.ActionEvent evt) {                                          
        File f;
        ObjectInputStream ois=null;
        JFileChooser jfc=new JFileChooser();
        jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
        jfc.setMultiSelectionEnabled(false);
        jfc.addChoosableFileFilter(jfc.getAcceptAllFileFilter());
        jfc.addChoosableFileFilter( new KDSFileFilter());
        jfc.showOpenDialog(this);
        f=jfc.getSelectedFile();
        if (f!=null) {
          try {
            ois=new ObjectInputStream(new FileInputStream(f));
          } catch (FileNotFoundException ex) {
            showMessage("Cannot find file "+f.getName());
            return;
          } catch (IOException ex) {
            showMessage("Cannot open file "+f.getName());
            return;
          if (ois!=null) {
            System.out.println("Restoring game "+f.getName());
            try {
              p=(GamePanel) ois.readObject();
            } catch (IOException ex) {
              showMessage("Cannot read game from file "+f.getName());
            } catch (ClassNotFoundException ex) {
              showMessage("Cannot restore game - wrong object type");
            try {
              ois.close();
            } catch (IOException ex) {
            pack();
            p.validate();
            p.repaint();
            System.out.println("Restored");
      private class KDSFileFilter extends javax.swing.filechooser.FileFilter {
        public boolean accept(File f) {
          if (f.isDirectory()) {
            return true;
          String ext = null;
          String s = f.getName();
          int i = s.lastIndexOf('.');
          if (i > 0 &&  i < s.length() - 1) {
            ext = s.substring(i+1).toLowerCase();
          return (ext==null || ext.equalsIgnoreCase(fileExtension));
        public String getDescription() {
          return "Killer Su Doku games";
       * @param args the command line arguments
      public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
          public void run() {
            new TestKiller().setVisible(true);
      // Variables declaration - do not modify                    
      private javax.swing.JMenuBar jMenuBar1;
      private javax.swing.JSeparator jSeparator1;
      private javax.swing.JSeparator jSeparator2;
      private javax.swing.JMenu jmFile;
      private javax.swing.JMenuItem jmiAddRegion;
      private javax.swing.JMenuItem jmiExit;
      private javax.swing.JMenuItem jmiPrint;
      private javax.swing.JMenuItem jmiRestore;
      private javax.swing.JMenuItem jmiSaveAs;
      // End of variables declaration                  
    * GamePanel.java
    * Created on 10 January 2007, 18:45
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package com.ptoye.TestSBug1;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.io.Serializable;
    import java.util.HashSet;
    import java.util.Set;
    import javax.swing.JLayeredPane;
    * @author PToye
    public class GamePanel extends JLayeredPane implements Serializable {
      private static final int GRID_LEVEL=2;
      private static final int REGIONS_LEVEL=3;
      private static final int THICK_WIDTH=4;
      private static final int THIN_WIDTH=1;
      static final int SQUARE_SIZE=60;
      private static final int SQUARES=1;  // test size
      static final int BIGSQUARES=SQUARES*SQUARES;
      static final int TotalSize=(SQUARES+1)*THICK_WIDTH+SQUARES*(SQUARES-1)*THIN_WIDTH+
          BIGSQUARES*SQUARE_SIZE;
      public final Color NORMAL_BACK_COLOUR=Color.WHITE;
      public final Color SELECTED_BACK_COLOUR=Color.PINK;
      int coordArray;  // used to be an array of start coords of each square
      private Region newRegion;
      private int regionId=1;
      private Square squareArray; // used to be an array
      private Region regions; // used to be a set
      /** Creates a new instance of GamePanel */
      public GamePanel() {
        super();
        regions=null;
        makeGridLayer();  //adds the white square
        setPreferredSize(new Dimension(TotalSize,TotalSize));
        setVisible(true);
        newRegion=null;
        setFocusable(true);
      public void dummyAdd() {
        setupRegion(squareArray);
        if (newRegion.checkNewRegion(1)) {
          addRegion(newRegion);
      public void addRegion(Region r) {
        if (regions==null) {
          regions=r;
          add(r,new Integer(REGIONS_LEVEL));
          r.repaint();
      void print() {
        Component[] cList=getComponents();
        System.out.println("Printing Gamepanel components");
        for (int i = 0; i < cList.length; i++) {
          Component c=cList;
    System.out.println(c.toString());
    System.out.println(" Bounds "+c.getBounds());
    System.out.println(" Layer "+getLayer(c));
    if (c instanceof Container) {
    printContainer((Container)c," ");
    void printContainer(Container c, String preString) {
    Component[] cList1=c.getComponents();
    for (int i = 0; i < cList1.length; i++) {
    Component comp=cList1[i];
    System.out.println(preString+comp.toString());
    System.out.println(preString+" Bounds "+comp.getBounds());
    if (comp instanceof Container) {
    printContainer((Container)comp,preString+" ");
    private void setupRegion(Square s) {
    if (newRegion==null) {
    newRegion=new Region(regionId++,this);
    Region r=s.getRegion();
    if (r==null) {
    newRegion.addSquare(s);
    selectSquare(s);
    s.setRegion(newRegion);
    } else {
    System.exit(1); // should not happen
    private void makeGridLayer() {
    int currentXCoord;
    int currentYCoord;
    int arrayIndex=0;
    Square sq;
    currentXCoord=THICK_WIDTH;
    currentYCoord=THICK_WIDTH;
    coordArray=currentYCoord;
    sq=new Square(0,0, NORMAL_BACK_COLOUR,this);
    add(sq,new Integer(GRID_LEVEL));
    squareArray=sq;
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2=(Graphics2D) g;
    System.out.println("Painting gridlayer");
    g2.setBackground(Color.BLACK);
    g2.setColor(Color.BLACK);
    g2.fillRect(0,0,TotalSize,TotalSize);
    void selectSquare(Square s) {
    System.out.println("Selecting square");
    s.setBackColour(SELECTED_BACK_COLOUR);
    * Square.java
    * Created on 28 December 2006, 15:53
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package com.ptoye.TestSBug1;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.io.Serializable;
    import javax.swing.JComponent;
    * @author PToye
    class Square extends JComponent implements Serializable {
    * X index in grid
    private int xIndex;
    * Y index in grid
    private int yIndex;
    * The square's parent grid
    private GamePanel parent;
    * Region it belongs to (or null if none)
    private Region region;
    * The background colour
    private Color backColour;
    private boolean marked;
    // public Square() {
    // System.out.println("New Square - null constructor");
    // addMouseListener(parent);
    * Create a new square
    public Square(int x, int y, Color bcol, GamePanel parent) {
    this.parent=parent;
    xIndex=x;
    yIndex=y;
    backColour=bcol;
    region=null;
    setName("Square-"+x+":"+y);
    setBounds(parent.coordArray,parent.coordArray,
    GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    setOpaque(true);
    setVisible(true);
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2=(Graphics2D) g;
    // System.out.println("Painting square "+xIndex+","+yIndex+":"+getBounds());
    g2.setColor(backColour);
    g2.fillRect(0,0,GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    g2.setColor(Color.BLACK);
    public Dimension getPreferredSize() {
    return new Dimension(GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    public void setBackColour(Color backColour) {
    this.backColour = backColour;
    repaint(0,0,GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    public Region getRegion() {
    return region;
    public void setRegion(Region region) {
    this.region = region;
    * Region.java
    * Created on 28 December 2006, 15:59
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package com.ptoye.TestSBug1;
    import java.awt.BasicStroke;
    import java.awt.Color;
    import java.awt.Font;
    import java.awt.FontMetrics;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.geom.GeneralPath;
    import java.io.Serializable;
    import java.util.HashSet;
    import java.util.Iterator;
    import java.util.Set;
    import javax.swing.JComponent;
    * @author PToye
    * Class representing a region whose total sum is known
    public class Region extends JComponent implements Serializable {
    private static final float BORDER_WIDTH=1f;
    private static final float DASH_LENGTH=4f;
    private static final float[] dashes={DASH_LENGTH,DASH_LENGTH};
    private static final BasicStroke borderStroke=
    new BasicStroke(BORDER_WIDTH,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,
    1f,dashes,0);
    private static final int borderInset=3;
    private GamePanel parent;
    * The sum as given
    private int total;
    private String totalString;
    private int id;
    * The squares constituting the region
    private Square contents; // the square in the region
    private Square leadSquare; // top left-hand square
    private int leadXCoord,leadYCoord; // X, Y coords of lead square wrt border
    private GeneralPath border=null;
    public Region(int id, GamePanel parent) {
    super();
    this.id=id;
    this.parent=parent;
    setName("Region-"+id);
    contents=null;
    border=new GeneralPath();
    System.out.println("New region "+id);
    public void addSquare(Square s) {
    if (contents!=null) {
    contents=s;
    public boolean checkNewRegion(int tot) {
    System.out.println("Checking region "+id);
    border.moveTo(borderInset,borderInset);
    border.lineTo(GamePanel.SQUARE_SIZE-borderInset,borderInset);
    border.lineTo(GamePanel.SQUARE_SIZE-borderInset,GamePanel.SQUARE_SIZE-borderInset);
    border.lineTo(borderInset,GamePanel.SQUARE_SIZE-borderInset);
    border.lineTo(borderInset,borderInset);
    setBounds(parent.coordArray,parent.coordArray,GamePanel.SQUARE_SIZE,GamePanel.SQUARE_SIZE);
    repaint();
    return true;
    public void paintComponent(Graphics g) {
    int newX, newY;
    System.out.println("Painting region "+id);
    super.paintComponent(g);
    Graphics2D g2=(Graphics2D) g;
    g2.setColor(Color.BLACK);
    g2.setStroke(borderStroke);
    g2.draw(border);

    OK, I asked the FTE team and got this reply: "Lucida Grande is CTS's fallback font for Thai.  This font on OS 10.7 and 10.6 are not supporting Thai anymore.  The version on 10.5 was supporting it." This means that it's our bug that we keep using Lucida Grande as fallback font even Apple dropped support Thai script with that font after 10.6. Unfortunately this bug was deferred from current development release (11.2) because of time constraint. If this support is critical for your business, can you open a bug in our public bugbase and ask as many vote as possible? In this way I may be able to convince internal team to fix this bug in next release.
    Thank you for your feedback!
    Hitomi

Maybe you are looking for

  • Photoshop CC 2014 incompatible with Wacom tablets?

    Hey everyone, so I'm having a lot of issues with my Wacom tablets and PS CC 2014. So, I have two tablets hooked up to my computer (and before you ask, no, the issues don't stem from two tablets being connected to the computer. I already tested that.)

  • Sync between iphone and Outlook not working

    When i was on itunes 9 using i phone version 4 and 4.01 everything was fine, as soon as the latest iphone firmware update happened it all went wrong. When i try to Sync outlook contacts or Calender it says would not do it and just freeze. So i follow

  • Index not used for search

    Hallo all, I created some Indexes that I select in the advanced search options. I even reindexed them for being sure that the documents are listed in there. Now if I'm searching for properties, title, text, or something else no one of the documents g

  • If i 'de-authorise all' will i keep my purchases when i re-authorise my computer?

    PLEASE HELP! it says i have 5 computers authorized but i only know of one, and i need to authorize my new computer. Thanks so so so much if you can help me with this.

  • Autocad 2015 Crashing on OSX Yosemite

    I recently upgraded to Apple's new opperating system (OSX Yosemite) and am experiencing random crashes every 5-10 minutes on Autocad 2015 for Mac. The crashes are not associated with any specific command or action but rather the program spontaneously