Some questions about how to change scenes

i have something like the following:
fxml (view/main/MainMenu.fxml):
<Scene fx:controller="view.main.CtrlMainMenu" xmlns:fx="http://javafx.com/fxml" stylesheets="view/main/main.css">
    <GridPane xmlns:fx="http://javafx.com/fxml" alignment="center" id="backgorund" hgap="10" vgap="10">
        <!--other panes -->
        <VBox spacing="8" GridPane.columnIndex="0" GridPane.rowIndex="1">
            <Button text="Start" onAction="#Start"/>
            <Button text="Options" onAction="#Options"/>
            <Button text="Exit" onAction="#Exit"/>
        </VBox>
    </GridPane>
</Scene>main loop (cotroller/main.java):
public class main extends Application{
    public static void main(String[] args){
        launch(main.class, args);
    public void start(Stage stage) throws Exception{
        stage.setTitle(CtrlLanguage.get(CtrlLanguage.TITLE));
        CtrlMainMenu main = new CtrlMainMenu();
        Scene scene = main.main();          //don't know how to make Scene scene = (Scene)FXMLLoader.load(getClass().getResource("MainMenu.fxml")); work on here since MainMenu.fxml is in view/main while the main class is in controller and ended up putting CtrlMainMenu in the view although is not very correct
        stage.setScene(scene);
        stage.setWidth(1080);
        stage.setHeight(720);
        stage.show();
}view controller (view/main/CtrlMainMenu.java):
public class CtrlMainMenu{
    //other buttons actions
    public Scene main() throws Exception{
        return (Scene)FXMLLoader.load(getClass().getResource("MainMenu.fxml"));
    @FXML protected void Start(ActionEvent event){
    @FXML protected void Options(ActionEvent event){
    @FXML protected void Exit(ActionEvent event){
        System.exit(0);          //is there any other way to finish the program than using a system.exit?
}got few questions currently:
1. i'd like to be able to keep using CtrlMainMenu for other buttons while the ones that appear there go to the main (since will be reusing those classes from other scenes)
tried adding fx:controller on panes instead of the scene, but it doesnt work at all (it crashes) else directly in CtrlMainMenu change the scenes of the stage, but then, i have to send the stage to every controller i use? (or how do i know the stage of the scene?)
and in the case of options, i'd like after done, go back to the previous scene, is that possible? if so, how?
2.if i want to implement languages, how do i do to change the text? tried with setText() but depending on where do i put it, it crashes, so dont know where do i have to put it
3.im doing a game that may have different number of players, so, is there some way to erase/hide/add data from a gridpane with fxml?

1. ok, found the way to change scenes, with this way:
@FXML protected void Start(ActionEvent event) throws Exception{
     Node node = (Node)event.getSource();
     Stage stage = (Stage)node.getScene().getWindow();
     Scene scene = (Scene)FXMLLoader.load(getClass().getResource("../view/main/MainMenu.fxml"));     //this is just an example, will change to go to another scene
     stage.setScene(scene);
     stage.show();
}but now i have another problem, when i click on the button the stage scene is changed, but the scene is transformed to a very small one at the top left (the size seems the same as when i dont put the set width/height on the stage when creating it), the stage size remains the same, and when i resize the window, it gets "repaired"
the options, i thought on using a pane over the current pane so this way instead of going back would be just removing that new pane, would that work well?
2. found about languages that is by using <Label text="%myText"/> and java.util.ResourceBundle but don't know how to use it, can someone provide me an example, please?
3. still haven't looked on it...

Similar Messages

  • A question about how to change a button in a JPanel during runtime

    I am a beginner of GUI. Now I am trying to change a specific component, a button, when the application is running. For example, I have 3 buttons in a JPanel. Each button has its onw icon. If I click one of them, it will change its icon, but the other two don't change. I don't know if there is any method for changing a specific component during runtime. If any one knows please let me know, I will appreciate that very much!!!

    What you're going to have to do is loop inside the actionlistener but still have accessability to click while its looping. I don't know much about it, but I think you're going to need a thread. Try something like this... (it doesn't work yet, but I have to take off)
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    class buttonxdemo extends JFrame implements ActionListener{
      Buttonx mybutton;
      //set it all up, make it look pretty  =]
      public buttonxdemo()
           mybutton = new Buttonx("default");
           getContentPane().add(mybutton.thebutton);
           mybutton.thebutton.addActionListener(this);
           this.setDefaultCloseOperation(3);
           this.setSize(200,200);
      public void actionPerformed(ActionEvent ae){
        if (ae.getSource() == mybutton.thebutton)
             if (mybutton.keepGoing)
               mybutton.keepGoing = false;
                else if (!mybutton.keepGoing)
                     mybutton.keepGoing = true;     
          mybutton = new Buttonx(/*Icon,*/"My Button");
          //getContentPane().remove(mybutton);
          //getContentPane().add(mybutton.thebutton);
          mybutton.startstop();
      }//actionperformed
      static void main(String args[])
           new buttonxdemo().show();
    } //movingicondemo
    class Buttonx extends Thread{
      public boolean keepGoing;
      //public Icon ICx;            //perhaps an array, so you can loop through?
      public String strbuttonx;
      public JButton thebutton;     //may have to extend JFrame?
      public Buttonx(/*Icon IC,*/ String strbutton){
        //ICx = IC;
        strbuttonx = strbutton;
        thebutton = new JButton(strbuttonx);
      public void startstop()
        int i = 0;
        while (keepGoing)
          thebutton.setLabel(strbuttonx.substring(0,i));
          //if an array of Icons ICx
          //thebutton.setIcon(ICx);
    i++;
    if (i > strbuttonx.length() - 1)
    i = 0;
    try
         Thread.sleep(1000);
    catch (InterruptedException ie)
         System.out.println("sleep caught: " + ie);
    }//startstop()
    }//buttonx
    kev

  • Very simple question about how to change a specific field in a table

    Hi,
    I'm working with a simple JSF web application, I have just drag a table, the "travel" standard example, and I just had 3 columns, one with a drop down list, other with a static text field and a Button.
    Then I introduced the following java code in the Button:
    public String button1_action() {
    int quantity=Integer.parseInt(dropMenu.getValue().toString());
    quantityChosen.setValue(quantity);
    When the button is pressed, I can print and check that the value obtained is the one selected in the drop down list, of the respective row.
    The problem that I would like to write it in the respective static text field (in the same row) where the button was pressed.
    What happens is that it write the value in all the column. So it reads from the write place and then write in every column?
    How to write in the respective row?
    Thanks in advance, Junkeira

    Hi,
    I'm working with a simple JSF web application, I have just drag a table, the "travel" standard example, and I just had 3 columns, one with a drop down list, other with a static text field and a Button.
    Then I introduced the following java code in the Button:
    public String button1_action() {
    int quantity=Integer.parseInt(dropMenu.getValue().toString());
    quantityChosen.setValue(quantity);
    When the button is pressed, I can print and check that the value obtained is the one selected in the drop down list, of the respective row.
    The problem that I would like to write it in the respective static text field (in the same row) where the button was pressed.
    What happens is that it write the value in all the column. So it reads from the write place and then write in every column?
    How to write in the respective row?
    Thanks in advance, Junkeira

  • Round trip workflow with proxies between Premiere and AE / a more general question about how these programs work?

    Hi all,
    I'm new to editing with proxies in Premiere and have some questions about how to handle the relationship with After Effects. Say I have a rough cut (with proxies) and I want to send it to AE to do some effects. The simplest thing to do seems to be to replace the proxies with the originals in Premiere, send the project to AE and do my thing. But if I then want to send the project back to Premiere, it will involve the original files, which are too machine-intensive for me to edit. In theory, it seems like there should be a way to send the project with original footage to AE, do effects, send it back to Premiere, and then replace it with proxies to do further editing while retaining the effects.
    This leads to a confusion about how AE works. When I do an effect, am I correct in assuming that it does nothing to the original file? If that's the case, it seems like it shouldn't matter (in the editing stage) what file AE "applies" an effect to (proxy or original). But I feel like there's a hitch in this workflow. The same question could also be asked about going back and forth in Speed Grade.
    Perhaps there is no real answer to this and the best option is to save effects and grading for after I have picture lock, but sometimes that's not entirely possible or convenient, etc.
    Hopefully this makes some sense—It's a little hard to explain.
    Thanks.

    Hi Mark,
    Here are the specific sections of the manual that should give you the best explanation regarding the Check out/in workflow for FCP projects in Final Cut Server:
    Check out:
    http://documentation.apple.com/en/finalcutserver/usermanual/#chapter=7%26section =5
    Editing:
    http://documentation.apple.com/en/finalcutserver/usermanual/#chapter=7%26section =6
    Check in:
    http://documentation.apple.com/en/finalcutserver/usermanual/#chapter=7%26section =7
    -Daniel

  • Some question about georaster?

    Hello,
    I have some question about how to create high efficiency georaster model. I have 3T capacity raster data. It's bands is from 8 bands to 12 bands and the resolution is 0.5 meter. In order to ensure the original information of raster data, I consider not use the SDO_GEOR.mosaic, this means that a import file is a georaster object. I keep the original data capacity, not compression. I use JPEG-B to compress pyramid data.
    Does anyone can tell me my georaster model is OK? or tell me some areas for improvement.
    Thanks who have lool my page.

    i don't have specific performance number on georaster using bigfile tablespaces. "A bigfile tablespace with 32K blocks can contain a 128 terabyte datafile" and should be doable with georaster in considering your data size is just 8 TB. It should have some advantages over small file tablespaces, for example, it would be easiler to manage because it has only one datafile. but note, "Bigfile tablespaces are intended to be used with Automatic Storage Management (ASM) or other logical volume managers that supports striping or RAID, and dynamically extensible logical volumes". "Using bigfile tablespaces on platforms that do not support large file sizes is not recommended and can limit tablespace capacity." please refer to the Oracle Database Administrator's Guide.
    thanks

  • Hi,sorry for my english.My question is how to change country when i have credit in my account.My account is US and i've 0.5 USD.Now,one frind from Canado bought some credit cards and i can't recharge my account.Tank you for helping me.

    Hi,sorry for my english.My question is how to change country when i have credit in my account.My account is US and i've 0.5 USD.Now,one frind from Canado bought some credit cards and i can't recharge my account.Tank you for helping me.

    BellaMichelle wrote:
    For some reason, I have had misgivings about partioning my internal HD.. not sure why.. sort of feels like I'm creating my own computer sybil ;-)  Truthfully, it seems weird to split it.. I don't think I can articulate it really.. but are there complications that can come with doing this?
    It's a common way to run multiple OSs, if there's room.  I've had two on my internal HD for a couple of years.  Plus a small partition for a copy of my Snow Leopard Install disc.  Just be sure to leave at least 10% to 15% free on each partition.
    Running Lion on a partition of the disk that also contains your backups is not a good idea; if that drive fails, you risk losing both copies of your stuff!
    OSX will also run somewhat more slowly, because access to an external is slower.  That probably won't be very significant, though.
    Also, would the decision be effected by how long I want to maintain the SL section?  I am assuming once I sort out what to replace Quicken with, I won't want to keep the SL section.  So would it be easy enough to 'clear out the SL data, and open the partition?
    Review #3 in Formatting, Partitioning, Verifying, and Repairing Disks. 
    All things considered, your best bet may be to  "clone" your SL partition to the second one, then (once you're sure everything is cool), erase the original (top) SL partition.  You can use the Restore tab of Disk Utility for that (#7 in the same link), or a "cloning" app such as CarbonCopyCloner or SuperDuper.  Then install Lion on the top partition.
    When you're done with SL, just delete it's partition and expand the Lion partition down into the vacated space.

  • Hello , I want to ask some question about ipads \  How powerful is the iPad?  How useful is it for reading books, newspaper or magazines or for surfing the web? Can you identify any shortcomings of the device?   please help me :(

    Hello ,
    I want to ask some question about ipads \
    How powerful is the iPad? 
    How useful is it for reading books, newspaper or magazines or for surfing the web?
    Can you identify any shortcomings of the device?  
    please help me

    it's less powerful than your average computer. THink of it like a netbook but with a better processor.
    It'll do fine for surfing (although if you browse a lot of flash based sites you will need to get a third party browser since safari doesn't accommodate it)
    You may do OK on reading books, papers or magazines, especially if they have apps, but the ipad's screen is backlit, so it doesn't work well outdoors and you may need to fiddle with the brightness so that you don't get eye strain (it's just like doing too much reading from a computer screen)
    I would say the biggest short comings are data transfer. Apple's preferred work flow is that everything is done via iTunes or the internet....well people dont' always have 100% reliable always on internet access so you can find yourself in a situation where you can't get things on/off the iPad.
    By and large, it's a good device for day to day stuff, but is not a computer replacement.

  • Some questions about configuration in MAX.

    Hello,everyone!
    I have some questions about configuration in MAX(I am a jackaroo for motion control development),I hope I can get your help.
    I use PCI-7344+UMI-7764+Servo amplifier+Servo motor,my MAX version is 4.2 and I use NI-Motion7.5
    My question as following:
    1,In Axis Configuration,for motor type,why I must select stepper but not servo?my motor is servo motor!If I select Servo,my motor can't run,I don't know why.
     If I select stepper,though motor can work but I can't test encoder in MAX.
    2,In Stepper settings,for stepper loop mode,why I must select open-loop but not close-loop?If I select close-loop,the servo motor doesn't work too.
    3,If I want my two servo motors run at different velocity,How shoud I do?It seems I just can set the same velocity in MAX for my two servo motors.
     My English is poor,Pls pardon me!I come from China.
    Thank you for your help!
    EnquanLi
    Striving is without limit!

    Hi,Jochen,
    Thank you for your kindly help!
    The manufacturer of the drive and motor that I am using now is Japan SANYO DENKI,drive type is RS1A01AA,motor type is R2AA06020FXP00.
    And I use position control mode,thehe encoder's counts per revolution is 131072.I set the electronic gear ratio to 1:1 for drive.
    Now,I can use Close-Loop to control the motor but still has some problems.When I configure it to run in closed loop mode, the motors behave strangely and never move to the target position.When I configure it to run in closed loop mode, the motors behave strangely and never move to the target position.The detail situation is as following
    1,Motor can't run.
    2, Or motor moves to a position, then moves in the same direction agian and eventually stops.
    Except for the  two points mentioned above,"Following Error" is  occured frequently,I don't know why.
    I am still not clear why I must set the motor type be stepper in MAX .
    And I have another question:what the relationship between the steps and the counts?They have the proportion relations?I notice that there are a section said like this in help document: For proper closed-loop and p-command operation, steps per revolution/counts per revolution must be in the range of 1/32,767 < steps/counts < 32,767. An incorrect counts to steps ratio can result in failure to reach the target position and erroneous closed-loop stepper operation.
    I am verry sorry I have too many questions!
    I am very appreciate for your kingly help!Thanks again!
    EnquanLi
    China
    Striving is without limit!

  • Some questions about the integration between BIEE and EBS

    Hi, dear,
    I'm a new bie of BIEE. In these days, have a look about BIEE architecture and the BIEE components. In the next project, there are some work about BIEE development based on EBS application. I have some questions about the integration :
    1) generally, is the BIEE database and application server decentralized with EBS database and application? Both BIEE 10g and 11g version can be integrated with EBS R12?
    2) In BIEE administrator tool, the first step is to create physical tables. if the source appliation is EBS, is it still needed to create the physical tables?
    3) if the physical tables creation is needed, how to complete the data transfer from the EBS source tables to BIEE physical tables? which ETL tool is prefer for most developers? warehouse builder or Oracle Data Integration?
    4) During data transfer phase, if there are many many large volume data needs to transfer, how to keep the completeness? for example, it needs to transfer 1 million rows from source database to BIEE physical tables, when 50%is completed, the users try to open the BIEE report, can they see the new 50% data on the reports? is there some transaction control in ETL phase?
    could anyone give some guide for me? I'm very appreciated if you can also give any other information.
    Thanks in advance.

    1) generally, is the BIEE database and application server decentralized with EBS database and application? Both BIEE 10g and 11g version can be integrated with EBS R12?You, shud consider OBI Application here which uses OBIEE as a reporting tool with different pre-built modules. Both 10g & 11g comes with different versions of BI apps which supports sources like Siebel CRM, EBS, Peoplesoft, JD Edwards etc..
    2) In BIEE administrator tool, the first step is to create physical tables. if the source appliation is EBS, is it still needed to create the physical tables?Its independent of any soure. This is OBIEE modeling to create RPD with all the layers. If you build it from scratch then you will require to create all the layers else if BI Apps is used then you will get pre-built RPD along with other pre-built components.
    3) if the physical tables creation is needed, how to complete the data transfer from the EBS source tables to BIEE physical tables? which ETL tool is prefer for most developers? warehouse builder or Oracle Data Integration?BI apps comes with pre-built ETL mapping to use with the tools majorly with Informatica. Only BI Apps 7.9.5.2 comes with ODI but oracle has plans to have only ODI for any further releases.
    4) During data transfer phase, if there are many many large volume data needs to transfer, how to keep the completeness? for example, it needs to transfer 1 million rows from source database to BIEE physical tables, when 50%is completed, the users try to open the BIEE report, can they see the new 50% data on the reports? is there some transaction control in ETL phase?User will still see old data because its good to turn on Cache and purge it after every load.
    Refer..http://www.oracle.com/us/solutions/ent-performance-bi/bi-applications-066544.html
    and many more docs on google
    Hope this helps

  • Some question about communicating the usb RAW device

    I have some question about USB communication: I want to make my VI communicate
    TI-DSP by USB, now, the driver of USB on DSP have done, and  there are a test
    program writen by VC and a driver fold(with a .inf and a .sys files), when I
    install the driver and run the test program, the driver program on DSP run
    regularly. And then I want to program a VI which have the same function as the
    test program, so I unload the driver on PC firstly, then install the DSP in
    NI_VISA according to "Using NI-VISA 3_0 to Control Your USB Device - Tutorial -
    Instrument Drivers". When I sent the standard control request using the VISA test panel, the status below happened. I don't know what wrong with my step.
    Dev  Phase  Data                       Info           Time   Cmd.Phase.Ofs    
     15  CTL    80 06 03 00 - 00 00 04 00  GET DESCRIPTR  5.2sc        56.1.0       
     14  CTL    80 06 03 00 - 00 00 04 00  GET DESCRIPTR   11us        57.1.0       
     14  USTS   00 00 01 c0                canceled       2.0sc        57.2.0       
     15  USTS   00 00 01 c0                canceled         5us        56.2.0 
    PS: the software I use to capture the data is BUSHOUND
    1、Do I have to install the .sys driver file in VISA? How can I install the driver file without losing the device in MAX?
    2、Someone told me it must be done by calling .dll fies in LV, but I want to know if LV can program the function directly without calling .dll file?
    Thank for any reply~~!

    逍遥浪子 wrote:
    I have some question about USB communication: I want to make my VI communicate TI-DSP by USB, now, the driver of USB on DSP have done, and  there are a test program writen by VC and a driver fold(with a .inf and a .sys files), when I install the driver and run the test program, the driver program on DSP run regularly. And then I want to program a VI which have the same function as the test program, so I unload the driver on PC firstly, then install the DSP in NI_VISA according to "Using NI-VISA 3_0 to Control Your USB Device - Tutorial - Instrument
    Drivers". When I sent the standard control request using the VISA test
    panel, the status below happened. I don't know what wrong with my step. Dev 
    Phase 
    Data                      
    Info          
    Time   Cmd.Phase.Ofs     --- 
    -----  ------------------  15 
    CTL    80 06 03 00 - 00 00 04 00  GET
    DESCRIPTR  5.2sc       
    56.1.0         14 
    CTL    80 06 03 00 - 00 00 04 00  GET
    DESCRIPTR   11us       
    57.1.0         14 
    USTS   00 00 01
    c0               
    canceled      
    2.0sc       
    57.2.0         15 
    USTS   00 00 01
    c0               
    canceled        
    5us        56.2.0  PS: the
    software I use to capture the data is BUSHOUND 1、Do I have to install the .sys driver file in VISA? How can I install the driver file without losing the device in MAX? 2、
    Someone told me it must be done by calling .dll fies in LV, but I want
    to know if LV can program the function directly without calling .dll
    file?
    This thread
    contains already a related answer and explains what a sys driver is.
    While you could theoretically use the Call Library Node to call all the
    necessary Win32 API kernel functions to connect to a device driver,
    this would be very cumbersome and not doable without a real good
    understanding about C programming. Writing an interface DLL instead
    won't need more C programming knowledge at all but will give you a
    clean interface to that device driver which eventually could be used in
    other programming environments as well.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Some question about Cisco Prime Infrastructure

    Dear all
    I have some question about using Cisco prime Infrastructure:
    - Can I show how many user access to one Access Point (AP) ?
    - If I can. What is display information of user ? etc Ip address, MAC, username access, name of device (notebook, tablet, phone ..)
    - How many time do Cisco Prime Infrastructure refesh user  informantion .?
    Please help me and send picture about it if you can.
    Thank you so much.

    Hi,
    I don't have the Prime Infrastructure to post you image, but you can simply find all the answers you want on the config guide:
    http://www.cisco.com/en/US/docs/wireless/prime_infrastructure/1.2/configuration/guide/clientmgmt.html#wp1232242
    1- You can surely find how many clients associated to a specific AP.
    - Informaiton of the client usually includes username, SSID, ip address, mac address, RSSI, device vendor...etc. I don't think it contains the device type (ipad or iphone both appear as apple vendor. it does not destinguish between this and that.
    3- The time of the refreshment is configurable. You need to configure the corresponding background task for the poll period. (this is also metnioned in the link above).
    HTH
    Amjad
    Rating useful replies is more useful than saying "Thank you"

  • A few questions about how ZPM works.

    We have patch management (in ZCM 11.2.2), but honestly don't use it much. I have a few questions about how it works that might make me use it more, if I understand it more.
    If I deploy a patch (or a set of patches), it creates a bundle for that deployment. That bundle seems to include actions that deploy the actual patch bundles (correct?). Do I have to recreate a new deployment bundle every time I want to push a new patch? i.e. If I push a Java update, and a month later, a new one comes out, do I build out a new bundle with the new patch in it, or do I modify the old one?
    Once the patch is deployed, can I safely delete that deployment bundle, or should they just pile up?
    Is there a way to "auto-approve" patches? Lets say I always want a group of machines to have the latest Adobe Flash Player patches. Can I set up ZPM to automatically cache and push the latest patches for a specific product, or do I have to manually remediate each patch? (I'm thinking of how MS's WSUS does "auto-approval")
    I see most packages aren't cached in list, but occasionally, a patch is cached without me touching it. Why? Can I change what gets automatically cached?
    Thanks for any help/answers you can provide.
    -Adam

    Originally Posted by adrockk
    We have patch management (in ZCM 11.2.2), but honestly don't use it much. I have a few questions about how it works that might make me use it more, if I understand it more.
    If I deploy a patch (or a set of patches), it creates a bundle for that deployment. That bundle seems to include actions that deploy the actual patch bundles (correct?). Do I have to recreate a new deployment bundle every time I want to push a new patch? i.e. If I push a Java update, and a month later, a new one comes out, do I build out a new bundle with the new patch in it, or do I modify the old one?
    Once the patch is deployed, can I safely delete that deployment bundle, or should they just pile up?
    Is there a way to "auto-approve" patches? Lets say I always want a group of machines to have the latest Adobe Flash Player patches. Can I set up ZPM to automatically cache and push the latest patches for a specific product, or do I have to manually remediate each patch? (I'm thinking of how MS's WSUS does "auto-approval")
    I see most packages aren't cached in list, but occasionally, a patch is cached without me touching it. Why? Can I change what gets automatically cached?
    Thanks for any help/answers you can provide.
    -Adam
    For #1, (assuming you're not using baselines), you would check the new version of the patch (vulnerability) and do a new deployment.
    #2 - once you're satisified that the machines are deployed (or the best to your ability) you can delete the DEPLOYMENT package. It doesn't delete the actual vulnerability bundles to my knowledge. That's why it's a good idea to name your bundle deployments with something meaningful, IMO (and maybe include a nice desription).
    #3 - currently I don't believe this is possible. I know you can probably configure it to auto-download the patches, but not auto-deploy everything. Given the propensity for software to wreck other things (hello MS .NET patches), this is probably not a good idea. At least I'd never auto-download and auto-deploy any patches without testing them first, and certainly take my servers a little more cautiously than my workstations.
    #4 - I think you can configure what's cached, but I could be wrong.
    I know there's a lot of improvements coming in the pipeline, and it doesn't hurt to "vote" for your enhancements via the enhancement system (more work for Shaun--haha)
    --Kevin

  • Some questions about javacard 2.1.1 and smartcardio

    Hello i have some question about java card 2.1.1 and the smartcardio package.
    1.) I want to sign a message with the Signature.ALG_RSA_SHA_PKCS1 algorithm. I use the following code in the applet to sign the message:
    final static byte P1_CREATION_MODE = (byte) 0x01;
    final static byte INS_SIGN_MODE = (byte) 0x60;
    final static byte SmartCard_CLA = (byte) 0xB0;
    private void signMessage(APDU apdu) {
            byte[] buffer = apdu.getBuffer();
            byte byteRead = (byte) (apdu.setIncomingAndReceive());
            signature.init(privateKey, Signature.MODE_SIGN);
            short length = signature.sign(buffer, ISO7816.OFFSET_CDATA, byteRead, buffer, (short) 0);
            apdu.setOutgoingLength((short) length);
            apdu.sendBytesLong(buffer, (short) ISO7816.OFFSET_CDATA, (short) length);
            apdu.setOutgoing();
        }On the host side I use the following code to connect to the card and to send the sign apdu:
    if (TerminalFactory.getDefault().terminals().list().size() == 0) {
                LOGGER.log(Level.SEVERE, "No reader present");
                throw new NoSuchCardReader();
            /* Select the first terminal*/
            CardTerminal terminal = TerminalFactory.getDefault().terminals().list().get(0);
            /* Is a card present? */
            if (!terminal.isCardPresent()) {
                LOGGER.log(Level.SEVERE, "No Card present!");
                throw new NoSuchCard();
            /* Set the card protocol */
         Card card = terminal.connect("*");
            ATR atr = card.getATR();
            LOGGER.fine(getHexString(atr.getBytes()));
            LOGGER.fine(getHexString(atr.getHistoricalBytes()));
            CardChannel channel = card.getBasicChannel();
            CommandAPDU cmd = new CommandAPDU((byte) 0xb0, (byte) 0x60, (byte) 0x01, (byte) 0x00, new String("datadatdatadata").getBytes(), (byte) 0x40);
         ResponseAPDU response = channel.transmit(cmd);
            card.disconnect(false);But this does not work and i got the following error
    javax.smartcardio.CardException: sun.security.smartcardio.PCSCException: Unknown error 0x8010002f
            at sun.security.smartcardio.ChannelImpl.doTransmit(ChannelImpl.java:202)
            at sun.security.smartcardio.ChannelImpl.transmit(ChannelImpl.java:73)
            at de.upb.client.smartmeter.SmartMeter.initSmartCardApplet(SmartMeter.java:114)
            at de.upb.client.smartmeter.SmartMeterApplikation.main(SmartMeterApplikation.java:39)
    Caused by: sun.security.smartcardio.PCSCException: Unknown error 0x8010002f
            at sun.security.smartcardio.PCSC.SCardTransmit(Native Method)
            at sun.security.smartcardio.ChannelImpl.doTransmit(ChannelImpl.java:171)
            ... 3 more2.) 3Des encryption
    I want to use the 3Des algorithm to encrypt my data. I use
    keyDES = (DESKey) KeyBuilder.buildKey(KeyBuilder.TYPE_DES,
                        KeyBuilder.LENGTH_DES3_2KEY, false);
    cipherDES = Cipher.getInstance(Cipher.ALG_DES_CBC_ISO9797_M2, false);But i do not know what is the aquivalent on the host side??
    3.) Another problem is that i am not able to send the modulus of a public key from the host applikation to the smard card
    new CommandAPDU((byte) 0xb0, (byte) 0x20, (byte) 0x01, (byte) 0x00, modulus.toByteArray()); // create the apdu
    // the method in the applet
    private void setServerKeyMod(APDU apdu) {
            byte[] buffer = apdu.getBuffer();
            try {
                byte byteRead = (byte) (apdu.setIncomingAndReceive());
                short off = ISO7816.OFFSET_CDATA;
                // strip of any integer padding
                if (buffer[off] == 0) {
                    off++;
                    byteRead--;
                publicKeyServer.setModulus(buffer, off, byteRead);
            } catch (APDUException ex) {
                ISOException.throwIt((short) (SW_APDU_EXCEPTION + ex.getReason()));
        }The error code is 6700
    4.) My last problem ist, that i am not able to use a value bigger than 0x7F as the ne field in the apducommand, because i get the following error
    CommandAPDU((byte) 0xb0, (byte) 0x60, (byte) 0x01, (byte) 0x00, data, (byte) 0xff);
    java.lang.IllegalArgumentException: ne must not be negative
            at javax.smartcardio.CommandAPDU.<init>(CommandAPDU.java:371)
            at javax.smartcardio.CommandAPDU.<init>(CommandAPDU.java:252)I thought that it this should be possible in order to use all the bytes of the response apdu.
    If you need more code to help please let me know.
    Cheers
    Edited by: 858145 on 06.07.2011 08:23

    2) What is PKCS? what is the difference between
    PKCS#11 and PKCS#15??PKCS is the abbreviation of "Public-Key Cryptography Standards"
    PKCS #11: Cryptographic Token Interface Standard
    See http://www.rsasecurity.com/rsalabs/node.asp?id=2133
    PKCS #15: Cryptographic Token Information Format Standard
    http://www.rsasecurity.com/rsalabs/node.asp?id=2141
    If you want to use yor smartcard as secure token it doesn't have to be a JavaCard.
    BTW: I don't remember a way to access PKCS#15 tokens on a JavaCard from within an oncard JavaCard program. If you want to use keys in your oncard program, you have to transfer it onto the card or generate it oncard and export the public key by your own oncard/offcard code.
    Jan

  • Some question about fade in // fade out by hideEffect and showEffect in Actionscript

    Some question about fade in // fade out by hideEffect and
    showEffect in Actionscript
    Please kindly take a look at the following page:
    http://camusmiu.no-ip.com/HounganQuestion/PictureHolderTest.html
    (can view source)
    I tried to make an image preloaded and scale the image to
    it's preferred size.
    When I came to consolidate the stuff into a component, I
    found the application goes weird as I implementation the show/hide
    effect.
    The third trial which just hide and show the images directly,
    instead of using viewstack, fail to bring the second image onto
    screen.
    It just used fadeOut instead of fadeIn(you see there is a
    flash of the second image)
    After some study of showEffect and hideEffect behaviour,
    seems the mechanism of hide/show a component works in this way:
    this._fadeIn:Fade = new Fade();
    this._fadeIn.alphaFrom = 0;
    this._fadeIn.alphaTo = 1;
    this._fadeIn.duration = 1000;
    this._fadeOut:Fade = new Fade();
    this._fadeOut.alphaFrom = 1;
    this._fadeOut.alphaTo = 0;
    this._fadeOut.duration = 1000;
    Component_A.visible = true;
    Component_A.setStyle("showEffect", this._fadeIn);
    Component_A.setStyle("hideEffect", this._fadeOut);
    then when I set Component_A.visible = false, the sequence
    works like following:
    Component_A.visible = true
    Component_A.visible = true, alpha = 100;
    Component_A.visible = true, alpha = 50;
    Component_A.visible = true, alpha = 0;
    Component_A.visible = false;
    The above sequence works visa versa as:
    Component_A.visible = false;
    Component_A.visible = true, alpha = 0;
    Component_A.visible = true, alpha = 50;
    Component_A.visible = true, alpha = 100;
    Component_A.visible = true;
    (Correct me if i am wrong)
    ========================================================================================== ====
    From what I observe from the application, I have two
    question.
    1) When more than one component using the this._fadeIn,
    this_fadeOut as the hide/show effects, the component in instance of
    this._fadeIn? will it mess out if more than one component using the
    fadeIn instance in the same time?
    2) from the third component, i.e. PictureHolder3, when I load
    other the picture , it fade out the new image instead of fading
    in... Seems there is problem if I hide show too frequent. I think
    when I hide then show right the way, the component only do the hide
    part...
    Can someone pls look into it and tell me what I did wrong?
    Cuz in normal practice I don't think appropriate to use ViewStack
    in Actionscript...

    Hello Jack,
    Currently, you can only import an swf file or you can embed videos from youtube, vimeo etc. into Muse / add HTML5 Video to Your Website.
    Take a look at these simple videos that explain the currently available processes for adding videos in Muse, in a step by step method:
    1. http://tv.adobe.com/watch/learn-adobe-muse-cc/inserting-a-youtube-flic kr-or-hulu-video/
    2. http://www.youtube.com/watch?v=5in4swnIFsw
    3. http://www.youtube.com/watch?v=KnBFLQheOk4
    Hope this helps.
    Cheers
    Parikshit

  • Some question about 9iAs R1.2.2 & R2, need your help:

    Some question about 9iAs R1.2.2 & R2, need your help:
    Since 2000, we has used 9iAS Core (R1.2.2) to publish our website. The platform is Suns Solaris (SPARC). The database is Oracle 8i. But there are so many questions:
    1.     The Web Cache cant be installed well
    2.     The web pages use JSP to query database with SQL show errors when we refresh the page a few times. The error will disappear after restarting the 9iAS or refreshing the page again. On the other hand, the same pages dont show error on resin. The error is java.sql.SQLException : Closed Connection: next. I supposed that the connection of database has some hidden troubles, but I can find it, could you give me some advice.
    Now I have installed 9iAS R2, But when I visited the manage page, I found that a password is needed to visit the web cache manage page. I dont think I have set the password, and then I cant control the web cache. I want to know is a default password occurred? If not, what is the password.

    The default password for Web Cache is: administrator
    See walkthrough on the sample code page: http://otn.oracle.com/sample_code/products/ias/content.html
    HTH,
    Ashesh Parekh
    Oracle9iAS product management

Maybe you are looking for