🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: cn.bbs.comp.program
1 messages
1 total messages Started by �ڰ�֮�� Sat, 20 Dec 1997 00:00
Java Q&A (GB��) (��)
#2493
Author: �ڰ�֮��
Date: Sat, 20 Dec 1997 00:00
1007 lines
22214 bytes
JAVA Q&A���弯

�����ϲ���Ӵ................. 


>            �������ʹ����ͬ��һ��htm��

>             ��java applet�ܻ�����ֵ....



        Ŀǰ���� Java ��û�а취��������... ÿ�� applet ���DZ˴˶�

        ����, ���߼���Ҫ��ͨ�����һ��Ȧ... ��������� Web Site д��

        Server������������ applet ��ͨ, ����xxxx.... �ȵ�.



        ���������ȥ JavaSoft �� homepage ����, ��һƪ���� ActiveX

        �������о��⵽��һ��... ������������ ActiveX �Ľ��������

        ���׾Ϳ�������, �����ⷽ���Ҳ���, ���Լ�ȥ����������ϰ�!



Netscape ����һ�� LiveConnect �ܹ�

�� Homepage �е� Java Applet, Java Script, Plug-in ֮�����л���

����Ȥ�Ļ��ɲο�����



���԰�! ����Sun��Java tutorial��applet InterClass Communication���ݰ�

(http://java.sun.com/books/Series/Tutorial/applet/communication/iac.html)

 ͬһ��page�ϵ�applet���ǿ��Ա˴˹�ͨ��



@Ӧ���кܶ෽��:��ʹ��AppletContext������static variable��



         ����Ȥȥwww.tientien.com/tjn/iac/index.html����ط�����



������������?? ---



   public class object1

   {

      String histring;

      public void sets(String s)

      {

         histring=new String(s);

      }

   }



   public class object2

   {

      public boolean mouseDown(Event e,int x,int y)

      {

         object1 ob1=(object1)getAppletContext().getApplet("object1");

         ob1.sets("Hi!!!");

      }

   }



   ���������һ��mouseDown,��object2��һ��"Hi!!!"��object1.....



   ��,û�Թ� .....��֪���Բ��� .......



 

�ҽ�����ȥ��һ����""JAVA��ʽ�������(�½���,����ԣ,���������)....



  �ڵ����� APPLET ���ж��� APPLETͬʱ��ͨ�ķ����ʽ....����ȥ������..



  P5_3.HTML >>>>>>>>>>>>>>>��Լ��5-20ҳ






:    ����Ŀǰ java�Ƿ����п� show bmp image �� class ? ���Ǹ�λ��

:    �����ⷽ�澭����,�ɷ�ָ��һ�� ?

:    Thanks in advance ... :)



������֪, Java ֱֻ��֧Ԯ gif & jpeg ��ʽ image.






: ��������λ����֪��"ר��ϵͳ"??

: �����˽�,�ɷ���ܼ�����?

������һ��ר��ϵͳ����

ȫ����Ѷ  ר��ϵͳ-����Ӧ����ʵ��   ���İ��  $390(����Ƭ)

���� ��ҫ��(Ϊ�ɴ����������ʦ)

������򵥵�.��ҪΪ����Ľ���.����һЩ����ķ���Ŷ!

����йصij�ʽ���Ծͽ��ܵĽ���

���������Ծ��ʺϳ�ѧ����ѧ��



���ĵ��鶼�ܾ���, ������ʮ���Ĺ���, �ɸ�ȥ���г�һ������!!

  �������"Prolog��ר��ϵͳ", ���ִ��������!!



Ŀǰȫ����No. 1 ��ר��ϵͳG2 Real Time Expert System. �ɱ���˾����

����Ҫ�˽�ר��ϵͳ�������籾��˾Dr. Chen






>   ����дһ��applet.....����Ҫ��һЩ���ϴ���serverȥ������....

>   ��������˵appletû�취��socket...

     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 Applet could use SOCKET. See java in a nutshell this book. Specially about 

Chapter 7(Networking), it provide examples that implement as APPLET!! 



Applet ������ socket, ����ֻ��춸����� applet �� host ֮��

        ��ͨ����. ��Ҫ����ȥ�Ļ�, �����Լ��� host ��д�� server ����

        ת...

socket ���÷�, �� UNIX �� socket ��ͬС���? ��һ���й� java.net.*

        �� api Ӧ�þͿ�����






:  Inside JDBC, it provide a SimpleSelect.java program. I had compiled it okay.

: But, when I want  to run it (java SimpleSelect).....Error message appear:

: java.lang.......classNotFound:Jdbc/Odbc/JdbcOdbcDriver

��������Ҳ���jdbcodbc.dll��? �������\jdbc-odbc\classes\jdbc\odbc\



����,����·������һĿ¼������...






: �Ҹ���Visual J++,

: ���д��һ�����н̿��鶼�е�С��ʽ--Hello.World!

: compile��buildʱ������!

: ִ��ʱȴ����java.lang.UnsatisfiedLinkError

: ��֪�����dz�������,��������û�趨��?����ûװMS IE3.0�Ĺ�ϵ��?

: ���λ���ֲ���ָ��!!

: �����dz�ʽ����:

: class Hello

^^^^^^^^^^^^^^^^^^^^:

  �Կ��� class Hello extends Applet





: {

: public static void main ( String args[] )

: {

: System.out.println("Hello.World!");

: }

: }

��⡡

> class Hello {

  ^ ǰ����� public ... �����ʽ���� class ����Ҫ public , �ſ��Ա�ִ��



: > class Hello {

:   ^ ǰ����� public ... �����ʽ���� class ����Ҫ public , �ſ��Ա�ִ��

: >       public static void main ( String args[] ){

: >               System.out.println("Hello.World!");

: >       }

: > }

��һ����?  ������֪, ֻҪ main() �� public �Ϳ�����.

��ָ��.



�Բ���!����ԭ�ȵ�post��,���ȸ�л��ҵIJ���ָ��!!

ԭ�ȵij�ʽ����JDK����ִ�й�,������ȷִ��!

���Գ�ʽ���?������,��������Ӧ�dz���Visual J++��,

���λ�ṩ�ĸ��ַ����Ҷ��Թ���,������Ү!

���ϣ���Ұ��������Ƿ���Visual J++����ʲ������!лл!!!....






: ���³�ѧ, ������ǰ����û���ܹ���æת�����ָ�̣ţĵij�ʽ�ء�



����С��д�ij�ʽ.

1. ����Ҫ����������͵�, �޸�һ��·��, compile

   �Ϳ�������.

2. Ҫ�� 24x24 ����Ҳ����, ��ʽҪ�����޸�, ��Ҫ��֪ͨ��.

3. ִ�����������ൽһ������, ǰ�����м���'�ָ�' '�ֿ�'

   '����' �IJ���ɵ�led �� font file.



���κ����ʻ�ӭ��������.

e-mail:ftlin@casa.ntit.edu.tw

home page:http://casa.ntit.edu.tw

------------------------------------------------------------------

#include 

void main()

{

FILE *inf,*inf1,*rd;

unsigned char a[72];

unsigned char

unsigned b;

int i,j,k,l=0;

unsigned char c[513];

/* set et3 font path here */

/* if you use dos, change '/' to '\\' also */

inf=fopen("/home2/users/casa/xcin/et3/spcfont.15","rb");

inf1=fopen("/home2/users/casa/xcin/et3/stdfont.15","rb");

if(inf==NULL)

  exit(0);

printf("������Ҫת��������:");

scanf("%s",c);

while(c[l]!='\0')

{

b=c[l]*256+c[l+1];

if (c[l+1]>0xa0)

  b-=34;

if(b>=0xa440)

  {

     b-=(c[l]-0xa4)*99;

     fseek(inf1,(long)(b-0xa440)*30,SEEK_SET);

     rd=inf1;

  }

  else

  {

     b-=(c[l]-0xa1)*99;

     fseek(inf,(long)(b-0xa140)*30,SEEK_SET);

     rd=inf;

   };

for(i=0;i<30;i++)

  fscanf(rd,"%c",&a[i]);

printf("\n%c%c\n15",c[l],c[l+1]);

for(i=0;i<15;i++)

  {

  printf("\n");

  for(j=0;j<2;j++)

    for(k=0;k<8;k++)

    {

      if(a[i*2+j] > 127)

         printf("#");

      else

         printf(" ");

       a[i*2+j]<<=1;

    };

  };

  l+=2;

};

printf("\n");

fclose(inf);

fclose(inf1);

}






:                 ����Ҫ�� java ������ client �� run һ�� applet

:                 ͬʱ���� server ��Ҳִ��һ�� java �� application

:                 �������� client �����ͻص� message...

:                 ���е��� cgi ��ʽ ���һ���Ҫ��һЩ������ж�

:                 ����һ��Ҫ�� java ��д......

:                 ���� ��Ҫ��δ���??



  ������ʹ��socket �Ϳ����� client-server��, ����java.net �����һЩclass






: ��֪��java�ɷ���Server�˴�ȡ������

: �� ��˵Java���԰���CGI�Ľ�ɫ

: (��֪������Ĺ���Բ���)

: ��Ϊ�����ϵ�applet���ֻ���ڶ����ϴ�ת��



   �кü��ַ�������java ����applet ��ȡserver �˵���,һ����socket

   ��server����һ���ճ�ʽ��ִ��applet ��Ҫ�Ķ���(��Ȼ�Ϳ��԰���������ȡ��)

   ��һ����URL ���class Ҳ���Զ�ȡserver �ϵĵ���(��춴浵����û�ù�,����

   ��֪���ɲ�����).






:         ������ͼ���ص�ʱ������Ҫ����ɫ

:         ��g.drawImage�Ὣ����ķ��ζ�������

:         ���������SPRITE�ء�

        ֻ��ָ�� drawImage ʱ���͸��ɫҪ��������ɫ���û�취�����ص�

  ʱ��������ͼ��.... �����ҿ� API reference ������˵��....



��LVIEW PROһ�¾ͺ���......�α����鷳......:)



@@@@@ ����Ҫ�跨�����ͼ����Ҫ��Ϊ͸��ɫ�IJ��ݱ��ͳһ��ijһ����ɫ,

      �ҵķ���������Lview��Option��ѡ�����趨Background color,

      Ҫ��ѡ��Ҫ��Ϊ͸���ĵ�ɫ, ��ѡ��Mark selection using��ѡ��

      �����Ƿ����趨���ı�����ɫ�Ƿ���ȷ,

      ������GIF 89a�ĸ�ʽ�浵��



      ��Ҳ���dz�ѧ��,

      ǰһ�����Թ�����ͼƬ����һ��,

      ����ǰ���IJ�����ͼ�����ڸ��ӵı������ƶ�:



      Image foreground,background;

      ......



      Graphics gr;

      gr=this.getGraphics();

      gr.drawImage(background,x1,y1,null);

      gr.drawImage(foreground,x2,y2,null);



      ����foreground�ͱ��뾭��Lview�Ĵ��?

      ���Ϊʲ����drawImage���ĸ����� ImageObserver Ҫ��Ϊ null �ҾͲ�֪�ˡ�






> ��ʹ�� JAVAH.EXE ��ʽȥ�� ij�� .CLASS �������� .H ��ʱ��������,

> ��ִ����������:

> F:\JAVA\BIN\JAVAH.EXE Simple            (��Ŀ¼���� Simple.class����)

> ����ҵ� error message �� "Simple: no such class"

> ������Ŀ¼��ȷʵ�� Simple.class ����,

> �ҵ� CLASSPATH= .;F:\JAVA\LIB\CLASSES

> ϣ���λ�Ƚ���æ, лл !!!



��϶���С��ȷ��???

����,����Ҫ��F:\JAVA\BIN\JAVAH.EXE Simple.class ����

��Ҫ�����̫����.



Ӧ�ò��Ǵ�ȫ��� ? ����ȫ�� simple.class, javah���� SimpleĿ¼�µ�

class ����, ���� error message ���� "no such class"



Cafe 1.2��ͷ����javah�д�����,����JDK 1.02�ľ�����



> ��Ŀǰ���� SUN JDK 1.0.2, �������һ��

��֪��ԭ����,��û��classpath�������

ͨ���������趨

set clasapath=c:\java\lib\classes.zip;.

              ^^^^^^^���JDK����Ŀ¼



cafe���javahӦû����,Ҳ�������classpath����



>������ķ���һ��, ȷʵ������лл��.



>������ԭ�����趨�� CLASSPATH=.;C:\java\lib\classes.zip Ϊ�β��� ?

>�����ҵ� comp.lang.java.programmer ȥ�ҿ������޽��,

>����ҵ���һƪ��ͬ����Ĵ�, ������������:



==========================================================

>javah HelloWorld.class

>to get header file, but I get from javah the error: "no such class"

>What did I wrong ???



Hi Zoran,

I assume that in you class you do define a 'native' method.

Problem:

 This is a somewhat known problem in the JDK 1.0.2 (It wasn't in

1.0.1). What 

is happening is javah is messing the first entry in your CLASSPATH 

environment. Usually this is equal to '.;' --which represents the

current 

directory. So, when we run javah is messes up the current directory

entry in 

CLASSPATH and therefore can't find the class you are trying to get a

header 

file out of.



Work around:

Create a c:\temp directory (or whatever depending on platform) and

that add 

'c:\temp;' to the beggining of the CLASSPATH variable.

This worked for me.



Regards.



Andrew Idsinga

Symantec Product Support

Win Devtools (C++/Cafe)



==============================================================



�����˼��������趨 classpath=.; �Ļ�, javah

�ƺ���춵�һ�����趨��path (Ҳ���� ".") �Ӷ��. ����� "." �ٲ���

����Ŀ¼��ƭ����. ������������д��, �� "." ��������.

������һ��ʵ��, �й����� path ��������:



ִ������: javah HelloWorld



(1) �趨 CLASSPATH=.;c:\java\lib\classes.zip

���� ==> "HelloWorld: no such class"



(2) �趨 CLASSPATH=C:\java\lib\classes.zip;.

OK



(3) �趨 CLASSPATH=.;.;c:\java\lib\classes.zip

OK



(4) �趨 CLASSPATH=.;;c:\java\lib\classes.zip 

OK



(5) �趨 CLASSPATH=;.;c:\java\lib\classes.zip 

OK






: ����һ�� Applet ��ʽ, ������һ��Ҫץȡ��� applet �� name, ����ÿ����

: getParameter("NAME") ʱ,  ����ֵ���� null,  Ƭ�γ�ʽ��HTML������,

: ϣ���Ϊ���æ, лл !!!

:       <... skip...>   

:        myName = getParameter("NAME");       // <---- 

:        Label senderLabel = new Label(" (My name is " + myName +

:  <...skip...>  

: HTML ��

: [  applet code="Sender.class" width=400 height=200]

: [ NAME = Sender]

: [PARAM NAME="RECEIVERNAME" VALUE="receiver"]

               ^^^^^^^^^^^^

               ����Ҫ�� getParameter("XXXX") ���һ��..



����õ� "Sender", write 

����õ� "RECEIVERNAME", write 



: �Բ���, ����ԭ������, ��û�а�����˵���, �ҵ�Ŀ����Ҫץ applet 

: instance �� name, ����ij�� �������� 



 �Ҽǵ�Java tutorial�イ�ú����,

 ��java.applet.getApplet(String name)����

 ������getParameter()






����cafe��һ�����������ʲ����?

: >  �������ѯ�ʡ�����֪���������ȡ��������ֲᡡ�������ɸ�����һ�׻�����

: >  Install���ϰ���(������ҷ���Ү�������ŷ��֡�ԭ��Install�ܺ�ʱ����á�)

: >  �����޲����ֲ�ɲο�Ү��

        NCTUCCCA/vendor/symentec/doc/cafeguid.zip



���ù�!

����resource�������õ�������?



����Ӧ�õ���չ����ȥ��symantec caf'e��˵����

    resource��˫λԪ�汾��os��������..

    ��һ���ӲŻ�����!!






>     ��ЩPage�е�applet,

>     ��ѡ��֮�������Լ�����һ����window,

>     ��ִ�����µ�window֮��....

>     ������������??

applet �� instance һ�� calss , �� class �̳��� frame



public class test extends Applet

{

  public void init()

  {

      TestFrame  tf = new TestFrame();

      ......

  }

}





class TestFrame extends Frame

{

    .....

}






> ���� Visual J++ �Dz��Dz���SHOW ���ġ�

�ǵ�, ��ŵõ�˫λԪ����а취��?



symantec cafe ����show ����

����resource������






�������Գ�native method, �е��ĵ÷���



   ʹ��native method�IJ����뿴Sun��java tutorial����

   ����Ҫ˵����tutorial��û�����,Ҳ����ؼ��һ��,����

   ������native method��.DLL(Windows 95), ������·�Ͽ���

   ����������, ��һҪ��MSVC (2.1������,������4.0), �ڶ�Ҫ��

   Cafe,��Ϊlinkʱ��Ҫjavai.lib, ��JDK���IJ���MSVC���ö���coff

   ��ʽ, ��Cafe���и�javai.lib_coff, �Ҳ�֪Visual J++���Ƿ���..



   ����������в�������, ��tutorial��HelloWorldΪ��



 cl -FeHello HelloWorld.c HelloWorldImp.c /Ic:\cafe\java\include

   /Ic:\cafe\java\include\win32 /MD /LD c:\cafe\java\lib\javai.lib_coff



   ����-Fe��ʾ�����ִ�е����(ΪHello.dll)

   /IΪinclude files path 

   /MD��ʾ��MSVCRT.LIB link 

            ^^^^^^(MSVC Run-time Library)

   /LD��ʾ����.DLL



   ����ἴ����Hello.dll, �������ο�tutorial






:    ��AWT�е�����ʾ��label��botton������

:    �ܷ�ı�����,��С����ɫ

  Label ll;

  Button bb;

  Font font;



  public void init()

  {

    this.setLayout(null);



    ll = new Label("LABEL");

    bb = new Button("BUTTON");

    font = new Font("Helvetica",Font.BOLD,30);

    

    ll.reshape(int x,int y,int width,int height);  //change size

    bb.reshape(int x,int y,int width,int height);

 

    ll.setFont(font);    //set FONT

    bb.setFont(font);



    this.add(ll);

    this.add(bb);

   

  }






>      ��֪��java��û�з�������ץ thread ��id �� thread ���Ͻṹ

>      ����������?  �ɲ������Լ���ɱ������Ҫ�� Thread ��Ҫ��ϵͳ��ɱ�� ?

ץijthread������,��toString()��getName()

Ҫɱijthread, ��stop()

��֪Ŀǰthread group����Щthreads, ��

ThreadGroup c=Thread.currentThread().getThreadGroup();

int num_threads=c.activeCount();

Thread threads[]=new Thread[num_threads];

c.enumerate(threads, false);

threads[0].stop(); //��˱��ɱ��һ��thread, ������ñ���ɱ,��Щ

                       //��ϵͳ(Java VM)��thread



��ϸ�÷���ο�java.lang.Thread��java.lang.ThreadGroup

��API ,�����code�ɲο�Java in  a Nutshell (p162-163)

��http://www.ora.com/catalog/javanut/examples/section9/ThreadLister.java






: ��д��һ��СС��Applet...

: ��;������ͼ��....

: �����Ҳ�֪������趨�����Ŀ��...

: awt.Graphics���ṩ���� member function��??



  û��,������Ҫ�õĻ�,ֻ��Ҫ drawLine() �໭���ΰ�!!!!!




            ����������������? �����κν��顡��д���Ÿ����ǰ�!! С���ᾡ�������ܵ��ġ�

                          Copyright (c) 1996 BluesTown Music & Internet Centre. 
                            Last modified: Wednesday, August 07 1996 01:55 

--

�� ��Դ:���ɰ��ļ�BBSվ bbs.njtu.edu.cn��[IP: 202.112.145.26]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads