Skip to main content

Require a sample application on CDC PP using native library

4 replies [Last post]
sharmarajesh
Offline
Joined: 2007-07-04
Points: 0

Hi sir,

I want to create a demo application on CDC-PP or CDC-PBP on Linux which can be used to create an image or button or label on a frame using the Native library like GTK or QT. I am trying the application in source code provide by the SUN microsystem dor CDC-PP while executing the application it display an error no method main(). only HelloWorld is executed successfully rest are not so please provide me any other application which can be used native library for graphics display.

Thanks in Advance.

Best Regards,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sharmarajesh
Offline
Joined: 2007-07-04
Points: 0

Hi Sir,
can you explain me in more detail about your suggestion "Any way if you build CDC with gtk peer, this java application will call native gtk lib c code".

Thanks in advance

yuzhoumao
Offline
Joined: 2007-05-08
Points: 0

> Hi sir,
>
> want to create a demo application on CDC-PP or
> CDC-PBP on Linux which can be used to create an
> image or button or label on a frame using the Native
> library like GTK or QT. I am trying the application
> in source code provide by the SUN microsystem dor
> CDC-PP while executing the application it display an
> error no method main(). only HelloWorld is executed
> successfully rest are not so please provide me any
> other application which can be used native library
> for graphics display.
>
>
> hanks in Advance.
>
> est Regards,

using the personal.DemoFrame in democlasses.

or just a simple application

package personal;

import sun.awt.gtk.*;
import java.awt.*;
import java.awt.event.*;
import java.lang.*;

/*
class EGPlatformFont extends GPlatformFont
{
public static void printProps ()
{
System.out.println ("Platform props is:" + props.toString ());
}
}
*/

public class EFrame
{
private Frame f;
Dialog dialog;
Button b;

public EFrame ()
{
//GPlatformFont.printProps ();

f = new Frame ();
f.show ();
f.setVisible (true);
Font font = new Font ("sansserif", 0, 10);

// GComponentPeer.java
// GFramePeer.java
// f.setFont (font);

f.setTitle ("!!!!!!!!!!!!!!!!!!!!!!Hello World!!!");

b = new Button("Close按钮");
b .setVisible(true);

b .addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
f.setVisible(false);
}
});
f.add("South", b);
f.pack();

Label label = new Label("This is a Dialog");
label.setVisible(true);
f.add("North", label);
f.pack ();

///*
dialog = new AboutDialog (f, "Dialog", true);
dialog.setLocation(200, 200);
dialog.setSize(200, 200);
dialog.setVisible(true);
//*/
}

public static void main (String [] args)
{
EFrame ef = new EFrame ();
}

public class AboutDialog extends Dialog {
AboutDialog(Frame owner, String title, boolean modal)
{
super(owner, title, modal);
Label label = new Label("This is a Dialog");
label.setVisible(true);
add("North", label);
pack ();

Button button = new Button("CloseButton");
button.setVisible(true);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
AboutDialog.this.setVisible(false);
}
});
add("South", button);
pack();
}
}
}

sharmarajesh
Offline
Joined: 2007-07-04
Points: 0

Thanks for the sample application.
I read code of the application and little bit confused that where this application called GTK library because this application is not using any class from sun.awt.gtk package. Please excuse me if Ii am wrong

yuzhoumao
Offline
Joined: 2007-05-08
Points: 0

> Thanks for the sample application.
> I read code of the application and little bit
> confused that where this application called GTK
> library because this application is not using any
> class from sun.awt.gtk package. Please excuse me if
> Ii am wrong

GPlatformFont is from sun.awt.gtk. but it is commented out.

Any way if you build CDC with gtk peer, this java application will call native gtk lib c code.