KeyListener function on non edittable

I have a JTextField that is set to not be edittable. I have a keylistener on it but it doesnt seem to work at all. Is this because the JTextField is set to non edittable? I even tried clicking in the field first before typing the allowed keys but still nothing. Any help would be greatly appreciated...
and yes, I know that most of my code is not in use/doesnt have anything looking to it, my program is far from being done, im getting one thing done at a time
package DiceGame;
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class DiceGameMain extends JFrame implements ActionListener
     JPanel status;
     JTextField POINTS, RISK, Risk, WinLose;
     int points = 1000, risk=0;
     JButton roll;
     Dimension res = Toolkit.getDefaultToolkit().getScreenSize();
     String win = "         WIN", lose = "       LOSE";
     boolean enterRisk = true;
public static void main(String[] args)
          DiceGameMain frame = new DiceGameMain();
          frame.setVisible(true);
public DiceGameMain()
          setName("Dice Game - Alpha");
          setSize(400, 300);
          setLocation((int)(res.getWidth()/2)-(getWidth()/2), (int)(res.getHeight()/2)-(getHeight()/2));
          setResizable(false);
          setLayout(null);
//     Bottom status bar
          status = new JPanel();
          status.setVisible(true);
          status.setSize(390, 40);
          status.setLocation(getWidth()/2-status.getWidth()/2-3, getHeight()-73);
          status.setLayout(null);
          status.setBackground(Color.BLACK);
          add(status);
          POINTS = new JTextField ("Points: "+points);
          POINTS.setSize(100,30);
          POINTS.setLocation(5, 5);
          POINTS.setEditable(false);
          POINTS.setBackground(Color.GREEN);
          status.add(POINTS);
          Risk = new JTextField(risk+"");
          Risk.setSize(55, 30);
          Risk.setLocation(status.getWidth()-60, 5);
          Risk.setEditable(false);
          Risk.setBackground(Color.GREEN);
          status.add(Risk);
          RISK = new JTextField ("Risk:");
          RISK.setSize(35,30);
          RISK.setLocation(status.getWidth()-RISK.getWidth()-60, 5);
          RISK.setEditable(false);
          RISK.setBackground(Color.GREEN);
          status.add(RISK);
          WinLose = new JTextField();
          WinLose.setSize(80,30);
          WinLose.setLocation(status.getWidth()/2-WinLose.getWidth()/2, 5);
          WinLose.setEditable(false);
          WinLose.setBackground(Color.BLACK);
          status.add(WinLose);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
public void actionPerformed(ActionEvent event)
     if(enterRisk==true) // 95 - 105 | 48 - 57
          Risk.addKeyListener(new KeyListener()
               public void keyReleased(KeyEvent arg0)
               public void keyTyped(KeyEvent arg0)
               public void keyPressed(KeyEvent arg0)
                    if((arg0.getID() <= 105 && arg0.getID() >= 95) || (arg0.getID() <= 57 && arg0.getID() >= 48))
                         if(Integer.parseInt(Risk.getText()+arg0) < points)
                                   Risk.setText(Risk.getText()+arg0);
                         if(Integer.parseInt(Risk.getText()+arg0) > points)
                                   Risk.setText(points+"");
public void ifStatements()
     if(risk==points)
               RISK.setBackground(Color.ORANGE);
     if(risk!=points)
               RISK.setBackground(Color.GREEN);
     if(points <= 500 && points > 250)
               POINTS.setBackground(Color.YELLOW);
     if(points <= 250)
               POINTS.setBackground(Color.RED);
     if(points > 500)
               POINTS.setBackground(Color.GREEN);
}

There are so many of wrong parts in your code.
You must learn basics for Java language and Java GUI
programming."my program is far from being done, im getting one thing done at a time"
Just one thing (among hundreds):
Where's your addActionListener() call ?yes i did forget to add my addActionListener, that has been added at the bottom of the public method. Problem persists still.

Similar Messages

  • Any RunningApplications-like function for non-windowed processes?

    Am I missing any RunningApplications-like function for non-windowed processes like Unix executables? To start with I'd settle for processes in user-space but would ultimately like to list processes like Activity Monitor does. Even comparing RunningApplications results to user space Activity Monitor results will show the difference.
    As far as I can tell you need to go all the way down to kauth and kernel space to watch for non-windowed processes being launched. Is there somethig in-between I'm missing? A notification device about launching apps would be perfect if it cover all processes.
    Thanks,
    =Tod

    I think kqueue may be able to do what you want. Look at the EVFILT_PROC filter. You may have to watch a number of processes - perhaps all of them. But that would tell you any time you get a fork and whenever a process is reaped.
    I looked at kqueue at it does what I want but you need to register it on a by process/file basis which is great for a very specific set of things but not for overall system watching. (I also looked at fsevents but it is designed as a post-event notification system.) While NSWorkspace has the usual Cocoa model notifcation willlaunchApp, didlaunchApp, etc it seems that you need to get the kernel to watch the launch lifecycle of non-windowed functions.
    I actually did manage to get a comprehensive list of running apps out of parsing sysctl output with much less trouble than I expected. So far I have managed to get the pid, uid and abbreviated processname and the list seems to match the Activity Monitor list - at least at this testing printf stage. Getting the username from uid should be trivial and the full file name is doable it just requires some struct length and offset math. I'd like the launch path information but I can live without it for monitoring purposes if I can't figure out how to get it.
    This means that the monitoring part of the running system seems relatively straight forward - wrapping the call in an NSTimer and watching for changes in the returned results. But the watching of the actual starting and stopping of all processes remains some deeper work.
    Thanks for all the suggestions,
    =Tod

  • PDFLPrintDoc functionality on non-English OS?

    We are using Datalogics PDF 8. 1 librrary in an exe. This has the functionality of printing a PDF region to a custom printer that generates a .EMF file. For this, we are setting few printer params using PDPrintParams and PDFLPrintUserParamsRec and then call PDFLPrintDoc.
    Now, on a English XP SP3 OS, this works fine and as expected generates a .EMF file with the custom printer that is added. However, on Swedish and German OS, it is NOT working. The printer just doesn't seem to do its job.
    Any ideas on what's causing this failure? Is it due to the printer params not being compatible on non-English OS? OR is there any other api call for printing on these OS?
    Any suggestions/comments or samples would be of great help.
    Thanks in advance!

    Thanks for ur reply.
    So, as you said, it might be a problem with the custom printer and driver that we are referring. But, its kinda getting difficult for me to trace the code that is failing for this OS as the driver is a native c code.
    Other than this, I tried printing it to a file with the existing Adobe PDF printer (that has Adobe PDF converter driver) and it worked fine. Is there any other way that I check the printing? You have mentioned printing to a postscript..how do i test this?
    Also, as you have mentioned to check the support contract with DL, before contacting them, is it documented anywhere about the compatibility of PDFv8.1 library on OS's that it supports?
    Please let me know.
    Once again thank you!

  • Material Ledger Functionality with Non Valuated Sales Order Stock

    We are in the process of setting up Make To Order (MTO) with Non Valuated Sales Order Stock. We currently use the Material Ledger in our other businesses that use Process Orders.
    Does the Material Ledger functionality support MTO with Non Valuated Sales Order Stock? I have been testing this and have not yet figured out how to get ML postings. We are using production orders that settle to sales orders. We do not bring this into inventory, the costs reside on the sales order.
    If this functionality does exist, I would assume I need to configure the Material Update Structure but I cannot find any documentation on this.
    Any help would be appreciated.
    Regards,
    Greg

    Hi Greg,
    no, material ledger will not be able to calculate and allocate actual costs for the sales order in the scenario you describe. It would of course, if you used the valuated sales order stock.
    Generally SAP sees in the valuated sales order stocks (avaliable since 3,1 or something) a great improvement and no real reason to use still the non-valuated scenario.
    best regards,
                          Udo

  • Function for non unicode-characters

    Hi
    is there a function that permit to  translate a  unicode characters to a non-unicode characters?
    For example with this function  "  à " must become " a ".
    thank you for your help

    Copy paste the below code and execute. This could also solve your problem.
    DATA: BEGIN OF trans OCCURS 0,
    auml TYPE x VALUE 'C4', "'Ä'
    c_8e TYPE c VALUE 'A',
    gra TYPE x VALUE 'E0', "'à'
    c_gra TYPE c VALUE 'a',
    END OF trans.
    DATA : input(40).
    DATA : output(40).
    input = 'ÄBàp'.
    output = input.
    TRANSLATE output USING trans.
    condense output no-gaps.
    write :/ input.
    write:/ output.
    Thanks,
    Senthil

  • SIT Issues - Undefined Functions and non-compilation

    Dear All,
    FIrst off hi! Am new to LabVIEW, SIT and the forums. I currently have an issue with SIT 4.0 that I hope you can help me with.
    Background:
    We are trying to move a Simulink model off of a Windows environment into a cRIO-9004. This will run the simulation on startup and will get its data and will pass its data via UDP links (2 x Transmits, 2 x Receives). The system will not have a host VI, it is to run stand-alone in that respect.
    Currently we have a model working fine in Simulink. It communicates both locally and over the network using custom UDP blocks that we wrote in C (and so have src for).
    Issues:
    Currently when we try to build a DLL from ANY model (even a simple output of a constant) the model will autocode into C and a DLL will build but when importing it into LabVIEW we are told that there are functions defined in the DLL that are not defined in the header (it lists a standard 21 functions [i.e. NISIT_<fn name>] ). The header seems to define a different 4 (or 5 - currently not to hand apologies) <Model name>_<fn name>. These are soemthing like Initialize, Update, Output, Terminate.
    So I cannot currently import. The 21 functions seem overkill to manually define in the header but am I wrong? Why is the SIT not writing the header correctly. This issue relates to a model without our UDP blocks, the UDP functionality would be added around the DLL in LabVIEW using standard LabVIEW function blocks.
    In addition, rather than directly importing the DLL we considered directly deploying a DLL with the UDP functions embedded in it. However, when using RTW in Simulink it autocodes to C fine, but upon compilation into a DLL is raises issues (in true MATLAB style, typically vague and non-helpful). Any ideas?
    Many thanks for any of your time,
    Rich
    Additional Info:
    LabVIEW 8.5 (with Real-Time Module)
    MATLAB 2007a
    MS VC++ 6.0
    The engineer who wrote the custom UDP blocks suggests that it might be an issue with using WinSock in his blocks
    Any other info please ask

    Adnan,
    Thank you for looking into this and I must apologise, my original post wasn't all that clear with hindsight. So I will answer you questions and try to be clearer on the situation:
    There are two situations and issues here.
    1) Any simlpe model (i.e. constant -> output, or say pulse_gen -> transfer_fn -> output) will happily compile and link to a DLL using you nidll.tlc and the makefile etc that it produces. When importing the DLL (just standard import, not using SIT Connection Manager) I get an error, however:
    2) When exporting a DLL (like above) it will load fine onto the target when using SIT Connection Manager, no errors like above.  We thought of using this method to do everything in Simulink and use the SIT connection manager as above to load it all. The issue we were having with this is that the UDP blocks that were custom written would not compile when using nidll.tlc and the makefile etc. It will run fine as an s-function in Simulink. The engineer who wrote the blocks thinks it might be that your makefile would not like the UDP blocks as they use Winsock and he assumes that the makefile will raise an error as winsock will not be in the LabVIEW environment.
    So to fully answer your questions:
    1) What are the exact codes?
    When examining the error in Situation 1 that's exactly what I get. Interestingly if I include all the header it lists on the right hand side (clearer in the following screen print) then LabVIEW hangs when adding parsing the "simstruc" headers: (N.B. if you are looking at the addresses of these images then ignore the name of this one!)
    The other error I'm getting with regards to the UDP blocks manifests as follows (ignore Paint in the background showing the Config Screen):
    2) Does the error occur for any model or just yours?
    The errors surrounding the missing functions concerns any model when importing (SIT Connection Manager seems not to mind). The error when compiling/linking the DLL surrounds just our model due to the UDP blocks
    3) Are the 21 undefined functions created by you or purely by the Simulink compiler?
    We haven't touched any of the files after they are thrown out of the compiler. The 21 or so functions it lists all begin NIRT_<FnName> (N.B. I previously posted wrongly stating NISIT_<FnName>. NIRT_ is correct) so I assume that's the compiler. The ones defined in the header (the 4) all start <ModelName>_<FnName>
    The functions I assume I want (copied from the produced header file - I have not edited it. RWFJMildModel is the name of the Model file. There are no instances of the letters NIRT):
    /* Model entry point functions */
    extern void RWFJMildModel_initialize(boolean_T firstTime);
    extern void RWFJMildModel_output(int_T tid);
    extern void RWFJMildModel_update(int_T tid);
    extern void RWFJMildModel_terminate(void);
    The ones LabVIEW finds in the DLL (due to the DLL_EXPORT I imagine) and not the header can be seen in previous screen prints.
    4) Are you using nidll.tlc as your System Target File?
    Yes all instructions provided online, in the SIT 4 help etc are followed and this includes using nidll.tlc:
    5) If the model you are trying to build does not use your custom UDP blocks, then why do you believe the issue is related to using WinSock in those blocks?
    The model we plan on using eventually currently includes the UDP blocks, although if we cannot import them we will wrap the UDP functionality around the "rest of the model DLL" in LabVIEW provided we get that working. The other models are simple (as in thrown together in less than 30 secs) and I have no reason to believe this, I think this confusion was caused by my terrible first post, apologies.
    Thank you for you help, it is much appreciated
    Rich
    P.S. My company blocks imagehosting sites so I cannot confirm if the screen prints are in place, in the right order etc. They should however all be there!

  • Calling a RFC function in non-SAP application

    Hi,
    I can call a RFC function in a .NET application. Here there is no problem.
    But if an ABAP program submitted in this RFC then I can not call this RFC?
    Can I call an RFC ( it submits another abap program) non-SAP application.
    Thanks.

    Hi Astron,
    Could you please close the thread as answered.
    Regards,
    Anand Mandalika.

  • Function of non leading ledger

    Hi
    I am booking expenses in one company code and for management reporting distributing to another company code by cost centre distribution. During this process system is creating cross company code accounting document which we want to avoid.
    I heard that we can not avoid cross company code transaction. But instead of posting entries into leading ledger, system can post these cross company code transaction into non leading ledger during cost centre distribution.
    Is it possible? If yes, please guide me how. If not possible, any other way to achieve above result?
    Following components are active in my system:-
    1.Profit centre accounting
    2.New GL functionality
    3.FICO reconciliation
    Please revert.
    Regards
    DD

    Hi,
    There is exactly only one leading ledger at client level. SAP Provides Leading Ledger with Standard System. Only the leading ledger passes and posts values to CO in the standard system. The Leading ledger manages additional currencies, Fiscal Year Variant and Posting Period Variant that are assigned to the company code. ONe are more SAP delivered scenarios(Cost Center/Business Area/Segment Update) are to leading ledger. These scenarios are updated in corresponding General Ledger view duriing the document posting.
    In addition to the leading ledger, you can also define other, non-leading ledgers that are assigned currencies and/or fiscal year variants that differ from the leading ledger. Multiple/non-leading ledgers are useful for portraying accounting in accordance with different accounting principles(ex. Local and Tax accounting principles). It is not necessary to define Non-Leading ledgers even if you have it is not necessary to assign scenarios(mentioned earlier) to Non-Leading Ledgers.
    Regards,
    Krishna Kishore

  • How do I delete documents from my iPad that were added when it ran regular Acrobat, now that it has switched to DC?  The docs are not on the cloud, and DC does not seem to have a delete function for non-cloud docs.

    I use an iPad.  It automatically switched me from old-fashioned Acrobat to DC.  How do I delete docs that were put on my iPad with the old Acrobat?  They are not in the cloud, and DC does not seem to have a delete function for them.

    Hi,
    By default, Acrobat DC for iOS displays recently viewed files.  You need to switch to other file location (such as Local, Document Cloud, Creative Cloud) to delete, rename, move, or duplicate files.
    You can switch to Local, if you would like to see the files and folders that are locally stored on your iPad.
    Would you take a look at the following document to see how you can switch to other file location and delete files?
    How to manage files in Acrobat DC for iOS
    Please let us know if you have additional questions.  Thank you.

  • Problem in discoverer  with analytic function created non-additive YTD

    I have problem with discoverer desktop which show me wrong ytdact, ytdbgt figure after i rollup/pivoting
    on custom folder i did in discoverer admin:
    SELECT a.year, a.month, c.deptno, b.glaccount, bgt.mthbgt, bgt.ytdbgt, bgt.fullbgt, bgt.lastyr_fullbgt,
    act.mthact, act.ytdact
    FROM (
    SELECT
    a.amount mthbgt,
    SUM(a.amount) OVER (PARTITION BY ...) fullbgt,
    SUM(a.amount) OVER (PARTITION BY ...) ytdbgt,
    LAG(SUM(a.amount),1) OVER (PARTITION BY...) lstyr_fullbgt
    FROM gltrans_bgt a, gl_master b, dept c
    WHERE a.glaccount=b.glaccount AND a.deptno=c.deptno GROUP BY a.year, a.month, c.deptno, b.glaccount
    ) bgt
    FULL OUTER JOIN
    SELECT a.year, a.month, c.deptno, b.glaccount,
    a.amount mthact,
    SUM(a.amount) OVER (PARTITION BY...) ytdact,
    LAG(SUM(a.amount),1) OVER (PARTITION BY...) lstyr_ytdact
    FROM gltrans_act a, gl_master b, dept c
    WHERE a.glaccount=b.glaccount AND a.deptno=c.deptno
    GROUP BY a.year, a.month, c.deptno, b.glaccount
    ) act
    ON
    bgt.year=act.year AND
    bgt.month=bgt.month AND
    bgt.deptno=act.deptno AND
    bgt.glaccount=act.glaccount
    In discoverer desktop, sometime i would like to remove deptno or month to see the rollup figure. But it seems discoverer tried to sum the ytd to give me wrong figure.
    I know that to ask oracle rewrite the query in order to roll up the figure, one may need to create dimension and specify the hierarchy for the related .
    Anyway to do on this MV so that oracle can rewrite the query for me automatically?

    I suspect if your FY runs not from Jan - Dec, then someone has had to come to grips with this before and has created some kind of custom FUNCTION to determine the fiscal year from the date entered. Or maybe a table that populated with the same info.
    Nevertheless, if there isn't one, then you'd just change the TRUNC(SYSDATE,'YYYY') logic to your fiscal year with a direct calculation.
    ie:
    calculation: what_fiscal_year
    CASE WHEN to_char(sysdate,'MMM') IN ('JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP') THEN to_char(sysdate,'YY')
    WHEN to_char(sysdate,'MMM') IN ('OCT','NOV','DEC') then to_char(sysdate,'YY')-1
    ELSE '99' END
    Something like that - I haven't tested it so treat as pseudo-code first (ie: the last to_char may need to have a to_char(to_number(to_char instead to substract the 1 but might work - Oracle's good with powerful date functions). It should give you an idea of what I'm referring to.
    So once each record has an associated FY either by a calculation such as shown or by a calculation calling your corporate FY function, you just do the same thing as described early (ie: range between FY and FY-1).
    Russ

  • Reg: Functionality of non standard screen

    Hi
    My client wants to enter serial number of final product and its sub assembly parts in a separate development T-code (Z or Y t-code). This is will be done after inspection by quality person.
    For developing the screen, what are the things i need to give for ABABer. I mean functionality requirement.
    Please advice..
    Janardhanan

    I run 1680x1050 through DVI with no problems.  I used to have to specify a modeline, but that was always tricky...some worked, some didn't, and I never knew which one was the "correct" mode.  Anyway, with the newer releases of Xorg (probably around 5-6 months ago), I don't have to specify a modeline at all.
    As Shaika-Dzari mentioned, you do have to specify the proper horizontal sync and vertical refresh though.  For an example, here is the relevant portion of my <code>xorg.conf</code> file (and my graphics card stuff too, for clarification):
    Section "Monitor"
    Identifier "Monitor0"
    VendorName "Dell"
    ModelName "UltraSharp 2005FPW"
    HorizSync 30.0 - 83.0
    VertRefresh 56.0 - 75.0
    Option "DPMS" "true"
    EndSection
    Section "Device"
    Identifier "Card0"
    Driver "nvidia"
    VendorName "NVIDIA Corporation"
    BoardName "GeForce 6200"
    Option "HWCursor" "off"
    Option "IgnoreDisplayDevices" "CRT, TV"
    Option "NoLogo" "true"
    Option "NvAgp" "1"
    Option "RenderAccel" "true"
    Option "AllowGLXWithComposite" "true"
    EndSection
    Section "Extensions"
    Option "Composite" "Enable"
    EndSection
    Section "Screen"
    Identifier "Screen0"
    Device "Card0"
    Monitor "Monitor0"
    DefaultDepth 24
    SubSection "Display"
    Viewport 0 0
    Depth 24
    Modes "1680x1050"
    EndSubSection
    EndSection

  • Array functions on non-double numbers

    Hey everyone,
    Sorry for another newbie question, coming from Labview has spoiled me  Is there a way to use the Array Operations functions on float numbers?  If not, can anyone recommend a Boost like library that is C based that will handle floats?
    Thanks,
    Austin

    I suppose you are referring to array functions from the Analysis library: unfrtunately those functions are limited to treat doubles only. I don't know of any alternative for floats or doubles: for the simpler of them you may want to create your own equivalent in a for loop; for more complex functions you can create a temporary array of doubles and use ConvertArrayType function to exchange data to and from it before and after calling the array function.
    Depending on other functions you are using into your application, you can consider promotinig all of your arrays to double and use them: PC are now plenty of memory to use and very fast CPU frequency so it could be a feasible solution.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Creating a  query with group function and non group function

    Could anyone help me with creating a query that contain single row function and multiple row function in Report6i.
    what i want to do basically is to create a query that will display sum of certain columns according to a column in that table

    You can either calculate a sum yourself, or let Reports do it for you.
    1. select sum(column) from table where ....
    This will just display the sum, not the records.
    2. Make a query: select column from table where ...
    Create a summary field. You can do it manually or with the report wizard.
    That will create a report like this:
       Column
           10
           20
           15
       ======
    Sum    45                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • New LR Merge to HDR function in non CC version?

    Hi,
    I have become aware of new features in LR CC.  One for merge to HDR and another for Merge to Panorama - both within the LR product (rather than using Photoshop or other 3rd party tools).
    Is this feature available for perpetual license users of LR vsn 5 or is it only in :LR CC?   If it is available in the Perpetual license version, where do I find the download?
    Thanks -- Dan

    I would expect those new features are in LR 6 (non-CC) and that the way to start a download of the trial is to use Help / Updates and click the Download… button.
    However, I have a CC subscription so I cannot test this theory because the download site is smart enough to know I’m a CC subscriber and just tells me to use the CC App to download the update, but it may work for you if you’re not a CC subscriber.
    BTW, new features released after this initial version wouldn’t be added to the non-CC version until LR 7 comes out—that’s a benefit of CC, besides having Photoshop, you also get new features as soon as they are available.

  • Paste function semi-non-functional

    Dear Folks:
    I can use apple key-C to copy but apple-key-V to paste will not work in "fields" or "forms" in Safari. I get a beep tone instead. Edit/Paste from the menu works. It's the keyboard shortcut that is disabled.
    It seems to work fine in programs, just not in my browser. This is a new issue too, and only on my Macbook Pro.
    I have checked to see if something else is assigned to that key combination in System Preferences and nothing is. I have also looked at Speech and nothing is checked in that preference panel.
    I posted a question on this earlier and I can't find it. A similar thread has been locked, even though no resolution is offered.
    What's up with this little irritation?
    Raoul

    telephoneman,
    Your second display should be off the DVI if you want to run Dual Monitors.
    Take Care,
    Richard

Maybe you are looking for