Strange Problem about KeyListener, and FocusListener

Hi,Please help me with this problem.
I create a JTable and setCellEditor by using my customerized TextField
The problem is: when I edit JTable Cell, the value can not be changed and I can not get Key Event and Focus Event.
here is my source:
//create normal JTable instance,and then initlize it
private void initTable(Vector folders)
TableColumn tempcol = getColumnModel().getColumn(0);
tempcol.setCellEditor(new DefaultCellEditor(new MyTextField()));
for(int i=0;i<folders.size();i++)
mddDataSource ds=(mddDataSource) folders.get(i);
String name = ds.getDataSourceName();
layers.add(name);
for(int i=0;i<layers.size();i++){
Vector temp = new Vector();
temp.add(layers.get(i));
temp.add(layers.get(i));
dtm.addRow(temp);
// My Text Field cell
class MyTextField extends JTextField implements FocusListener, KeyListener
MyTextField()
setOpaque (false);
addKeyListener(this);
addFocusListener(this);
MyTextField(String text)
setOpaque (false);
addKeyListener(this);
addFocusListener(this);
public void focusGained(FocusEvent e) {
System.out.println("get Focus");
public void focusLost(FocusEvent e) {
instance.setValue(getText());
public void keyTyped(KeyEvent e){
instance.setValue(getText());
public void keyPressed(KeyEvent e){
System.out.println("get Key ");
public void keyReleased(KeyEvent e){
instance.setValue(getText());
If there are some good sample, please tell me the link or give me some suggestion.
Thanks in advanced

Thanks for your help.
The problem still exist. It does not commit the value that I input.
Maybe I should say it clearly.
I have create JPanel include three JPanel:
Left Panel and right upper-panel and right borrom panel.
The JTable instance is on right-upper Panel.
If I edit one of row at JTable and then click JTable other row,the value can be commited. if I edit one of row and then push one Button on
the right-bottom button to see the editting cell value.It does not commit value.
when I use debug style, and set breakpoint the
foucsGained or KeyTyped,
It never stopes at there,So I assume that the Editing cell never get focus.
Is there a bug at Java if we move focus on other Panel, that JTable can not detect the Focus lost or focus gained event?
Thanks

Similar Messages

  • Hello apple I have the problem with my iPhone and my friends have this problem too. My iPhone have the problem about calling and answer the call. When I use my iPhone to call I can't hear anything from my iPhone but the person that I call can answer it bu

    Hello apple
    I have the problem with my iPhone and my friends have this problem too.
    My iPhone have the problem about calling and answer the call. When I use my iPhone to call I can't hear anything from my iPhone but the person that I call can answer it but when answer both of us can't hear anything and when I put my iPhone to my face the screen is still on and when I quit the phone application and open it again it will automatic call my recent call. And when my friends call me my iPhone didn't show anything even the missed call I'm only know that I missed the call from messages from carrier. Please check these problem I restored my iPhone for 4 time now in this week. I lived in Hatyai, Songkhla,Thailand and many people in my city have this problem.
    Who have this problem??

    Apple isnt here. this is a user based forum for technical questions. The solution is to restart, reset, and restore as new which is in the manual after that get it replaced for hard ware failure. if your within your one year warranty its replaced if it is out of the warranty then it is 199$

  • A very surprise problem about JDBC and connection pool

    I occur a very problem about JDBC and connection pool on Weblogic Platform
    8.1.
    There is a table in Oracle
    Table
    Name: t1
    id varchar2(5);
    content clob;
    id is primary key.
    If I use a connection pool to connect to Oracle,like following program:
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup("cgOracleDataSource");
    con = ds.getConnection();
    then following program will throw a ClassCastException
    String sql = "select content from t1 where id = ?";
    PreparedStatement pst = con.prepareStatement(sql);
    pst.setString(1,"001");
    oracle.sql.CLOB clob = (oralce.sql.CLOB)rs.getClob("content") //this
    statement will throw ClassCastException
    but if I use JNDI to connect to Oracle,like following program, then those
    program above is ok
    private String dbdriver="oracle.jdbc.driver.OracleDriver";
    private String dburl="jdbc:oracle:thin:@192.168.7.148:1521:ep";
    private String username="ep";
    private String password="epuser";
    Class.forName(dbdriver);
    conn = DriverManager.getConnection(dburl, username, password);
    conn.setAutoCommit(false);
    On the contrary, if I use JNDI to connect to Oracle, following program will
    throw ClassCastException
    weblogic.jdbc.vendor.oracle.OracleThinClob clob =
    (weblogic.jdbc.vendor.oracle.OracleThinClob)rs.getClob("content");
    but it is fine if I use connection pool to connect to Oracle.
    I am confused this problem, who can tell me why?
    Daniel

    When you are getting connection using datasource lookup from weblogic
    connection pool, this connection is internally wrapped and hence you have to
    cast it to weblogic.jdbc.vendor.oracle.OracleThinClob which you do and so it
    works.
    But when you get connection by loading driver straight, you are getting naked
    oracle connection. In this case when you cast it to oracle.sql.Clob it works,
    as you have seen in your test case.
    I hope this explains what is going on with your code.
    Thanks,
    Mitesh
    Daniel wrote:
    I occur a very problem about JDBC and connection pool on Weblogic Platform
    8.1.
    There is a table in Oracle
    Table
    Name: t1
    id varchar2(5);
    content clob;
    id is primary key.
    If I use a connection pool to connect to Oracle,like following program:
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup("cgOracleDataSource");
    con = ds.getConnection();
    then following program will throw a ClassCastException
    String sql = "select content from t1 where id = ?";
    PreparedStatement pst = con.prepareStatement(sql);
    pst.setString(1,"001");
    oracle.sql.CLOB clob = (oralce.sql.CLOB)rs.getClob("content") //this
    statement will throw ClassCastException
    but if I use JNDI to connect to Oracle,like following program, then those
    program above is ok
    private String dbdriver="oracle.jdbc.driver.OracleDriver";
    private String dburl="jdbc:oracle:thin:@192.168.7.148:1521:ep";
    private String username="ep";
    private String password="epuser";
    Class.forName(dbdriver);
    conn = DriverManager.getConnection(dburl, username, password);
    conn.setAutoCommit(false);
    On the contrary, if I use JNDI to connect to Oracle, following program will
    throw ClassCastException
    weblogic.jdbc.vendor.oracle.OracleThinClob clob =
    (weblogic.jdbc.vendor.oracle.OracleThinClob)rs.getClob("content");
    but it is fine if I use connection pool to connect to Oracle.
    I am confused this problem, who can tell me why?
    Daniel

  • Strange Problems With Display and Permissions Since 10.5.1 update.

    Since I've done the 10.5.1 update I have been having a strange problem with my desktop and dock displays. On my desktop I have these strange lines that appear any time I log in or open any application, the lines never go away and change locations on the screen once I open an application or move a window. My dock has the reflective shelf for about half of it, the rest is a dull grey. I've also had problems with verifying and repairing my permissions. I can never actually complete either permissions task. I've used some third party apps, they always fail as well. The only time I can actually repair my permissions is by booting in to single user mode and doing a fsck -f command. When I boot back in to Leopard and try to use the Disk Utility to repair, it continues to fail.
    I'm not sure if the video problem I am having stems from a permissions issue or possibly a corrupt video driver. Either way, I've done a lot research and haven't found anyone with the same problems I have been having so I thought I would give these forums a shot.
    I am using a PowerMac G4 Quicksilver with dual 800Mhz, 1.5gb RAM, and a GeForce4 Ti 4600 128mb video card.
    Here is a screen shot of the line and dock problem.
    Here is a screen shot of my "About This Mac.
    If anyone could lend some light on this issue, I would greatly appreciate it.
    Thanks
    Jeff

    you can pile it on this: http://discussions.apple.com/thread.jspa?threadID=1246649&tstart=0
    btw - no solution yet.

  • Strange problem with DatagramSocket and DatagramPacket.

    Hi!
    I got a strange problem with UDP sockets:
    Client (hardware device) send binary data messages, consisting of bytes and shorts fields (8 and 16 bits). But when I tried to read byte array, received from socket, I got some type anomaly. For example:
    byte[] buffer = new byte[1024];
    DatagramPacket packet = new DatagramPacket(buffer, 1024);
    socket.receive(packet);
    byte[] data = packet.getData();
    System.out.println("Received data:");
    for (int i = 0; i < packet.getLength(); i++) {
      System.out.printf("%h:", data);
    I got such thing: 34:4:fffffff1:ffffffdb:ffffffdc:20:1:1:0:2:50
    If I try to parse it using ByteArrayInputStream and DataInputStream
    ByteArrayInputStream is = new ByteArrayInputStream(packet.getData());
    DataInputStream dis = new DataInputStream(is);
    int head = dis.readByte();
    int recvinfo = dis.readByte();
    short count = (short)dis.readShort();
    System.err.printf("Decoded:\n head: %h\n recvinfo: %h\n count: %h\n",
         head, recvinfo, count);i got following:
    Decoded:
    head: 34
    recvinfo: 4
    count: fffff1db
    So I get Integer entries in byte?! array. I also got Integer even I try to read and cast it as short in short!!! variable.
    Please help!
    P.S. Sorry for my bad English.

    Rather fortunate that it auto-casts(or rather, that 0xFF is int by default, rather than attempting any type-detection as most languages do), as otherwise the brackets would have been in the wrong place. If it was still a byte after the "& 0xFF", sign extension would still occur.
    For the sake of the less bit-literate reading this thread, it should be explained that the reason for this was large bytes being interpreted as negative numbers, which translate to negative int, which in hexa become very large ints. That's about as verbose as I can be about this without writing the equivalent of a wikipedia entry about 2s complement.

  • Short code causes a strange problem - About the list again -- please read!

    Hi again people. Maybe you remember my project - has a list, that you can search thru using a text field. During the work I got stuck on a strange problem ( Again :-( ) My app has one text field, one combo box, one list and a text field once more. The code should do the following ->
    *1. Load the list, no problem with that.*
    *2. Show the elements of the list, that match the selected group in the combo box,no problem.*
    *3. Search thru the list using the text field,no problem.*
    4. When the user selects an element from the list, it should display its info in the second text field. This also works fine, but when after looking at info of one of the elements the things on numbers 2 and 3 ( look up! ) stop working. I must say that everything works fine until user selects an element from the list. I couldnt understand this kind of behavior so I am asking you to help me please.
    The code is very simple:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    class the_window extends JFrame implements DocumentListener, ItemListener, ListSelectionListener {
        FileReader reader;
        String data_base[][];
        String first_pass[];
        int number_of_elements;
        DefaultListModel dflm = new DefaultListModel();
        JList list;
        JTextField text_field = new JTextField();
        JTextField info_field = new JTextField();
        String groups[] = {"1. group" , "2. group"};
        JComboBox groups_cmbx = new JComboBox(groups);
        the_window(){
            super("the Window!");
            JPanel panel = new JPanel(null);
            Container c = this.getContentPane();
            c.add(panel);
            text_field.setBounds(10,10,170,25);
            text_field.getDocument().addDocumentListener(this);
            panel.add(text_field);
            groups_cmbx.setBounds(10,45,170,25);
            groups_cmbx.addItemListener(this);
            panel.add(groups_cmbx);
            list = new JList(dflm);
            list.setBounds(10,90,170,190);
            list.setFixedCellHeight(20);
            list.addListSelectionListener(this);
            panel.add(list);
            info_field.setBounds(10,280,170,25);
            panel.add(info_field);
            load_the_base();
            refresh();
            this.setSize(190,350);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setResizable(false);
            this.setVisible(true);
        public void itemStateChanged(ItemEvent e){
            refresh();
        public void valueChanged(ListSelectionEvent e){
            String str = (String) dflm.getElementAt(list.getSelectedIndex());
            int index = 0;
            for(int i = 0; i < number_of_elements; i++){
                if(str.equals(data_base[0])){
    index = i;
    break;
    info_field.setText(data_base[index][1]);
    private void load_the_base(){
    String data = "";
    try{
    reader = new FileReader("data.txt";);
    int r = 0;
    while((r = reader.read()) != -1){
    char c = (char) r;
    data += c;
    reader.close();
    }catch(IOException e){}
    first_pass = data.split(";");
    number_of_elements = first_pass.length;
    data_base = new String[number_of_elements][];
    for(int i = 0; i<number_of_elements; i++){
    data_base[i] = first_pass[i].split("#");
    private void refresh(){
    String search_str = text_field.getText();
    int selektovano = groups_cmbx.getSelectedIndex();
    dflm.clear();
    for(int i = 0; i < number_of_elements; i++){
    int grupa = Integer.parseInt(data_base[i][2]);
    if(grupa == selektovano){
    String at_the_moment = data_base[i][0]; // if you change this to String at_the_moment = data_base[i][1]; it works perfectly
    if(at_the_moment.startsWith(search_str)){
    dflm.addElement(at_the_moment);
    public void changedUpdate(DocumentEvent e){
    refresh();
    public void removeUpdate(DocumentEvent e){
    refresh();
    public void insertUpdate(DocumentEvent e){
    refresh();
    public class Main {
    public static void main(String[] args) {
    JFrame f = new the_window();
    Now, can you please tell me whats wrong with this?
    For the "data.txt" make a new text file using *notepad* and copy the following line into the document:
    _1. element#1. info#0;2. element#2. info#0;3. element#3. info#1;4. element#4. info#1;5. element#5. info#1;_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Darryl.Burke wrote:
    Keith, thanks for making that readable. So here's the diagnosis -
    In the refresh() method, calling defaultListModel.clear() results in a valueChanged(...) event in which this method calldefaultListModel.getElementAt(list.getSelectedIndex())results in the exception noted, as getSelectedIndex returns -1, the list being empty... you can't getElementAt(-1).
    I haven't analyzed all the code nor checked whether is now works as desired, but this small change to valueChanged counters the exception being thrown.   public void valueChanged(ListSelectionEvent e) {
    infoField.setText(""); // do this unconditionally
    if (list.getSelectedIndex() != -1) {
    String value = (String)defaultListModel.getElementAt(list.getSelectedIndex());
    for(int i = 0; i < numFields; i++){
    if(value.equals(matrix[0])){
    infoField.setText(matrix[i][1]);
    break;
    db
    Yea! You were right! I didnt think that calling *list_model.clear();* will result in calling *valueChanged()* ........
    That was some *clear()* thinking :-) Thank you!
    corlettk wrote:
    I cleaned up some variable & method names (tut tut), imports (very naighty), and some thread stuff... but it remains fundamentally the same codeIs it so important to "clean" the imports? How much does it slow down the loading time? Should I do this on all my projects, because they are all "very naighty"?
    ps. Thanks to all that gave some help to answering this strange question :-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • A strang problem about Resin database connection pool

    I am a beginner&#65292;hope somebody can help me.
    my web site occured a strange problem after I used the Resin database connection pool instead of
    connecting directly
    the error message as follows:java.lang.IllegalArgumentException: Request cannot be null
    at javax.servlet.ServletRequestWrapper.<init>(ServletRequestWrapper.java:100)
    at javax.servlet.http.HttpServletRequestWrapper.<init>(HttpServletRequestWrapper.java:92)
    at com.caucho.server.connection.RequestAdapter.<init>(RequestAdapter.java:96)
    at com.caucho.server.webapp.DispatchRequest.<init>(DispatchRequest.java:97)
    at com.caucho.server.webapp.IncludeDispatchRequest.<init>(IncludeDispatchRequest.java:77)
    at com.caucho.server.webapp.IncludeDispatchRequest.createDispatch(IncludeDispatchRequest.java:87)
    at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:389)
    at com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherImpl.java:345)
    at com.caucho.jsp.PageContextImpl.include(PageContextImpl.java:807)
    at _jsp._intro__jsp._jspService(/intro.jsp:60)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
    at com.caucho.jsp.Page.pageservice(Page.java:571)
    at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:155)
    at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:211)
    at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:177)
    at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:263)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:331)
    at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:464)
    at com.caucho.util.ThreadPool.run(ThreadPool.java:408)
    at java.lang.Thread.run(Thread.java:595)

    <!--
    - Resin 3.0 configuration file.
    -->
    <resin xmlns="http://caucho.com/ns/resin"
    xmlns:resin="http://caucho.com/ns/resin/core">
    <!--
    - Logging configuration for the JDK logging API.
    -->
    <log name='' level='info' path='stdout:' timestamp='[%H:%M:%S.%s] '/>
    <log name='com.caucho.java' level='config' path='stdout:'
    timestamp='[%H:%M:%S.%s] '/>
    <log name='com.caucho.loader' level='config' path='stdout:'
    timestamp='[%H:%M:%S.%s] '/>
    <!--
    - For production sites, change dependency-check-interval to something
    - like 600s, so it only checks for updates every 10 minutes.
    -->
    <dependency-check-interval>2s</dependency-check-interval>
    <!--
    - You can change the compiler to "javac" or jikes.
    - The default is "internal" only because it's the most
    - likely to be available.
    -->
    <javac compiler="internal" args=""/>
    <!-- Security providers.
    - <security-provider>
    - com.sun.net.ssl.internal.ssl.Provider
    - </security-provider>
    -->
    <!--
    - If starting bin/resin as root on Unix, specify the user name
    - and group name for the web server user.
    - <user-name>resin</user-name>
    - <group-name>resin</group-name>
    -->
    <!--
    - Configures threads shared among all HTTP and SRUN ports.
    -->
    <thread-pool>
    <!-- Maximum number of threads. -->
    <thread-max>128</thread-max>
    <!-- Minimum number of spare connection threads. -->
    <spare-thread-min>25</spare-thread-min>
    </thread-pool>
    <!--
    - Configures the minimum free memory allowed before Resin
    - will force a restart.
    -->
    <min-free-memory>1M</min-free-memory>
    <server>
    <!-- adds all .jar files under the resin/lib directory -->
    <class-loader>
    <tree-loader path="$resin-home/lib"/>
    </class-loader>
    <!-- Configures the keepalive -->
    <keepalive-max>500</keepalive-max>
    <keepalive-timeout>120s</keepalive-timeout>
    <!-- The http port -->
    <http server-id="" host="*" port="8080"/>
    <!--
    - SSL port configuration:
    - <http port="8443">
    - <openssl>
    - <certificate-file>keys/gryffindor.crt</certificate-file>
    - <certificate-key-file>keys/gryffindor.key</certificate-key-file>
    - <password>test123</password>
    - </openssl>
    - </http>
    -->
    <!--
    - The local cluster, used for load balancing and distributed
    - backup.
    -->
    <cluster>
    <srun server-id="" host="127.0.0.1" port="6802" index="1"/>
    </cluster>
    <!--
    - Enables/disables exceptions when the browser closes a connection.
    -->
    <ignore-client-disconnect>true</ignore-client-disconnect>
    <!--
    - Enables the cache
    -->
    <cache path="cache" memory-size="10M"/>
    <!--
    - Enables periodic checking of the server status.
    - With JDK 1.5, this will ask the JDK to check for deadlocks.
    - All servers can add <url>s to be checked.
    -->
    <ping>
    <!-- <url>http://localhost:8080/test-ping.jsp</url> -->
    </ping>
    <!--
    - Defaults applied to each web-app.
    -->
    <web-app-default>
    <!--
    - Sets timeout values for cacheable pages, e.g. static pages.
    -->
    <cache-mapping url-pattern="/" expires="5s"/>
    <cache-mapping url-pattern="*.gif" expires="60s"/>
    <cache-mapping url-pattern="*.jpg" expires="60s"/>
    <!--
    - Servlet to use for directory display.
    -->
    <servlet servlet-name="directory"
    servlet-class="com.caucho.servlets.DirectoryServlet"/>
    </web-app-default>
    <!--DataSource jndi configuration-->
    <database>
    <jndi-name>jdbc/artunion</jndi-name>
    <driver type="org.gjt.mm.mysql.Driver">
    <url>jdbc:mysql://localhost:3306/union</url>
    <user>as</user>
    <password>as</password>
    </driver>
    <prepared-statement-cache-size>8</prepared-statement-cache-size>
    <max-connections>20</max-connections>
    <max-idle-time>30s</max-idle-time>
    </database>
    <!--
    - Default host configuration applied to all virtual hosts.
    -->
    <host-default>
    <class-loader>
    <compiling-loader path='webapps/WEB-INF/classes'/>
    <library-loader path='webapps/WEB-INF/lib'/>
    </class-loader>
    <!--
    - With another web server, like Apache, this can be commented out
    - because the web server will log this information.
    -->
    <access-log path='logs/access.log'
    format='%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-Agent}i"'
    rollover-period='1W'/>
    <!-- creates the webapps directory for .war expansion -->
    <web-app-deploy path='webapps'/>
    <!-- creates the deploy directory for .ear expansion -->
    <ear-deploy path='deploy'>
    <ear-default>
    <!-- Configure this for the ejb server
    - <ejb-server>
    - <config-directory>WEB-INF</config-directory>
    - <data-source>jdbc/test</data-source>
    - </ejb-server>
    -->
    </ear-default>
    </ear-deploy>
    <!-- creates the deploy directory for .rar expansion -->
    <resource-deploy path='deploy'/>
    <!-- creates a second deploy directory for .war expansion -->
    <web-app-deploy path='deploy'/>
    </host-default>
    <!-- includes the web-app-default for default web-app behavior -->
    <resin:import path="${resinHome}/conf/app-default.xml"/>
    <!-- configures the default host, matching any host name -->
    <host id=''>
    <document-directory>D:/artunion</document-directory>
    <!-- configures the root web-app -->
    <web-app id='/'>
    <!-- adds xsl to the search path -->
    <class-loader>
    <simple-loader path="$host-root/xsl"/>
    </class-loader>
    <servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>
    </web-app>
    </host>
    </server>
    </resin>
    Thank you!

  • A strange problem about InputStream

    I meet a strange problem.
    I have a data file named data.dat whose size is 16k.
    I write a passage of code to read the binary data from data.dat
           byte[] gbData = new byte[8177 * 2];
           // it's length equals to the size of data.dat
           InputStream in = ClassLoader.getSystemResourceAsStream(
               "com/sunway/james/st/res/data.dat");
           in.read(gbData);
           in.close();When I run the program, It's can work well. Then I put all class and resources into a jar file.
    When I run the jar file, I can only get first 600 (and serval more) bytes right. left bytes are 0.
    Who can tell me what happen?

    Thank you.
    I tried to use java.nio to read the data, and there is still the problem.
    flowing is the new codes:
            FileInputStream in =
                new FileInputStream("com/sunway/james/st/res/BIG5.dat");
            ByteBuffer buffer = ByteBuffer.allocateDirect(1024);
            in.getChannel().read(buffer);
            byte[] big5Data = buffer.array();
            in.close();

  • Strange problem with RDP and mouse, only solved after minimize/maximize

    Good day,
    We have this very annoying problem with a RDP Terminal Server. It is Windows Server 2008 R2 SP1.
    This server has the Session Host role installed, with local RDP user licenses.
    We only have this issue when running a certain application.
    This application is called Rockwell FactoryTalk View and this in an application to display industrial processes.
    It will take the Full Screen in a fixed resolution and will display buttons, objects, values... The application also uses Internet Explorer cache so I think it uses ActiveX, Flash or Java, I don't know.
    What sometimes happens is this:
    - The mouse point is able to move in the entire screen (good)
    - The mouse button will only work in 1 certain area of the screen (which is a small rectangle)
    - The mouse "hovering" above objects will also only highlight items that are in this rectangle
    - The keyboard remains functional and with alt-tab other objects or other applications can get focus, but still no mouse clicking
    The problem can be solved by:
    - Minimizing the RDP window and maximizing it again
    - Or: Sending a message to the session using task manager, after clicking "OK" on that message the problem is gone
    Normally, about 5 users will have this application opened in their session, the "crash" is only effecting 1 session.
    The problem seems to happen randomly and we don't know if we should point to the FactoryTalk application, or to Terminal Services/RDP. The end users have no rights to minimize/maximize, this is not the solution. 
    Is it possible to have any input on this please?
    Thank you.

    Hi,
    Thank you for posting in Windows Server Forum.
    Firstly please check with the application support team whether the application is fully supported by Windows Server 2008 R2 in remote session. In addition, suggest you to update the client RDP version to RDP 8.1 and check the result for better feature and functionality. 
    Apart from this, there is Hotfix for the issue. Please download, install and check the result.
    Cause:
    The issue occurs because the remote desktop ActiveX object does not deactivate the focus of the remote desktop session when the focus is lost. Because the focus is still activated, the remote desktop ActiveX object cannot set the focus of the remote desktop
    session again when you change the focus back to the session.
    A remote desktop session does not respond to keyboard input or mouse input after it loses the focus in Windows 7 or in Windows Server 2008 R2
    http://support.microsoft.com/kb/2579381
    Hope it helps!
    Thanks.
    Dharmesh Solanki

  • Strange problem with Outlets and Collection View Items

    This is a strange issue. I am using XCode 3.2.2 and I am building a Collection View. To do this I have a non-document based application that uses Core Data.
    *Collection View Item Class*
    I created a new class that inherits NSCollectionViewItem and built it to have an outlet to the Label.
    *Collection View Item NIB*
    I created a Empty NIB for my Collection View Item. To the NIB I added a Custom View object and set the Class Identity to NSBox. I then added a Label to the new NSBox. I changed the File Owner to the new class and connected the "view" outlet to the new NSBox and the Label to the label outlet.
    *Main Menu NIB*
    I added a new NSCollectionViewItem object to the Main Menu NIB and set the Class Identity to the new class mentioned above. I then set the NIB Name to the name of the NIB mentioned above. In the window I added a NSCollectionView then set its Item Prototype to the new NSCollectionViewItem object I just configured. This is the typical way to set up a collection view with its item in a different NIB.
    *Back to the problem*
    Everything seem to work well except that in the setRepresentativeObject in the Collection View Item class when it attempts to set the Label to a value. Nothing happens. When I check closely I find that the Label is coming back nil. It is properly linked. I deleted everything and rebuilt the collection view item and relinked everything without success.
    *How I made it work but not happy with it*
    I have finally made this work by simply putting the line "[self view];" just before I attempt to run "[label setStringValue:name];". If I remark out the "[self view];" the label returns nil. I have a note near the line to make it easier to spot. It seems that I should not need to access the superclass's "view" accessor just to access one of view's subviews. Is this a bug or have I written this wrong?
    The Collection View Item code is below. Any help is appreciated.
    Thanks,
    Rob
    #import <Cocoa/Cocoa.h>
    #import "PersonManagedObject.h"
    @interface PersonSelectionViewItem : NSCollectionViewItem {
    NSTextField *label;
    #pragma mark Finalizers
    - (void)dealloc;
    #pragma mark Outlets
    @property (nonatomic, assign) IBOutlet NSTextField *label;
    #pragma mark Instance Methods
    - (void)configureKeyValueObserving;
    - (void)removeKeyValueObserving;
    #pragma mark Overrides
    - (void)setRepresentedObject:(id)representedObject;
    - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context;
    @end
    #import "PersonSelectionViewItem.h"
    @implementation PersonSelectionViewItem
    #pragma mark Finalizers
    - (void)dealloc{
    [self removeKeyValueObserving];
    [super dealloc];
    #pragma mark Outlets
    @synthesize name;
    #pragma mark Instance Methods
    - (void)configureKeyValueObserving{
    PersonManagedObject *person = (PersonManagedObject *)[self representedObject];
    [person addObserver:self forKeyPath:@"lastNameFirstName" options:0 context:NULL];
    - (void)removeKeyValueObserving{
    PersonManagedObject *person = (PersonManagedObject *)[self representedObject];
    [person removeObserver:self forKeyPath:@"lastNameFirstName"];
    #pragma mark Overrides
    - (void)setRepresentedObject:(id)representedObject{
    [super setRepresentedObject:representedObject];
    NSString *personName = (NSString *)[representedObject valueForKey:@"lastNameFirstName"];
    [self view]; //<---Without this line the "label" variable 2 lines down will be nil.
    if (personName) {
    [label setStringValue:personName];
    [self configureKeyValueObserving];
    - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
    if ([keyPath isEqualToString:@"lastNameFirstName"]) {
    [[self label]setStringValue:[object valueForKey:@"lastNameFirstName"]];
    } else {
    [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
    @end

    I think you must be correct. I just ran into the problem again in yet another NIB. It was in the setRepresentedObject method. I simply put in the same line "\[self view\]" just before I needed to set the value of the view component and it worked again. If it is the same in other components I guess I just need to pay attention to it. Thanks for the information.
    Message was edited by: Cycles4Fun

  • Strange problems about my projects(efficiency,event structure,queue)

    hey,guys,i am a labview user from china,so forgive me about the chinese words of my projest. i found something wrong with my work. .
    there are two functions in my "While loop", the first one depends on "queue" and  is to get information from UART, the second one is "event structure" to send information through UART. my problems:
    1. i can not stop while loop by pressing "停止“, and i find two ways to stop it. first, i press"停止”,then, i press any buttons that can trigger "event structure"twice, at last, while loop can stop.the second way, i press buttons for "event structure" one time, then "停止”, and then the same button for"event". it also works
    2.my work does not run efficiently. you guys can try. once you press buttons for "event structure", it responses very slowly,and if you press many times,the whole program seems like suspending.i have added a LED named test at the front panel, it should light once you press "运行“. and it also shows how slow the whole program is.
    i have attached my work, and my main vi is "串口通信 主VI".
    can any body give me some suggestions? thanks a lot
    Attachments:
    Uart.zip ‏140 KB

    Your event structure will execute exactly once per loop of the main loop, thus the other three loops must stop before handlig the next event. You will also get a race condition between the top loop and the events when writing.
    I'd put the top loop as the timeout case in the event and place the loop around the event for starters.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • A strange error about cursor and dblink

    My dbms:Oracle8i Enterprise Edition Release 8.1.7.4.0
    I have a stored procedure, which inserts records from a remote database into a local table.
    The 'insert' statement have similar pattern:
    insert into table_a
    select table_b.columns from table_b@dblink
    where table_a.column in (select table_b.column from table_b@dblink);
    commit;
    There are about 100 'insert' statement in my procedure. But there is same error messages at the same
    place when the procedure is run. The error messages:ora-01000:maximum open cursors exceeded,ora-02063:
    preceding line from dblink. I have manually run the 'insert'statements before the error place and after the error place.
    The before and after statements are both OK.
    From google.com, I have learned that 'commit' will clear the implicit cursors from 'insert' statement. So I think
    the problem is ora-02063. Again, keywords 'ora-01000 ora-02063'from google.com, I found 'alter session close
    database link dblink' might solve the problem. I have add the 'alter session' statement after each 'commit' in
    my procedure. Unfortunately, same error happened again at the same place.
    I am puzzled. Would you like to give some advice? Thanks a lot!

    Hello
    Well, the best place to lookup error messages is here....
    http://www.oracle.com/pls/db92/db92.homepage
    It's also where all the rest of the database documentation is. As for this error, too many open cursors, as it suggests, one session has too many open. From the statement you are using to select the data, it seems like you are forming the statements dynamically, is this the case? If so, you're using cursors, and so there's a good chance you aren't closing them.
    HTH

  • Problem about rmic and rmiregistry

    I am new to java!
    My OS is Win2000 and the java compiler I installed is Sun One Studio 4 CE. The teaching book I used is teh JAVA2 unleash.
    I try to copy some example in the book and run it! The problem I have the book didn't quite tell me how to compile it!
    The chapter is about the RMI and the step describe in the book are followed:
    1) Move to the directory containing all your classes and compile them. (Which I did)
    2) Move to the root directory
    c:\>rmic unleashed.ch2.GreeterImpl (problem)
    3) Open one command window and type
    c:\> rmiregistry (problem)
    4) Open another command window and type
    c:\> java unleashed.ch2.GreeterServer
    5) open the thrid window and type
    c:\> java unleashed.ch2.GreetingClient
    Problem part:
    I try to follow the step and open a DOS Prompt and type step two and three!! It seems that the window don't understand the command rmic and rmiregistry! What should I do??
    Thank you very much for helping! Thanks!!
    Ferdinand

    you need to add the java bin directory to your 'path' system environment variable

  • A strange problem about batch input (VA01)

    Dear experts,
    I have created one batch input program about VA01,When the selection screen is full window and run,one error occurs.Opposition the screen is not full window ,and the error do not occur.
    Could you help me?
    Thanks and regards,
    collysun

    Hi Collysun,
         The problem what you are facing is due to the resolution setting of individual desktop. This is a known issue in BDC's. Pls do one more recording of VA01 by putting the screen into default size from the tri color button that comes at the right corner of the application tool bar of your session window.
         The advantage is that when the BDC is executed in background automatically the size of the session which is doing the job for you goes to the original size as the one in the recording and it will work irrespective of the windows screen resolution.
    Cheers
    JK
    PS: Award points if this answer is helpful

  • A problem about Proc and oci

    I got a new task (coding in c language with oci or proc to operate remote oracle. the develope environment is linux server is windows OS ) ,but I have nothing experice about it previously. in the process of using oci and proc, amount of problems appeared.
    the first question i want to make explicit is , can I testing and running the program with out the client of oracle. in a other word ,only use the .so files to compiling and testing .in linux environment .
    If the answer is that we can . how can i program with oci or proc?
    as I know in the samples of oracle ,every demo is only link to the local database.
    and the resource about this field is so limit. I can not find any usable material with google.
    in my familar condition ,if we need connect to remote database ,we should provide the hostname or ip address and the prot num of oracle service . but in OCI library ,there are two functions olog and ocilogon can use to log to service .how can i use it?
    eg. if the server hostname is dbserver/192.168.1.2 and port is 1521,the dbname is iv. how can i use olog or ocilogon to log on the server? thanks very much !!!
    btw: if we using proc to connect server. how can i connect to server?
    waiting on line...
    Thanks.

    You must install an Oracle Client in order to proceed. The client installation is included in the Oracle Database installation disc.
    Afterwards, use "netca" to configure the connection to your remote DB. Alternatively, you could edit the tnsnames.ora file manually if so you wish.
    For reading material, type "Pro*C/C++ Precompiler Programmer's Guide" in google.
    Message was edited by:
    jonjac

Maybe you are looking for

  • Is there any way to get FileUpload.PosetedFile.Inputstream property as string?

    Hello, In my project i have used asp.net Fileupload control which works fine on my local machine. but when run that project on server i am not able to load the xls file. so i have used "Fileupload1.PostedFile.InputStream" property which returns as a

  • New version of Numbers - two important questions

    I'm running the new version of Numbers and have some questions. First let me say that I switched from PC to Mac earlier this year.  I decided I wanted to try Numbers instead of Excel.  Although I do have Office for Mac installed as well.  I setup a b

  • CS5.5 HTML5 and getting MSSQL data

    I am a long time ASP developer and looking to get into HTML5 using Dreamweaver CS5.5 for Mobile apps. I am very excited to understand the mobile development features of CS5.5! I'm hoping somebody can point me into the right direction or explain what

  • Calling Stored Function from DOT NET

    Hi, I am trying to call a stored function "PKG_MIS_USER_MASTER.ADD_USER(userid varchar2, password varchar2) return NUMBER" from my DOT NET application. Everything works fine within TOAD. Can anyone please help me in writing the C# code for calling a

  • ISG L4 redirect

    Hi, My client is using Cisco ISG. Setup is as described below. 1. Client makes a request through browser for xyz.com. 2. Through routing, the request reaches to ISG. 3. ISG is configured to redirect port 80 and 443 requests to squid proxy server(runn