codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Paint method paints over everything in applet  AK_47 at 11:00 on Tuesday, March 08, 2005
 

Ive created an applet in java for which displays images on a canvas, it also has panels for the buttons and components. I have used the paint method for displaying the images. The problem I'm haveing is that when I run the applet the panels are painted over, such that only the buttons are visible but the panels borders are just painted over.

  Re: Paint method paints over everything in applet  javaEmperior at 15:55 on Tuesday, March 08, 2005
 

i had the same problem.
firstly you must create another canvas in where all the graphics would be drawn onto.

Then add this new canvas just like you would add a button to the applet

i.e. add(CanvasName);

  Re: Paint method paints over everything in applet  AK_47 at 16:23 on Tuesday, March 08, 2005
 

By painting on the canvas part of the problem is solved but the other panels and the menubar are still painted over.


  Re: Paint method paints over everything in applet  javaEmperior at 07:29 on Wednesday, March 09, 2005
 

/b Example what to to

import java.awt.*;
class can extends Canvas
{
public void paint (Graphics g)
{


g.setColor(Color.blue);
g.setFont (new Font ("Arial", Font.PLAIN, 12));
g.drawString("Hello AK_47", 20, 50);

}


}
public class Loading extends Frame
{



Button b1 = new Button("hello");
public Loading () throws Exception
{
super ("EG"); // Set the frame's name
setLayout(new GridLayout(1,2));
add(b1);
add(new can());
setSize (200, 200);
show();
}

public static void main (String [] args) throws Exception
{
new Loading ();
}
}

<Added>

Example what to to

import java.awt.*;
class can extends Canvas
{
public void paint (Graphics g)
{


g.setColor(Color.blue);
g.setFont (new Font ("Arial", Font.PLAIN, 12));
g.drawString("Hello AK_47", 20, 50);

}


}
public class Loading extends Frame
{



Button b1 = new Button("hello");
public Loading () throws Exception
{
super ("EG"); // Set the frame's name
setLayout(new GridLayout(1,2));
add(b1);
add(new can());
setSize (200, 200);
show();
}

public static void main (String [] args) throws Exception
{
new Loading ();
}
}








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: Help: Trouble with z-Index and SELECT lists
•  Help with
•  Re: C# and EXCEL question saving a file saving the the first column as read only
•  Iexplore -
•  Iframe and Div Layer Scrollbar Problem
•  Left margin increases as page fills.....
•  Re: Parse error that is slowly driving me insane
•  simple javascript/dhtml drop-down menu
•  notify an object that the user interface has changed one of its properties


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005