Display on canvas
hi
how to display words in *.txt file
on canvas i.e
i have "amer.txt" contains:
amer
hamed
alsmadi
i want to display this 3 words line by line
on my canvas.
this is my code
protected void paint(Graphics g){
g.setColor(0x000000);
g.fillRect(0, 0, 176, 208);
g.setColor(0xffffff);
InputStream is = getClass().getResourceAsStream("/amer.txt");
StringBuffer sb = new StringBuffer();
try{
int chars, i = 0;
while ((chars = is.read()) != -1){
sb.append((char) chars);
g.drawString(sb.toString(), 3, 3, g.TOP | g.LEFT);
}catch (Exception e){
}but result appear like this (amerhamedalsmadi)
plez any help
thnx.
the solution
int y = 10;
int x =0;
InputStream is = getClass().getResourceAsStream("/info.txt");
StringBuffer sb = new StringBuffer();
try{
int chars = 0;
while ((chars = is.read()) != -1){
sb.append((char) chars);
}catch (Exception e){}
String s = sb.toString();
char[] charArray = s.toCharArray();
for (int a = 0; a < charArray.length; a++) {
if (charArray[a] == '\n') {
y += g.getFont().getHeight() + 2;
x = 0;
}else{
g.drawChar(charArray[a], x, y, 0);
x += g.getFont().charWidth(charArray[a]) + 1;
}DarrylBurke
=========
No its my code and thnx for this good response.
Edited by: smadi on May 10, 2009 5:04 AM
Similar Messages
-
Display stacked canvas on tab canvas page
Hi,
I am using Forms 10g. I have Content canvas named CANVAS1. I created a tab canvas called TAB_CAN contains TAB_PAGE1 and TAB_PAGE2, Stacked Canvas called STACK1.
If if create tab canvas on content canvas thourhg labout editor. It's display well when forms run. But, i have created manually.
1. How to display tab canvas programatically.
2. How to display stacked canvas on TAB_PAGE1
Regards,
MuraliLooks like you are in the wrong forum.
Please post this in the [Forms forum|http://forums.oracle.com/forums/forum.jspa?forumID=82]
Timo -
Problem in displaying stack canvas.....
anyone plz help......
First let me explain wat I hav done
I have a form module with two canvas - one is of content type(Canv1) and another is stacked type(stack1).. In Canv1 there is a button (Click)
in WHEN-NEW-FORM-INSTANCE trigger
hide_view('stack1');
in the WHEN-BUTTON-PRESSED trigger I hav given
Show_view('stack1');
hide_view('Canv1');
but,when I run the form and click the button it is not displaying stack1 canvas
Why?.....anyone plz help......
First let me explain wat I hav done
I have a form module with two canvas - one is of
content type(Canv1) and another is stacked
type(stack1).. In Canv1 there is a button (Click)
in WHEN-NEW-FORM-INSTANCE trigger
hide_view('stack1');
in the WHEN-BUTTON-PRESSED trigger I hav given
Show_view('stack1');
hide_view('Canv1');
but,when I run the form and click the button it is
not displaying stack1 canvas
Why?.....You don't need to hide your content canvas, just use show_view for the stacked canvas. and check the viewport height and width on your stack canvas properties.
Tony -
Photoshop CS6 shut down after using for 5mins; no image can be display on canvas.
Photoshop CS6 shut down after using for 5mins; no image can display on canvas.
Thanks for your help. Actually the problem was solved when turning off the GPU. In the mean time, I would like to upgrade my Video Card, too. My existing vedio card detials are as below. May I seek your advice on any good method other than replace it.
-
UREGENT: How to get a Image displayed on Canvas?
Hi, my problem is: I have an image drew on Canvas, but I cannot access this image through Java, the image is there on Canvas, but I simply can't get that image.
Anyone know how can I get an Image displayed on Canvas?Pt 1. > but I cannot access this image through Java, the
Q1. > Anyone know how can I get an Image displayed on Canvas?
From the axioms given, I would say that it is not possible. :)
Why is it so UREGENT? -
Tab Canvas displaying Stacked Canvas at runtime disappears?
Hi,
I have 3 canvases that contain the following:
1) Content Canvas -- This contains the TREE item.
2) Tab Canvas -- A tab canvas with a single Tab Page
3) Stacked Canvas -- This is a Stack Canvas with a few
text items on it.
4) Single Window.
======At runtime the following actions occur: ==========
1) The Viewport of the stacked canvas is set to the
Viewport of the Tab Page on the Tab Canvas so that it
looks like the Tab Page has a vertical and horizontal
scrollbar with text items displayed.
2) A text item on the Stacked Canvas is in focus as soon
the as the form window is displayed.
===================Problem is : =====================
1) When I select a Node of the Tree Item, the Tab Canvas
automatically disappears(or becomes invisible) , as a
result the stacked canvas displayed within it at
runtime also becomes invisible. I am left with only
the Tree item being displayed.
=======================================================
PS : I have never experienced this problem with just the
content canvas and the Tab Canvas together.
Any soultion to this problem is most appreciated.
Thanks
SharathI am experiencing the exact same thing. The width of the tabs in the layout editor is varied depending on the length of the text. However, at run-time, the width of the tabs is fixed, causing the tabs to be wider than the window and a set of VCR buttons to appear in the upper right corner of the canvas. Personally, I think this is a Forms bug. Why would they intentionally let us set the width to variable at design-time only to force a fixed width at run-time?
-
Retrieve variable value from local Storage and display on canvas
Hi
I'm working on a project that has multiple html files (the projects are split into 12 so 12 different edge projects and im linking them via window.open()). I have a variable that keeps track of correct answers stored in LocalStorage html object. I have managed to get the localStorage variable to increment up by one each time the object is correct however my last step is to get the variable and them display the result on the canvas. I have tried
var outPut localStorage.getItem(' ') method to retrieve the variable then used the set and get method to display the result however it doesn't work. Im not sure if I need a for loop to go though the localStorage and get the elements
Code:
// insert code to be run when the composition is fully loaded here
yepnope({nope:['jquery-ui-1.10.0.custom.min.js','jquery.ui.touch-punch.min.js'],complete: init}); // load the jquery files
sym.setVariable("myScore", 0);
var c = localStorage["myCount"] || 0; //loading from localStorage
function init(){
sym.getSymbol("barLimit").$('scrubber').draggable({start: function(e){
},drag: function(e,ui){ // start: ... // Find original position of dragged image
var leftLimitScrubber = sym.getSymbol('barLimit').$('scrubber').position().left; // position of the scrubber
var rightLimitScrubber = sym.getSymbol('barLimit').$('leftLimit').position().left;
var LimitTwoLeft = sym.getSymbol('barLimit').$('rightLimit').position().left;
if(leftLimitScrubber == rightLimitScrubber){
sym.getSymbol('correctBar1').play('in'); //
sym.getSymbol('nextButton').play('in');
sym.getSymbol('incorrectBar1').play('out'); //
sym.getSymbol('thumbsDown1').play('out'); //
sym.getSymbol('thumbsUp1').play('in'); //
sym.getSymbol('congrats').play('in'); //
localStorage["myCount"] = parseInt(c)+1; //Converting string to number, and then saving it
console.log("numberOfCorrectAnswers", localStorage["myCount"]);
var finalScore = sym.getVariable("myScore");
finalScore = c;
sym.setVariable("myScore", finalScore);
sym.$("Score").html(finalScore);
} else if(leftLimitScrubber == LimitTwoLeft){
sym.getSymbol('incorrectBar1').play('in');
sym.getSymbol('correctBar1').play('out');
sym.getSymbol('thumbsUp1').play('out');
sym.getSymbol('thumbsDown1').play('in');
axis: "x",
containment: "parent"
//for (var i = 0; i < localStorage.length; i++){ // iterate throught the local storage
//var getItem = localStorage.getItem(localStorage.key(i));
//if(getItem == 'numberOfCorrectAnswers' ){
The above is the code for the 12th project in this projects it needs to display the variable inside the object localStorage and display on the canvas.
Any help will mean a lot. Thank You in advance
P.S edge animate has a lot of bugs hard to code inwhat you need to do is to create a text box and set a default value of zero. Once that is don't you need a code on the stage which grabs the value form the localStorage object. I used the .text() jquery method to display the value on the canvas. So the zero will be replaced with whatever the value of the localStorage is.
You also need a if statement to check if the localStorage is undefined, if its not then grab the value and display on the canvas.
e.g
var number = localStorage['finalValue']; // for the sake of completeness I had to put this line of code
if( number ! = undefined){ // if not undefined so the object exits then ...
sym.$(' (text identifier) '). text(number); // note text identifier is the name of the text box you create in edge
} // Done -
Calculated field won't display on canvas
I am importing login and logout times to Xcelsius v 5.4.0.0 using a web service. Once the data is imported I am calculating the minutes between the login and logout by subtracting the login from the logout in the Xcelsius spreadsheet.
I import DATE, USER, LOGIN, & LOGOUT to columns A:D in my spreadsheet. Column E contains the formula D2 - C2 to calculate the minutes, where D2 is the logout and C2 is the login.
I cannot get the calculated times to display on the canvas. I have tried both a list view and a spreadsheet table. I set the DISPLAY DATA property of either the list view or spreadsheet table to columns A:E in my spreadsheet. When I do Preview and import my data, all the data shows up EXCEPT THE MINUTES CALCULATION. That field is always blank.
I tried displaying the raw data tab, and the minutes calc is always blank. I created another tab named display data, added formulas to it to copy over the info from the raw data tab and tried displaying that instead. I thought perhaps the actual calculation was causing a problem. That didnu2019t work either. The minutes calc column is always blank.
I tried changing the format of the labels in the spreadsheet table or list view from general to numeric to time, but it makes no difference. There is no data in the column to format.
If I paste data into the spreadsheet while in design mode, the calculated minutes DO APPEAR in the list view on the canvas. If I then go to Preview mode, the data is still there, including the calculated minutes. However as soon as I give it a new date range in Preview mode and refresh the data through the web service, the minutes column is again blank.
Since the list view does display the calculated minutes if I paste data in the spreadsheet in design mode, and since the exported spreadsheet snapshot contains the correct calculations when I import data using the web service, it appears that the data is being displayed on the canvas before the time calculations are taking place, resulting in a blank column.
Has anyone else experienced this? What am I doing wrong? I am sure I should be able to do this, but evidently donu2019t understand how. Iu2019ve attached the exported spreadsheet snapshot as a reference.
Thanks!Hi there - I checked your site on my PC and it does not display. I've found this on a number iWeb created site, so you are not alone.
However, I have found iWeb created sites that display well on PC's, they are http://leapfrogenterprise.com and http://donandkasha.com - if you view the 'source', notice they used frames to display their site... Best wishes on your project, Rick
iMac G5 iSight 20" - 30G iPOD - HP Pav 15" WS and Toshiba Sat 17" WS Mac OS X (10.4.7) Canon 20D & A620 -
Display stacked canvas on content canvas?
hello all,
i am try to show the stacked canvas on content canvas at design . but its not display. i set the following properties.
type-stacked
displayed:true
blevel:none
window: window which is assign to content canvas
raised on entry: true
display x position
display y position
view hori. scroll bar: true
after setting above properties stacked canvas is still on showing on content canvas at design .
please help me
thanks
yashHi,
1.Create one content canvas and create one stacked canvas.
2.give the label as Conetnt canvas and stack canvas respectively.
3.Go to conetent canvas layout editor
4.click on menu view-->Stacked Views and select ur stack canvas.
5.Now ur stack canvas is placed on ur content canvas.
6.select the stack canvas in same layout editor and click on one of the corner of stack canvas.
7.now u can move that stack canvas where ever u want on content canvas.
if u hav any problem then ask me. -
Hi to everyone,
No doubt this house is full of geniuses. Problem i have in my application is I have a main tab canvas which has two tab pages 1. Main 2. Details on detail page i want to display multiple subtab pages. What I want to achieve is when I click on tabpage details all those subtab pages should be displayed and when I click on Maintab page they should be disappeared can someone help me out to sort out this problem. Note there is no content canvas at all involved.
Thanks in advanceTab pages in Forms are linear not hierarchical I am afraid. Perhaps there is a PJC somewhere that you could use? I don't know of one though. Or perhaps it would be possible to build something similar with stacked canvases?
-
Bug? Filters not displaying in Canvas?
Trying to put a Colour Corrector on a piece of video to get rid of a green-ish background but keep the colours in the foreground. I drag the Colour Corrector onto the clip in the Sequence or get it into the viewer after having selected the clip, and start to mess around with finding the right colour.
Except it doesn't seem to actually update what's displayed on the canvas. I've had this issue before where sometimes the stuff you're trying to do in the Viewer under the Filters tab just isn't actually displaying any change on the Canvas.
Is this a bug or am I just completely overlooking something?
Any help is appreciated, Happy New Year's and all that.
Edit: and then all of a sudden it starts displaying, for no apparent reason. W.T.F?
Message was edited by: par larssonTrashing the preferences seemed to do nothing whatsoever except make any image imported into FCE somewhat distorted.
No clue why. I have the "Easy Setup" settings set to 1280*720p if that's connected to the issue - the image shows up in the Canvas with a letterbox black stripe on either side and distorted.
http://i.imgur.com/oNT1Q.jpg
shows what I'm talking about
note that me sliding around the "Limit on Chroma" settings does NOTHING to the image on the Canvas, which is the real problem -
Icon images not displayed on canvas in form developer
It seems I've got the opposite problem from all the postings regarding icons. I've read the white paper: "How To Deploy Icons" and tried both "documentbase" and "codebase" settings, and icons are displayed fine in both cases when I preview (run the form from Form Developer), but I cannot see the gif images on canvas in Forms Developer, whatever setting I choose.
I'm running DS 9.0.4 and the only specific thing is that my startup shortcut on my XME desktop is starting in a directory where we store our *.fmb *.fmx files (W:\ScreenDevelopement\... which is not default directory - when you run from Start -> Programs menu).
It is not a big deal (I guess I can live without having images on canvas), but I don't understand why something that should be fairly simple to setup is such a pain.
Thanks,
A.M.No part of the picture is visible on canvas in Forms Developer, and neither UI_ICONS nor UI_ICON_EXTENSION is helping. It looks like Forms Developer is totally disconnected from the rest of the DS (run time), and cannot figure out where to look for the pictures. As I mentioned earlier, when I run the screen preview the pictures are visible.
A.M. -
Regarding displaying the canvas at runtime
hi all,
i am using Forms [32 Bit] Version 6.0.8.24.1 (Production).
i have three base table blocks. block 1 i am showing constantly, block2 and dblock3 showing at run time based on the poplist selection.
when form will be opened for first time i am showing block2 canvas by setting the view position. and hiding the bllock3 canvas with the help of
show_view('canvas_block2');
SET_VIEW_PROPERTY('canvas_block2',DISPLAY_POSITION,0,3.7);
hide_view('canvas_block3');my problem is when i run the form for first time the 'canvas_block3' is appearing at the position(0,0) on canvas and disappearing within the fraction of second.
this is happening when i change the list item(which contains the code to show the canvases based on the user selection) also.
i have written the show and hide canvases in when-new-record-instance of the block1 and when-list-changed trigger.
I don't know why the canvas 'canvas_block3' is appearing and then disappering after a fraction of second even though i have written 'hide_view('canvas_block3');' in w-n-r-i trigger.
Please advise.
Thanks..hi,
i have tried with default visible to 'no' but still same problem exists.
my problem is the canvas which i am trying to hide('canvas_block3') that is appearing for a while and then disappearing(which is causing destraction on the screen)
i am calling hide and show views in w-n-r-i of block1.
i cannot give go_item or go_block. and i don't want to navigate to that block(block_3) .
i want to reside on the same block.
Thanks.. -
Flash Movie Tween Displays Off Canvas in Flex
I have a SWF which plays a tween of a sliding door moving downwards. I am loading it using SWFLoader and then extracting the content as a MovieClip and playing it. The intention is that it will occupy the top half of the screen in the Flex app so the size of the SWFLoader has been set accordingly. I have tried to constrain it in various types of containers but no matter what I do the door slides down into bottom half of my Flex app (obscuring other stuff) even though the flash movie has a size which corresponds to the top half of the window only and plays that way as a standalone movie.
Any ideas on this? Surely there must be some way to say "use the following rectangle of the screen and no more".Okay. So I figured it out. Seems that you have to set clipAndEnableScrolling="true" on the container. Cheers.
-
Help displaying an image using the canvas!!!!!!!!
Hey guys
I don't know whether I am not grasping some concepts well.I have been going mad trying to get the code working
Here is the code
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;
* @author Administrator
* @version
public class MyMIDlet extends javax.microedition.midlet.MIDlet implements CommandListener{
private Display display;
private MyCanvas canvas;
private Command exitcommand = new Command("Exit",Command.SCREEN,1);
private Image source;
public MyMIDlet() {
protected void startApp() throws MIDletStateChangeException{
if (display == null){
initMIDlet();
protected void pauseApp() {
protected void destroyApp(boolean unconditional)throws MIDletStateChangeException {
exitMIDlet();
public void commandAction(Command c, Displayable d) {
if (c == exitcommand){
exitMIDlet();
protected void initMIDlet() {
display = Display.getDisplay(this);
canvas = new MyCanvas(this);
System.err.println("Canvas instiated succesfully");
canvas.addCommand(exitcommand);
canvas.setCommandListener(this);
display.setCurrent(canvas);
public void exitMIDlet() {
notifyDestroyed();
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import java.io.*;
public class MyCanvas extends Canvas implements Runnable {
private MIDlet midlet;
private Image offscreen;
private Image currentimage;
private Graphics g;
//MID profile application
/** Creates a new instance of MyCanvas */
public MyCanvas(MIDlet midlet) {
this.midlet = midlet;
try{
currentimage = Image.createImage("/bird0.png");
}catch(IOException e){
System.err.println(e.getMessage());
if (currentimage!= null){
System.err.println("Image create successfully");
}else{
System.err.println("Image not created");
try{
Thread t = new Thread(this);
t.start();
}catch(Execption e){}
protected void paint(Graphics g){
Graphics saved = g;
int x = getWidth();
int y = getHeight();
g.setColor(255,255,255);
g.drawImage(currentimage,x,y,g.TOP|g.VCENTER);
public void run() {
repaint();
I know for a fact that the Canvas class 's paint method is called by the system and not the application. This poses a problem for me because I am not sure how to pass the image to the piant method, so that it can be painted.
When I run the program(using J2ME wtk04), this is the outcome.
Image created succesfully
Canvas instiatiated successfully
null
Here are my questions
1) when is the paint method precisely called by the system?after a reference to the canvas class is created?
2) is it wise to create the image when instiating the canvas class?( initially created the image using a separate thread)-when sould the image be created?
3)how to let the application know when to use the image when painting the display area?
I am just trying the logistics here. It is very crucial to me to understand the bolts of this as the core f my project fouses on the man machine interface development.(For the project, the cilent application is quering for the map using HTTP)
I use a png file of size 161 bytes. Is that too big for testing purposes.
I would all the help that I can get. thanks in advance1) when is the paint method precisely called by the system?after a reference to the canvas class is created?
After the canvas is set as the current display, and after that, after the repaint() is called.
2) is it wise to create the image when instiating the canvas class?( initially created the image using a separate thread)-when sould the image be created?
It's better to create the image in the very begining of the program e.g. in the midlet initialization. You can call the created image as often as you like later on
3)how to let the application know when to use the image when painting the display area?
you have to tell it :))
you can use if-then, switch, or anything else
and you can use clipping too
Maybe you are looking for
-
hi every body, i want to display data inside my forms when the form open direct, no need to prss Excute query, How ????? thanks.....
-
I bought an ipod2 yesterday and all the photos were from an old computer (that I don't want to synch with) were transferred in the store without synching with it. I was told I could delete any I didn't want later but now find I can't delete any witho
-
J2ME pre-requisites, URGENT!!!
Hi people!!! How are you doing? Are you ok? I wanna know what do I need to know and what software do I need to have to start learning J2ME? Do I get to learn it with the JBuilder 7? And do I need to know JDBC, JSP, XML and Servlet programming? Becaus
-
Driving DO lines with external clock wired to PFI lines
Hi all, I have few issues understanding how to use hardware timing resources in M series USB6229, with particular focus on DO. I have read last couple of day all google offered on the subject but I am still straggling with some basic tasks. To cut th
-
This is what the Print Dialog looks like. The print preview is too small. The final printed images are coming out all wrong. This is happening for ALL DRIVERS (5 different printers) and 2 different USERS in our company. It doesn't matter if you chang