jacob raja

Greenhorn
+ Follow
since Feb 20, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by jacob raja

thank you Campbell Ritchie, was able to Display menu Items dynamically, Was able to display menus(Dynamicaly) using IMenuManager and IMenuListerner. create the menu -> File using IMenuManager and add a listerner to it and add the sub menus in the listerner.

IMenuManager and IMenuListerner are present in JFace using this i was able to display MenuItems dynamically
17 years ago
I need to create the menu list dynamically, i visited this link and http://wiki.eclipse.org/index.php/FAQ_How_do_I_make_menus_with_dynamic_contents%3F and came to know about IMenuManager and IMenuListener. kindly help me to know how it works through an example
17 years ago
i have add a menu item print in the File Menu and when i click the print menu item the print dialog should open as it is opening in MsWord i am using the following code for the dialog to pop up , but it does not pop up, if anyone know how to resolve it, it would be great helpfull to me.

The code that i used is
FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
String fileName = fileChooser.open();


if (fileName == null) { return; }

// Load the image
ImageLoader loader = new ImageLoader();
ImageData[] imageData = loader.load(fileName);
PrinterData printerData = null;
if (imageData.length > 0) {//
// Show the Choose Printer dialog
PrintDialog dialog = new PrintDialog(shell, SWT.CLOSE);
try{
printerData = dialog.open();

}catch(Exception e){
e.printStackTrace();
}

if (printerData != null) {
// Create the printer object
Printer printer = new Printer(printerData);

// Calculate the scale factor between the screen resolution and printer
// resolution in order to correctly size the image for the printer
Point screenDPI = display.getDPI();
Point printerDPI = printer.getDPI();
int scaleFactor = printerDPI.x / screenDPI.x;
// Determine the bounds of the entire area of the printer
Rectangle trim = printer.computeTrim(0, 0, 0, 0);
// Start the print job
if (printer.startJob(fileName)) {
if (printer.startPage()) {
GC gc = new GC(printer);
Image printerImage = new Image(printer, imageData[0]);

// Draw the image
gc.drawImage(printerImage, 0, 0, imageData[0].width,
imageData[0].height, -trim.x, -trim.y,
scaleFactor * imageData[0].width,
scaleFactor * imageData[0].height);

// Clean up
printerImage.dispose();
gc.dispose();
printer.endPage();
}
}
// End the job and dispose the printer
printer.endJob();
printer.dispose();
} else {
System.out.println("No data to print");
}

KINDLY HELP ME TO KNOW IF ANY THING THAT NEEDED TO BE CHANGED TO BRING THE PRINTER DIALOG BOX.
17 years ago
kindly use another SWT designer6.1.0 it would work
17 years ago
hi CR, when i click a button on a screen it should open up an another tabItem, i wanted to implement using annotation, but i am do not know anything about annotation, with out using annotation i have implemented it.

presently i have a print menuItem in my file menu, when i click on the print it does not open up the print dialog, is that the OS, this is the that i am using kindly let me know the solution

// Prompt the user for an image file
FileDialog fileChooser = new FileDialog(shell, SWT.OPEN);
String fileName = fileChooser.open();

System.out.println("2");

if (fileName == null) { return; }

System.out.println("3");

// Load the image
ImageLoader loader = new ImageLoader();
ImageData[] imageData = loader.load(fileName);

System.out.println("4");
PrinterData printerData = null;
if (imageData.length > 0) {//

System.out.println("5");
// Show the Choose Printer dialog
PrintDialog dialog = new PrintDialog(shell, SWT.CLOSE);
try{
System.out.println("dialog : "+dialog);
printerData = dialog.open();
System.out.println("dialog1 : "+dialog);
}catch(Exception e){
e.printStackTrace();
}
System.out.println("6");

if (printerData != null) {

System.out.println("7");
// Create the printer object
Printer printer = new Printer(printerData);

System.out.println("8");

// Calculate the scale factor between the screen resolution and printer
// resolution in order to correctly size the image for the printer
Point screenDPI = display.getDPI();
Point printerDPI = printer.getDPI();
int scaleFactor = printerDPI.x / screenDPI.x;

System.out.println("9");

// Determine the bounds of the entire area of the printer
Rectangle trim = printer.computeTrim(0, 0, 0, 0);

System.out.println("10");
// Start the print job
if (printer.startJob(fileName)) {
if (printer.startPage()) {
GC gc = new GC(printer);
Image printerImage = new Image(printer, imageData[0]);

// Draw the image
gc.drawImage(printerImage, 0, 0, imageData[0].width,
imageData[0].height, -trim.x, -trim.y,
scaleFactor * imageData[0].width,
scaleFactor * imageData[0].height);

// Clean up
printerImage.dispose();
gc.dispose();
printer.endPage();
}
}
// End the job and dispose the printer
printer.endJob();
printer.dispose();
} else {
System.out.println("No data to print");
}
17 years ago
need to know how annotations work and how to create annotations
17 years ago
i am new to SWT and annotations i need to create a Button when a click this button i need to create a tab. so that where ever i using this button (control) i need to create a tab. kindly let me know how to start with.
17 years ago